protected void Add() { try { BLL.Sys_Department bll = new BLL.Sys_Department(); Model.Sys_Department model = new Model.Sys_Department(); model.ParentNo = ddlFatherDepartment.SelectedItem.Value; model.No = txtDeptNo.Text.ToString().Trim(); model.Name = txtDeptName.Text.ToString().Trim(); model.Remarks = txtRemarks.Text.ToString(); bll.Add(model); JscriptMsg("添加部门成功啦!", "DepartmentList.aspx", "Success"); } catch (Exception ex) { JscriptMsg(ex.Message + "添加部门失败!", "", "Error"); } }
protected void GetDepartment() { Model.Sys_Department model = new Model.Sys_Department(); BLL.Sys_Department bll = new BLL.Sys_Department(); if (!string.IsNullOrWhiteSpace(No)) { model = bll.GetModel(No); if (model != null) { ddlFatherDepartment.SelectedValue = model.ParentNo; txtDeptName.Text = model.Name; txtDeptNo.Text = model.No; txtRemarks.Text = model.Remarks; txtDeptNo.Enabled = false; } } }