コード例 #1
0
ファイル: BU_User.aspx.cs プロジェクト: qq5013/SenseDigital
    private void SetDropDownList(bool Enable)
    {
        if (this.GridView1.Rows.Count <= 0)
            return;
        UserID = int.Parse(ViewState["UserID"].ToString());
        string UserName = ViewState["UserName"].ToString();
        int ParentUserID = int.Parse(ViewState["ParentUserID"].ToString());
        string ParentUserName = ViewState["ParentUserName"].ToString();

        Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal();
        dtRole = dal.GetUserRolePermission(UserID, UserName).Tables[0];

        //父級用戶權限
        DataTable dt;
        if (ViewState["ParentUserName"].ToString().ToLower() == "administrator" || ViewState["ParentUserName"].ToString() == "")
            dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0];
        else
            dt = dal.GetUserPermission(ParentUserID, ParentUserName).Tables[0];

        DropDownList ddl;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadBrowse"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadDo"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadAdd"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadEdit"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadDelete"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadPrint"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadStop"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadCheck"));
        ddl.Enabled = Enable;
        ddl = (DropDownList)(this.GridView1.HeaderRow.FindControl("ddlHeadUnCheck"));
        ddl.Enabled = Enable;

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            //int SysID = int.Parse(this.GridView1.Rows[i].Cells[13].Text);
            //int PermissionID = int.Parse(this.GridView1.Rows[i].Cells[14].Text);

            //DataRow[] dr = dtRole.Select(string.Format("SysID={0} and PermissionID={1}", SysID, PermissionID));
            //DataRow[] drp = dt.Select(string.Format("SysID={0} and PermissionID={1}", SysID, PermissionID));

            //角色權限
            //string RolePermission = "0000000000";
            //string ParentPermission = "0000000000";

            //if (dr.Length > 0)
            //    RolePermission = dr[0]["Permission"].ToString();
            //if (drp.Length > 0)
            //    ParentPermission = drp[0]["Permission"].ToString();

            //Browse
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlBrowse"));
            //if (int.Parse(RolePermission.Substring(0, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //int PIndex = int.Parse(ParentPermission.Substring(0, 1));
            //for(int j=PIndex+1;j<4;j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //Do
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDo"));
            //if (int.Parse(RolePermission.Substring(1, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(1, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //Add
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlAdd"));
            //if (int.Parse(RolePermission.Substring(2, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(2, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //Edit
                ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlEdit"));
            //if (int.Parse(RolePermission.Substring(3, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(3, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //Delete
                ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDelete"));
            //if (int.Parse(RolePermission.Substring(4, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(4, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //Print
                ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlPrint"));
            //if (int.Parse(RolePermission.Substring(5, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(5, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //Stop
                ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlStop"));
            //if (int.Parse(RolePermission.Substring(6, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(6, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //Check
                ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlCheck"));
            //if (int.Parse(RolePermission.Substring(7, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(7, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");

            //UnCheck
                ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlUnCheck"));
            //if (int.Parse(RolePermission.Substring(8, 1)) > 0)
            //    ddl.Enabled = false;
            //else
                ddl.Enabled = Enable;

            //PIndex = int.Parse(ParentPermission.Substring(8, 1));
            //for (int j = PIndex + 1; j < 4; j++)
            //    ddl.Items[j].Attributes.Add("disabled", "disabled");
        }
    }
コード例 #2
0
ファイル: BU_User.aspx.cs プロジェクト: qq5013/SenseDigital
    protected void btnCopyPermission_Click(object sender, EventArgs e)
    {
        IsEdit = true;
        this.btnAdd.Enabled = !IsEdit;
        this.btnPermission.Enabled = !IsEdit;
        this.btnDelete.Enabled = !IsEdit;
        this.btnCopyPermission.Enabled = IsEdit;
        this.btnCancel.Enabled = IsEdit;
        this.btnSave.Enabled = IsEdit;

        this.GridView1.Columns[12].Visible = true;
        this.GridView1.Columns[13].Visible = true;
        this.GridView1.Columns[14].Visible = true;

        UserID = int.Parse(this.txtCopyUserID.Text);

        Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal();
        DataTable dtp = dal.GetParentUser(int.Parse(this.txtCopyUserID.Text));

        string UserName = "";
        int ParentUserID = 0;
        string ParentUserName = "";
        if (dtp.Rows.Count > 0)
        {
            UserName = dtp.Rows[0]["UserName"].ToString();
            ParentUserID = int.Parse(dtp.Rows[0]["ParentUserID"].ToString());
            ParentUserName = dtp.Rows[0]["ParentUserName"].ToString();
        }

        //用戶本身權限
        dtUser = dal.GetUserPermission(UserID, UserName).Tables[0];
        //父級用戶權限
        DataTable dt;
        if (ViewState["ParentUserName"].ToString().ToLower() == "administrator" || ViewState["ParentUserName"].ToString() == "")
            dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0];
        else
            dt = dal.GetUserPermission(ParentUserID, ParentUserName).Tables[0];

        this.GridView1.DataSource = dt;
        this.GridView1.DataBind();
        this.GridView1.Columns[12].Visible = false;
        this.GridView1.Columns[13].Visible = false;
        this.GridView1.Columns[14].Visible = false;
        ScriptManager.RegisterStartupScript(this.updatePanel, this.GetType(), "Display", "document.getElementById('tdTree').style.display = '';treeview_resize();", true);
    }
