예제 #1
0
 private void BindMenuGrid(DataTable dtMenu)
 {
     GdFin.DataSource = dtMenu;
     GdFin.DataBind();
     loadcolor();
 }
예제 #2
0
    protected void loadGrid()
    {
        try
        {
            loadFinanceDetails();
            bool save = false;
            if (arlist.Count > 0)
            {
                for (int row = 0; row < arlist.Count; row++)
                {
                    string values = Convert.ToString(arlist[row]);
                    if (!string.IsNullOrEmpty(values))
                    {
                        string[] splval = values.Split('-');
                        if (splval.Length > 0)
                        {
                            string InsQ = "if exists(select * from Security_Rights_Details where rights_Code='" + splval[2] + "' and ModuleName='" + splval[0] + "' and HeaderName='" + splval[1] + "') update Security_Rights_Details set ReportId='" + splval[3] + "',ReportName='" + splval[4] + "',PageName='" + splval[5] + "',HelpUrl='" + splval[6] + "',PagePriority='" + splval[7] + "',HeaderPriority='" + splval[8] + "' where rights_Code='" + splval[2] + "' and ModuleName='" + splval[0] + "' and HeaderName='" + splval[1] + "' else insert into Security_Rights_Details(ModuleName,HeaderName,Rights_Code,ReportId,ReportName,PageName,HelpUrl,PagePriority,HeaderPriority) values('" + splval[0] + "','" + splval[1] + "','" + splval[2] + "','" + splval[3] + "','" + splval[4] + "','" + splval[5] + "','" + splval[6] + "','" + splval[7] + "','" + splval[8] + "')";
                            int    upd  = d2.update_method_wo_parameter(InsQ, "Text");
                            save = true;
                        }
                    }
                }
            }

            //if (save)
            //{
            string grouporusercode = "";
            string group_code      = Convert.ToString(Session["group_code"]);
            if (group_code.Contains(";"))
            {
                string[] group_semi = group_code.Split(';');
                group_code = group_semi[0].ToString();
            }
            if ((Session["group_code"].ToString().Trim() != "") && (Session["group_code"].ToString().Trim() != "0") && (Session["group_code"].ToString().Trim() != "-1"))
            {
                grouporusercode = " and group_code=" + group_code.Trim() + "";
            }

            else
            {
                grouporusercode = " and user_code=" + Session["usercode"].ToString().Trim() + "";
            }

            string SelQ = " select ModuleName ,HeaderName ,srd.Rights_Code ,ReportId ,ReportName ,PageName ,HelpURL from Security_Rights_Details srd,security_user_right sur where sur.rights_code=srd.Rights_Code  " + grouporusercode + "  and srd.ModuleName='Finance' order by HeaderPriority, PagePriority asc";

            //string SelQ = " select ModuleName ,HeaderName ,srd.Rights_Code ,ReportId ,ReportName ,PageName ,HelpURL from Security_Rights_Details srd,security_user_right sur where sur.rights_code=srd.Rights_Code and user_code='30'  and college_code='13' order by HeaderPriority, PagePriority asc";
            ds.Clear();
            ds = d2.select_method_wo_parameter(SelQ, "Text");
            if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                BindMenuGrid(ds.Tables[0]);
            }
            else
            {
                GdFin.DataSource = null;
                GdFin.DataBind();
            }
            //}
        }
        catch { }
    }