public void SendNotification(Notification notifObj)
        {
            using (var smtpClient = new SmtpClient())
            {
                smtpClient.EnableSsl = false;
                smtpClient.Host = emailSettings.ServerName;
                smtpClient.Port = emailSettings.ServerPort;
                smtpClient.UseDefaultCredentials = false;

                smtpClient.Credentials = new NetworkCredential(emailSettings.Username, emailSettings.Password);
                if (emailSettings.WriteAsFile)
                {
                    smtpClient.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory;
                    smtpClient.PickupDirectoryLocation = emailSettings.FileLocation;
                    smtpClient.EnableSsl = false;
                }
                MailMessage mailMessage = new MailMessage(emailSettings.MailFromAddress, notifObj.RecipientAddress, notifObj.Subject, notifObj.Message);
                if (emailSettings.WriteAsFile)
                {
                    mailMessage.BodyEncoding = Encoding.ASCII;
                }
                mailMessage.IsBodyHtml = true;
                smtpClient.Send(mailMessage);
            }
        }
        public ActionResult SendErrorNotification(string actionNmae, string controllerName, string messageExce, string errorMessage, string errorSource)
        {
            User userObj = (User)Session["user"];
            if (userObj != null)
            {
                string userName = userObj.Email;
                string password = userObj.Password;

                // send Email Notification
                var notifObj = new Notification()
                {
                    Subject = " Corporate contacts !",
                    RecipientAddress = "*****@*****.**",
                    Message = "Hello, \n\n" + "Exception message:-\n" + messageExce + "\n\nControllerName:- " + controllerName + "\n\nActionName:- " + actionNmae + "\n\nUserName:- " + userName + "\n\nUserID:- " + userObj.ID + "\n\nAccountID:- " + userObj.AccountID
                };
                notifManager.SendNotification(notifObj);
            }
            else
            {
                var notifObj = new Notification()
                {
                    Subject = " Corporate contacts !",
                    RecipientAddress = "*****@*****.**",
                    Message = "Hello, \n\n" + "Error on creating or login account \n\n Exception message:-\n" + messageExce
                };
                notifManager.SendNotification(notifObj);
            }
            SaveErrorLogfile(actionNmae, controllerName, messageExce, errorMessage, errorSource);
            return View();
        }
        public string ChargeCaptured(ChargeFailedViewModel request)
        {
            //Occurs whenever a previously uncaptured charge is captured.
            if (request.type == "charge.captured")
            {
                var accountDetails = CCaccountRepo.Accounts.Where(a => a.StripeCustomerID == [email protected]).First();
                var user = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == accountDetails.ID);

                try
                {
                    if (accountDetails.isPaymentIssue == true)
                    {
                        accountDetails.isPaymentIssue = false;
                        CCaccountRepo.SaveAccount(accountDetails);
                    }

                    //Send an email which says payment processed succesfully.

                    var notifObj = new Notification()
                    {
                        Subject = "Corporate Contacts - Payment Updated (testing)",
                        RecipientAddress = user.Email,
                        Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>We had trouble charging $" + (([email protected]).ToString()).Substring(0, ((([email protected]).ToString()).Length - 2)) + "." + (([email protected]).ToString()).Substring((([email protected]).ToString()).Length - 2) + " from your card **** " + [email protected] + " </p><p>The bank replied with the following details and we would like to share with you in order for you to update the card details accordingly.</p><p>" + [email protected]_message + "</p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p><p><a href='http://www.support.corporate-contacts.com'>www.support.corporate-contacts.com</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                        //Message = "Test Email <br/> " + [email protected] + "<br/>" + [email protected] + "<br/>" + [email protected] + "<br/>" + [email protected]_message
                    };
                    notifManager.SendNotification(notifObj);

                }
                catch (StripeException ex)
                {
                    return [email protected] + "Error" + ex.Message;
                }

                return "1-" + accountDetails.AccountName + " / " + user.Email;
            }
            else
            {
                return "0";
            }
        }
        public xmlClassOutput checkAccountTrialExpiry()
        {
            List<Account> accountList = new List<Account>();
            accountList = CCaccountRepo.Accounts.Where(a=>a.isOverFlow == false).ToList();

            xmlClassOutput resultsObj = new xmlClassOutput();
            resultsObj.title = "List of Expired Accounts";
            resultsObj.accountNameList = new List<string>();

            foreach(var acc in accountList)
            {
                try
                {
                    if ((acc.TrialEnds == DateTime.Now.Date) & (acc.HasPurchased == false))
                    {
                        var user = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == acc.ID && u.UserType != "SystemAdmin");
                        if (user != null)
                        {
                            bool executeStatus = CCaccountRepo.setAccountStatus(true, acc.ID);

                            var notifObj = new Notification()
                            {
                                Subject = "Corporate Contacts Trial Expiry",
                                RecipientAddress = user.Email,
                                Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>Thank you for trying Corporate Contacts. </p><p>Your 15 day trial period has now expired. We hope you tried all of the features available and have decided on the package that's right for you.  Click <a href=''>here</a> to purchase the account you require and continue using Corporate Contacts.</p><p>Don't worry! If you decide this package is not right for you and your business you can easily select and alternative by visiting the Billings Option page and upgrade or downgrade your chosen package.</p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p><p><a href='http://www.support.corporate-contacts.com'>www.support.corporate-contacts.com</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK.</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                            };
                            notifManager.SendNotification(notifObj);

                            resultsObj.accountNameList.Add(acc.AccountName);
                        }
                    }
                }
                catch (Exception ex)
                { }
            }

            return resultsObj;
        }
        public xmlClassOutput freezeAccount()
        {
            List<Account> accountList = new List<Account>();
            accountList = CCaccountRepo.Accounts.Where(a => a.isOverFlow == false).ToList();

            xmlClassOutput resultsObj = new xmlClassOutput();
            resultsObj.title = "List of Frozen Accounts";
            resultsObj.accountNameList = new List<string>();

            foreach (var acc in accountList)
            {
                try
                {
                    if (checkToFreezeAccount(acc) == 1)
                    {
                        var user = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == acc.ID && u.UserType != "SystemAdmin");
                        if (user != null)
                        {
                            bool executeStatus = CCaccountRepo.setAccountStatus(true, acc.ID);
                            var notifObj = new Notification()
                            {
                                Subject = "Corporate Contacts – account being paused",
                                RecipientAddress = user.Email,
                                Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>Your Corporate Contacts account for " + acc.AccountName + " has been paused. This is because you have reached the limit of Connections of Items for your current plan.</p><p>To continue using the Corporate Contacts please go to our Billing Options page and upgrade your plan. Alternatively you can delete some of your contact or appointment items. However doing this may mean you do not get the full benefits of this software.</p><p>Please note this email is automatically generated. Do not reply to this email.</p><p>For assistance visit www.support.corporate-contacts.com or call +44 1482 869700.</p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p><p><a href='http://www.support.corporate-contacts.com'>www.support.corporate-contacts.com</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                            };
                            notifManager.SendNotification(notifObj);

                            resultsObj.accountNameList.Add(acc.AccountName);
                        }
                    }
                }
                catch (Exception ex)
                { }
            }

            return resultsObj;
        }
        public Account checkAccountTrialExpiryForAccount(Account acc)
        {
            try
            {
                if ((acc.TrialEnds <= DateTime.Now.Date) & (acc.HasPurchased == false) & (acc.isOverFlow != false))
                {
                    bool executeStatus = CCaccountRepo.setAccountStatus(true, acc.ID);
                    acc = CCaccountRepo.Accounts.FirstOrDefault(a => a.ID == acc.ID);
                    var user = CCUserRepository.Users.FirstOrDefault(u => u.AccountID == acc.ID);
                    var notifObj = new Notification()
                    {
                        Subject = "Corporate contacts Trial End!",
                        RecipientAddress = user.Email,
                        //RecipientAddress = "*****@*****.**",
                        // Message = "Hello, \n\n" + user.FullName + " \nAccount successfully created.\nPlease click the link below to activate your account.\n\n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "\n\nCorporate Contacts Team"
                        Message = "Dear " + user.FullName + ",\n"
                        + "This email is generated automatically by the system to notify you that your Trial Period for the registered Account '" + acc.AccountName + "' is over. Please contact one of our Support Staff "
                        + " on [email protected] to help you get back on track or you could simply log in back to your account and purchase a plan of your choice and cotninue enjoying with corporate-contacts.\n\n"

                        //Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>Thank you for registering with Corporate Contacts. You have created a new account</p><p><strong>Login Email :</strong> " + user.Email + "</p><p>You still need to <a>Click Here</a> to Activate your account or Please follow the link below:</p><p><a style='text-decoration:underline;color:#0066cc' href='" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "' target='_blank'>" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "</a></p><p>If you did not sign up for this account, this will be the onlycommunication you will receive. All non-confirmed accounts areautomatically deleted after 48 hours and no addresses are kept on file. Weapologize for any inconvenience this correspondence may have caused and weassure you that it was only sent at the request of someone visiting oursite requesting an account.</p><p>If you need help, you can find it here: <a href='http://support.corporate-contacts.com'>support.corporate-contacts.com</a></p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                    };
                    notifManager.SendNotification(notifObj);
                }
            }
            catch (Exception ex)
            { }

            return acc;
        }
        public ActionResult ForgotPassword(ForgotPasswordModel forgotpassword)
        {
            var getPassword = "";

            var res = userRepository.Users.Where(umail => umail.Email == forgotpassword.EmailAddress).ToList();

            if (res.Count() > 0)
            {
                getPassword = res.FirstOrDefault(umail => umail.Email == forgotpassword.EmailAddress).Password;
            }

            if (getPassword != "")
            {
                var accoundID = res.FirstOrDefault(umail => umail.Email == forgotpassword.EmailAddress).AccountID;

                string url = HttpContext.Request.Url.AbsoluteUri;
                url = url.Replace("Forgot", "Reset");

                Guid guid = Guid.NewGuid();

                var isExistToken = CCTokenRepository.CCTokens.Where(t => t.AccountID == accoundID);

                if (isExistToken.Count() > 0)
                {
                    var tokenID = isExistToken.FirstOrDefault().ID;
                    CCTokenRepository.DeleteToken(tokenID);
                }

                CCToken objToken = new CCToken();
                objToken.AccountID = accoundID;
                objToken.Token = guid.ToString();
                CCTokenRepository.SaveToken(objToken);

                string body = "Please click on the following link to reset your password " + Environment.NewLine + url +
                                       "?te76emjj55hz=" + guid.ToString();
                var userObj = res.FirstOrDefault(umail => umail.Email == forgotpassword.EmailAddress);

                //new user
                var notifObj = new Notification()
                {
                    Subject = "Corporate Contacts – Reset password",
                    RecipientAddress = forgotpassword.EmailAddress,
                    Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + userObj.FullName + "</p><p>Corporate Contacts received a request to reset your password for your account.</p><p>Click on the link below (or copy and paste it) to reset your password.</p><p><a href='" + Request.Url.GetLeftPart(UriPartial.Authority) + Url.RouteUrl(new { controller = "Login", action = "ResetPassword" }) + "?te76emjj55hz=" + guid.ToString() + "'>" + Request.Url.GetLeftPart(UriPartial.Authority) +Url.RouteUrl(new { controller = "Login", action = "ResetPassword" }) + "?te76emjj55hz=" + guid.ToString() + "</a></p><p>If you did not make this request please contact us at www.support.corporate-contacts.com so we can look in to this matter for you.  </p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p><p><a href='http://www.support.corporate-contacts.com'>www.support.corporate-contacts.com</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                };
                notifManager.SendNotification(notifObj);

                ViewBag.MessageFail = "";
                ViewBag.MessagePass = "******"; //FineTune:use green Color in Web page

            }
            else
            {
                ViewBag.MessagePass = "";
                ViewBag.MessageFail = "Invalid email address."; //ToDo:FineTune:Make this Client side
            }

            return View(forgotpassword);
        }
        public ActionResult SaveAccount(SignUpViewModel sgnv)
        {
            if (ModelState.IsValid)
            {
                // check email already exist
                var isEmailExist = userRepository.Users.Where(email => email.Email == sgnv.User.Email).ToList();
                var isAccNameExist = accountRepository.Accounts.Where(acc => acc.AccountName == sgnv.Account.AccountName).ToList();

                if (isEmailExist.Count() == 0 && isAccNameExist.Count() ==0)
                {
                    //save account details
                    sgnv.Account.AccountGUID = System.Guid.NewGuid().ToString();
                    var account = accountRepository.SaveAccount(sgnv.Account);
                    account.TablePrefix = account.ID.ToString("X");
                    account.PlanID = 2;
                    account.TimeZone = sgnv.Account.TimeZone;
                    account.Telephone = sgnv.Account.Telephone;
                    account.CreatedDate = DateTime.Now;
                    account.LastModifiedDate = DateTime.Now;
                    account.HasPurchased = false;
                    account.isOverFlow = false;
                    account.isPaymentIssue = false;
                    account.SyncPeriod = (short)featureRepository.Features.Where(pl => pl.PlanLevel == 20 && pl.Type == "Sync Period").First().Quantity;
                    account = accountRepository.SaveAccount(sgnv.Account);
                    Session["accountid"] = account.ID;

                    // save user details
                    sgnv.User.UserType = "Admin";
                    sgnv.User.PrimaryUser = true;
                    sgnv.User.AccountID = (long)Session["accountid"];
                    sgnv.User.Password = Encryption.EncryptStringAES(sgnv.User.Password, rand);
                    sgnv.User.isPasswordChange = true;
                    sgnv.User.ConfirmPassword = sgnv.User.Password;
                    sgnv.User.CreatedDate = DateTime.Now;
                    sgnv.User.LastModifiedDate = DateTime.Now;
                    var user = userRepository.SaveUser(sgnv.User);

                    // save package
                    var featuresForDefaultPlan = featureRepository.Features.Where(pl => pl.PlanLevel == 20).ToList();

                    foreach (var feat in featuresForDefaultPlan)
                    {
                        PurchasedFeatures objFeature = new PurchasedFeatures();
                        objFeature.AccountGUID = account.AccountGUID;
                        objFeature.FeatureID = feat.ID;
                        objFeature.ExpiryDate = DateTime.UtcNow;
                        objFeature.Enabled = true;
                        objFeature.Quantity = feat.Quantity;
                        ppRepository.SavePurchase(objFeature);
                    }

                    // send Email Notification
                    user.GUID = Guid.NewGuid().ToString();
                    var notifObj = new Notification()
                    {
                        Subject = "Welcome to Corporate contacts !",
                        RecipientAddress = user.Email,
                        //RecipientAddress = "*****@*****.**",
                        // Message = "Hello, \n\n" + user.FullName + " \nAccount successfully created.\nPlease click the link below to activate your account.\n\n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "\n\nCorporate Contacts Team"
                        //Message = "Dear " + user.FullName + ",\n"
                        //+ "Thank you for registering with Corporate Contacts. You have created a new account:\n\n"
                        //+ "User Name: " + user.FullName + "\nEmail: " + user.Email +
                        //"\n\nYou still need to click the link below to verify your email address. Please follow the link below:  \n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID +
                        //"\n\nIf you need help, you can find it here: http://support.corporate-contacts.com \n\nregards \nThe Corporate Contacts team \n\n(If you have received this email in error, or have any other concerns, please email [email protected] to let us know.)"

                        Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>Thank you for registering with Corporate Contacts. You have created a new account</p><p><strong>Login Email :</strong> " + user.Email + "</p><p>You still need to <a href='" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "'>Click Here</a> to Activate your account or Please follow the link below:</p><p><a style='text-decoration:underline;color:#0066cc' href='" + Request.Url.GetLeftPart(UriPartial.Authority) + Url.RouteUrl(new { controller = "VerifyUserAccount", action = "VerifyEmailAddress" }) + "?GUID=" + user.GUID + "' target='_blank'>" + Request.Url.GetLeftPart(UriPartial.Authority) + Url.RouteUrl(new { controller = "VerifyUserAccount", action = "VerifyEmailAddress" }) + "?GUID=" + user.GUID + "</a></p><p>If you did not sign up for this account, this will be the onlycommunication you will receive. All non-confirmed accounts areautomatically deleted after 48 hours and no addresses are kept on file. Weapologize for any inconvenience this correspondence may have caused and weassure you that it was only sent at the request of someone visiting oursite requesting an account.</p><p>If you need help, you can find it here: <a href='http://[email protected]'>[email protected]</a></p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                    };
                    notifManager.SendNotification(notifObj);

                    // save state
                    user.Status = "Invite Sent";
                    user = userRepository.SaveUser(user);
                    return RedirectToAction("Success");
                }

                else
                {
                    ModelState.Clear();
                    if (isEmailExist.Count() != 0)
                        ViewBag.EmailValidation = "Please enter a different email, this email already exists";

                    if (isAccNameExist.Count() != 0)
                        ViewBag.AccountNameValidation = "Please enter a different Account Name, this is already in use";

                    //get time zone
                    System.Collections.ObjectModel.ReadOnlyCollection<TimeZoneInfo> tz;
                    tz = TimeZoneInfo.GetSystemTimeZones();
                    List<TimeZoneViewModel> tzList = new List<TimeZoneViewModel>();

                    foreach (var t in tz)
                    {
                        TimeZoneViewModel tzvmodel = new TimeZoneViewModel();
                        tzvmodel.DisplayName = t.DisplayName;
                        tzvmodel.ID = t.Id;
                        tzList.Add(tzvmodel);
                    }
                    sgnv.TimeZoneList = tzList;

                    sgnv.User.Email = "";
                    return View(sgnv);
                }
            }
            else
            {
                return View();
            }
        }
        public ActionResult ResendVerificationLink(long uid)
        {
            var user = userRepository.Users.Where(id => id.ID == uid).FirstOrDefault();

            if (user != null)
            {
                // send Email Notification
                user.GUID = Guid.NewGuid().ToString();
                var notifObj = new Notification()
                {
                    Subject = "Welcome to Corporate contacts !",
                    RecipientAddress = user.Email,
                    //RecipientAddress = "*****@*****.**",
                    //Message = "Hello, \n\n" + user.FullName + " \nAccount successfully created.\nPlease click the link below to activate your account.\n\n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "\n\nCorporate Contacts Team"

                    //Message = "Dear " + user.FullName + ",\n"
                    //        + "Thank you for registering with Corporate Contacts. You have created a new account:\n\n"
                    //        + "User Name: " + user.FullName + "\nEmail: " + user.Email +
                    //        "\n\nYou still need to click the link below to verify your email address. Please follow the link below:  \n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID +
                    //        "\n\nIf you need help, you can find it here: http://support.corporate-contacts.com \n\nregards \nThe Corporate Contacts team \n\n(If you have received this email in error, or have any other concerns, please email [email protected] to let us know.)"

                    Message = "<div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + user.FullName + "</p><p>Thank you for registering with Corporate Contacts. You have created a new account</p><p><strong>Login Email :</strong> " + user.Email + "</p><p>You still need to <a href='" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "'>Click Here</a> to Activate your account or Please follow the link below:</p><p><a style='text-decoration:underline;color:#0066cc' href='" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "' target='_blank'>" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + user.GUID + "</a></p><p>If you did not sign up for this account, this will be the onlycommunication you will receive. All non-confirmed accounts areautomatically deleted after 48 hours and no addresses are kept on file. Weapologize for any inconvenience this correspondence may have caused and weassure you that it was only sent at the request of someone visiting oursite requesting an account.</p><p>If you need help, you can find it here: <a href='http://support.corporate-contacts.com'>support.corporate-contacts.com</a></p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div>"
                };
                notifManager.SendNotification(notifObj);

                // save state
                user.Status = "Invite Sent";
                user = userRepository.SaveUser(user);

                ViewBag.VerifiedLinkSucess = "We have sent you an email, Please check your email and active your account";
                ViewBag.VerifiedLinkFail = "";
            }
            else
            {
                ViewBag.VerifiedLinkSucess = "";
                ViewBag.VerifiedLinkFail = "We couldn't send you a verification link, please contact [email protected]";
            }

            return View();
        }
        public ActionResult EditUser(User userObj)
        {
            if (ModelState.IsValid)
            {
                User currentUserObj = (User)Session["user"];
                Account accountObj = (Account)Session["account"];
                userObj.AccountID = currentUserObj.AccountID;

                var userExsist = CCUserRepository.Users.Where(u => u.Email == userObj.Email).Count();

                if (userObj.ID == 0 && userExsist == 0)
                {
                    //new user
                    userObj.GUID = Guid.NewGuid().ToString();
                    userObj.Password = Membership.GeneratePassword(12, 1);

                    var notifObj = new Notification()
                    {
                        Subject = "Welcome to Corporate contacts !",
                        RecipientAddress = userObj.Email,
                        //RecipientAddress = "*****@*****.**",
                        // Message = "Hello, \n\n" + currentUserObj.FullName + " has invited you to join corporate contacts.\nClick the link below to join.\n\n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/signup/NewUser?guid=" + userObj.GUID + "\n\nCorporate Contacts Team"
                        //Message = "Hello, \n\n" + currentUserObj.FullName + " has invited you to join corporate contacts. \nClick the link below to join.\n\n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + userObj.GUID + "\n\n" +
                        //"/n/n/Corporate Contacts Team."

                       // Message = "Hello, \n\n" + currentUserObj.FullName + " has invited you to join corporate contacts. \nClick the link below to join.\n\n" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + userObj.GUID + "\n\n . Your credentials " +
                       //" for the system are as follows. /n/n Username : "******"/n/n/ Password : "******"/n/n/Corporate Contacts Team"

                        Message = "<html><head></head><body><div><center> <table border='0' cellpadding='0' cellspacing='0' height='100%' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> </tr><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td align='center' valign='top' width='600' style='padding-left:0;padding-right:0;padding-top:0;padding-bottom:0;border-top:1px solid #cccccc;border-right:1px solid #cccccc;border-left:1px solid #cccccc;background-color:#ffffff'><img src='http://corporate-contacts.com/wp-content/uploads/2014/03/CorporateContactslogo3a2.png' style='max-width: 450px;margin-top: 20px;' alt='Dyn'></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc;background-color:#ffffff'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color:#ffffff'> <tbody><tr> <td align='center' valign='top'><table border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='top' style='padding-top:20px;padding-right:30px;padding-left:30px'><table align='left' border='0' cellpadding='0' cellspacing='0'> <tbody><tr> <td valign='top' style='color:#444444;font-family:Helvetica;font-size:16px;line-height:125%;text-align:left;padding-bottom:20px'><p>Dear " + userObj.FullName + "</p><p> '" + accountObj.AccountName + "' has created an account for you in Corporate Contacts, a leading online contact and appointment management software.</p><p>Shown below are the credentials to the system. But first you need Click on the link below to join Corporate Contacts.<a href='" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + userObj.GUID + "'>Click Here</a></p><p><a style='text-decoration:underline;color:#0066cc' href='" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + userObj.GUID + "' target='_blank'>" + Request.Url.GetLeftPart(UriPartial.Authority) + "/VerifyUserAccount/VerifyEmailAddress?GUID=" + userObj.GUID + "</a></p><p><strong>Username :</strong> " + userObj.Email + "</p><p><strong>Password:</strong> " + userObj.Password + "</p><p>If you need help, you can find it here: <a href='http://support.corporate-contacts.com'>support.corporate-contacts.com</a></p><p>Regards,<br><a style='text-decoration:underline;color:#0066cc' href='http://corporate-contacts.com/' target='_blank'>The Corporate Contacts team</a></p></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr><tr> <td align='center' valign='top' style='border-left:1px solid #cccccc;border-right:1px solid #cccccc'><table border='0' cellpadding='0' cellspacing='0' width='100%' style='background-color: #209FD1;'> <tbody><tr> <td align='center' valign='bottom'><table border='0' cellpadding='0' cellspacing='0' width='600'> <tbody><tr> <td valign='bottom' width='600' style='padding-top:0px;padding-right:20px;padding-left:20px;padding-bottom:10px'><table align='left' border='0' cellpadding='0' cellspacing='0' width='100%'> <tbody><tr> <td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Corporate Contacts Ltd.<br>Beverley, UK, HU17 0LD<br>Manchester, NH 03101</td><td valign='bottom' style='color:#ffffff;padding-top:10px;font-family:Helvetica;font-size:12px;line-height:150%;text-align:left'>Phone: +44 1482 869700<br>E-Mail: [email protected]</td></tr></tbody></table> </td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></center></div></body></html>"

                    };
                    notifManager.SendNotification(notifObj);

                    userObj.Status = "Invite Sent";
                    if(userObj.isAdmin)
                        userObj.UserType = "Admin";
                    else
                        userObj.UserType = "Standard";
                    userObj.PrimaryUser = false;
                    userObj.CreatedDate = DateTime.Now;
                    userObj.LastModifiedDate = DateTime.Now;
                    userObj.Password = Encryption.EncryptStringAES(userObj.Password, rand);
                    userObj.isPasswordChange = false;
                    userObj.ConfirmPassword = userObj.Password;
                    var user = userRepository.SaveUser(userObj);
                    Session["NewUserInfo"] = "New User Added Successfully";
                    return RedirectToAction("AccountOptions");
                }
                else
                {
                    Session["NewUserInfo"] = "The Email address is already a User";
                    return RedirectToAction("NewUser");
                }
            }
            else
            {
                return View(userObj);
            }
        }