public static String DeleteCallLog(int Id = 0) { NJ_CallLogs obj = new NJ_CallLogs(); obj.DeleteCallLog(Id); return("1"); }
public static NJ_CallLogs CallLogDetails(int id = 0) { NJ_CallLogs obj = new NJ_CallLogs(); var Result = obj.CallLogDetails(id); return(Result); }
public static List <NJ_CallLogs> PrintCallLog(string Search = "", string SearchByName = "") { NJ_CallLogs obj = new NJ_CallLogs(); var Result = obj.CallLogs(Search, SearchByName); return(Result); }
public static List <NJ_CallLogs> CallLog(string Search = "", int PageIndex = 0, string SearchByName = "") { NJ_CallLogs obj = new NJ_CallLogs(); var Result = obj.CallLogs(Search, SearchByName); //for paging int PageSize = 15; int skip = PageIndex * PageSize; double PageCount = Convert.ToDouble(Math.Ceiling((double)((double)Result.Count() / (double)PageSize))); List <NJ_CallLogs> query = Result.Skip(skip).Take(PageSize).ToList(); return(query); }
public static String AddCallLog(int Id = 0, string FirstName = "", string LastName = "", string Phone = "", string Notes = "") { NJ_CallLogs obj = new NJ_CallLogs(); //if (Convert.ToInt32(HttpContext.Current.Session["LoginId"]) != 0) //{ obj.AddCallLog(Id, FirstName, LastName, Phone, Notes); return("1"); //} //else //{ // return "2"; //} }
public static String AddandEmailCallLog(int Id = 0, string FirstName = "", string LastName = "", string Phone = "", string Notes = "", string EmailToUser = "") { string success = "0"; NJ_CallLogs obj = new NJ_CallLogs(); obj.AddCallLog(Id, FirstName, LastName, Phone, Notes, EmailToUser); //Send Email string result = ""; //string to = EmailToUser; //string from = "*****@*****.**"; string from = HttpContext.Current.Request.Cookies["UserName"].Value; string body = "<h2>Call Detail</h2>"; body = body + "<p><table><tr><td>FirstName : " + FirstName + " </td></tr><tr><td>Last Name : " + LastName + "</td></tr><tr><td>Phone : " + Phone + "</td></tr><tr><td>Notes : " + Notes + "</td></tr></table></p>"; //MailMessage mail = new MailMessage(from, to); MailMessage mail = new MailMessage(); mail.From = new MailAddress(from); string[] multipleIDs = EmailToUser.Split(','); foreach (string multi in multipleIDs) { mail.To.Add(new MailAddress(multi)); } SmtpClient client = new SmtpClient(); client.DeliveryMethod = SmtpDeliveryMethod.Network; client.UseDefaultCredentials = false; client.Host = "mail.newjerseydefensivedriving.net"; //mail.Subject = "Call Log Details from Driving Users app"; mail.Subject = "Phone call message from " + FirstName + " " + LastName; mail.IsBodyHtml = true; mail.Body = body; mail.CC.Add(new MailAddress(from)); mail.CC.Add(new MailAddress("*****@*****.**")); try { client.Send(mail); result = "Email Sent"; } catch (Exception ex) { result = ex.Message + "....... Inner exception is: " + ex.InnerException; } return(result); }
public static string EmailTodayCallLogs(string Search = "") { NJ_CallLogs obj = new NJ_CallLogs(); var Result = obj.CallLogs(Search); var doc = new Document(PageSize.A4, 50, 50, 5, 5); string PathStart = System.Web.HttpContext.Current.Server.MapPath("/CallLogsPDF"); if (!System.IO.Directory.Exists(PathStart)) { System.IO.Directory.CreateDirectory(PathStart); } string FolderNameByDate = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString(); PdfWriter.GetInstance(doc, new System.IO.FileStream(System.Web.HttpContext.Current.Server.MapPath("/CallLogsPDF/" + "/" + "CallLog" + FolderNameByDate + ".pdf"), System.IO.FileMode.Create)); string Filepath = System.Web.HttpContext.Current.Server.MapPath("/CallLogsPDF/" + "/" + "CallLog" + FolderNameByDate + ".pdf"); doc.SetPageSize(iTextSharp.text.PageSize.A4.Rotate()); doc.Open(); string row = ""; foreach (var item in Result) { row = row + @"<tr> <td align='center' style="" font-size: 11px;"" colspan=""2""> " + item.FirstName + @" </td> <td align='center' style="" font-size: 11px;"" colspan=""2""> " + item.LastName + @" </td> <td align='center' style="" font-size: 11px;"" colspan=""2""> " + item.Phone + @" </td> <td align='center' style="" font-size: 11px;"" colspan=""2""> " + item.Notes + @"</td> <td align='center' style="" font-size: 11px;"" colspan=""2""> " + item.AddedName + @"</td> <td align='center' style="" font-size:11px;"" colspan=""2""> " + item.Users + @"</td> </tr>"; } string footer = @"</tbody> </table > <table style='width:100%;'> <thead> </thead> <tbody> </table> </div> </body> <html>"; string htmlText = @"<html><title></title> <p> <table style='width:100%;'> <thead> </thead> <tbody> <tr><td>.</td></tr> <tr> <td style=""font-weight:bold"" colspan=""4""align='center'>Call Log Report of " + DateTime.Now.ToShortDateString() + @"</td> </tr> <tr > <td colspan=""4"">.</td> </tr> </tbody> </table> <head> </head> <body> <p> <div><table border=""1"" style='width:100%;'> <thead> </thead> <tbody> <tr > <td align='center' colspan=""2"" style=""font-weight:bold; font-size: 11px;""> FirstName</td> <td align='center' colspan=""2"" style=""font-weight:bold; font-size: 11px;""> LastName</td> <td align='center' colspan=""2"" style=""font-weight:bold; font-size: 11px;"">Phone</td> <td align='center' colspan=""2"" style=""font-weight:bold; font-size:11px;"">Notes</td> <td align='center' colspan=""2"" style=""font-weight:bold; font-size: 11px;"">AddedBy</td> <td align='center' colspan=""2"" style=""font-weight:bold; font-size: 11px;"">Mail Sent To</td> </tr>" + row + footer; iTextSharp.text.html.simpleparser.HTMLWorker hw = new iTextSharp.text.html.simpleparser.HTMLWorker(doc); hw.Parse(new System.IO.StringReader(htmlText)); doc.Close(); CallLogs objCalllog = new CallLogs(); string Emailresult = objCalllog.SendCalllogsEmail(Filepath); // string Emailresult = objCalllog.SendEmail(Filepath); return(Emailresult); }