Beispiel #1
0
        public string AddUsers(string firstname, string lastname, string emailID, string contact, bool Active, string Groups)
        {
            object result    = null;
            string strReturn = string.Empty;

            try
            {
                eUsers eObj = new eUsers();
                eObj.sUserName = emailID;
                byte[] b        = new byte[1];
                string Password = emailID.Substring(0, emailID.IndexOf("@")).ToLower();
                Password = SimpleHash.ComputeHash(Password, "SHA1", b);

                eObj.sPassword    = Password;
                eObj.sFirstName   = firstname;
                eObj.sLastName    = lastname;
                eObj.sEmail       = emailID;
                eObj.sContact     = contact;
                eObj.dtCreatedOn  = DateTime.Now;
                eObj.dtActionDate = DateTime.Now;
                eObj.cStatus      = Active ? "A" : "D";
                eObj.iActionBy    = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId;

                int i = BL_Users.AddRecord(eObj, Groups.Substring(0, Groups.Length - 1));
                if (i == 1)
                {
                    result = new { st = 1, msg = clsUtils.ErrorMsg("User", 1) };
                }
                else
                {
                    result = new { st = 0, msg = clsUtils.ErrorMsg("User", 0) };
                }
            }
            catch (Exception ex)
            {
                result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) };
            }
            strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result);
            return(strReturn);
        }