void btnCheckRemainder_Click(object sender, EventArgs e)
{
try
{
DateTime dt = DateTime.Today;
DateTime wkStDt = DateTime.MaxValue;
DateTime wkEndDt = DateTime.MaxValue;
wkStDt = dt.AddDays(1 - Convert.ToDouble(dt.DayOfWeek));
wkEndDt = dt.AddDays(7 - Convert.ToDouble(dt.DayOfWeek));
Page.Response.Write(wkStDt.ToString("MM/dd/yyyy") + "<br/>");
Page.Response.Write(wkEndDt.ToString("MM/dd/yyyy"));
SPSecurity.RunWithElevatedPrivileges(delegate()
{
using (SPSite site = new SPSite("http://vsr00a027-02:44712/"))
{
site.AllowUnsafeUpdates = true;
using (SPWeb web = site.OpenWeb())
{
web.AllowUnsafeUpdates = true;
SPList myList = web.Lists["Shared Documents"];
//SPList myList = web.Lists["Tasks"];
//SPListItem myListItem = myList.GetItemById(8);
if (myList != null)
{
foreach (SPListItem f in myList.Items)
{
//string value = f["Title"].ToString();
//DateTime dd = Convert.ToDateTime(f["Due Date"].ToString());
string value = f["Name"].ToString();
DateTime dd = Convert.ToDateTime(f["Modified"].ToString());
string value1 = f["Modified By"].ToString();
Page.Response.Write(value);
Page.Response.Write(dd);
Page.Response.Write(value1);
hdnDate.Value = dd.ToShortDateString();
}
string s=hdnDate.Value.ToString();
if ((Convert.ToDateTime(s)) == wkEndDt)
{
#region Mail-Code
SmtpClient mailClient = new SmtpClient();
MailMessage email = new MailMessage("busadmin@kryptos.in", "chitharan.s@kryptos.in");
email.Bcc.Add("vinitha.k@kryptos.in");
email.Subject = "Remainder mail for Uploading Documents!!!";
email.IsBodyHtml = true;
email.Body = "<html><body><table><tr><td>Dear Head of the Department,</td></tr><tr><td></td></tr><tr><td>Greetings!.</td></tr><tr><td>Please find the Details below<br/></td></tr><tr><td></td></tr><tr><td> This is Message to Inform..</td> <td></td> </tr><tr><td></td></tr><tr><td></td></tr><tr><td>This weeks Douments has been Uploaded in to Sharepoint..!! </td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Kindly acknowledge the receipt.</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Regards,</td></tr><tr><td><tr><td>Sharepoint Administrator</td></tr></table><body></html>";
//Attachment attach = new Attachment(ms, inv_no + ".xls");
//email.Attachments.Add(attach);
// You can specify the host name or ipaddress of your server
// Default in IIS will be localhost
//client.PickupDirectoryLocation = @"C:\Inetpub\mailroot\Pickup\";
//Default port will be 25
mailClient.Port = 25;
mailClient.Host = "vsr00a008-03.kryptos.gcc";
mailClient.Send(email);
#endregion
}
else
{
#region Mail-Code
SmtpClient mailClient = new SmtpClient();
MailMessage email = new MailMessage("busadmin@kryptos.in", "chitharan.s@kryptos.in");
email.Bcc.Add("vinitha.k@kryptos.in");
email.Subject = "Remainder mail for Uploading Documents!!!";
email.IsBodyHtml = true;
email.Body = "<html><body><table><tr><td>Dear Employee,</td></tr><tr><td></td></tr><tr><td>Greetings!.</td></tr><tr><td>Please find the Details below<br/></td></tr><tr><td></td></tr><tr><td></td> <td></td> </tr><tr><td></td></tr><tr><td></td></tr><tr><td>This weeks Douments Not Upload in to Sharepoint..!! </td></tr><tr><td></td></tr><tr><td>Kindly Upload Document as soon as possiple Today iteslf..!!</td></tr><tr><td></td></tr><tr><td>Kindly acknowledge the receipt.</td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td></td></tr><tr><td>Regards,</td></tr><tr><td><tr><td>Sharepoint Administrator</td></tr></table><body></html>";
//Attachment attach = new Attachment(ms, inv_no + ".xls");
//email.Attachments.Add(attach);
// You can specify the host name or ipaddress of your server
// Default in IIS will be localhost
//client.PickupDirectoryLocation = @"C:\Inetpub\mailroot\Pickup\";
//Default port will be 25
mailClient.Port = 25;
mailClient.Host = "vsr00a008-03.kryptos.gcc";
mailClient.Send(email);
#endregion
}
}
else
{
DisplayMessage("No Document is there!!! ", MessageType.Warning);
}
}
}
});
}
catch (Exception ex)
{
DisplayErroMessage(ex);
}
}
No comments:
Post a Comment