Example #1
0
        protected void ApplicationMenu_Load(object sender, EventArgs e)
        {
            try
            {
                if (user != null && ApplicationMenu.Items.Count == 0)
                {
                    DataTable dt  = new DataTable();
                    ArrayList cle = new ArrayList();
                    ArrayList val = new ArrayList();
                    cle.Add("@LOGIN"); val.Add(user.UserName);
                    cle.Add("@SENDER"); val.Add(2);
                    dt = Cl_Fonction.Extraction_ds("PS_E_LIENSOUSMENU", cle, val, ref dt);

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        MenuItem menuItem = new MenuItem();
                        menuItem.Name         = dt.Rows[i]["ID_MENU"].ToString();
                        menuItem.Text         = dt.Rows[i]["LIBELLE_MENU"].ToString();
                        menuItem.Image.IconID = dt.Rows[i]["ICONE"].ToString();
                        ApplicationMenu.Items.Add(menuItem);
                    }
                }
                if (user == null && ApplicationMenu.Items.Count != 0)
                {
                    HttpContext.Current.Response.RedirectLocation = System.Web.VirtualPathUtility.ToAbsolute("~/Account/SignIn.aspx");
                }
            }
            catch (Exception ex)
            {
                log.Info("Error : " + ex + "; Method : " + Cl_Fonction.GetCurrentMethod());
            }
        }
Example #2
0
        protected void LeftCallbackPanel_Callback(object sender, CallbackEventArgsBase e)
        {
            try
            {
                if (user != null)
                {
                    DataTable dt  = new DataTable();
                    ArrayList cle = new ArrayList();
                    ArrayList val = new ArrayList();
                    cle.Add("@LOGIN"); val.Add(user.UserName);
                    cle.Add("@ID_MENU"); val.Add(e.Parameter);
                    cle.Add("@SENDER"); val.Add(3);
                    dt = Cl_Fonction.Extraction_ds("PS_E_LIENSOUSMENU", cle, val, ref dt);

                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        string Libelle      = dt.Rows[i]["LIBELLE_SOUSMENU"].ToString();
                        string id_sous_menu = dt.Rows[i]["ID_SOUSMENU"].ToString();

                        NavBarGroup nbg = new NavBarGroup();
                        nbg.Text = Libelle;
                        navbarMain.Groups.Add(nbg);

                        ////**************Lien************************//
                        DataTable dtlien  = new DataTable();
                        ArrayList clelien = new ArrayList();
                        ArrayList vallien = new ArrayList();
                        clelien.Add("@LOGIN"); vallien.Add(user.UserName);
                        clelien.Add("@ID_SOUSMENU"); vallien.Add(Convert.ToInt32(id_sous_menu));
                        clelien.Add("@SENDER"); vallien.Add(1);
                        dtlien = Cl_Fonction.Extraction_ds("PS_E_LIENSOUSMENU", clelien, vallien, ref dtlien);

                        for (int ilien = 0; ilien < dtlien.Rows.Count; ilien++)
                        {
                            string LibelleLien = dtlien.Rows[ilien]["LIBELLE_LIENSOUSMENU"].ToString();
                            string idLien      = dtlien.Rows[ilien]["ID_LIENSOUSMENU"].ToString();
                            string Chemin      = dtlien.Rows[ilien]["CHEMIN"].ToString();
                            string Icone       = dtlien.Rows[ilien]["ICONE"].ToString();

                            string Libellestatut   = dtlien.Rows[ilien]["STATUT"].ToString();
                            string ID_TYPEDOCUMENT = dtlien.Rows[ilien]["ID_LIENSOUSMENU"].ToString();

                            string affichermontant = dtlien.Rows[ilien]["AFFICHER_MONTANT"].ToString();
                            string accederdate     = dtlien.Rows[ilien]["ACCEDER_DATE"].ToString();

                            //DataTable dtlienstatut = new DataTable();
                            //ArrayList clelienstatut = new ArrayList();
                            //ArrayList vallienstatut = new ArrayList();
                            //clelienstatut.Add("@LIEN_SOUSMENU");
                            //vallienstatut.Add(idLien);
                            //clelienstatut.Add("@USERNAME");
                            //vallienstatut.Add(user.UserName);
                            //dtlienstatut = Cl_Fonction.Extraction_ds("PS_STATUT_USER", clelienstatut, vallienstatut, ref dtlienstatut);

                            //string ID_TYPEDOCUMENT = dtlienstatut.Rows[0]["ID_TYPEDOCUMENT"].ToString();

                            navbarMain.Groups.FindByText(Libelle.Trim()).Items.Add(LibelleLien.Trim()).Name             = Chemin + "|" + Libellestatut + "|" + ID_TYPEDOCUMENT + "|" + idLien + "|" + affichermontant + "|" + accederdate;
                            navbarMain.Groups.FindByText(Libelle.Trim()).Items.FindByText(LibelleLien.Trim()).Image.Url = Icone.Trim();
                        }
                        //**************Fin Lien*******************//
                    }
                }
                else
                {
                    HttpContext.Current.Response.RedirectLocation = System.Web.VirtualPathUtility.ToAbsolute("~/Account/SignIn.aspx");
                }
            }
            catch (Exception ex)
            {
                log.Info("Error : " + ex + "; Method : " + Cl_Fonction.GetCurrentMethod());
            }
        }