Пример #1
0
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        Js.BLL.Account.RoleDal dal = new Js.BLL.Account.RoleDal();
        dal.Delete(int.Parse(ViewState["RoleID"].ToString()));

        Js.BLL.BaseDal bdal = new Js.BLL.BaseDal(FormID);
        DataTable dt = bdal.GetRecord("1=1");
        BindTreeView(dt);

        ViewState["RoleID"] = this.TreeView1.SelectedNode.Value;

        BindGrid();
    }
Пример #2
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Js.BLL.Account.RoleDal dal = new Js.BLL.Account.RoleDal();
        ArrayList UserList = new ArrayList();
        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            CheckBox oChk = (CheckBox)this.GridView1.Rows[i].FindControl("cbSelect");
            if(oChk.Checked)
                UserList.Add(this.GridView1.DataKeys[i].Value);
        }
        dal.RoleToUser(int.Parse(this.ddlRoleID.SelectedValue), UserList, Session["User"].ToString());

        Response.Redirect("BU_RoleToUsers.aspx?FormID=" + Server.UrlEncode(FormID));
    }
Пример #3
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Js.BLL.Account.RoleDal dal = new Js.BLL.Account.RoleDal(FormID);
        Js.Model.Account.RoleInfo model = new Js.Model.Account.RoleInfo();
        if(RoleID.Length>0)
            model.RoleID = int.Parse(RoleID);
        model.RoleName = this.txtRoleName.Text.Trim();
        model.UserLevel = this.ddlUserLevel.SelectedIndex;
        model.CreateUserName = this.txtCreateUserName.Text;
        if(this.txtCreateDate.Text.Length>0)
            model.CreateDate = DateTime.Parse(this.txtCreateDate.Text);
        else
            model.CreateDate = DateTime.Now;
        model.LastModifyUserName = Session["User"].ToString();
        model.LastModifyDate = DateTime.Now;

        if (RoleID.Length > 0)
            dal.Update(model);
        else
            dal.Add(model);

        Response.Redirect("BU_Role.aspx?FormID=" + Server.UrlEncode(FormID));
    }
Пример #4
0
 private void BindDropDownList()
 {
     Js.BLL.Account.RoleDal dal = new Js.BLL.Account.RoleDal();
     DataTable dt = dal.GetRecord("1=1");
     this.ddlRoleID.DataSource = dt;
     this.ddlRoleID.DataTextField = "RoleName";
     this.ddlRoleID.DataValueField = "RoleID";
     this.ddlRoleID.DataBind();
 }
Пример #5
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Js.BLL.Account.RoleDal dal = new Js.BLL.Account.RoleDal();
        ArrayList SysID = new ArrayList();
        ArrayList PermissionID = new ArrayList();
        ArrayList Permission = new ArrayList();
        DropDownList ddl;

        for (int i = 0; i < this.GridView1.Rows.Count; i++)
        {
            string Permissions = "";

            SysID.Add(this.GridView1.Rows[i].Cells[13].Text);
            PermissionID.Add(this.GridView1.Rows[i].Cells[14].Text);

            //Browse
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlBrowse"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions = "0";
            //Do
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDo"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlAdd"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";
            //Edit
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlEdit"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";
            //Delete
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlDelete"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";
            //Print
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlPrint"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";
            //Stop
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlStop"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";
            //Check
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlCheck"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";
            //UnCheck
            ddl = (DropDownList)(this.GridView1.Rows[i].FindControl("ddlUnCheck"));
            if (ddl != null)
            {
                Permissions += ddl.SelectedIndex.ToString();
                ddl.Enabled = false;
            }
            else
                Permissions += "0";

            Permission.Add(Permissions);
        }
        dal.AddRolePermission(int.Parse(ViewState["RoleID"].ToString()), SysID, PermissionID, Permission);

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

        IsEdit = false;
        this.btnAdd.Enabled = !IsEdit;
        this.btnPermission.Enabled = !IsEdit;
        this.btnDelete.Enabled = !IsEdit;
        this.btnCopyPermission.Enabled = IsEdit;
        this.btnCancel.Enabled = IsEdit;
        this.btnSave.Enabled = IsEdit;
        ScriptManager.RegisterStartupScript(this.updatePanel, this.GetType(), "Display", "document.getElementById('tdTree').style.display = '';treeview_resize2();", true);
    }