Ejemplo n.º 1
0
        public ActionResult AccountSetup()
        {
            AccountSetupViewModel model = new AccountSetupViewModel();

            model.AccountName      = User.Identity.GetUserName();
            model.StartDate        = DateTime.Now;
            ViewBag.AccountLevelID = new SelectList(db.AccountLevels, "ID", "Type");
            return(View(model));
        }
Ejemplo n.º 2
0
 public ActionResult Setup(AccountSetupViewModel viewModel)
 {
     try
     {
         return(View());
     }
     catch (Exception ex)
     {
         LogError(ex, CurrentUserId);
         return(View("error"));
     }
 }
        public ActionResult index(AccountSetupViewModel accountSetupViewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string path = Server.MapPath("App_Data") + "\\" + "client_inquiry.txt";

                    if (System.IO.File.Exists(path))
                    {
                        string body    = System.IO.File.ReadAllText(path);
                        string subject = System.Configuration.ConfigurationManager.AppSettings.Get("InquiryEMailSubject");
                        string from    = System.Configuration.ConfigurationManager.AppSettings.Get("InquiryEMailFrom");
                        string cc      = System.Configuration.ConfigurationManager.AppSettings.Get("InquiryEMailCc");

                        body = body.Replace("[*NAME*]", accountSetupViewModel.Name);
                        body = body.Replace("[*BUSINESSNAME*]", accountSetupViewModel.BusinessName);
                        body = body.Replace("[*PHONENUMBER*]", accountSetupViewModel.PhoneNumber);
                        body = body.Replace("[*EMAILADDRESS*]", accountSetupViewModel.EmailAddress);

                        WebMail.SmtpServer = System.Configuration.ConfigurationManager.AppSettings.Get("SmtpServer");
                        WebMail.Send(accountSetupViewModel.EmailAddress, subject, body, from, cc, null, true);
                    }
                }
                catch (Exception ex)
                {
                    string test = "";
                }

                accountSetupViewModel         = new AccountSetupViewModel();
                accountSetupViewModel.Message = "Thank You!";
            }
            else
            {
                accountSetupViewModel.Message = "Please correct the following:";
            }



            return(View(accountSetupViewModel));
        }
Ejemplo n.º 4
0
        public ActionResult AccountSetup(AccountSetupViewModel model)
        {
            if (ModelState.IsValid)
            {
                var  currentUser = db.Users.Where(u => u.UserName == User.Identity.Name).FirstOrDefault();
                bool isPrimary   = (db.Accounts.Where(m => m.MemberID == currentUser.Id).ToList().Any()) ? false : true;
                db.Accounts.Add(new Account {
                    AccountLabelID = model.AccountLabelID, AccountName = model.AccountName, CreatedDate = DateTime.Now, IsActive = true, IsPrimary = isPrimary, MemberID = currentUser.Id, MinimumThreshold = model.MinimumThreshold, StartDate = model.StartDate
                });
                int result = db.SaveChanges();
                if (result == 1)
                {
                    return(RedirectToAction("Index", "Dashboard"));
                }
                else
                {
                    ModelState.AddModelError("", "Some Problem occured during the operation. Please try after some time.");
                }
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
        public ActionResult index(AccountSetupViewModel accountSetupViewModel)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    string path = Server.MapPath("App_Data") + "\\" + "settlement.txt";

                    if (System.IO.File.Exists(path))
                    {
                        string body = System.IO.File.ReadAllText(path);

                        string stxs = @"[\***";
                        string etxs = @"***/]";

                        int stx = body.IndexOf(stxs);
                        int etx = body.IndexOf(etxs);

                        if (stx == 0 && etx > 0)
                        {
                            string settings = body.Substring(stxs.Length, (etx - etxs.Length));

                            if (settings.Trim().Length > 0)
                            {
                                Dictionary <string, string> d = this.ParseSettings(settings);

                                if (d.Count > 0)
                                {
                                    body = body.Substring(etx + etxs.Length);

                                    string subject  = d.ContainsKey("EmailSubject") ? d["EmailSubject"] : "Payment World Inquiry";
                                    string fromName = d.ContainsKey("EmailFromName") ? d["EmailFromName"] : "Payment World";
                                    string from     = d.ContainsKey("EmailFrom") ? d["EmailFrom"] : "*****@*****.**";

                                    string cc  = d.ContainsKey("Cc") ? d["Cc"] : null;
                                    string bcc = d.ContainsKey("Bcc") ? d["Bcc"] : null;

                                    body = body.Replace("[*NAME*]", accountSetupViewModel.Name);
                                    body = body.Replace("[*BUSINESSNAME*]", accountSetupViewModel.BusinessName);
                                    body = body.Replace("[*PHONENUMBER*]", accountSetupViewModel.PhoneNumber);
                                    body = body.Replace("[*EMAILADDRESS*]", accountSetupViewModel.EmailAddress);

                                    string smtpServer   = System.Configuration.ConfigurationManager.AppSettings.Get("SmtpServer");
                                    string smtpUsername = System.Configuration.ConfigurationManager.AppSettings.Get("SmtpUsername");
                                    string smtpPassword = System.Configuration.ConfigurationManager.AppSettings.Get("SmtpPassword");
                                    string smtpPort     = System.Configuration.ConfigurationManager.AppSettings.Get("SmtpPort");

                                    if (!string.IsNullOrEmpty(smtpServer))
                                    {
                                        WebMail.SmtpServer = smtpServer;

                                        if (!string.IsNullOrEmpty(smtpPort))
                                        {
                                            WebMail.SmtpPort = Int32.Parse(smtpPort);
                                        }

                                        if (!string.IsNullOrEmpty(smtpUsername))
                                        {
                                            WebMail.UserName = smtpUsername;
                                        }

                                        if (!string.IsNullOrEmpty(smtpPassword))
                                        {
                                            WebMail.Password = smtpPassword;
                                        }

                                        WebMail.Send(accountSetupViewModel.EmailAddress, subject, body, from, cc, null, true);
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    string test = "";
                }

                accountSetupViewModel         = new AccountSetupViewModel();
                accountSetupViewModel.Message = "Thank You!";
            }
            else
            {
                accountSetupViewModel.Message = "Please correct the following:";
            }

            return(View(accountSetupViewModel));
        }