Exemplo n.º 1
0
        public ActionResult SignUpUser(RegisterModel objRegModel, string captcha)
        {
            #region Code for Registration
            MemberAction objMember = new MemberAction();
            bool isUserExist = objMember.FindByUserName(objRegModel.UserName.Trim());

            if (isUserExist)
            {
                ModelState.AddModelError("", "User Already exist. Please change Username.");
            }
            else
            {
                bool isRegistered = objMember.Signup(objRegModel);
                if (isRegistered == true)
                {
                    #region Send Mail if Registration Successful
                    //send automated email - content of email will be decided later
                    // Creating array list for token
                    ArrayList arrTokens = new ArrayList();
                    arrTokens.Add(objRegModel.FirstName + " " + objRegModel.LastName);
                    arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Dashboard");
                    arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Seed/DiscoverSeed");
                    arrTokens.Add("http://" + Request.ServerVariables["SERVER_NAME"] + "/Member/Profile");

                    // Filling mail object
                    SendMail objSendMail = new SendMail();
                    objSendMail.ToEmailId = objRegModel.UserName;
                    objSendMail.Subject = "email.member.signup.subject.content";
                    objSendMail.MsgBody = "email.member.signup.body.content";
                    objSendMail.ChangesInMessage = arrTokens;

                    objSendMail.SendEmail(objSendMail);//    SendMail.(member.username, SystemStatements.DEFAUL_EMAIL_ADDRESS, SystemStatements.EMAIL_SUBJECT_SIGNUP, "");
                    #endregion

                    return RedirectToAction("SignUpThanks", "Member");
                }
                else
                {
                    ModelState.AddModelError("", "Error occured while registration.");
                }
            }
            return View("Default");
            #endregion
        }