Saturday, July 4, 2009

Send SMS

many time because of the special events (like: server crash,...);we want to send sms.
I found this article on the net about this subject!

How to send SMS messages from C# using an SQL database

Monday, March 2, 2009

How to change the SQL Server 2005 - Engin Collation

it's easy to change the database collation by using alter database but must of the time we want to change the sql-engin collation.
to do this:
  1. detache all database
  2. copy the mdf & ldf files
  3. go SQL-Server CD--> setup folder
  4. run : setup.exe /qb INSTANCENAME=MSSQLSERVER REINSTALL=SQL_Engine REBUILDDATABASE=1 SAPWD=xxxxx SQLCOLLATION=
  5. attach the databases again

Sunday, March 1, 2009

Vertical Label in ASP.NET

a simple code to change the label direction to vertival:

style="writing-mode:tb-rl;"

Monday, February 23, 2009

Polymorphism (C# Programming Guide)

From :

Polymorphism is often referred to as the third pillar of object-oriented programming, after encapsulation and inheritance. Polymorphism is a Greek word that means "many-shaped" and it has two distinct aspects:
1. At run time, objects of a derived class may be treated as objects of a base class in places such as method parameters and collections or arrays. When this occurs, the object's declared type is no longer identical to its run-time type.
2. Base classes may define and implement virtual methods, and derived classes can override them, which means they provide their own definition and implementation. At run-time, when client code calls the method, the CLR looks up the run-time type of the object, and invokes that override of the virtual method. Thus in your source code you can call a method on a base class, and cause a derived class's version of the method to be executed.
Virtual methods enable you to work with groups of related objects in a uniform way. For example, suppose you have a drawing application that enables a user to create various kinds of shapes on a drawing surface. You do not know at compile time which specific types of shapes the user will create. However, the application has to keep track of all the various types of shapes that are created, and it has to update them in response to user mouse actions. You can use polymorphism to solve this problem in two basic steps:
1. Create a class hierarchy in which each specific shape class derives from a common base class.
2. Use a virtual method to invoke the appropriate method on any derived class through a single call to the base class method.
First, create a base class called Shape, and derived classes such as Rectangle, Circle, and Triangle. Give the Shape class a virtual method called Draw, and override it in each derived class to draw the particular shape that the class represents. Create a List object and add a Circle, Triangle and Rectangle to it. To update the drawing surface, use a foreach loop to iterate through the list and call the Draw method on each Shape object in the list. Even though each object in the list has a declared type of Shape, it is the run-time type (the overridden version of the method in each derived class) that will be invoked.

Sunday, February 15, 2009

Send SMS by Sharepoint

i found this sms provider ipip.com
they supported me with this code


private void button1_Click(object sender, EventArgs e)
{
string toPhoneNumber = toTextBox.Text;
string login = fromTextBox.Text;
string password = passTextBox.Text;
string compression = subjectTextBox.Text;
string body = bodyTextBox.Text;


MailMessage mail = new MailMessage();
mail.To = toPhoneNumber + "@sms.ipipi.com";
mail.From = login + "@ipipi.com";
mail.Subject = compression;
mail.Body = body;
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", login);
mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password);


System.Web.Mail.SmtpMail.SmtpServer = "ipipi.com";
System.Web.Mail.SmtpMail.Send(mail);



/*set the addresses
mail.From = new MailAddress("me@mycompany.com");
mail.To.Add("you@yourcompany.com");

//set the content
mail.Subject = "This is an email";
mail.Body = "this is a sample body";

//send the message
SmtpClient smtp = new SmtpClient("127.0.0.1");
smtp.Send(mail);*/
}
}
}


http://social.msdn.microsoft.com/Forums/en-US/sharepointdevelopment/thread/bd801d6b-b934-428e-bff1-d52d82cd439e/

Sunday, September 28, 2008

Multiline in tootip

you the below codes to add multiline tooltip for a button :

btnConvert.ToolTip = String.Format("This{0}is{0}a{0}multiline{0}tooltip", Environment.NewLine);

btnConvert.ToolTip = String.Format("YTD Excellence {0}\nYTD Overall {1}\nFeb Excellence {2}\nFeb Overall {3}",
"1",
"2",
"3",
"4"
);

Wednesday, August 27, 2008

Programmatically Creating Server Controls

// Create a new HtmlTable object.
HtmlTable table1 = new HtmlTable();
// Set the table's formatting-related properties.
table1.Border = 1;
table1.CellPadding = 3;
table1.CellSpacing = 3;
table1.BorderColor = "red";
// Start adding content to the table.
HtmlTableRow row;
HtmlTableCell cell;
for (int i = 1; i <= 5; i++)
{
// Create a new row and set its background color.
row = new HtmlTableRow();
row.BgColor = (i % 2 == 0 ? "lightyellow" : "lightcyan");
for (int j = 1; j <= 4; j++)
{
// Create a cell and set its text.
cell = new HtmlTableCell();
cell.InnerHtml = "Row: " + i.ToString() +
"
Cell: " + j.ToString();
// Add the cell to the current row.
row.Cells.Add(cell);
}
// Add the row to the table.
table1.Rows.Add(row);
}
// Add the table to the page.
this.Controls.Add(table1);