Tuesday, November 23, 2010

Button that will call Outlook express

Hey all,
      Just few days back I tried to implement the mail transferring with .NET I came across some solutions

1) How to send the mail that will automatically call the outlook express on click button finally ?

Here is the solution


               System.Diagnostics.Process.Start("Outlook");
                ProcessStartInfo startInfo = new ProcessStartInfo("Outlook.exe"); // Open Outlook express
                string admin = "mparamasivan@newtglobal.com";
                startInfo.FileName = "mailto:" + admin + "?subject=Applying for Leave" + "&cc=" + offemail + "&body=" + Reason.Text; //Formated mail
              
                Process.Start(startInfo);


2) Through SMTP configuration via g-mail


System.Net.Mail.MailMessage toSend = new System.Net.Mail.MailMessage("from email ID", "To email ID", "Subject", "messageBody");
        SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
        smtp.EnableSsl = true;
        System.Net.NetworkCredential mailAuthentication = new System.Net.NetworkCredential("some gmail id @gmail.com", "password of it");
        smtp.Credentials = mailAuthentication;
        smtp.Send(toSend);


Hope the information vl save ur time.

Happy Coding ;)

Wednesday, November 10, 2010

Select Date with leaving Weekend in Asp.Net

Hey All,
     For Past week I m worrying abt rendering the day counts in ASP.Net jst now found the solution .
For Example I vl let yo knw the scenario if I want to prepare leave form hence I got to design a calender with start date and end date to it what I m going to do just give yo the piece of code where weekend will be neg lated in the coding so when ever yo come across this scenario yo vl thank to me ...:-)


public void checkmonth()
    {
        TimeSpan timespan = Convert.ToDateTime(cal2).Subtract(Convert.ToDateTime(cal1));
        DateTime date1 = Convert.ToDateTime(cal1);
        DateTime date2 = Convert.ToDateTime(cal2);
        //NoOfDays.Text = Convert.ToString(timespan.Days + 1);
        long        wholeWeeks = ((long)Math.Round(Math.Floor(timespan.TotalDays))) / 7;
   DateTime    dateCount  = date1.AddDays(wholeWeeks * 7);
   int         endDays    = 0;


        
   while (dateCount.Date <= date2.Date)
   {
      switch (dateCount.DayOfWeek)
      {
         case DayOfWeek.Saturday:
         case DayOfWeek.Sunday:
            break;
         default:
            endDays++;
            break;
         }
         dateCount = dateCount.AddDays(1);
   }
   NoOfDays.Text=Convert.ToString(wholeWeeks * 5 + endDays);

            }

Happy Coding

Wednesday, November 3, 2010

What if Bill Gates dies









Well, Bill,” said God, “I’m really confused on this one. I’m not sure whether to send you to Heaven or Hell! After all, you helped society enormously by putting a computer in almost every home in the world and yet you created that ghastly Windows. I’m going to do something I’ve never done before. I’m going to let you decide where you want to go!”
Mr. Gates replied, “Well, thanks, Lord. What’s the difference between the two?”
God said, “You can take a peek at both places briefly if it will help you decide. Shall we look at Hell first?” “Sure!” said Bill. “Let’s go!”
Bill was amazed! He saw a clean, white sandy beach with clear waters. There were thousands of beautiful women running around, playing in the water, laughing and frolicking about.
The sun was shining and the temperature was just perfect!
Bill said, “This is great! If this is Hell, I can’t wait to see Heaven!”
To which God replied, “Let’s go!” and off they went. Bill saw puffy white clouds in a beautiful blue sky with angels drifting about playing harps and singing.
It was nice, but surely not as enticing as Hell. Mr. Gates thought for only a brief moment and rendered his decision.
“God, I do believe I would like to go to Hell.”
“As you desire,” said God.
Two weeks later, God decided to check up on the late billionaire to see how things were going. He found Bill shackled to a wall, screaming among the hot flames in a dark cave. He was being burned and tortured by demons.
“How ya doin’, Bill?” asked God. Bill responded with anguish and despair.
“This is awful! This is not what I expected at all! What happened to the beach and the beautiful women playing in the water?”
“Oh, THAT!” said God.
“That was the screen saver”….!! !!!!!!!