private bool SendMail(EmployeeMailTemplate model) { try { SMTPHelper smtpHelper = new SMTPHelper(); char[] symbols = new char[] { ';', ' ', ',', '\r', '\n' }; if (model != null) { string[] ToEmailId = model.To.Split(symbols); //Loop to seperate email id's of CC peoples string[] CCEmailId = null; if (model.Cc != "" && model.Cc != null) { CCEmailId = model.Cc.Split(symbols); string[] CCEmailIds = CCEmailId.Where(s => !String.IsNullOrEmpty(s)).ToArray(); return(smtpHelper.SendMail(ToEmailId, null, CCEmailIds, null, null, null, model.From, null, model.Subject, model.Message, null, null)); } else { return(smtpHelper.SendMail(ToEmailId, null, null, null, null, null, model.From, null, model.Subject, model.Message, null, null)); } } else { return(false); } } catch (Exception) { return(false); } }
void UpdateEditor(EmployeeMailTemplate mailTemplate) { ViewModel.Modified = snapControl.Modified; cbMailTemplate.EditValue = mailTemplate; LoadTemplate(mailTemplate); SynchronizeCurrentRecordWithSnap(); }
void LoadTemplate(EmployeeMailTemplate mailTemplate) { string template = (mailTemplate.ToFileName() + ".snx"); using (var stream = MailMergeTemplatesHelper.GetTemplateStream(template)) snapControl.LoadDocumentTemplate(stream, DevExpress.Snap.Core.API.SnapDocumentFormat.Snap); ribbonControl.ApplicationDocumentCaption = DevExpress.XtraEditors.EnumDisplayTextHelper.GetDisplayText(mailTemplate); }
void LoadTemplate(EmployeeMailTemplate mailTemplate) { var template = (mailTemplate.ToFileName() + ".snx"); using (var stream = MailMergeTemplatesHelper.GetTemplateStream(template)) { snapControl.LoadDocumentTemplate(stream, DevExpress.Snap.Core.API.SnapDocumentFormat.Snap); } }
public void QuickLetter(EmployeeMailTemplate mailTemplate) { EmployeeCollectionViewModel collectionViewModel = ViewModelHelper.GetParentViewModel <EmployeeCollectionViewModel>(this); if (collectionViewModel != null) { collectionViewModel.QuickLetterCore(Entity, mailTemplate); } }
public bool CanQuickLetter(EmployeeMailTemplate mailTemplate) { if (Entity == null || IsNew()) { return(false); } EmployeeCollectionViewModel collectionViewModel = ViewModelHelper.GetParentViewModel <EmployeeCollectionViewModel>(this); return((collectionViewModel != null) && collectionViewModel.CanQuickLetterCore(Entity, mailTemplate)); }
public static string ToFileName(this EmployeeMailTemplate mailTemplate) { switch (mailTemplate) { case EmployeeMailTemplate.ProbationNotice: return("Employee Probation Notice"); case EmployeeMailTemplate.ServiceExcellence: return("Employee Service Excellence"); case EmployeeMailTemplate.ThankYouNote: return("Employee Thank You Note"); case EmployeeMailTemplate.WelcomeToDevAV: return("Welcome to DevAV"); default: return("Employee of the Month"); } }
public void QuickLetter(EmployeeMailTemplate mailTemplate) { EmployeeCollectionViewModel collectionViewModel = ViewModelHelper.GetParentViewModel<EmployeeCollectionViewModel>(this); if(collectionViewModel != null) collectionViewModel.QuickLetterCore(Entity, mailTemplate); }
void UpdateEditor(EmployeeMailTemplate mailTemplate) { cbMailTemplate.EditValue = mailTemplate; LoadTemplate(mailTemplate); SynchronyzeCurrentRecordWithSnap(); }
void BindGalleryQuickLettersItem(int index, EmployeeMailTemplate parameter) { galleryQuickLetters.Gallery.Groups[0].Items[index].BindCommand(() => ViewModel.QuickLetter(parameter), ViewModel, () => parameter); }
void LoadTemplate(EmployeeMailTemplate mailTemplate) { string template = (mailTemplate.ToFileName() + ".snx"); using(var stream = MailMergeTemplatesHelper.GetTemplateStream(template)) snapControl.LoadDocumentTemplate(stream, DevExpress.Snap.Core.API.SnapDocumentFormat.Snap); ribbonControl.ApplicationDocumentCaption = DevExpress.XtraEditors.EnumDisplayTextHelper.GetDisplayText(mailTemplate); }
public void QuickLetter(EmployeeMailTemplate mailTemplate) { QuickLetterCore(SelectedEntity, mailTemplate); }
public ActionResult SendEmail(EmployeeMailTemplate model) { bool result = false; try { char[] symbols = new char[] { ';', ' ', ',', '\r', '\n' }; int CcCounter = 0; int ToCounter = 0; if (model.Cc != "" && model.Cc != null) { string CcMailIds = model.Cc.TrimEnd(symbols); model.Cc = CcMailIds; string[] EmailIds = CcMailIds.Split(symbols); string[] CCEmailId = EmailIds.Where(s => !String.IsNullOrEmpty(s)).ToArray(); foreach (string id in CCEmailId) { HRMS_tbl_PM_Employee employeeDetails = employeeDAL.GetEmployeeDetailsFromEmailId(id); if (employeeDetails != null) { CcCounter = 1; } else { CcCounter = 0; break; } } string[] EmailToId = model.To.Split(symbols); string[] EmailToIds = EmailToId.Where(s => !String.IsNullOrEmpty(s)).ToArray(); foreach (string email in EmailToIds) { HRMS_tbl_PM_Employee employeeDetails = employeeDAL.GetEmployeeDetailsFromEmailId(email); if (employeeDetails != null) { ToCounter = 1; } else { ToCounter = 0; break; } } } else { CcCounter = 1; string[] EmailToId = model.To.Split(symbols); string[] EmailToIds = EmailToId.Where(s => !String.IsNullOrEmpty(s)).ToArray(); foreach (string email in EmailToIds) { HRMS_tbl_PM_Employee employeeDetails = employeeDAL.GetEmployeeDetailsFromEmailId(email); if (employeeDetails != null) { ToCounter = 1; } else { ToCounter = 0; break; } } } if (CcCounter == 1 && ToCounter == 1) { result = SendMail(model); if (result == true) { return(Json(new { status = true, validCcId = true, validtoId = true })); } else { return(Json(new { status = false, validCcId = true, validtoId = true })); } } else { if (CcCounter == 1 && ToCounter == 0) { return(Json(new { status = false, validCcId = true, validtoId = false })); } else { if (CcCounter == 0 && ToCounter == 1) { return(Json(new { status = false, validCcId = false, validtoId = true })); } else { return(Json(new { status = false, validCcId = false, validtoId = false })); } } } } catch (Exception) { return(Json(new { status = "Error" }, JsonRequestBehavior.AllowGet)); } }
public bool CanQuickLetter(EmployeeMailTemplate mailTemplate) { if(Entity == null || IsNew()) return false; EmployeeCollectionViewModel collectionViewModel = ViewModelHelper.GetParentViewModel<EmployeeCollectionViewModel>(this); return (collectionViewModel != null) && collectionViewModel.CanQuickLetterCore(Entity, mailTemplate); }
public bool CanQuickLetter(EmployeeMailTemplate mailTemplate) { return(CanQuickLetterCore(SelectedEntity, mailTemplate)); }
protected internal bool CanQuickLetterCore(Employee employee, EmployeeMailTemplate mailTemplate) { return(employee != null); }
protected internal void QuickLetterCore(Employee employee, EmployeeMailTemplate mailTemplate) { ShowDocument <EmployeeMailMergeViewModel>("MailMerge", mailTemplate); }