private void biAddSubDept_Click(object sender, EventArgs e) { Maticsoft.Model.SMT_ORG_INFO orgInfo = GetSelectOrg(); if (orgInfo == null) { WinInfoHelper.ShowInfoWindow(this, "请选择一个节点!"); return; } else { FrmAddOrModifyDept frmDept = new FrmAddOrModifyDept(orgInfo.ID); if (frmDept.ShowDialog(this) == DialogResult.OK) { var node = DeptDataHelper.CreateNode(frmDept.OrgInfo, null); if (this.deptTree.Tree.SelectedNode == null) { this.deptTree.Tree.Nodes.Add(node); } else { this.deptTree.Tree.SelectedNode.Nodes.Add(node); this.deptTree.Tree.SelectedNode.Expand(); } } } }
private void DoCheckedDept(Node node, List <Maticsoft.Model.SMT_ROLE_FUN> funs) { Maticsoft.Model.SMT_ORG_INFO fun = node.Tag as Maticsoft.Model.SMT_ORG_INFO; if (fun == null) { if (node.Nodes.Count > 0) { foreach (Node item in node.Nodes) { DoCheckedDept(item, funs); } } } else { if (funs.Exists(m => m.FUN_ID == fun.ID)) { node.Checked = true; node.EnsureVisible(); } else { foreach (Node item in node.Nodes) { DoCheckedDept(item, funs); } } } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Maticsoft.Model.SMT_ORG_INFO model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update SMT_ORG_INFO set "); strSql.Append("PAR_ID=@PAR_ID,"); strSql.Append("ORG_CODE=@ORG_CODE,"); strSql.Append("ORG_NAME=@ORG_NAME,"); strSql.Append("ORDER_VALUE=@ORDER_VALUE"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@PAR_ID", SqlDbType.Decimal, 9), new SqlParameter("@ORG_CODE", SqlDbType.VarChar, 100), new SqlParameter("@ORG_NAME", SqlDbType.NVarChar, 100), new SqlParameter("@ORDER_VALUE", SqlDbType.Int, 4), new SqlParameter("@ID", SqlDbType.Decimal, 9) }; parameters[0].Value = model.PAR_ID; parameters[1].Value = model.ORG_CODE; parameters[2].Value = model.ORG_NAME; parameters[3].Value = model.ORDER_VALUE; parameters[4].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
/// <summary> /// 增加一条数据 /// </summary> public decimal Add(Maticsoft.Model.SMT_ORG_INFO model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into SMT_ORG_INFO("); strSql.Append("PAR_ID,ORG_CODE,ORG_NAME,ORDER_VALUE)"); strSql.Append(" values ("); strSql.Append("@PAR_ID,@ORG_CODE,@ORG_NAME,@ORDER_VALUE)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@PAR_ID", SqlDbType.Decimal, 9), new SqlParameter("@ORG_CODE", SqlDbType.VarChar, 100), new SqlParameter("@ORG_NAME", SqlDbType.NVarChar, 100), new SqlParameter("@ORDER_VALUE", SqlDbType.Int, 4) }; parameters[0].Value = model.PAR_ID; parameters[1].Value = model.ORG_CODE; parameters[2].Value = model.ORG_NAME; parameters[3].Value = model.ORDER_VALUE; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToDecimal(obj)); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.SMT_ORG_INFO DataRowToModel(DataRow row) { Maticsoft.Model.SMT_ORG_INFO model = new Maticsoft.Model.SMT_ORG_INFO(); if (row != null) { if (row["ID"] != null && row["ID"].ToString() != "") { model.ID = decimal.Parse(row["ID"].ToString()); } if (row["PAR_ID"] != null && row["PAR_ID"].ToString() != "") { model.PAR_ID = decimal.Parse(row["PAR_ID"].ToString()); } if (row["ORG_CODE"] != null) { model.ORG_CODE = row["ORG_CODE"].ToString(); } if (row["ORG_NAME"] != null) { model.ORG_NAME = row["ORG_NAME"].ToString(); } if (row["ORDER_VALUE"] != null && row["ORDER_VALUE"].ToString() != "") { model.ORDER_VALUE = int.Parse(row["ORDER_VALUE"].ToString()); } } return(model); }
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 = ""; List <Maticsoft.Model.SMT_STAFF_INFO> staffInfos = null; if (orgInfo.ID == -1) { strWhere += "ORG_ID=-1 or ORG_ID is null"; staffInfos = staffBll.GetModelList("(" + strWhere + ") and IS_DELETE=0"); } else { // 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 = staffBll.GetModelListByParOrgId(orgInfo.ID); // } } var depts = DeptDataHelper.GetDepts(false); foreach (var item in staffInfos) { var dept = depts.Find(m => m.ID == item.ORG_ID); if (dept != null) { item.ORG_NAME = dept.ORG_NAME; item.ORG_CODE = dept.ORG_CODE; } } this.Invoke(new Action(() => { DoShowInfos(staffInfos); })); } catch (Exception ex) { log.Error("获取人员异常:", ex); WinInfoHelper.ShowInfoWindow(this, "获取人员异常:" + ex.Message); } }); waiting.Show(this); } }
public FrmAddOrModifyDept(Maticsoft.Model.SMT_ORG_INFO orgInfo) { InitializeComponent(); _orgInfo = orgInfo; this.Text = "修改部门:" + orgInfo.ORG_NAME; tbDeptNo.Text = orgInfo.ORG_CODE; tbDeptName.Text = orgInfo.ORG_NAME; iOrder.Value = orgInfo.ORDER_VALUE == null ? 0 : (int)orgInfo.ORDER_VALUE; }
/// <summary> /// 递归创建下级节点 /// </summary> /// <param name="root">当前节点</param> /// <param name="depts">区域列表</param> private static void GetSubTree(DevComponents.AdvTree.Node root, List <Maticsoft.Model.SMT_ORG_INFO> depts, List <Maticsoft.Model.SMT_ORG_INFO> parDepts) { Maticsoft.Model.SMT_ORG_INFO rootarea = (Maticsoft.Model.SMT_ORG_INFO)root.Tag; List <Maticsoft.Model.SMT_ORG_INFO> subAreas = depts.FindAll(m => m.PAR_ID == rootarea.ID); subAreas.ForEach(m => depts.Remove(m)); foreach (var item in subAreas) { DevComponents.AdvTree.Node node = CreateNode(item, parDepts); GetSubTree(node, depts, parDepts); root.Nodes.Add(node); } }
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); } }
private void biCombine_Click(object sender, EventArgs e) { Maticsoft.Model.SMT_ORG_INFO orgInfo = GetSelectOrg(); if (orgInfo == null) { WinInfoHelper.ShowInfoWindow(this, "请选择合并的部门!"); return; } FrmCombineDept frmCombine = new FrmCombineDept(orgInfo); if (frmCombine.ShowDialog(this) == DialogResult.OK) { this.deptTree.RefreshTree(); //this.deptTree.EnsureVisible(orgInfo.ID); } }
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 deptTree_NodeMouseUp(object sender, DevComponents.AdvTree.TreeNodeMouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right) { ctxMenu.Show(Cursor.Position); } Maticsoft.Model.SMT_ORG_INFO info = e.Node.Tag as Maticsoft.Model.SMT_ORG_INFO; if (info != null) { tbSelectDeptPath.Text = e.Node.FullPath.Replace("<i><font color=\"#444444\">", "").Replace("</font></i>", ""); tbSelectDeptPath.Tag = info; tbDeptNo.Text = info.ORG_CODE; tbDeptName.Text = info.ORG_NAME; ShowRoles(info.ID); ShowUsers(info.ID, info.ORG_NAME); } }
private void biModifyDept_Click(object sender, EventArgs e) { Maticsoft.Model.SMT_ORG_INFO orgInfo = GetSelectOrg(); if (orgInfo == null) { WinInfoHelper.ShowInfoWindow(this, "请选择一个节点!"); return; } else { FrmAddOrModifyDept frmDept = new FrmAddOrModifyDept(orgInfo); if (frmDept.ShowDialog(this) == DialogResult.OK) { string text = frmDept.OrgInfo.ORG_NAME + " [" + frmDept.OrgInfo.ORG_CODE + "]"; this.deptTree.Tree.SelectedNode.Text = text; this.deptTree.Tree.SelectedNode.Tooltip = text; } } }
private void btnOk_Click(object sender, EventArgs e) { var node = comDeptTree.SelectedNode; if (node == null) { WinInfoHelper.ShowInfoWindow(this, "请选择要移至的部门!"); return; } Maticsoft.Model.SMT_ORG_INFO dept = (Maticsoft.Model.SMT_ORG_INFO)node.Tag; if (dept.ID == _info.PAR_ID || dept.ID == _info.ID) { WinInfoHelper.ShowInfoWindow(this, "请选择不同的上级部门!"); return; } decimal parId = _info.PAR_ID; _info.PAR_ID = dept.ID; CtrlWaiting waiting = new CtrlWaiting(() => { try { DeptDataHelper.UpdateDept(_info); this.DialogResult = DialogResult.OK; this.BeginInvoke(new Action(() => { this.Close(); })); } catch (Exception ex) { log.Error("移动部门异常:", ex); _info.PAR_ID = parId; WinInfoHelper.ShowInfoWindow(this, "移动部门异常:" + ex.Message); } }); waiting.Show(this); }
/// <summary> /// 创建树形节点 /// </summary> /// <param name="dept">区域</param> /// <returns>节点</returns> public static DevComponents.AdvTree.Node CreateNode(Maticsoft.Model.SMT_ORG_INFO dept, List <Maticsoft.Model.SMT_ORG_INFO> parDepts) { DevComponents.AdvTree.Node node = new DevComponents.AdvTree.Node(dept.ORG_NAME + " [" + dept.ORG_CODE + "]"); node.Tag = dept; node.Image = Properties.Resources.添加下级部门; node.Tooltip = dept.ORG_NAME + " [" + dept.ORG_CODE + "]"; node.DataKey = "1"; if (parDepts != null && parDepts.Count > 0) { if (parDepts.Contains(dept)) { node.Text = "<i><font color=\"#444444\">" + node.Text + "</font></i>"; node.Tooltip = "<font color=\"red\">" + node.Tooltip + " 【不可选节点】</font>"; node.DataKey = "0"; } else { node.DataKey = "1"; } } return(node); }
private void btnAddPrivate_Click(object sender, EventArgs e) { if (tbSelectDeptPath.Tag == null) { WinInfoHelper.ShowInfoWindow(this, "请选择部门!"); return; } Maticsoft.Model.SMT_ORG_INFO orgInfo = (Maticsoft.Model.SMT_ORG_INFO)tbSelectDeptPath.Tag; CtrlWaiting waiting = new CtrlWaiting(() => { try { Maticsoft.BLL.SMT_DEPT_USER duBll = new Maticsoft.BLL.SMT_DEPT_USER(); var duModels = duBll.GetModelList("DEPT_ID=" + orgInfo.ID); this.Invoke(new Action(() => { List <decimal> userIds = new List <decimal>(); foreach (var item in duModels) { userIds.Add(item.USER_ID); } FrmSelectedUser frmUser = new FrmSelectedUser(userIds, orgInfo.ID); if (frmUser.ShowDialog(this) == DialogResult.OK) { DoShowUsersToGrid(frmUser.SelectedUsers, orgInfo.ORG_NAME); } })); } catch (System.Exception ex) { log.Error("加载用户操作权限异常:" + ex.Message, ex); WinInfoHelper.ShowInfoWindow(this, "加载用户操作权限异常:" + ex.Message); } }); waiting.Show(this); }
/// <summary> /// 得到一个对象实体 /// </summary> public Maticsoft.Model.SMT_ORG_INFO GetModel(decimal ID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 ID,PAR_ID,ORG_CODE,ORG_NAME,ORDER_VALUE from SMT_ORG_INFO "); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@ID", SqlDbType.Decimal) }; parameters[0].Value = ID; Maticsoft.Model.SMT_ORG_INFO model = new Maticsoft.Model.SMT_ORG_INFO(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return(DataRowToModel(ds.Tables[0].Rows[0])); } else { return(null); } }
private void DoAddDept(Maticsoft.Model.SMT_ORG_INFO orgInfo) { decimal parId = -1; if (orgInfo != null) { parId = orgInfo.PAR_ID; } FrmAddOrModifyDept frmDept = new FrmAddOrModifyDept(parId); if (frmDept.ShowDialog(this) == DialogResult.OK) { var node = DeptDataHelper.CreateNode(frmDept.OrgInfo, null); if (this.deptTree.Tree.SelectedNode == null || this.deptTree.Tree.SelectedNode.Parent == null) { this.deptTree.Tree.Nodes.Add(node); } else { this.deptTree.Tree.SelectedNode.Parent.Nodes.Add(node); this.deptTree.Tree.SelectedNode.Parent.Expand(); } } }
public FrmMoveDept(Maticsoft.Model.SMT_ORG_INFO info) { InitializeComponent(); _info = info; this.Text = "移动部门:" + _info.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); }
private void btnOk_Click(object sender, EventArgs e) { if (tbUserName.Text.Trim() == "") { MessageBox.Show("用户名不能为空!"); return; } if (_userInfo == null) { _userInfo = new Maticsoft.Model.SMT_USER_INFO(); _userInfo.ID = -1; } string oldUser = _userInfo.USER_NAME; _userInfo.USER_NAME = tbUserName.Text.Trim(); _userInfo.PASS_WORD = tbPwd.Text; if (_userInfo.PASS_WORD == "123456") { _userInfo.PASS_WORD = "e10adc3949ba59abbe56e057f20f883e"; } _userInfo.REAL_NAME = tbRealName.Text.Trim(); _userInfo.IS_ENABLE = cbEnable.Checked; _userInfo.TELEPHONE = tbTel.Text.Trim(); _userInfo.ADDRESS = tbAddress.Text.Trim(); _userInfo.EMAIL = tbEmail.Text.Trim(); _userInfo.QQ = tbQQ.Text.Trim(); _userInfo.KEY_VAL = ""; _userInfo.IS_DELETE = false; if (cboRole.SelectedItem != null) { ComboItem cboItem = (ComboItem)cboRole.SelectedItem; Maticsoft.Model.SMT_ROLE_INFO roleInfo = (Maticsoft.Model.SMT_ROLE_INFO)cboItem.Tag; _userInfo.ROLE_ID = roleInfo.ID; _userInfo.ROLE_NAME = roleInfo.ROLE_NAME; } else { _userInfo.ROLE_ID = -1; } if (cbtDept.SelectedNode != null) { Maticsoft.Model.SMT_ORG_INFO orgInfo = (Maticsoft.Model.SMT_ORG_INFO)cbtDept.SelectedNode.Tag; _userInfo.ORG_ID = orgInfo.ID; _userInfo.DEPT_NAME = orgInfo.ORG_NAME; } else { _userInfo.ORG_ID = -1; } CtrlWaiting waiting = new CtrlWaiting(() => { try { Maticsoft.BLL.SMT_USER_INFO userBll = new Maticsoft.BLL.SMT_USER_INFO(); if (_userInfo.ID == -1) { userBll.Add(_userInfo); SmtLog.InfoFormat("用户", "添加用户:用户名={0},状态={1}", _userInfo.USER_NAME, _userInfo.IS_ENABLE); } else { userBll.Update(_userInfo); SmtLog.InfoFormat("用户", "更新用户:用户名={0},状态={1},原始用户名={2}", _userInfo.USER_NAME, _userInfo.IS_ENABLE, oldUser); } this.BeginInvoke(new Action(() => { this.DialogResult = DialogResult.OK; this.Close(); })); } catch (Exception ex) { WinInfoHelper.ShowInfoWindow(this, "保存用户异常:" + ex.Message); log.Error("保存用户异常:", ex); } }); waiting.Show(this); }
private void biAddDept_Click(object sender, EventArgs e) { Maticsoft.Model.SMT_ORG_INFO orgInfo = GetSelectOrg(); DoAddDept(orgInfo); }
private void biInput_Click(object sender, EventArgs e) { //WinInfoHelper.ShowInfoWindow(this, "建设中,敬请期待!"); CtrlWaiting waiting = new CtrlWaiting(() => { try { bool iscancel; List <Maticsoft.Model.SMT_ORG_INFO> orgs = new List <Maticsoft.Model.SMT_ORG_INFO>(); ImportHelper2.ImportEx(out iscancel, 2, 1, 4, new ImportDataHandle((o, ise, row, error) => { if (ise) { WinInfoHelper.ShowInfoWindow(this, "导入中发生行值错误,行号:" + row + " 错误:" + error); return; } Maticsoft.Model.SMT_ORG_INFO org = new Maticsoft.Model.SMT_ORG_INFO(); org.ORG_CODE = o[0]; int ord = 100; int.TryParse(o[3], out ord); org.ORDER_VALUE = ord; org.ORG_NAME = o[2]; org.PAR_ORG_CODE = o[1]; org.PAR_ID = -1; orgs.Add(org); })); if (!iscancel) { if (orgs.Count == 0) { WinInfoHelper.ShowInfoWindow(this, "导入部门个数为0!"); return; } foreach (var item in orgs) { if (string.IsNullOrWhiteSpace(item.ORG_CODE) || string.IsNullOrWhiteSpace(item.ORG_NAME)) { WinInfoHelper.ShowInfoWindow(this, "导入失败,存在部门编码或者名称为空!编码:" + item.ORG_CODE + ",名称:" + item.ORG_NAME + ",行号:" + orgs.IndexOf(item)); return; } } foreach (var item in orgs) { var dept = DeptDataHelper.GetDeptByCode(item.ORG_CODE); if (dept == null) { item.ID = DeptDataHelper.AddDept(item);//添加 } else { item.ID = dept.ID; item.PAR_ID = dept.PAR_ID; DeptDataHelper.UpdateDept(item);//更新 } } foreach (var item in orgs) { if (string.IsNullOrWhiteSpace(item.PAR_ORG_CODE)) { continue; } var f = orgs.Find(m => m.ORG_CODE == item.PAR_ORG_CODE); if (f == null) { f = DeptDataHelper.GetDeptByCode(item.PAR_ORG_CODE); } if (f == null) { if (item.PAR_ID == -1) { continue; } item.PAR_ID = -1; } else { if (item.PAR_ID == f.ID) { continue; } item.PAR_ID = f.ID; } DeptDataHelper.UpdateDept(item); } WinInfoHelper.ShowInfoWindow(this, "导入结束!"); this.Invoke(new Action(() => { biRefreshDept_Click(sender, e); })); } } catch (Exception ex) { log.Error("导入异常:", ex); WinInfoHelper.ShowInfoWindow(this, "导入异常:" + ex.Message); } }); waiting.Show(this); }