/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_ok_Click(object sender, EventArgs e) { SysdatOrg Org = new SysdatOrg(); bool isSuccess = false; if (txtCurrentOrg.Text == string.Empty) { new PubUtils().ShowNoteNGMsg("节点名称不能为空", 2, grade.RepeatedError); return; } Org.ParentID = Common.Helper.SqlInput.ChangeNullToInt(cbo_ParentOrg.SelectedValue, 0); Org.text = txtCurrentOrg.Text.Trim(); Org.ID = Common.Helper.SqlInput.ChangeNullToInt(_current_orgID, 0); if (operationType == OperationType.Add) { string strSql = string.Format("select * from SysdatOrg where text='{0}' and ParentID='{1}'", txtCurrentOrg.Text.Trim(), Common.Helper.SqlInput.ChangeNullToInt(cbo_ParentOrg.SelectedValue, 0)); dtOrg = NMS.QueryDataTable(PubUtils.uContext, strSql); if (dtOrg.Rows.Count > 0) { new PubUtils().ShowNoteNGMsg("节点名称已存在", 2, grade.RepeatedError); return; } isSuccess = BLL_SysdatOrg.InsertOrg(Org); } else { isSuccess = BLL_SysdatOrg.UpdateOrg(Org); } if (isSuccess) { new PubUtils().ShowNoteOKMsg("保存成功"); this.DialogResult = DialogResult.OK; this.Close(); } }
/// <summary> /// 删除组织管理 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btn_deleteOrg_Click(object sender, EventArgs e) { if (trv_org.SelectedNode == null) { new PubUtils().ShowNoteNGMsg("请先选中节点", 1, grade.OrdinaryError); return; } if (MsgBox.Question("确认删除?") == DialogResult.OK) { string ID = trv_org.SelectedNode.Tag.ToString(); BLL_SysdatOrg.Delete(ID); InitTreeRoot(); new PubUtils().ShowNoteOKMsg("删除成功"); } }