/// <summary> /// SetMainInfo /// </summary> /// <param name="vo"></param> void SetMainInfo(EntityCodeDepartment vo) { if (vo == null) { Viewer.txtDeptCode.Tag = null; Viewer.txtDeptCode.Text = string.Empty; Viewer.txtDeptName.Text = string.Empty; Viewer.lueParent.Properties.DBValue = null; Viewer.lueParent.Text = string.Empty; Viewer.cboType.SelectedIndex = -1; Viewer.cboType.Text = string.Empty; Viewer.cboLevel.SelectedIndex = -1; Viewer.cboLevel.Text = string.Empty; Viewer.cboLeaf.SelectedIndex = 1; Viewer.cboIsBk.Text = string.Empty; Viewer.cboIsBk.SelectedIndex = 0; Viewer.txtXh.Text = string.Empty; InitRoom(); InitExpert(); } else { Viewer.txtDeptCode.Tag = vo; Viewer.txtDeptCode.Text = vo.deptCode; Viewer.txtDeptName.Text = vo.deptName; Viewer.txtXh.Text = vo.xh.ToString(); Viewer.lueParent.Properties.DBValue = vo.parent; SetLueParent(vo.parent); if (Function.Int(vo.type) > 0) { Viewer.cboType.SelectedIndex = Function.Int(vo.type) - 1; } else { Viewer.cboType.SelectedIndex = -1; Viewer.cboType.Text = string.Empty; } if (Function.Int(vo.grade) > 0) { Viewer.cboLevel.SelectedIndex = Function.Int(vo.grade) - 1; } else { Viewer.cboLevel.SelectedIndex = -1; Viewer.cboLevel.Text = string.Empty; } Viewer.cboLeaf.SelectedIndex = (!string.IsNullOrEmpty(vo.leafFlag) && vo.leafFlag.ToUpper() == "T") ? 1 : 0; Viewer.cboIsBk.SelectedIndex = Function.Int(vo.isBk); #region room、expert using (ProxyDictionary proxy = new ProxyDictionary()) { this.gvDataBindingSourceRoom.DataSource = proxy.Service.LoadDeptRoom(vo.deptCode); this.gvDataBindingSourceExpert.DataSource = proxy.Service.LoadDeptExpert(vo.deptCode); } #endregion } Viewer.ValueChanged = false; }
/// <summary> /// GetPatInfo /// </summary> /// <param name="key"></param> /// <param name="value"></param> /// <returns></returns> List <EntityPatientInfo> GetPatInfo(string key, string value) { using (ProxyDictionary proxy = new ProxyDictionary()) { return(proxy.Service.GetPatInfo(key, value)); } }
/// <summary> /// DelOperRole /// </summary> internal void DelOperRole() { if (Viewer.gvRole.FocusedRowHandle < 0) { return; } if (DialogBox.Msg("是否删除?", MessageBoxIcon.Question) == DialogResult.Yes) { EntityDefOperatorRole vo = DataSourceOperRole[Viewer.gvRole.FocusedRowHandle]; if (vo != null) { using (ProxyDictionary proxy = new ProxyDictionary()) { if (proxy.Service.DelOperatorRole(vo) > 0) { LoadOperRole(vo.operCode); DialogBox.Msg("删除成功!"); } else { DialogBox.Msg("删除失败。"); } } } } }
/// <summary> /// LoadPlus /// </summary> /// <param name="rowHandle"></param> internal void LoadPlus(int rowHandle) { if (IsLoading) { return; } IsLoading = true; try { string operCode = GetFieldValueStr(Viewer.gvEmployee, rowHandle, EntityOperatorDisp.Columns.operCode); if (string.IsNullOrEmpty(operCode)) { return; } EntityCodeOperator mainVo = null; EntityPlusOperator plusVo = null; using (ProxyDictionary proxy = new ProxyDictionary()) { proxy.Service.LoadCodeOperatorAndPlus(operCode, out mainVo, out plusVo); } LoadOperDept(operCode, plusVo.deptCode); LoadOperRole(operCode); SetMainInfo(mainVo, plusVo); } finally { IsLoading = false; } }
/// <summary> /// Del /// </summary> internal void Del() { EntityCodeDepartment vo = Viewer.txtDeptCode.Tag as EntityCodeDepartment; if (vo == null || string.IsNullOrEmpty(vo.deptCode)) { return; } if (DialogBox.Msg("是否删除当前科室?", MessageBoxIcon.Question) == DialogResult.Yes) { ProxyDictionary proxy = new ProxyDictionary(); int ret = proxy.Service.DelDepartment(vo.deptCode); proxy = null; if (ret > 0) { // 刷新树 SetMainInfo(null); Refresh(); Viewer.ValueChanged = false; DialogBox.Msg("删除成功!"); } else { DialogBox.Msg("删除失败。"); } } }
/// <summary> /// NewOperRole /// </summary> internal void NewOperRole() { EntityCodeOperator vo = GetOperOrig(); if (vo == null) { DialogBox.Msg("请先保存职工主信息。"); return; } frmNew frm = new frmNew(EntityTools.ConvertToDataTable <EntityCodeRole>(DataSourceRole), "roleCode", "roleCode", "roleName"); if (frm.ShowDialog() == DialogResult.OK) { if (frm.lstNo.Count > 0) { foreach (int index in frm.lstNo) { EntityDefOperatorRole vo1 = new EntityDefOperatorRole(); vo1.operCode = vo.operCode; vo1.roleCode = DataSourceRole[index].roleCode; using (ProxyDictionary proxy = new ProxyDictionary()) { if (proxy.Service.SaveOperatorRole(vo1) < 0) { DialogBox.Msg("保存职工所属角色失败。"); return; } } } LoadOperRole(vo.operCode); } } }
/// <summary> /// LoadRoleOper /// </summary> /// <param name="rowHandle"></param> internal void LoadRoleOper(int rowHandle) { if (rowHandle < 0) { return; } Viewer.gvRole.Columns[EntityCodeRole.Columns.roleCode].OptionsColumn.AllowEdit = true; Viewer.gvRole.Columns[EntityCodeRole.Columns.roleCode].OptionsColumn.AllowFocus = true; string roleCode = GetFieldValueStr(Viewer.gvRole, rowHandle, "roleCode"); if (string.IsNullOrEmpty(roleCode)) { return; } using (ProxyDictionary proxy = new ProxyDictionary()) { Viewer.gcEmployee.DataSource = proxy.Service.LoadRoleOper(roleCode); } if (Function.Int(Viewer.gvRole.GetRowCellValue(rowHandle, EntityCodeRole.Columns.isEdit)) > 0) { Viewer.gvRole.Columns[EntityCodeRole.Columns.roleCode].OptionsColumn.AllowEdit = false; Viewer.gvRole.Columns[EntityCodeRole.Columns.roleCode].OptionsColumn.AllowFocus = false; } InitRoleFunc(roleCode); }
/// <summary> /// Delete /// </summary> internal void Delete() { EntityPatientInfo patOrig = Viewer.txtCardNo.Tag as EntityPatientInfo; if (patOrig == null || string.IsNullOrEmpty(patOrig.pid)) { Clear(); return; } if (DialogBox.Msg("确定是否删除?", MessageBoxIcon.Question) == DialogResult.Yes) { ProxyDictionary proxy = new ProxyDictionary(); int ret = proxy.Service.DelPatInfo(patOrig.pid); proxy = null; if (ret > 0) { Clear(); Viewer.ValueChanged = false; DialogBox.Msg("删除患者信息成功!"); } else { DialogBox.Msg("删除患者信息失败。"); } } }
/// <summary> /// LoadOperDept /// </summary> /// <param name="operCode"></param> /// <param name="deptCode"></param> void LoadOperDept(string operCode, string deptCode) { using (ProxyDictionary proxy = new ProxyDictionary()) { DataSourceOperDept = proxy.Service.LoadOperatorDept(operCode); } if (DataSourceOperDept != null && DataSourceOperDept.Count > 0) { foreach (EntityDefDeptemployee item in DataSourceOperDept) { if (GlobalDic.DataSourceDepartment.Any(t => t.deptCode.Trim() == item.deptCode.Trim())) { item.deptName = GlobalDic.DataSourceDepartment.FirstOrDefault(t => t.deptCode.Trim() == item.deptCode.Trim()).deptName; } } } else { if (!string.IsNullOrEmpty(deptCode)) { DataSourceOperDept = new List <EntityDefDeptemployee>(); EntityDefDeptemployee vo1 = new EntityDefDeptemployee(); vo1.deptCode = deptCode; if (GlobalDic.DataSourceDepartment.Any(t => t.deptCode == deptCode)) { vo1.deptName = GlobalDic.DataSourceDepartment.FirstOrDefault(t => t.deptCode == deptCode).deptName; } DataSourceOperDept.Add(vo1); } } Viewer.gcDept.DataSource = DataSourceOperDept; }
/// <summary> /// LoadDataSource /// </summary> void LoadDataSource() { using (ProxyDictionary proxy = new ProxyDictionary()) { this.isInit = true; DataSourceDept = proxy.Service.LoadDeptInfo(); Viewer.tvDept.BeginUpdate(); Viewer.tvDept.DataSource = DataSourceDept; Viewer.tvDept.ExpandAll(); Viewer.tvDept.EndUpdate(); if (DataSourceDept == null) { Viewer.lueParent.Properties.DataSource = null; } else { EntityCodeDepartment[] data = new EntityCodeDepartment[DataSourceDept.Count + 1]; for (int i = 0; i < DataSourceDept.Count; i++) { data[i] = DataSourceDept[i]; } EntityCodeDepartment vo = new EntityCodeDepartment(); vo.deptCode = "&"; vo.deptName = "全院"; data[data.Length - 1] = vo; Viewer.lueParent.Properties.DataSource = data; } Viewer.lueParent.Properties.SetSize(); this.isInit = false; } }
/// <summary> /// Del /// </summary> internal void Del() { EntityCodeOperator vo = GetOperOrig(); if (vo == null) { DialogBox.Msg("请先选择需要删除的职工。"); return; } if (vo.operCode == "00") { DialogBox.Msg("系统管理员默认账号不能删除。"); return; } if (DialogBox.Msg("是否删除当前职工记录?", MessageBoxIcon.Question) == DialogResult.Yes) { using (ProxyDictionary proxy = new ProxyDictionary()) { if (proxy.Service.DelOperator(vo.operCode) > 0) { Viewer.ValueChanged = false; New(); LoadList(); DialogBox.Msg("删除成功!"); } else { DialogBox.Msg("删除失败。"); } } } }
/// <summary> /// LoadList /// </summary> void LoadList() { using (ProxyDictionary proxy = new ProxyDictionary()) { DataSourceEmpList = proxy.Service.LoadEmpInfo(); DataSourceEmpList.Sort(); Viewer.gcEmployee.DataSource = DataSourceEmpList; } }
/// <summary> /// ImportData /// </summary> /// <param name="isExt"></param> internal void AsyncImport() { if (isImport) { return; } isImport = true; int ret = 0; string info = string.Empty; bool success = false; try { using (ProxyDictionary proxy = new ProxyDictionary()) { foreach (int typeId in lstType) { switch (typeId) { case 1: info = "科室字典"; ret = proxy.Service.ImportDeptInfo(); break; case 2: info = "员工字典"; ret = proxy.Service.ImportEmpInfo(); break; default: break; } if (ret < 0) { Viewer.marqueeProgressBarControlLoad.Text = "导入" + info + "失败。"; Viewer.marqueeProgressBarControlLoad.Properties.Stopped = true; return; } } success = true; } } catch (System.Exception ex) { Viewer.marqueeProgressBarControlLoad.Text = ex.Message; } finally { isImport = false; if (success) { Viewer.marqueeProgressBarControlLoad.Text = "数据成功导入!!"; } Viewer.btnImport.Visible = true; } }
/// <summary> /// InitRoleFunc /// </summary> /// <param name="roleCode"></param> internal void InitRoleFunc(string roleCode) { List <EntityRoleFunction> data = null; using (ProxyDictionary proxy = new ProxyDictionary()) { data = proxy.Service.LoadRoleFunc(roleCode); } SetCheckState(Viewer.tvFunction.Nodes, data); }
/// <summary> /// LoadDataSourceDept /// </summary> void LoadDataSourceDept() { using (ProxyDictionary proxy = new ProxyDictionary()) { this.isInit = true; DataSourceDept = proxy.Service.LoadDeptInfo(); Viewer.tvDept.BeginUpdate(); Viewer.tvDept.DataSource = DataSourceDept; Viewer.tvDept.ExpandAll(); Viewer.tvDept.EndUpdate(); this.isInit = false; } }
/// <summary> /// LoadOperRole /// </summary> /// <param name="operCode"></param> void LoadOperRole(string operCode) { using (ProxyDictionary proxy = new ProxyDictionary()) { DataSourceOperRole = proxy.Service.LoadOperatorRole(operCode); } foreach (EntityDefOperatorRole item in DataSourceOperRole) { if (DataSourceRole.Any(t => t.roleCode == item.roleCode)) { item.roleName = DataSourceRole.FirstOrDefault(t => t.roleCode == item.roleCode).roleName; } } Viewer.gcRole.DataSource = DataSourceOperRole; }
/// <summary> /// 设默认科室 /// </summary> internal void SetDefaultDept() { EntityCodeOperator vo = GetOperOrig(); if (vo == null) { DialogBox.Msg("请先保存职工主信息。"); return; } if (Viewer.gvDept.RowCount <= 0 || Viewer.gvDept.FocusedRowHandle < 0) { return; } int rowHandle = Viewer.gvDept.FocusedRowHandle; EntityDefDeptemployee defVo = new EntityDefDeptemployee(); defVo.operCode = vo.operCode; defVo.deptCode = GetFieldValueStr(Viewer.gvDept, rowHandle, EntityDefDeptemployee.Columns.deptCode); defVo.defaultFlag = 1; using (ProxyDictionary proxy = new ProxyDictionary()) { if (proxy.Service.UpdateOperatorDeptDefault(defVo) < 0) { DialogBox.Msg("设置职工默认科室失败。"); return; } else { List <EntityDefDeptemployee> data = Viewer.gcDept.DataSource as List <EntityDefDeptemployee>; for (int i = 0; i < data.Count; i++) { if (i == rowHandle) { data[i].defaultFlag = 1; } else { data[i].defaultFlag = 0; } } Viewer.gvDept.RefreshData(); Viewer.gvDept.Invalidate(); DialogBox.Msg("设置职工默认科室成功!"); } } }
/// <summary> /// NewOperDept /// </summary> internal void NewOperDept() { EntityCodeOperator vo = GetOperOrig(); if (vo == null) { DialogBox.Msg("请先保存职工主信息。"); return; } frmNew frm = new frmNew(EntityTools.ConvertToDataTable <EntityCodeDepartment>(GlobalDic.DataSourceDepartment), "deptCode", "deptCode", "deptName"); if (frm.ShowDialog() == DialogResult.OK) { if (frm.lstNo.Count > 0) { bool isDefault = false; foreach (int index in frm.lstNo) { EntityDefDeptemployee vo1 = new EntityDefDeptemployee(); vo1.operCode = vo.operCode; vo1.deptCode = GlobalDic.DataSourceDepartment[index].deptCode; if (Viewer.gvDept.RowCount == 0 && isDefault == false) { vo1.defaultFlag = 1; isDefault = true; } else { vo1.defaultFlag = 0; } using (ProxyDictionary proxy = new ProxyDictionary()) { if (proxy.Service.SaveOperatorDept(vo1) < 0) { DialogBox.Msg("保存职工所属科室失败。"); return; } } } LoadOperDept(vo.operCode, string.Empty); } } }
/// <summary> /// Del /// </summary> internal void Del() { Viewer.gvRole.CloseEditor(); if (Function.Int(GetFieldValueStr(Viewer.gvRole, Viewer.gvRole.FocusedRowHandle, EntityCodeRole.Columns.isEdit)) > 0) { string roleCode = GetFieldValueStr(Viewer.gvRole, Viewer.gvRole.FocusedRowHandle, EntityCodeRole.Columns.roleCode); if (string.IsNullOrEmpty(roleCode)) { DialogBox.Msg("角色编码为空,不能删除,请重新选择。"); return; } if (roleCode == "00") { DialogBox.Msg("系统管理员角色不能删除,请重新选择。"); return; } if (DialogBox.Msg("确定是否删除?", MessageBoxIcon.Question) == DialogResult.Yes) { ProxyDictionary proxy = new ProxyDictionary(); int ret = proxy.Service.DelRole(roleCode); proxy = null; if (ret > 0) { Refresh(); DialogBox.Msg("删除角色成功!"); } else { DialogBox.Msg("删除角色失败。"); } } } else { DialogBox.Msg("未保存的角色,请直接用删除按钮进行删除。"); } }
/// <summary> /// CheckNode /// </summary> /// <param name="node"></param> internal void CheckNode(TreeListNode node) { EntityFunction vo = Viewer.tvFunction.GetDataRecordByNode(node) as EntityFunction; vo.imageIndex = (node.CheckState == CheckState.Checked ? 1 : 0); if (Viewer.gvRole.FocusedRowHandle >= 0) { if (Function.Int(GetFieldValueStr(Viewer.gvRole, Viewer.gvRole.FocusedRowHandle, EntityCodeRole.Columns.isEdit)) > 0) { EntityRoleFunction voFunc = new weCare.Core.Entity.EntityRoleFunction(); voFunc.Rolecode = GetFieldValueStr(Viewer.gvRole, Viewer.gvRole.FocusedRowHandle, EntityCodeRole.Columns.roleCode); voFunc.Funcid = vo.Funcid; using (ProxyDictionary proxy = new ProxyDictionary()) { int ret = proxy.Service.SaveRoleFunc(voFunc, vo.imageIndex); if (ret < 0) { DialogBox.Msg("权限分配失败。"); } } } } Viewer.tvFunction.RefreshNode(node); }
/// <summary> /// Save /// </summary> /// <param name="isExit">是否窗体退出时</param> internal void Save(bool isExit) { // 1.main EntityCodeDepartment mainVo = new EntityCodeDepartment(); mainVo.deptCode = Viewer.txtDeptCode.Text.Trim(); mainVo.deptName = Viewer.txtDeptName.Text.Trim(); mainVo.parent = Viewer.lueParent.Properties.DBValue; mainVo.type = Convert.ToString(Viewer.cboType.SelectedIndex + 1); mainVo.grade = Viewer.cboLevel.SelectedIndex + 1; mainVo.leafFlag = Viewer.cboLeaf.Text == "是" ? "T" : "F"; mainVo.isBk = Viewer.cboIsBk.SelectedIndex; mainVo.xh = Function.Int(Viewer.txtXh.Text); #region 校验 if (string.IsNullOrEmpty(mainVo.deptCode)) { DialogBox.Msg("请输入科室编码。"); Viewer.txtDeptCode.Focus(); return; } if (string.IsNullOrEmpty(mainVo.deptName)) { DialogBox.Msg("请输入科室名称"); Viewer.txtDeptName.Focus(); return; } if (string.IsNullOrEmpty(mainVo.parent)) { DialogBox.Msg("请选择父级科室"); Viewer.lueParent.Focus(); return; } if (string.IsNullOrEmpty(Viewer.cboType.Text)) { DialogBox.Msg("请选择科室类型"); Viewer.cboType.Focus(); return; } if (string.IsNullOrEmpty(Viewer.cboLevel.Text)) { DialogBox.Msg("请选择科室级别"); Viewer.cboLevel.Focus(); return; } if (string.IsNullOrEmpty(Viewer.cboLeaf.Text)) { DialogBox.Msg("请指定是否为末级科室"); Viewer.cboLeaf.Focus(); return; } #endregion EntityCodeDepartment deptOrig = null; if (Viewer.txtDeptCode.Tag != null) { deptOrig = Viewer.txtDeptCode.Tag as EntityCodeDepartment; } List <string> lstKey = new List <string>(); // 2.room Viewer.gvRoom.CloseEditor(); List <EntityDicDeptRoom> lstDeptRoom = this.gvDataBindingSourceRoom.DataSource as List <EntityDicDeptRoom>; for (int i = lstDeptRoom.Count - 1; i >= 0; i--) { if (!string.IsNullOrEmpty(lstDeptRoom[i].roomCode) && !string.IsNullOrEmpty(lstDeptRoom[i].roomName)) { lstDeptRoom[i].deptCode = mainVo.deptCode; lstDeptRoom[i].status = 1; if (lstKey.IndexOf(lstDeptRoom[i].roomCode) >= 0) { DialogBox.Msg("诊室编号不能重复,请检查。"); Viewer.gcRoom.Focus(); return; } else { lstKey.Add(lstDeptRoom[i].roomCode); } } else { lstDeptRoom.RemoveAt(i); } } // 3.expert lstKey.Clear(); Viewer.gvExpert.CloseEditor(); List <EntityDicDeptReg> lstDeptExpert = this.gvDataBindingSourceExpert.DataSource as List <EntityDicDeptReg>; if (lstDeptExpert != null) { for (int i = lstDeptExpert.Count - 1; i >= 0; i--) { if (!string.IsNullOrEmpty(lstDeptExpert[i].regCode) && !string.IsNullOrEmpty(lstDeptExpert[i].regName)) { lstDeptExpert[i].deptCode = mainVo.deptCode; lstDeptExpert[i].status = 1; if (lstKey.IndexOf(lstDeptExpert[i].regCode) >= 0) { DialogBox.Msg("专科号编号不能重复,请检查。"); Viewer.gcExpert.Focus(); return; } else { lstKey.Add(lstDeptExpert[i].regCode); } } else { lstDeptExpert.RemoveAt(i); } } } ProxyDictionary proxy = new ProxyDictionary(); int ret = proxy.Service.SaveDepartment(mainVo, deptOrig, lstDeptRoom, lstDeptExpert); proxy = null; if (ret > 0) { Viewer.ValueChanged = false; // 刷新树 if (!isExit) { Viewer.txtDeptCode.Tag = mainVo; Refresh(); } DialogBox.Msg("保存成功!"); } else { DialogBox.Msg("保存失败。"); } }
/// <summary> /// Save /// </summary> internal void Save(bool isExit) { #region get EntityPatientInfo pat = new EntityPatientInfo(); pat.cardNo = Viewer.txtCardNo.Text.Trim(); pat.name = Viewer.txtPatName.Text.Trim(); pat.sex = Viewer.cboSex.SelectedIndex.ToString(); pat.feeCode = Viewer.lueFee.Properties.DBValue; pat.ID = Viewer.txtIdNo.Text.Trim(); pat.birth = Viewer.dteBirth.Text; pat.marry = Viewer.lueMarry.Properties.DBValue; pat.addr = Viewer.txtHomeAddr.Text.Trim(); pat.corp = Viewer.txtWorkAddr.Text.Trim(); pat.contact = Viewer.txtContactPerson.Text.Trim(); pat.cTel = Viewer.txtContactPersonTel.Text.Trim(); pat.relation = Viewer.cboContackRel.Text.Trim(); pat.lockFlag = (Viewer.cboStatus.SelectedIndex == 1 ? "F" : "T"); pat.country = Viewer.lueCitizenship.Properties.DBValue; pat.nation = Viewer.lueNation.Properties.DBValue; pat.job = Viewer.lueOccupation.Properties.DBValue; pat.birthArea = Viewer.txtBirthplace.Text.Trim(); pat.email = Viewer.txtEmail.Text.Trim(); pat.contAddr = Viewer.txtContactPersonAddr.Text.Trim(); pat.contTel = Viewer.txtContactPersonTel.Text.Trim(); #endregion #region check if (string.IsNullOrEmpty(pat.cardNo)) { DialogBox.Msg("请输入诊疗卡号。"); Viewer.txtCardNo.Focus(); return; } if (string.IsNullOrEmpty(pat.name)) { DialogBox.Msg("请输入姓名。"); Viewer.txtPatName.Focus(); return; } if (string.IsNullOrEmpty(Viewer.cboSex.Text)) { DialogBox.Msg("请选择性别。"); Viewer.cboSex.Focus(); return; } if (string.IsNullOrEmpty(pat.feeCode)) { DialogBox.Msg("请选择费别。"); Viewer.lueFee.Focus(); return; } if (string.IsNullOrEmpty(pat.ID)) { DialogBox.Msg("请输入身份证号。"); Viewer.txtIdNo.Focus(); return; } if (string.IsNullOrEmpty(pat.birth)) { DialogBox.Msg("请输入出生日期。"); Viewer.dteBirth.Focus(); return; } #endregion #region default DateTime dtmNow = Utils.ServerTime(); if (Viewer.txtCardNo.Tag != null) { EntityPatientInfo tmp = Viewer.txtCardNo.Tag as EntityPatientInfo; pat.pid = tmp.pid; pat.regDate = tmp.regDate; pat.regTime = tmp.regTime; pat.regOper = tmp.regOper; } else { pat.regDate = dtmNow.ToString("yyyy.MM.dd"); pat.regTime = dtmNow.ToString("yyyy.MM.dd HH:mm:dd"); pat.regOper = GlobalLogin.objLogin.EmpNo; } pat.modiDate = dtmNow; #endregion int ret = 0; using (ProxyDictionary proxy = new ProxyDictionary()) { ret = proxy.Service.SavePatInfo(ref pat); } if (ret > 0) { Viewer.txtCardNo.Tag = pat; Viewer.IsSave = true; Viewer.ValueChanged = false; DialogBox.Msg("保存成功!"); } else { DialogBox.Msg("保存失败。"); } }
/// <summary> /// Save /// </summary> internal void Save() { Viewer.gvRole.CloseEditor(); if (Viewer.gvRole.RowCount == 0) { return; } List <EntityCodeRole> lstRoleUpdate = new List <weCare.Core.Entity.EntityCodeRole>(); List <EntityCodeRole> lstRoleNew = new List <weCare.Core.Entity.EntityCodeRole>(); List <EntityCodeRole> lstRoleAll = new List <weCare.Core.Entity.EntityCodeRole>(); int status = 0; EntityCodeRole vo = null; for (int i = 0; i < Viewer.gvRole.RowCount; i++) { vo = new EntityCodeRole(); vo.roleCode = GetFieldValueStr(Viewer.gvRole, i, EntityCodeRole.Columns.roleCode); vo.roleName = GetFieldValueStr(Viewer.gvRole, i, EntityCodeRole.Columns.roleName); vo.innerFlag = "F"; if (lstRoleAll.Exists(t => t.roleCode == vo.roleCode)) { DialogBox.Msg("角色编码存在重复值,请检查。"); return; } else { lstRoleAll.Add(vo); } status = Function.Int(GetFieldValueStr(Viewer.gvRole, i, EntityCodeRole.Columns.isEdit)); if (status == 0) { if (string.IsNullOrEmpty(vo.roleCode) || string.IsNullOrEmpty(vo.roleName)) { DialogBox.Msg("请输入角色编码和名称."); return; } lstRoleNew.Add(vo); } else if (status == 1) { continue; } else if (status == 2) { lstRoleUpdate.Add(vo); } if (lstRoleNew.Count == 0 && lstRoleUpdate.Count == 0) { DialogBox.Msg("数据无改变."); return; } ProxyDictionary proxy = new ProxyDictionary(); int ret = proxy.Service.SaveRole(lstRoleUpdate, lstRoleNew); proxy = null; if (ret > 0) { Refresh(); DialogBox.Msg("角色保存成功!"); } else { DialogBox.Msg("角色保存失败。"); } } }
/// <summary> /// Save /// </summary> /// <param name="isExit"></param> internal void Save(bool isExit) { // 1.main EntityCodeOperator mainVo = new EntityCodeOperator(); mainVo.operCode = Viewer.txtEmpNo.Text.Trim(); mainVo.operName = Viewer.txtEmpName.Text.Trim(); mainVo.pwd = Viewer.txtPwd.Text; if (mainVo.pwd != string.Empty) { if (1 != 1) { mainVo.pwd = (new clsSymmetricAlgorithm()).Encrypt(mainVo.pwd, clsSymmetricAlgorithm.enmSymmetricAlgorithmType.DES); } } if (Viewer.cboStatus.SelectedIndex == 2) { mainVo.disable = "T"; } else if (Viewer.cboStatus.SelectedIndex == 1) { mainVo.disable = "F"; } else { mainVo.disable = "F"; } mainVo.ukey = Viewer.txtCakey.Text.Trim(); mainVo.innerFlag = "T"; EntityPlusOperator plusVo = new EntityPlusOperator(); plusVo.operCode = mainVo.operCode; plusVo.pyCode = SpellCodeHelper.GetPyCode(mainVo.operName); plusVo.wbCode = SpellCodeHelper.GetWbCode(mainVo.operName); plusVo.clsCode = Viewer.lueType.Properties.DBValue; plusVo.dutyCode = Viewer.lueDuty.Properties.DBValue; plusVo.rankCode = Viewer.lueRank.Properties.DBValue; if (!string.IsNullOrEmpty(plusVo.clsCode)) { plusVo.clsCode = plusVo.clsCode.Trim(); } if (!string.IsNullOrEmpty(plusVo.dutyCode)) { plusVo.dutyCode = plusVo.dutyCode.Trim(); } if (!string.IsNullOrEmpty(plusVo.rankCode)) { plusVo.rankCode = plusVo.rankCode.Trim(); } if (Viewer.gvDept.RowCount > 0) { plusVo.deptCode = GetFieldValueStr(Viewer.gvDept, 0, EntityDefDeptemployee.Columns.deptCode); } else { plusVo.deptCode = "&"; } plusVo.birth = Viewer.dtmBirth.Text; plusVo.tel = Viewer.txtContactTel.Text.Trim(); plusVo.addr = Viewer.txtContactAddr.Text.Trim(); plusVo.sex = Viewer.cboSex.SelectedIndex.ToString(); #region 校验 if (string.IsNullOrEmpty(mainVo.operCode)) { DialogBox.Msg("请输入职工编码。"); Viewer.txtEmpNo.Focus(); return; } if (string.IsNullOrEmpty(mainVo.operName)) { DialogBox.Msg("请输入职工名称"); Viewer.txtEmpName.Focus(); return; } if (string.IsNullOrEmpty(plusVo.rankCode)) { DialogBox.Msg("请选择职工职称"); Viewer.lueRank.Focus(); return; } if (string.IsNullOrEmpty(plusVo.clsCode)) { DialogBox.Msg("请选择职工类型"); Viewer.lueType.Focus(); return; } #endregion // 1.main EntityCodeOperator operOrig = new EntityCodeOperator(); if (Viewer.txtEmpNo.Tag != null) { operOrig = Viewer.txtEmpNo.Tag as EntityCodeOperator; } ProxyDictionary proxy = new ProxyDictionary(); int ret = proxy.Service.SaveOperator(mainVo, plusVo, operOrig); proxy = null; if (ret > 0) { Viewer.ValueChanged = false; // 刷新树 if (!isExit) { Viewer.txtEmpNo.Tag = mainVo; Refresh(); FindDept(plusVo.deptCode); for (int i = 0; i < Viewer.gvEmployee.RowCount; i++) { if (GetFieldValueStr(Viewer.gvEmployee, i, EntityOperatorDisp.Columns.operCode) == mainVo.operCode) { Viewer.gvEmployee.FocusedRowHandle = i; break; } } } DialogBox.Msg("保存成功!"); } else { DialogBox.Msg("保存失败。"); } }