Ejemplo n.º 1
0
        public static JSONReturnData AddModifyUser(string LoginUserID, string UserName, string LoginID, string RoleID, string Password, bool isPasswordRegenerated, bool isdeleted,
                                                   string EmpoyeeID, string BranchIDs)
        {
            JSONReturnData Objuser = new JSONReturnData();
            LoginUser      currentUser;

            try
            {
                if (!GetUserSession(out currentUser))
                {
                    Objuser.errorCode    = 1001;
                    Objuser.errorMessage = "";
                    return(Objuser);
                }
                byte[] EncryptedCurrentpassword = new System.Text.ASCIIEncoding().GetBytes(Cryptography.Encrypt(Password));

                AdminManagerSP adminObj = new AdminManagerSP();

                if (adminObj._U_AddModifyUser(currentUser.CompanyID, currentUser.UserId, string.IsNullOrEmpty(LoginUserID) ? 0 : Convert.ToInt32(LoginUserID),
                                              UserName, LoginID, string.IsNullOrEmpty(RoleID) ? 0 : Convert.ToInt32(RoleID), EncryptedCurrentpassword, isPasswordRegenerated, isdeleted, string.IsNullOrEmpty(EmpoyeeID) ? 0 : Convert.ToInt32(EmpoyeeID), BranchIDs))


                {
                    Objuser.errorCode    = 0;
                    Objuser.errorMessage = "";
                }
                else
                {
                    Objuser.errorCode    = 1;
                    Objuser.errorMessage = "Failed to save user. please try again later";
                }
            }
            catch (Exception ex)
            {
                Utils.Write(ex);
            }

            return(Objuser);
        }