コード例 #3
0
ファイル: BU_User.aspx.cs プロジェクト: qq5013/SenseDigital
    private void BindGrid()
    {
        this.GridView1.Columns[12].Visible = true;
        this.GridView1.Columns[13].Visible = true;
        this.GridView1.Columns[14].Visible = true;

        UserID = int.Parse(ViewState["UserID"].ToString());
        string UserName = ViewState["UserName"].ToString();
        int ParentUserID = int.Parse(ViewState["ParentUserID"].ToString());
        string ParentUserName = ViewState["ParentUserName"].ToString();

        Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal();
        Js.Model.Account.UsersInfo model = dal.GetModel(UserID);

        this.txtUserID.Text = model.UserID.ToString();
        this.txtUserName.Text = model.UserName;
        this.txtTrueName.Text = model.TrueName;
        this.txtPersonID.Text = model.PersonID;
        this.txtPersonName.Text = model.PersonName;
        this.ddlDepartmentID.SelectedValue = model.DepartmentID;
        if (!model.Sex)
            this.ddlSex.SelectedIndex = 0;
        else
            this.ddlSex.SelectedIndex = 1;
        if (model.State == 0)
            this.txtState.Text = Resources.Resource.User_State0;
        else if (model.State == 1)
            this.txtState.Text = Resources.Resource.User_State1;
        else
            this.txtState.Text = Resources.Resource.User_State2;

        if (model.UserLevel == 1000)
            this.ddlUserLevel.SelectedIndex = 2;
        else if (model.UserLevel % 1000 == 0)
            this.ddlUserLevel.SelectedIndex = 1;
        else
            this.ddlUserLevel.SelectedIndex = 0;

        this.txtEnableDate.Text = Js.Com.PageValidate.ParseDateTime(model.EnableDate.ToString());
        this.txtStopDate.Text = Js.Com.PageValidate.ParseDateTime(model.StopDate.ToString());

        this.txtEMail.Text = model.Email;
        this.txtPhone.Text = model.Phone;
        this.txtCellPhone.Text = model.CellPhone;
        this.txtCreateDate.Text = Js.Com.PageValidate.ParseDateTime(model.CreateDate.ToString());
        this.txtCreateUserName.Text = model.CreateUserName;
        this.txtLastModifyDate.Text = Js.Com.PageValidate.ParseDateTime(model.LastModifyDate.ToString());
        this.txtLastModifyUserName.Text = model.LastModifyUserName;

        //用戶本身權限
        dtUser = dal.GetUserPermission(UserID, UserName).Tables[0];
        //父級用戶權限
        DataTable dt;
        if (ViewState["ParentUserName"].ToString().ToLower() == "administrator" || ViewState["ParentUserName"].ToString() == "")
            dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0];
        else
            dt = dal.GetUserPermission(ParentUserID, ParentUserName).Tables[0];

        this.GridView1.DataSource = dt;
        this.GridView1.DataBind();
        this.GridView1.Columns[12].Visible = false;
        this.GridView1.Columns[13].Visible = false;
        this.GridView1.Columns[14].Visible = false;
        if (UserName.ToLower() == "administrator")
        {
            this.btnPermission.Enabled = false;
            this.btnDelete.Enabled = false;
            this.btnRole.Enabled = false;
            this.btnState.Enabled = false;
        }
        else
        {
            this.btnPermission.Enabled = true;
            this.btnDelete.Enabled = true;
            this.btnRole.Enabled = true;
            this.btnState.Enabled = true;
        }
    }
コード例 #4
0
ファイル: BU_Role.aspx.cs プロジェクト: qq5013/SenseDigital
    private void BindGrid()
    {
        this.GridView1.Columns[12].Visible = true;
        this.GridView1.Columns[13].Visible = true;
        this.GridView1.Columns[14].Visible = true;

        int RoleID = int.Parse(ViewState["RoleID"].ToString());
        this.HiddenField1.Value = RoleID.ToString();

        Js.BLL.Account.PermissionDal pdal = new Js.BLL.Account.PermissionDal();
        dtRole = pdal.GetRolePermissions(RoleID).Tables[0];

        Js.BLL.Account.UserDal dal = new Js.BLL.Account.UserDal();

        //用戶本身權限
        DataTable dt = dal.GetPermission(Session["language_session"].ToString()).Tables[0];

        this.GridView1.DataSource = dt;
        this.GridView1.DataBind();
        this.GridView1.Columns[12].Visible = false;
        this.GridView1.Columns[13].Visible = false;
        this.GridView1.Columns[14].Visible = false;

        this.btnPermission.Enabled = true;
        this.btnDelete.Enabled = true;
    }