Esempio n. 1
0
        public void BindData()
        {
            #region LoadThongTin

            var it = MemberGroupDAO.getGroupByID(GroupID);
            this.txt_GroupName.Text = it.GroupName;
            this.txt_GroupDesc.Text = it.GroupDesc;
            this.ckb_Active.Checked = it.Active;

            #endregion

            #region Quyền hạn trong từng chức năng

            #region Header

            this.tbl.Append(
                "<div style='padding: 2px; margin: 5px 0px 5px 0px;' class='ui-widget-content ui-corner-top ui-corner-bottom'><div><table cellspacing='0' border='1' style='width: 100%; border-collapse: collapse;' rules='all' class='adminlist'><tbody> <tr> <th scope='col'>Nhóm chức năng</th>");
            foreach (TBT_AdminFunctionName t1 in MemberGroupDAO.DanhSachTinhNang())
            {
                this.tbl.Append(String.Format("<th scope='col'>{0}</th>", t1.FunctionName));
            }
            this.tbl.Append("</tr>");

            #endregion

            #region Content

            foreach (var t1 in MemberGroupDAO.DanhSachNhomChucNang())
            {
                for (int i = 0; i < tinhNangCount; i++)
                {
                    this.Permission[i] = false;
                    this.bcheck[i]     = string.Empty;
                }
                this.tbl.Append("<tr class='row0'>");
                this.tbl.Append("    <td align='left' width='25%'>");
                this.tbl.Append(
                    String.Format(
                        "        <a href='JavaScript:checkAllGroupItem({0},document.aspnetForm.chbFunc{0})' class='member_list'>{1}</a>",
                        t1.Function_Group_ID,
                        t1.FunctionGroupName));
                this.tbl.Append("    </td>");
                foreach (var t2 in MemberGroupDAO.DanhSachTinhNangChucNang1(t1.Function_Group_ID))
                {
                    int id = (int)(t2.TBT_AdminFunctionName.FunctionOrder - 1);
                    this.Permission[id]        = true;
                    this.Function_Group_Id[id] = t1.Function_Group_ID;
                    this.Function_Id[id]       = t2.Function_ID;
                    if (
                        MemberGroupDAO.DanhSachQuyenHanNhomThanhVien().Any(p => p.Group_ID == GroupID && p.Function_ID == t2.Function_ID))
                    {
                        this.bcheck[id] = " checked ";
                    }
                }

                for (int i = 0; i < tinhNangCount; i++)
                {
                    if (this.Permission[i])
                    {
                        this.tbl.Append("<td align='center'>");
                        this.tbl.Append(
                            String.Format(
                                "<input type='checkbox' name='chbFunc{0}' value='check' id='{1}' {2}>",
                                this.Function_Id[i],
                                this.Function_Group_Id[i],
                                this.bcheck[i]));
                        this.tbl.Append("</td>");
                    }
                    else
                    {
                        this.tbl.Append("<td align='center'>");
                        this.tbl.Append("&nbsp;");
                        this.tbl.Append("</td>");
                    }
                }
                this.tbl.Append("</tr>");
            }
            this.tbl.Append("</tbody></table></div></div>");

            #endregion

            #endregion

            this.htmlMemberGroupEdit.InnerHtml = this.tbl.ToString();
        }
Esempio n. 2
0
 private void BinList()
 {
     this.lv_ThongTinSP.DataSource = MemberGroupDAO.DanhSachNhomChucNang();
     this.lv_ThongTinSP.DataBind();
 }
        public void BindData()
        {
            #region Quyền hạn trong từng chức năng

            #region Header

            this.tbl.Append(
                "<div style='padding: 2px; margin: 5px 0px 5px 0px;' class='ui-widget-content ui-corner-top ui-corner-bottom'><div><table cellspacing='0' border='1' style='width: 100%; border-collapse: collapse;' rules='all' class='adminlist'><tbody> <tr> <th scope='col'>Nhóm chức năng</th>");
            foreach (TBT_AdminFunctionName t1 in MemberGroupDAO.DanhSachTinhNang())
            {
                this.tbl.Append(String.Format("<th scope='col'>{0}</th>", t1.FunctionName));
            }
            this.tbl.Append("</tr>");

            #endregion

            #region Content

            foreach (TBT_AdminFunctionGroup t1 in MemberGroupDAO.DanhSachNhomChucNang())
            {
                for (int i = 0; i < tinhNangCount; i++)
                {
                    this.Permission[i] = false;
                    this.bcheck[i]     = string.Empty;
                }
                this.tbl.Append("<tr class='row0'>");
                this.tbl.Append("    <td align='left' width='25%'>");
                this.tbl.Append(
                    String.Format(
                        "        <a href='JavaScript:checkAllGroupItem({0},document.aspnetForm.chbFunc{0})' class='member_list'>{1}</a>",
                        t1.Function_Group_ID,
                        t1.FunctionGroupName));
                this.tbl.Append("    </td>");
                int ID = -1;
                foreach (TBT_AdminFunction t2 in MemberGroupDAO.DanhSachTinhNangChucNang1(t1.Function_Group_ID))
                {
                    ID++;
                    this.Permission[ID]        = true;
                    this.Function_Group_Id[ID] = t1.Function_Group_ID;
                    this.Function_Id[ID]       = t2.Function_ID;
                }

                for (int i = 0; i < tinhNangCount; i++)
                {
                    if (this.Permission[i])
                    {
                        this.tbl.Append("<td align='center'>");
                        this.tbl.Append(
                            String.Format(
                                "<input type='checkbox' name='chbFunc{0}' value='check' id='{1}'>",
                                this.Function_Id[i],
                                this.Function_Group_Id[i]));
                        this.tbl.Append("</td>");
                    }
                    else
                    {
                        this.tbl.Append("<td align='center'>");
                        this.tbl.Append("&nbsp;");
                        this.tbl.Append("</td>");
                    }
                }
                this.tbl.Append("</tr>");
            }
            this.tbl.Append("</tbody></table></div></div>");

            #endregion

            #endregion

            this.htmlMemberGroupEdit.InnerHtml = this.tbl.ToString();
        }