Пример #1
0
    /// <summary>
    /// 验证部门信息
    /// </summary>
    private void CheckCompanyDept()
    {
        if (ddlDepts.Items.Count == 0)
        {
            ScriptHelper.SetAlert(Page, GetTran("001122", "部门不存在!"));
            return;
        }
        IList <CompanyDeptModel> depts = CompanyDeptBLL.GetCompanyDept();

        if (depts == null)
        {
            ScriptHelper.SetAlert(Page, GetTran("001122", "部门不存在!"));
            return;
        }
        bool isHave = false;

        foreach (CompanyDeptModel dept in depts)
        {
            if (dept.Id.ToString().Trim().Equals(this.ddlDepts.SelectedValue))
            {
                isHave = true;
                break;
            }
        }
        if (!isHave)
        {
            ScriptHelper.SetAlert(Page, GetTran("001122", "部门不存在!"));
            return;
        }
    }
Пример #2
0
    /// <summary>
    /// 将所有部门加载到下拉框中
    /// </summary>
    protected void InitdllDepts()
    {
        IList <CompanyDeptModel> depts = CompanyDeptBLL.GetCompanyDept();

        this.ddlDepts.DataSource     = depts;
        this.ddlDepts.DataTextField  = "dept";
        this.ddlDepts.DataValueField = "id";
        this.ddlDepts.DataBind();
    }
Пример #3
0
    /// <summary>
    /// 绑定部门下拉列表框

    /// </summary>
    protected void InitdllDepts()
    {
        IList <CompanyDeptModel> depts = CompanyDeptBLL.GetCompanyDept(DeptRoleBLL.GetDeptRoleIDs(Session["Company"].ToString()));

        this.ddlDepts.DataSource     = depts;
        this.ddlDepts.DataTextField  = "dept";
        this.ddlDepts.DataValueField = "id";
        this.ddlDepts.DataBind();
    }
Пример #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Permissions.ComRedirect(Page, Permissions.redirUrl);
     Response.Cache.SetExpires(DateTime.Now);
     Permissions.CheckManagePermission(Model.Other.EnumCompanyPermission.SafeRightDpetManage);
     if (!IsPostBack)
     {
         //获取参数ID
         string mid = Request.QueryString["id"];
         int    id  = 0;
         //验证id类型,并将id转换成int类型
         try
         {
             id = int.Parse(mid);
         }
         catch (Exception)
         {
             ScriptHelper.SetAlert(this.Page, GetTran("001041", "指定ID无效."), "CompanyDeptManage.aspx");
             return;
         }
         if (id <= 0)
         {
             ScriptHelper.SetAlert(this.Page, GetTran("001041", "指定ID无效."), "CompanyDeptManage.aspx");
             return;
         }
         CompanyDeptModel dept = CompanyDeptBLL.GetCompanyDept(id);
         if (dept == null)
         {
             ScriptHelper.SetAlert(this.Page, GetTran("001042", "部门不存在"), "CompanyDeptManage.aspx");
             return;
         }
         ViewState["id"]   = id;
         this.txtDept.Text = dept.Dept;
     }
     Translations();
 }