/// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="entity">用户信息</param>
 /// <returns></returns>
 public static int InsertUser(Users entity)
 {
     DataCommand cmd = DataCommandManager.GetDataCommand("InsertUser");
     cmd.SetParameterValue<Users>(entity);
     cmd.ExecuteNonQuery();
     return Convert.ToInt32(cmd.GetParameterValue("@SysNo"));
 }
 /// <summary>
 /// 更新用户状态
 /// </summary>
 /// <param name="entity">用户信息</param>
 public static void UpdateUserStatusBySysNo(Users entity)
 {
     DataCommand cmd = DataCommandManager.GetDataCommand("UpdateUserStatusBySysNo");
     cmd.SetParameterValue<Users>(entity);
     cmd.ExecuteNonQuery();
 }
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <returns></returns>
        public ActionResult DeleteUser()
        {
            var request = GetParams<List<string>>();

            if (request != null && request.Count > 0)
            {
                foreach (string str in request)
                {
                    Users entity = new Users()
                    {
                        SysNo = int.Parse(str),
                        Status = Entity.Enums.CommonStatus.Deleted
                    };
                    this.SetEntityBase(entity, false);
                    UsersMgtService.Instance.UpdateUserStatusBySysNo(entity);
                }
            }

            PortalResult result = new PortalResult()
            {
                Code = 0,
                Success = true,
                Data = true,
                Message = ""
            };
            return View(result);
        }
 /// <summary>
 /// 更新用户密码
 /// </summary>
 /// <param name="entity">用户信息</param>
 public static void UpdateUserPasswordByUserID(Users entity)
 {
     DataCommand cmd = DataCommandManager.GetDataCommand("UpdateUserPasswordByUserID");
     cmd.SetParameterValue<Users>(entity);
     cmd.ExecuteNonQuery();
 }
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <returns></returns>
        public ActionResult ModifyPassword()
        {
            var requestVM = GetParams<ModifyPasswordVM>();
            Users entity = new Users()
            {
                UserID = this.CurrUser.UserID,
                Password = requestVM.NewPassword
            };
            this.SetEntityBase(entity, false);
            UsersMgtService.Instance.UpdateUserPasswordBySysNo(entity, requestVM.OldPassword);

            PortalResult result = new PortalResult()
            {
                Code = 0,
                Success = true,
                Data = true,
                Message = ""
            };
            return View(result);
        }