Drupal 8's core platform has more than 200 new features built in. But it's more than a collection of features; Drupal 8 beta is a platform you can use to achieve digital success.
Tomer Damari - ASP.NET,Drupal, C# And CRM
This blog was born to save some time for developers in ASP.NET and CRM for problems I dealt with and found their answers, Hope you find it useful.
Sunday, June 14, 2015
Drupal 8 final Release estimated at 20/8/2015
Drupal 8 has something for everyone who supports online content and digital experience at your organization: business decision makers, site administrators, digital marketers, content managers, web developers, technical architects, and IT pros.
Drupal 8's core platform has more than 200 new features built in. But it's more than a collection of features; Drupal 8 beta is a platform you can use to achieve digital success.
Drupal 8's core platform has more than 200 new features built in. But it's more than a collection of features; Drupal 8 beta is a platform you can use to achieve digital success.
Saturday, November 22, 2008
Get attributes display name into DropDownList in CRM 4.0
In CRM 4.0 if you want the label name of a field also called attribute display name, you can get it by the Metadata Service.
Here is the code:
MetadataService service = GetMetadataService(crmServerUrl, orgName);
try
{
RetrieveEntityRequest req = new RetrieveEntityRequest();
req.EntityItems = EntityItems.IncludeAttributes;
req.LogicalName = "new_employee"; // enter the name of the entity
RetrieveEntityResponse res = (RetrieveEntityResponse)service.Execute(req);
foreach (AttributeMetadata attribute in res.EntityMetadata.Attributes)
{
ListItem item = new ListItem();
item.Value = attribute.LogicalName;
item.Text = attribute.DisplayName.LocLabels[0].Label;
DropDownList1.Items.Add(item);
}
DropDownList1.DataBind();
}
catch{}
if you want only specific fields you can add in the foreach statment
if (attribute.LogicalName == "new_fullname") \\ where new_fullname is your field's name
Hope this was useful
Tomer
Here is the code:
MetadataService service = GetMetadataService(crmServerUrl, orgName);
try
{
RetrieveEntityRequest req = new RetrieveEntityRequest();
req.EntityItems = EntityItems.IncludeAttributes;
req.LogicalName = "new_employee"; // enter the name of the entity
RetrieveEntityResponse res = (RetrieveEntityResponse)service.Execute(req);
foreach (AttributeMetadata attribute in res.EntityMetadata.Attributes)
{
ListItem item = new ListItem();
item.Value = attribute.LogicalName;
item.Text = attribute.DisplayName.LocLabels[0].Label;
DropDownList1.Items.Add(item);
}
DropDownList1.DataBind();
}
catch{}
if you want only specific fields you can add in the foreach statment
if (attribute.LogicalName == "new_fullname") \\ where new_fullname is your field's name
Hope this was useful
Tomer
Friday, November 21, 2008
Show user exact age in JavaScript (like 28.34)
If you are working on Human Resources project and needs this info or you just want to be more accurate when displaying age.
Here is the code:
function DisplayAge()
{
// that's the user's birthday
month = 11;
date = 18;
year = 1980;
today = new Date();
dateStr = today.getDate();
monthStr = today.getMonth()+1;
yearStr = today.getFullYear();
theYear = yearStr - year;
theMonth = monthStr - month;
theDate = dateStr - date;
var age = theYear + theMonth/12 + theDate/365;
document.write(age.toLocaleString());
}
Here is the code:
function DisplayAge()
{
// that's the user's birthday
month = 11;
date = 18;
year = 1980;
today = new Date();
dateStr = today.getDate();
monthStr = today.getMonth()+1;
yearStr = today.getFullYear();
theYear = yearStr - year;
theMonth = monthStr - month;
theDate = dateStr - date;
var age = theYear + theMonth/12 + theDate/365;
document.write(age.toLocaleString());
}
Thursday, November 20, 2008
Import Excel file to Dataset or xml
Just a simple code for reading an excel file
using System.Data.OleDb;
public void ReadXLS()
{
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Data\Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
OleDbConnection myConnection = new OleDbConnection(connectionString);
try
{
myConnection.Open();
OleDbDataAdapter myAdapter = new OleDbDataAdapter("Select * From [TABLE$]", myConnection);
DataSet dataset = new DataSet();
myAdapter.Fill(dataset);
dataGridView1.DataSource = dataset.Tables[0].DefaultView;
dataset.WriteXml("myxml.xml");
myConnection.Close();
}
catch {}
}
using System.Data.OleDb;
public void ReadXLS()
{
string connectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Data\Book1.xls;Extended Properties=""Excel 8.0;HDR=YES;""";
OleDbConnection myConnection = new OleDbConnection(connectionString);
try
{
myConnection.Open();
OleDbDataAdapter myAdapter = new OleDbDataAdapter("Select * From [TABLE$]", myConnection);
DataSet dataset = new DataSet();
myAdapter.Fill(dataset);
dataGridView1.DataSource = dataset.Tables[0].DefaultView;
dataset.WriteXml("myxml.xml");
myConnection.Close();
}
catch {}
}
Let users send you email throw GMAIL in your site
You can create a contact us form for example and allow visitors on your site to fill some details and get that data into your gmail account.
using System.Net;
using System.Net.Mail;
protected void SendMail()
{
MailMessage email = new MailMessage();
MailAddress adressToSend = new MailAddress("your gmail adress");
email.To.Add(adressToSend);
email.From = new MailAddress("user email adress");
email.Subject = "email subject";
email.Body = " email body ";
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
NetworkCredential myCreds = new NetworkCredential("your gmail username", "your gmail password");
client.Credentials = myCreds;
try
{
client.Send(email);
}
catch {}
}
Hope that was helpful
Tomer
using System.Net;
using System.Net.Mail;
protected void SendMail()
{
MailMessage email = new MailMessage();
MailAddress adressToSend = new MailAddress("your gmail adress");
email.To.Add(adressToSend);
email.From = new MailAddress("user email adress");
email.Subject = "email subject";
email.Body = " email body ";
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
client.EnableSsl = true;
NetworkCredential myCreds = new NetworkCredential("your gmail username", "your gmail password");
client.Credentials = myCreds;
try
{
client.Send(email);
}
catch {}
}
Hope that was helpful
Tomer
Pass parameters in QueryString in other languages
In ASP.NET you might have a problem with passing strings in languages other then English.
so what you need to do is:
Add to the web.config file under "system.web"
Now windows-1255 is the hebrew encoding, you need to find what's the windows encoding for your language.
Hope that was helpful.
Tomer
Use the ENTER Key In a TextBox
In most cases you'll want to let the users on the site to click ENTER in your Textbox,
and that will the trigger the same action as if they pressed the button next to the Textbox.
Paste that code on Page_Load.
TextBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode)
{if ((event.which == 13) || (event.keyCode == 13))
{document.getElementById('" + Button1.UniqueID + "').click();return false;}}
else {return true}; ");
the only 2 parameters that you need to change are:
TextBox1 = your text box.
Button1 = this is the button next to your text box.
So here is what it does bassicly:
It adds to the TextBox an attribute that says:
Add an event OnKeyDown (when you press your keyboard)
then it checks if I pressed on ENTER (which is 13 in ASCI)
and finally it adds the event that our button has which is CLICK to the Textbox ENTER key.
Hope that was helpful
I tried to make it as simple as I could.
Tomer.
and that will the trigger the same action as if they pressed the button next to the Textbox.
Paste that code on Page_Load.
TextBox1.Attributes.Add("onkeydown", "if(event.which || event.keyCode)
{if ((event.which == 13) || (event.keyCode == 13))
{document.getElementById('" + Button1.UniqueID + "').click();return false;}}
else {return true}; ");
the only 2 parameters that you need to change are:
TextBox1 = your text box.
Button1 = this is the button next to your text box.
So here is what it does bassicly:
It adds to the TextBox an attribute that says:
Add an event OnKeyDown (when you press your keyboard)
then it checks if I pressed on ENTER (which is 13 in ASCI)
and finally it adds the event that our button has which is CLICK to the Textbox ENTER key.
Hope that was helpful
I tried to make it as simple as I could.
Tomer.
Subscribe to:
Posts (Atom)