/// <summary> /// 强制刷新部门 /// </summary> public static void UpdateDepts() { try { _depts = null; _allDepts = null; Maticsoft.BLL.SMT_ORG_INFO bll = new Maticsoft.BLL.SMT_ORG_INFO(); if (UserInfoHelper.UserInfo.USER_NAME == "admin" || PrivateMgr.FUN_POINTS.Contains(SYS_FUN_POINT.USER_PRIVATE_CONFIG)) { log.Debug("管理员加载部门..."); _depts = bll.GetModelList("1=1 order by ORDER_VALUE"); if (_allDepts == null) { _allDepts = new List <Maticsoft.Model.SMT_ORG_INFO>(); } _allDepts.Clear(); _allDepts.AddRange(_depts); } else { log.Debug("普通用户加载部门..."); _allDepts = bll.GetModelList("1=1 order by ORDER_VALUE"); Maticsoft.BLL.SMT_ROLE_FUN rbll = new Maticsoft.BLL.SMT_ROLE_FUN(); var funs = rbll.GetModelList("ROLE_TYPE=2 and ROLE_ID=" + UserInfoHelper.UserInfo.ROLE_ID);// _depts = bll.GetModelList("id in (select RF.FUN_ID from SMT_ROLE_FUN RF where RF.ROLE_TYPE=2 and RF.ROLE_ID=" + UserInfoHelper.UserInfo.ROLE_ID + ") order by ORDER_VALUE"); _depts = _allDepts.FindAll(m => funs.Exists(n => n.FUN_ID == m.ID)); } } catch (Exception ex) { WinInfoHelper.ShowInfoWindow(null, "获取区域列表异常:" + ex.Message); log.Error("获取区域列表异常:", ex); } }
public static Maticsoft.Model.SMT_ORG_INFO GetDeptByCode(string deptCode) { Maticsoft.BLL.SMT_ORG_INFO bll = new Maticsoft.BLL.SMT_ORG_INFO(); var c = bll.GetModelList("ORG_CODE='" + deptCode + "'"); if (c.Count > 0) { return(c[0]); } return(null); }
public static void DeleteDepts(List <Maticsoft.Model.SMT_ORG_INFO> depts) { Maticsoft.BLL.SMT_ORG_INFO bll = new Maticsoft.BLL.SMT_ORG_INFO(); string ids = ""; foreach (var item in depts) { ids += item.ID + ","; } ids = ids.TrimEnd(','); bll.DeleteList(ids); _depts = null; _allDepts = null; }
public static decimal AddDept(Maticsoft.Model.SMT_ORG_INFO dept) { Maticsoft.BLL.SMT_ORG_INFO bll = new Maticsoft.BLL.SMT_ORG_INFO(); dept.ID = bll.Add(dept); if (_depts != null) { _depts.Add(dept); } if (_allDepts != null) { _allDepts.Add(dept); } return(dept.ID); }
private void cbTreeDept_SelectionChanged(object sender, DevComponents.AdvTree.AdvTreeNodeEventArgs e) { Maticsoft.Model.SMT_ORG_INFO orgInfo = e.Node.Tag as Maticsoft.Model.SMT_ORG_INFO; if (orgInfo == null) { orgInfo = new Maticsoft.Model.SMT_ORG_INFO(); orgInfo.ID = -1; } if (orgInfo != null) { CtrlWaiting waiting = new CtrlWaiting(() => { try { Maticsoft.BLL.SMT_STAFF_INFO staffBll = new Maticsoft.BLL.SMT_STAFF_INFO(); string strWhere = "ORG_ID=" + orgInfo.ID; if (orgInfo.ID == -1) { strWhere += " or ORG_ID is null"; } var staffInfos = staffBll.GetModelList("(" + strWhere + ") and IS_DELETE=0"); if (orgInfo.ID != -1) { Maticsoft.BLL.SMT_ORG_INFO orgBll = new Maticsoft.BLL.SMT_ORG_INFO(); var orgS = orgBll.GetModelList("PAR_ID=" + orgInfo.ID); foreach (var org in orgS) { var subInfos = staffBll.GetModelList("ORG_ID=" + org.ID + " and IS_DELETE=0"); staffInfos.AddRange(subInfos); } } this.Invoke(new Action(() => { DoShowInfos(staffInfos); })); } catch (Exception ex) { log.Error("获取人员异常:", ex); WinInfoHelper.ShowInfoWindow(this, "获取人员异常:" + ex.Message); } }); waiting.Show(this); } }
public static void UpdateDept(Maticsoft.Model.SMT_ORG_INFO model) { Maticsoft.BLL.SMT_ORG_INFO bll = new Maticsoft.BLL.SMT_ORG_INFO(); bll.Update(model); if (_depts != null) { Maticsoft.Model.SMT_ORG_INFO ff = _depts.Find(m => m.ID == model.ID); if (ff != null) { ff.PAR_ID = model.PAR_ID; ff.ORG_CODE = model.ORG_CODE; ff.ORDER_VALUE = model.ORDER_VALUE; ff.ORG_NAME = model.ORG_NAME; } } }
private void btnOk_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(tbDeptNo.Text)) { WinInfoHelper.ShowInfoWindow(this, "部门编码不能为空!"); tbDeptNo.Focus(); return; } if (string.IsNullOrWhiteSpace(tbDeptName.Text)) { WinInfoHelper.ShowInfoWindow(this, "部门名称不能为空!"); tbDeptName.Focus(); return; } Maticsoft.Model.SMT_ORG_INFO info = new Maticsoft.Model.SMT_ORG_INFO(); info.ORG_CODE = tbDeptNo.Text.Trim(); info.ORG_NAME = tbDeptName.Text.Trim(); info.ORDER_VALUE = iOrder.Value; Maticsoft.BLL.SMT_ORG_INFO bll = new Maticsoft.BLL.SMT_ORG_INFO(); CtrlWaiting ctrlWaiting = new CtrlWaiting(() => { bool ret = false; try { var exitscode = bll.GetModelList("ORG_CODE='" + info.ORG_CODE + "'"); if (_orgInfo == null) { if (exitscode.Count > 0) { WinInfoHelper.ShowInfoWindow(this, "部门编码已存在!"); return; } // info.ORDER_VALUE = 100; info.PAR_ID = _parId; DeptDataHelper.AddDept(info); _orgInfo = info; ret = true; } else { if (exitscode.Count > 0) { if (!exitscode.Exists(m => m.ID == _orgInfo.ID)) { WinInfoHelper.ShowInfoWindow(this, "部门编码已存在!"); return; } } info.ID = _orgInfo.ID; info.PAR_ID = _orgInfo.PAR_ID; //info.ORDER_VALUE = _orgInfo.ORDER_VALUE; if (bll.Update(info)) { _orgInfo.ORG_CODE = info.ORG_CODE; _orgInfo.ORG_NAME = info.ORG_NAME; ret = true; } else { WinInfoHelper.ShowInfoWindow(this, "更新部门失败,可能部门已被删除!"); } } if (ret) { this.BeginInvoke(new Action(() => { this.DialogResult = DialogResult.OK; this.Close(); })); } } catch (Exception ex) { log.Error("添加或保修改部门:", ex); WinInfoHelper.ShowInfoWindow(this, "添加或修改部门失败:" + ex.Message); } }); ctrlWaiting.Show(this); }