Exemple #1
0
        public static bool Registration(string strFName, string strLName, string strEmail)
        {
            bool   IsRegistered = false;
            string strTempPass  = string.Empty;
            string HashPassword = string.Empty;
            string HashSalt     = string.Empty;
            string strReturn    = string.Empty;

            try
            {
                strTempPass  = DateTime.Now.Millisecond.ToString() + DateTime.Now.Minute.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Second.ToString() + DateTime.Now.Day.ToString();
                HashPassword = SecurityObj.SecurityObj.ComputeHash(strTempPass, "SHA1", null);
                HashSalt     = SecurityObj.SecurityObj.GetSalt("SHA1", HashPassword);

                clsUser objUser = new clsUser();
                objUser.FName            = GlobalMethods.stringToMixedCase(strFName);
                objUser.LName            = GlobalMethods.stringToMixedCase(strLName);
                objUser.Password         = HashPassword;
                objUser.TempPassword     = strTempPass;
                objUser.salt             = HashSalt;
                objUser.EmailId          = strEmail;
                objUser.IsCurrent        = 1;
                objUser.IndividualUserID = 0;
                objUser.CreatedDate      = DateTime.Now;
                objUser.CreatedBy        = GlobalMethods.stringToMixedCase(strFName) + " " + GlobalMethods.stringToMixedCase(strLName);
                objUser.UpdatedDate      = Convert.ToDateTime("1/1/1900");
                objUser.UpdatedBy        = "";
                objUser.Notes            = "";
                objUser.ImageURL         = "";
                objUser.IsAdmin          = 0;
                objUser.IsActive         = -2;
                if (UserDAL.InsertUser(objUser))
                {
                    IsRegistered = true;

                    #region Now sending email with the Temp Password.

                    //System.Text.StringBuilder strbEmailMSG = new StringBuilder();
                    //strbEmailMSG.Append(objUser.FName + " " + objUser.LName + "," + System.Environment.NewLine + System.Environment.NewLine);
                    //strbEmailMSG.Append("LRCA System generated a TEMPORARY PASSWORD For your account." + System.Environment.NewLine + " To access your account enter the following information:" + System.Environment.NewLine + "Username : "******"Temporary Password : "******"To access LRCA application please visit " + AppConstants.ConstAppURL + "." + System.Environment.NewLine);
                    //strbEmailMSG.Append(System.Environment.NewLine + System.Environment.NewLine);
                    //strbEmailMSG.Append("If you require any further information, feel free to contact " + AppConstants.ConstHelpPhone + System.Environment.NewLine + " or Email us @" + AppConstants.ConstHelpEmail + System.Environment.NewLine + System.Environment.NewLine);

                    //GlobalMethods.SendEmail(objUser.EmailId, "", strbEmailMSG, "LRCA - New Account Registration");
                    Mailing.SendWelcomeMail(objUser, objUser.EmailId, strTempPass);
                    #endregion
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.ErrorLogging(ex, false);
                ErrorHandler.ReadError();
            }

            return(IsRegistered);
        }