public string InsertEmail(string Template, string MailFrom, string MailTo, string ResentCount, string SendingDate, string Subject, string Content, string MailCC, string SentStatus, string Record,Controller Ctrl)
 {
     string status = "Success";
     DBEntities insertentity = new DBEntities();
     BizTbl_MailQueue MsgObj = new BizTbl_MailQueue();
     MsgObj.MailTemplateID = Convert.ToInt32(Template);
     MsgObj.MailFrom = MailFrom;
     MsgObj.MailTo = MailTo;
     MsgObj.MailCC = MailCC;
     MsgObj.Subject = Subject;
     MsgObj.Body = Content;
     MsgObj.IsSent = Convert.ToBoolean(SentStatus);
     if (ResentCount == "")
     {
         MsgObj.ResentCount = 0;
     }
     else
     {
         MsgObj.ResentCount = Convert.ToInt32(ResentCount);
     }
     MsgObj.SendingDateTime = DateTime.Now;
     if (Record == "")
     {
         MsgObj.RecordID = null;
     }
     else
     {
         MsgObj.RecordID = Convert.ToInt64(Record);
     }
     MsgObj.OpDateTime = DateTime.Now;
     MsgObj.OpUserID = Convert.ToInt64(Ctrl.Session["UserID"]);
     insertentity.BizTbl_MailQueue.Add(MsgObj);
     insertentity.SaveChanges();
     return status;
 }
 public bool Create(EmailExt model, ref string Msg, Controller ctrl)
 {
     bool status = true;
     DBEntities insertentity = new DBEntities();
     BizTbl_MailQueue MsgObj = new BizTbl_MailQueue();
     MsgObj.ID = model.ID;
     MsgObj.MailTemplateID = model.MailTemplateID;
     MsgObj.MailFrom = model.MailFrom;
     MsgObj.MailTo = model.MailTo;
     MsgObj.MailCC = model.MailCC;
     MsgObj.Subject = model.Subject;
     MsgObj.Body = model.Content;
     MsgObj.IsSent = Convert.ToBoolean(model.SentStatus);
     MsgObj.ResentCount = model.ResentCount;
     MsgObj.SendingDateTime = DateTime.Now;
     MsgObj.RecordID = Convert.ToInt64(model.Record);
     MsgObj.OpDateTime = DateTime.Now;
     MsgObj.OpUserID = Convert.ToInt64(ctrl.Session["UserID"]);
     insertentity.BizTbl_MailQueue.Add(MsgObj);
     insertentity.SaveChanges();
     return status;
 }