//**************************************************************************************************** //窗体加载 private void frmWorker_Load(object sender, EventArgs e) { TreeNode tnAll = new TreeNode(); tnAll.Text = "全部科室"; tnAll.Tag = 0; DataTable dt = new ModDepartment().getSelect(); foreach (DataRow dr in dt.Rows) { TreeNode tnChild = new TreeNode(); tnChild.Text = dr["departmentName"].ToString(); tnChild.Tag = dr["id"].ToString(); tnAll.Nodes.Add(tnChild); } tre.Nodes.Add(tnAll); tre.ExpandAll(); tre.Select(); tre.HideSelection = false; showData(); }
//**************************************************************************************************** //加载 private void FrmDepartmentEdit_Load(object sender, EventArgs e) { if (intId == 0) { this.Text = "添加" + this.Text; ParseCombobox.setHospital(cmbHospitalId); ParseCombobox.setDepartmentType(cmbDepartmentTypeId); } else { this.Text = "修改" + this.Text; DataRow dr = new ModDepartment().setWhere("id > 0", true).getFind(intId); if (dr == null) { Function.showMessage("记录为空"); this.Close(); } else { txtDepartmentCode.Text = dr["departmentCode"].ToString(); txtDepartmentName.Text = dr["departmentName"].ToString(); txtSpell.Text = dr["spell"].ToString(); chkIsPass.Checked = Convert.ToBoolean(dr["isPass"]); ParseCombobox.setHospital(cmbHospitalId, dr["hospitalId"]); ParseCombobox.setDepartmentType(cmbDepartmentTypeId, dr["departmentTypeId"]); } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["userlogin"] == null) { Response.Redirect("/login.aspx"); } cur_actionid = apps.getActionId(Convert.ToInt32(Session["userlogin"]), appid); if (cur_actionid == 1) { btnAdd2.Enabled = false; } if (Request.QueryString["did"] != null) { modifydept = pp.getdid(Request.QueryString["did"], Convert.ToInt32(Session["bid"])); //Response.Write(Request.QueryString["whid"]); txtbdept_name.Text = modifydept.dept_name; rblDeptCat.SelectedValue = modifydept.dept_cat_id.ToString(); btnDel2.Enabled = true; btnUpdate2.Enabled = true; btnAdd2.Enabled = false; } #region NEW VENDOR CREATING if (!string.IsNullOrEmpty(Request.Form["txtbdept_name"]) & btnUpdate2.Enabled == false & btnDel2.Enabled == false) { if (cur_actionid == 1) { Response.Write("<script>alert('You are authorized user for this action, Please coordinate IT Person!. Thank You!');</script>"); return; } if (Request.Form["txtbdept_name"] != null & Request.Form["rblDeptCat"] != null) { newdepartment.dept_name = (Request.Form["txtbdept_name"]); newdepartment.dept_cat_id = Convert.ToInt32(Request.Form["rblDeptCat"]); newdepartment.isActive = 1; newdepartment.b_entity_id = Convert.ToInt32(Session["bid"]); pp.postmaster_department(newdepartment); if (pp.errTrue == true) { Response.Write("<script>alert('" + pp.repText + "')</script>"); } Response.Write("<script>location.replace(location.pathname)</script>"); } else { Response.Write("<script>alert('Missing Fields, Please Fill Required Field!','ISAY');</script>"); } } #endregion NEW WAREHOUSE CREATING }
//**************************************************************************************************** //科室 public static void setDepartment(ComboBox cmb, Object value = null) { DataTable dt = new ModDepartment().getSelect(); DataRow dr = dt.NewRow(); dr["id"] = 0; dr["departmentName"] = "--请选择科室--"; dt.Rows.InsertAt(dr, 0); cmb.DataSource = dt; cmb.ValueMember = "id"; cmb.DisplayMember = "departmentName"; if (value == null) { cmb.SelectedValue = 0; } else { cmb.SelectedValue = Convert.ToInt32(value); } }
//**************************************************************************************************** //显示数据 private void showData() { DataTable dt = new ModDepartment().setWhere("id > 0", true).setRelation(true).getSelect(); if (dt == null) { btnUpdate.Enabled = false; } else { btnUpdate.Enabled = true; int intIndex = 0; if (grd.Rows.Count > 0) { intIndex = grd.CurrentRow.Index; } grd.AutoGenerateColumns = false; grd.DataSource = dt; grd.Rows[intIndex].Cells[1].Selected = true; } }