Exemple #1
0
        private static void sendMailThread(object obj)
        {
            MailMsg mailMsg = (MailMsg)obj;

            try
            {
                int num = MailAPI.GetInstance().SendEmail(mailMsg);
                if (num != ErrorCode.SUCCESS)
                {
                    int num2 = 0;
                    LogInfo.InsertNewLog(ref num2, "0120062", new string[]
                    {
                        mailMsg.Receiver,
                        mailMsg.Subject.Replace("\r\n", "")
                    });
                }
            }
            catch (Exception)
            {
            }
            finally
            {
                if (LogAPI._mailerCounter > 0)
                {
                    Interlocked.Decrement(ref LogAPI._mailerCounter);
                }
            }
        }
Exemple #2
0
        public async Task SendEmail()
        {
            await MailAPI.SendEmail(Email, FirstName + " " + LastName,
                                    "Meeting tomorrow",
                                    "Don't forget about our meeting tomorrow.");

            //Add Popup here
        }
        public async Task <ActionResult> Register(string firstname, string lastname, string email, string phone,
                                                  string gender, string dob, string accounttype, string password, string agreeToTos)
        {
            var dateofbirth = new DateTime();

            DateTime.TryParse(dob, out dateofbirth);
            var customer = new Customer
            {
                FirstName   = firstname,
                LastName    = lastname,
                Email       = email,
                PhoneNumber = phone,
                Password    = password,
                Gender      = gender,
                DOB         = dateofbirth,
                AccountType = accounttype,
                CreatedDate = DateTime.Now
            };

            try
            {
                if (String.IsNullOrEmpty(password) || String.IsNullOrEmpty(email) || String.IsNullOrEmpty(dob) ||
                    String.IsNullOrEmpty(firstname) || String.IsNullOrEmpty(agreeToTos))
                {
                    throw new Exception(ControllerConstants.missingRequiredFields);
                }
                bool emailIsInUse = await CheckIfEmailExists(email);

                if (emailIsInUse)
                {
                    throw new Exception(ControllerConstants.emailInUse);
                }
                _customerManagementService.Enroll(customer);
                customer = _customerManagementService.GetCustomerByEmail(email);
                _addressManagementService.AddNewAddress(new CustomerAddress {
                    CustomerID = customer.Id
                });
                MailAPI.SendWelcomeMessage(email, firstname);
                return(RedirectToAction("Index", "LogIn"));
            }
            catch (Exception ex)
            {
                if (customer != null)
                {
                    _customerManagementService.RemoveCustomer(customer.Id.ToString());
                }
                TempData["SignUpError"] = ex.Message;
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Wanted(string customerId)
        {
            const string c_votingUrlKey = "votingUrl";
            const string c_subject      = "Wanted Comedy Competition Entry Confirmation";

            Customer user = _customerManagementService.GetCustomerbyId(customerId);

            ViewBag.FirstName = user.FirstName;
            string votingLink = ConfigurationManager.AppSettings[c_votingUrlKey] + customerId;
            string message    = ControllerConstants.wantedRegistrationMessageStart + votingLink + ControllerConstants.wantedRegistrationMessageEnd;

            MailAPI.SendMessage(user.Email, user.FirstName, message, c_subject);
            return(View("Index"));
        }
        public ActionResult Index(string customerId, string message = null, string subject = null)
        {
            if (string.IsNullOrEmpty(message))
            {
                message = ControllerConstants.defaultThankYouMessage;
            }
            if (string.IsNullOrEmpty(subject))
            {
                subject = ControllerConstants.defaultThankYouSubject;
            }
            Customer user = _customerManagementService.GetCustomerbyId(customerId);

            ViewBag.FirstName = user.FirstName;
            MailAPI.SendMessage(user.Email, user.FirstName, message, subject);
            return(View());
        }
Exemple #6
0
 public async Task SendEmail()
 {
     await MailAPI.SendEmail(email, firstName + " " + lastName, subject, body, isPriority);
 }
Exemple #7
0
 public ContactController()
 {
     _mailAPI = new MailAPI();
     _result  = "";
 }