예제 #1
0
        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);
            }
        }
예제 #2
0
 void UpdateEditor(EmployeeMailTemplate mailTemplate)
 {
     ViewModel.Modified       = snapControl.Modified;
     cbMailTemplate.EditValue = mailTemplate;
     LoadTemplate(mailTemplate);
     SynchronizeCurrentRecordWithSnap();
 }
예제 #3
0
        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);
        }
예제 #4
0
        void LoadTemplate(EmployeeMailTemplate mailTemplate)
        {
            var template = (mailTemplate.ToFileName() + ".snx");

            using (var stream = MailMergeTemplatesHelper.GetTemplateStream(template)) {
                snapControl.LoadDocumentTemplate(stream, DevExpress.Snap.Core.API.SnapDocumentFormat.Snap);
            }
        }
예제 #5
0
        public void QuickLetter(EmployeeMailTemplate mailTemplate)
        {
            EmployeeCollectionViewModel collectionViewModel = ViewModelHelper.GetParentViewModel <EmployeeCollectionViewModel>(this);

            if (collectionViewModel != null)
            {
                collectionViewModel.QuickLetterCore(Entity, mailTemplate);
            }
        }
예제 #6
0
        public bool CanQuickLetter(EmployeeMailTemplate mailTemplate)
        {
            if (Entity == null || IsNew())
            {
                return(false);
            }
            EmployeeCollectionViewModel collectionViewModel = ViewModelHelper.GetParentViewModel <EmployeeCollectionViewModel>(this);

            return((collectionViewModel != null) && collectionViewModel.CanQuickLetterCore(Entity, mailTemplate));
        }
예제 #7
0
        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");
            }
        }
예제 #8
0
 public void QuickLetter(EmployeeMailTemplate mailTemplate) {
     EmployeeCollectionViewModel collectionViewModel = ViewModelHelper.GetParentViewModel<EmployeeCollectionViewModel>(this);
     if(collectionViewModel != null)
         collectionViewModel.QuickLetterCore(Entity, mailTemplate);
 }
예제 #9
0
 void UpdateEditor(EmployeeMailTemplate mailTemplate)
 {
     cbMailTemplate.EditValue = mailTemplate;
     LoadTemplate(mailTemplate);
     SynchronyzeCurrentRecordWithSnap();
 }
예제 #10
0
 void UpdateEditor(EmployeeMailTemplate mailTemplate) {
     ViewModel.Modified = snapControl.Modified;
     cbMailTemplate.EditValue = mailTemplate;
     LoadTemplate(mailTemplate);
     SynchronizeCurrentRecordWithSnap();
 }
예제 #11
0
 void BindGalleryQuickLettersItem(int index, EmployeeMailTemplate parameter) {
     galleryQuickLetters.Gallery.Groups[0].Items[index].BindCommand(() => ViewModel.QuickLetter(parameter), ViewModel, () => parameter);
 }
예제 #12
0
 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);
 }
예제 #14
0
 void BindGalleryQuickLettersItem(int index, EmployeeMailTemplate parameter)
 {
     galleryQuickLetters.Gallery.Groups[0].Items[index].BindCommand(() => ViewModel.QuickLetter(parameter), ViewModel, () => parameter);
 }
예제 #15
0
        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));
            }
        }
예제 #16
0
 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);
 }