//Write Functions to set the Available to a user when login
    public void setMenuList()
    {
        bool exist = false;

        mainDSTableAdapters.GetMenuItemsTableAdapter menuItem = new mainDSTableAdapters.GetMenuItemsTableAdapter();
        mainDS.GetMenuItemsDataTable tblmenuItem             = menuItem.GetMenuItems(MySessionManager.CurrentUser.UserID);
        mainDSTableAdapters.GetAllMenuItemsTableAdapter menu = new mainDSTableAdapters.GetAllMenuItemsTableAdapter();
        mainDS.GetAllMenuItemsDataTable tblmenu = menu.GetData();
        foreach (mainDS.GetAllMenuItemsRow r in tblmenu)
        {
            DataRow[] lr;
            DataTable l;

            lr = tblmenuItem.Select("datControlName='" + r.datControlName.ToString() + "'");
            if (lr.Length > 0)
            {
                exist = true;
                setControl(exist, r.datControlName, r.datControlType);
            }
            else
            {
                exist = false;
                setControl(exist, r.datControlName, r.datControlType);
            }
        }
    }
Ejemplo n.º 2
0
    public void setMenuList()
    {
        bool exist = false;

        mainDSTableAdapters.GetMenuItemsTableAdapter menuItem = new mainDSTableAdapters.GetMenuItemsTableAdapter();
        mainDS.GetMenuItemsDataTable tblmenuItem             = menuItem.GetMenuItems(MySessionManager.CurrentUser.UserID);
        mainDSTableAdapters.GetAllMenuItemsTableAdapter menu = new mainDSTableAdapters.GetAllMenuItemsTableAdapter();
        mainDS.GetAllMenuItemsDataTable tblmenu = menu.GetData();
        foreach (mainDS.GetAllMenuItemsRow r in tblmenu)
        {
            foreach (mainDS.GetMenuItemsRow l in tblmenuItem)
            {
                if (l.datControlName.ToString() == r.datControlName.ToString())
                {
                    exist = true;
                    setControl(exist, r.datControlName, r.datControlType);
                    continue;
                }
                else
                {
                    exist = false;
                }
                setControl(exist, r.datControlName, r.datControlType);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (MySessionManager.CurrentUser == null)
        {
            Response.Redirect("~/logout.aspx");
        }

        this.dbi_databar1.Visible        = false;
        this.dbi_financials1.Visible     = false;
        this.dbi_payments1.Visible       = false;
        this.dbi_portfolios1.Visible     = false;
        this.dbi_debt_provision1.Visible = false;
        mainDSTableAdapters.GetMenuItemsTableAdapter menuItems = new mainDSTableAdapters.GetMenuItemsTableAdapter();
        mainDS.GetMenuItemsDataTable tblMenuItems = menuItems.GetMenuItems(MySessionManager.CurrentUser.UserID);

        if (tblMenuItems.Rows.Count > 0)
        {
            foreach (mainDS.GetMenuItemsRow r in tblMenuItems)
            {
                if (r.datType.ToString() == "Dashboard")
                {
                    if (r.datControlName.ToString() == "LoanDisbursement")
                    {
                        this.dbi_databar1.Visible = true;
                    }
                    else if (r.datControlName.ToString() == "LoanRepayment")
                    {
                        this.dbi_payments1.Visible = true;
                    }
                    else if (r.datControlName.ToString() == "LoanInterestIncome")
                    {
                        this.dbi_financials1.Visible = true;
                    }
                    else if (r.datControlName.ToString() == "LoanDebtProvision")
                    {
                        this.dbi_debt_provision1.Visible = true;
                    }
                    else if (r.datControlName.ToString() == "LoanCategories")
                    {
                        this.dbi_portfolios1.Visible = true;
                    }
                }
            }
        }
    }
    public void LoadCheckItems(int userid)
    {
        mainDSTableAdapters.GetMenuItemsTableAdapter menuItem = new mainDSTableAdapters.GetMenuItemsTableAdapter();
        mainDS.GetMenuItemsDataTable tblmenuItem = menuItem.GetMenuItems(userid);

        foreach (mainDS.GetMenuItemsRow r in tblmenuItem)
        {
            try
            {
                CheckBox chk = (CheckBox)FindControl("chk_" + r.datCode.ToString());
                if (chk != null)
                {
                    chk.Checked = true;
                }
            }
            catch (Exception ex) { }
        }
    }