private bool CheckInput() { if (_user.ID <= 0) { return(Common.Common_Func.ErrorMessage("用户信息获取不正确", "保存失败")); } if (string.IsNullOrEmpty(_user.UserNo)) { return(Common.Common_Func.ErrorMessage("用户编号不能为空", "保存失败")); } if (string.IsNullOrEmpty(_user.UserName)) { return(Common.Common_Func.ErrorMessage("用户名称不能为空", "保存失败")); } if (string.IsNullOrEmpty(_user.Password)) { return(Common.Common_Func.ErrorMessage("密码不能为空", "保存失败")); } if (!_user.Password.Equals(_user.RePassword)) { return(Common.Common_Func.ErrorMessage("确认密码与新用户密码不一致", "保存失败")); } if (_user.Password.Equals(Basic_Func.JiaMi(Common.Common_Var.DefaultPwd))) { return(Common.Common_Func.ErrorMessage("不能修改为默认密码", "保存失败")); } return(true); }
private HouseInfo GetBelongHouse(int HouseID) { HouseInfo house = new HouseInfo(); if (HouseID <= 0) { Common.Common_Func.ErrorMessage("获取库区信息失败", "错误"); return(null); } else { string strError = string.Empty; house = new HouseInfo() { ID = HouseID }; if (!Basic_Func.GetHouseByID(ref house, ref strError)) { Common.Common_Func.ErrorMessage(strError, "错误"); return(null); } } return(house); }
private void GetListQueryData() { try { this.Cursor = Cursors.WaitCursor; bsMain.EndEdit(); bool bResult = false; string strErr = string.Empty; GetQueryMain(); if (queryMain.StartTime != null && queryMain.EndTime != null) { if (queryMain.StartTime.ToDateTime().Date > queryMain.EndTime.ToDateTime().Date) { Common.Common_Func.ErrorMessage("开始日期不能大于结束日期", "查询失败"); return; } } ChensControl.DividPage clientPage = pageList.dDividPage; Common.Common_Func.GetServerPageFromClientPage(ref _serverMainPage, clientPage); bResult = Basic_Func.GetAreaListByPage(ref lstMain, queryMain, ref _serverMainPage, ref strErr); Common.Common_Func.GetClientPageFromServerPage(_serverMainPage, ref clientPage); pageList.ShowPage(); dgvList.DataSource = lstMain; if (!bResult || !string.IsNullOrEmpty(strErr)) { Common.Common_Func.ErrorMessage(strErr, "查询失败"); } if (dgvList.DataSource == null || dgvList.Rows.Count <= 0) { } else { dgvList.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2; } } catch (Exception ex) { Common.Common_Func.ErrorMessage(ex.Message, "查询失败"); } finally { this.Cursor = Cursors.Default; cbxSelectAll.Checked = false; txtAreaNo.Focus(); } }
private bool SaveData() { bsMain.EndEdit(); if (_user.Password != _back.Password) { _user.Password = Basic_Func.JiaMi(_user.Password); _user.RePassword = Basic_Func.JiaMi(_user.RePassword); } else { Common.Common_Func.ErrorMessage("密码未做任何修改!", "保存失败"); return(false); } if (!CheckInput()) { return(false); } string strErr = string.Empty; if (Login_Func.ChangeUserPassword(_user, ref strErr)) { if (_user.ID == Common.Common_Var.CurrentUser.ID) { Common.Common_Func.ErrorMessage("密码修改成功,请重新登陆!", "保存成功"); Application.Exit(); } else { Common.Common_Func.ErrorMessage("数据保存成功!", "保存成功"); InitForm(); } return(true); } else { Common.Common_Func.ErrorMessage(strErr, "保存失败"); return(false); } }
private AreaInfo GetListRowModel() { if (!Common.Common_Func.CheckDgvOper(dgvList)) { Common.Common_Func.ErrorMessage("请先选中一行", "删除失败"); return(null); } string strErr = string.Empty; AreaInfo warehouse = new AreaInfo(); warehouse.ID = lstMain[dgvList.CurrentCell.RowIndex].ID; if (!Basic_Func.GetAreaByID(ref warehouse, ref strErr)) { Common.Common_Func.ErrorMessage(strErr, "读取失败"); GetListQueryData(); return(null); } return(warehouse); }