Esempio n. 1
0
    private void VierPermissionID()
    {
        CateNewsGroupPermissionBSO _cateNewsGroupPermissionBSO = new CateNewsGroupPermissionBSO();
        CateNewsGroupPermission    _cateNewsGroupPermission    = new CateNewsGroupPermission();

        foreach (ListItem items in chkListCate.Items)
        {
            if (_cateNewsGroupPermissionBSO.CheckExitPermission(Convert.ToInt32(hddRoles_ID.Value), Convert.ToInt32(items.Value)))
            {
                items.Selected = true;
            }
        }
    }
    private void VierPermissionID()
    {
        CateNewsGroupPermissionBSO cateNewsPermissionBSO = new CateNewsGroupPermissionBSO();
        CateNewsGroupPermission    cateNewsPermission    = new CateNewsGroupPermission();

        foreach (GridViewRow rows in grvRoles.Rows)
        {
            CheckBox chkId = (CheckBox)rows.Cells[0].FindControl("chkId");

            if (cateNewsPermissionBSO.CheckExitPermission(Convert.ToInt32(rows.Cells[0].Text), Convert.ToInt32(hddCateNewsGroupID.Value)))
            {
                chkId.Checked = true;
            }
        }
    }
    protected void btn_add_Click(object sender, EventArgs e)
    {
        try
        {
            CateNewsGroup    catenewsGroup    = ReceiveHtml();
            CateNewsGroupBSO catenewsGroupBSO = new CateNewsGroupBSO();

            int id = catenewsGroupBSO.CreateCateNewsGroup(catenewsGroup);

            if (!Session["Admin_UserName"].ToString().Equals("administrator"))
            {
                AdminRolesBSO adminRolesBSO = new AdminRolesBSO();
                DataTable     table         = adminRolesBSO.GetAdminRolesByUserName(Session["Admin_UserName"].ToString());

                CateNewsGroupPermissionBSO catenewGroupPermissionBSO = new CateNewsGroupPermissionBSO();
                CateNewsGroupPermission    cateNewsGroupPermission   = new CateNewsGroupPermission();

                if (table.Rows.Count > 0)
                {
                    foreach (DataRow subrow in table.Rows)
                    {
                        cateNewsGroupPermission.CateNewsGroupID = id;
                        cateNewsGroupPermission.RolesID         = Convert.ToInt32(subrow["RolesID"].ToString());
                        cateNewsGroupPermission.Permission      = "";
                        cateNewsGroupPermission.UserName        = Session["Admin_UserName"].ToString();
                        cateNewsGroupPermission.Created         = DateTime.Now;
                        cateNewsGroupPermission.Language        = Language.language;

                        catenewGroupPermissionBSO.CreateCateNewsGroupPermission(cateNewsGroupPermission);
                    }
                }
            }

            clientview.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Thêm mới thành công !</div>";
            initControl(id);
            AspNetCache.Reset();
        }
        catch (Exception ex)
        {
            clientview.Text = ex.Message.ToString();
        }
    }
Esempio n. 4
0
    protected void btn_add_cate_Click(object sender, EventArgs e)
    {
        DataTable datatable = CateNewsGroupID();

        try
        {
            CateNewsGroupPermissionBSO catenewPermissionBSO = new CateNewsGroupPermissionBSO();

            DataTable table1 = catenewPermissionBSO.GetCateNewsGroupPermissionByRoles(Convert.ToInt32(hddRoles_ID.Value), Language.language);

            if (table1.Rows.Count > 0)
            {
                catenewPermissionBSO.DeleteCateNewsGroupPermissionRoles(Convert.ToInt32(hddRoles_ID.Value), Language.language);
            }

            CateNewsGroupPermission _cateNewsGroupPermission = new CateNewsGroupPermission();

            if (datatable.Rows.Count > 0)
            {
                foreach (DataRow subrow in datatable.Rows)
                {
                    _cateNewsGroupPermission.CateNewsGroupID = Convert.ToInt32(subrow["CateNewsGroupID"].ToString());
                    _cateNewsGroupPermission.RolesID         = Convert.ToInt32(hddRoles_ID.Value);
                    _cateNewsGroupPermission.Permission      = "";
                    _cateNewsGroupPermission.UserName        = Session["Admin_UserName"].ToString();
                    _cateNewsGroupPermission.Created         = DateTime.Now;
                    _cateNewsGroupPermission.Language        = Language.language;

                    catenewPermissionBSO.CreateCateNewsGroupPermission(_cateNewsGroupPermission);
                    errorCate.Text = "<div class='alert alert-sm alert-danger bg-gradient'>Cập nhật thành công !</div>";
                    //  initControl(_cateNewsGroupPermission.RolesID);
                }
            }
        }
        catch (Exception ex)
        {
            errorCate.Text = ex.Message.ToString();
        }
    }