コード例 #1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            BLL.Sys_Department bll = new BLL.Sys_Department();

            string ids = "";
            for (int i = 0; i < rptList.Items.Count; i++)
            {
                string  id = "'"+((HiddenField)rptList.Items[i].FindControl("hidId")).Value+"'";
                CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId");
                if (cb.Checked)
                {
                    ids += id + ",";
                }

            }

            try
            {
                bll.DeleteList(ids.TrimEnd(','));

                JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("DepartmentList.aspx", "keywords={0}", this.txtKeywords.Text), "Success");

            }
            catch (Exception ex)
            {
                JscriptMsg(ex.Message + "批量删除失败!", "", "Error");
            }
        }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
        /// <summary>
        /// 下拉框绑定所有部门
        /// </summary>
        protected void BindDepartmentList()
        {
            BLL.Sys_Department sysDt = new BLL.Sys_Department();
            DataTable dtList = sysDt.GetAllList().Tables[0];

            for (int i = 0; i < dtList.Rows.Count; i++)
            {
                ddlFatherDepartment.Items.Add(new ListItem(dtList.Rows[i]["Name"].ToString() + "(" + dtList.Rows[i]["No"].ToString() + ")", dtList.Rows[i]["No"].ToString()));
            }
        }
コード例 #4
0
 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;
         }
     }
 }