Example #1
0
        public static bool SendEmailAsRejected(int agentId, string category,
                                               string notes, string applicationPath)
        {
            try
            {
                // Send email to the Agent.
                RegistrationService.RegistrationService registrationService =
                    serviceLoader.GetRegistration();
                RegistrationService.RegistrationInfo agent =
                    registrationService.GetDetails(agentId);

                string templatePath = AppDomain.CurrentDomain.BaseDirectory +
                                      "HTMLTemplate\\Email_DesignRejected_Agent.html";

                Hashtable variables = new Hashtable();
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_CATEGORY", category);
                variables.Add("DESIGN_NOTES", (notes == "" ? "---" : notes));

                MailAddressCollection mailAddresses = new MailAddressCollection();
                mailAddresses.Add(agent.Email);

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Rejected", applicationPath);

                // Send email to all the Admins.
                CommonService.CommonService            commonService = serviceLoader.GetCommon();
                IList <CommonService.RegistrationInfo> users         =
                    commonService.GetUsersByRole(CommonService.UserRole.Admin.ToString());

                templatePath = AppDomain.CurrentDomain.BaseDirectory +
                               "HTMLTemplate\\Email_DesignRejected_Admin.html";

                variables = new Hashtable();
                variables.Add("DESIGN_CATEGORY", category);
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_NOTES", (notes == "" ? "---" : notes));

                mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Rejected", applicationPath);
            }
            catch (Exception ex)
            {
                log.Error("Unknown Error", ex);
                return(false);
            }

            return(true);
        }
Example #2
0
    protected void SendRejectEmailCSR()
    {
        try
        {
            ///Creating HTML MAil from HTML Template
            Hashtable templateVars          = new Hashtable();
            String    emailTemplateFilePath = AppDomain.CurrentDomain.BaseDirectory + "\\HTMLTemplate\\Email_AccountRejected_CSR.html";
            templateVars.Add("USER_NAME", UserNameLabel.Text);
            templateVars.Add("FIRST_NAME", FirstNameLabel.Text);
            templateVars.Add("LAST_NAME", LastNameLabel.Text);
            templateVars.Add("EMAIL", EmailLabel.Text);
            Parser parser = new Parser(emailTemplateFilePath, templateVars);

            string toAddress = EmailLabel.Text;
            string subject   = "Account is Rejected With Mailing Cycle";

            // Send email to all the CSR's.
            ServiceAccess serviceLoader = ServiceAccess.GetInstance();
            CommonService.CommonService            commonService = serviceLoader.GetCommon();
            IList <CommonService.RegistrationInfo> users         =
                commonService.GetUsersByRole(CommonService.UserRole.CSR.ToString());

            MailAddressCollection mailAddresses = new MailAddressCollection();
            foreach (CommonService.RegistrationInfo user in users)
            {
                mailAddresses.Add(user.Email);
            }

            if (mailAddresses.Count > 0)
            {
                Util.Mail.Send(emailTemplateFilePath, templateVars, mailAddresses, subject, Request.ApplicationPath);
            }
        }
        catch (Exception ex)
        {
            //log.Error("User Reject Email Sending Failed", ex);
            ErrorLiteral.Text = "User Reject Email Sending Failed !!! ";
        }
    }
Example #3
0
        public static bool SendEmailAsFirmedUp(string farmName, string planName,
                                               DateTime startDate, string firstName, string lastName,
                                               string applicationPath)
        {
            try
            {
                // Send email to all the Printers.
                CommonService.CommonService commonService =
                    serviceLoader.GetCommon();
                IList <CommonService.RegistrationInfo> users =
                    commonService.GetUsersByRole(CommonService.UserRole.Printer.ToString());

                string templatePath = AppDomain.CurrentDomain.BaseDirectory +
                                      "HTMLTemplate\\Email_PlanFirmedUp.html";

                Hashtable variables = new Hashtable();
                variables.Add("ROLE", CommonService.UserRole.Printer.ToString());
                variables.Add("PLAN_NAME", planName);
                variables.Add("FARM_NAME", farmName);
                variables.Add("START_DATE", startDate.ToString("MM/dd/yyyy"));
                variables.Add("FIRST_NAME", firstName);
                variables.Add("LAST_NAME", lastName);

                MailAddressCollection mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Plan Firmed Up", applicationPath);

                // Send email to all the Admins.
                commonService = serviceLoader.GetCommon();
                users         = commonService.GetUsersByRole(CommonService.UserRole.Admin.ToString());

                templatePath = AppDomain.CurrentDomain.BaseDirectory +
                               "HTMLTemplate\\Email_PlanFirmedUp.html";

                variables = new Hashtable();
                variables.Add("ROLE", "Administrator");
                variables.Add("PLAN_NAME", planName);
                variables.Add("FARM_NAME", farmName);
                variables.Add("START_DATE", startDate.ToString("MM/dd/yyyy"));
                variables.Add("FIRST_NAME", firstName);
                variables.Add("LAST_NAME", lastName);

                mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Plan Firmed Up", applicationPath);
            }
            catch (Exception ex)
            {
                log.Error("Unknown Error", ex);
                return(false);
            }

            return(true);
        }
Example #4
0
        public static bool SendEmailAsSubmitted(DesignService.DesignInfo design,
                                                string applicationPath, string url)
        {
            try
            {
                RegistrationService.RegistrationService registrationService =
                    serviceLoader.GetRegistration();
                RegistrationService.RegistrationInfo agent =
                    registrationService.GetDetails(design.UserId);

                // Send email to all the Printers.
                CommonService.CommonService commonService =
                    serviceLoader.GetCommon();
                IList <CommonService.RegistrationInfo> users =
                    commonService.GetUsersByRole(CommonService.UserRole.Printer.ToString());

                string templatePath = AppDomain.CurrentDomain.BaseDirectory +
                                      "HTMLTemplate\\Email_DesignSubmitted.html";

                Hashtable variables = new Hashtable();
                variables.Add("ROLE", CommonService.UserRole.Printer.ToString());
                variables.Add("DESIGN_CATEGORY", design.Category.Name);
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_INFO", BuildInformation(design, agent.UserId, url));

                MailAddressCollection mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Submitted for Approval", applicationPath);

                // Send email to all the Admins.
                users = commonService.GetUsersByRole(CommonService.UserRole.Admin.ToString());

                templatePath = AppDomain.CurrentDomain.BaseDirectory +
                               "HTMLTemplate\\Email_DesignSubmitted.html";

                variables = new Hashtable();
                variables.Add("ROLE", "Administrator");
                variables.Add("DESIGN_CATEGORY", design.Category.Name);
                variables.Add("FIRST_NAME", agent.FirstName);
                variables.Add("LAST_NAME", agent.LastName);
                variables.Add("DESIGN_INFO", BuildInformation(design, agent.UserId, url));

                mailAddresses = new MailAddressCollection();
                foreach (CommonService.RegistrationInfo user in users)
                {
                    mailAddresses.Add(user.Email);
                }

                Mail.Send(templatePath, variables, mailAddresses,
                          "MailingCycle Design Submitted for Approval", applicationPath);
            }
            catch (Exception ex)
            {
                log.Error("Unknown Error", ex);
                return(false);
            }

            return(true);
        }