예제 #1
0
        private bool SaveData()
        {
            bsUser.EndEdit();

            _user.PinYin = PinYinConvert.Get(_user.UserName);
            //if (_user.Password == _back.Password)
            if (_user.ID == 0 || _user.Password != _back.Password)
            {
                _user.Password   = Basic_Func.JiaMi(_user.Password);
                _user.RePassword = Basic_Func.JiaMi(_user.RePassword);
            }
            _user.IsReceive     = _user.BIsReceive.ToInt32();
            _user.IsQuality     = _user.BIsQuality.ToInt32();
            _user.IsPick        = _user.BIsPick.ToInt32();
            _user.GroupCode     = GetGroupCode();
            _user.WarehouseCode = GetWarehouseCode();

            if (!CheckInput())
            {
                return(false);
            }

            string strErr = string.Empty;

            if (Basic_Func.SaveUser(ref _user, ref strErr))
            {
                Common.Common_Func.ErrorMessage("数据保存成功!", "保存成功");
                bsUser.DataSource = _user;
                InitForm();
                _back = Common.Common_Func.ConvertToModel <UserInfo>(_user);
                return(true);
            }
            else
            {
                Common.Common_Func.ErrorMessage(strErr, "保存失败");
                bsUser.DataSource = _user;
                return(false);
            }
        }