Example #1
0
        // -- Gestion des erreur 500 survenu dans l'application -- //
        protected override void OnException(ExceptionContext context)
        {
            // -- Activation de l'etat d'exception -- //
            context.ExceptionHandled = true;

            // -- Réccupération du controller et action de l'erreur -- //
            string controller = context.RouteData.Values["controller"].ToString();
            string action     = context.RouteData.Values["action"].ToString();

            // -- Log -- //
            GBClass.Log.Error(context.Exception);

            // -- Redirection vers la page d'erreur approprié -- //
            context.Result = RedirectToAction(
                // -- Action -- //
                "Page",
                // -- Controlleur -- //
                "Erreur",
                // -- Paramètres -- //
                new
            {
                dt = GB.Models.Cryptage.Program.EncryptStringAES(
                    GBConvert.To_JavaScript(
                        new
                {
                    code        = 500,
                    message     = context.Exception.Message,
                    id_lang     = this.id_lang,
                    reconnecter = GBClass.Reconnecter_erreur_action(controller, action)
                }
                        )
                    )
            }
                );
        }
Example #2
0
        public void Charger_Parametres()
        {
            // -- Version de l'application -- //
            this.ViewBag.VERSION_BUILD = AppSettings.VERSION_BUILD;

            // -- Nom de l'application -- //
            this.ViewBag.APP_NAME = AppSettings.APP_NAME;

            // -- Paramètres langue -- //
            this.ViewBag.Lang = new System.Dynamic.ExpandoObject();

            // -- Initialisation des données à traiter -- //
            this.ViewBag.donnee = new System.Dynamic.ExpandoObject();

            // -- Paramètres de test -- //
            this.ViewBag.Test = new System.Dynamic.ExpandoObject();

            // -- Langue de l'application -- //
            this.ViewBag.Lang.code = (this.id_lang == 0) ? GB_Enum_Langue.Anglais
                                                         : GB_Enum_Langue.Francais;

            // -- Label cookiee -- //
            this.ViewBag.Lang.Cookie_message = App_Lang.Lang.Cookie_message;
            this.ViewBag.Lang.Cookie_button  = App_Lang.Lang.Cookie_button;
            this.ViewBag.Lang.Copyright      = App_Lang.Lang.Copyright;
            this.ViewBag.Lang.Process        = App_Lang.Lang.Process;

            // -- Lable bouton -- //
            this.ViewBag.Lang.New           = App_Lang.Lang.New;
            this.ViewBag.Lang.Delete        = App_Lang.Lang.Delete;
            this.ViewBag.Lang.Save          = App_Lang.Lang.Save;
            this.ViewBag.Lang.Print         = App_Lang.Lang.Print;
            this.ViewBag.Lang.Close         = App_Lang.Lang.Close;
            this.ViewBag.Lang.Form          = App_Lang.Lang.Form;
            this.ViewBag.Lang.Yes           = App_Lang.Lang.Yes;
            this.ViewBag.Lang.No            = App_Lang.Lang.No;
            this.ViewBag.Lang.Modify        = App_Lang.Lang.Modify;
            this.ViewBag.Lang.Name          = App_Lang.Lang.Name;
            this.ViewBag.Lang.Surname       = App_Lang.Lang.Surname;
            this.ViewBag.Lang.Name_french   = App_Lang.Lang.Name + "-" + App_Lang.Lang.French;
            this.ViewBag.Lang.Name_english  = App_Lang.Lang.Name + "-" + App_Lang.Lang.English;
            this.ViewBag.Lang.Creation_date = App_Lang.Lang.Creation_date;
            this.ViewBag.Lang.Employee      = App_Lang.Lang.Employee;

            // -- Autre -- //
            this.ViewBag.Lang.List_of_records = App_Lang.Lang.List_of_records;

            // -- Rendu html dans les combo box -- //
            this.ViewBag.donnee.HTML_Non_Oui = GBClass.HTML_Non_Oui();
            this.ViewBag.donnee.HTML_Oui_Non = GBClass.HTML_Oui_Non();
        }
Example #3
0
        public override void Write(byte[] buffer, int offset, int count)
        {
            // -- Réccupération du string de la page HTML -- //
            string page = GBClass.HTML_Site_Web($"{AppSettings.URL_APPLICATION}/Erreur/Page/?dt={dt}");

            // -- Ajout de la page dans la reponse -- //
            responseContent.Append(page);

            // Write contentWithCopyright to the outputStream
            byte[] outputBuffer = UTF8Encoding.UTF8.GetBytes(responseContent.ToString());

            // -- Mise à jour de la page dans le stream de sortie --//
            outputStream.Write(outputBuffer, 0, outputBuffer.Length);
        }
Example #4
0
        public override ActionResult Charger_Table(string id_page, string id_vue)
        {
            // -- Variable temporaire de refu d'autorisation -- //
            Boolean autorisation_refuse = false;

            try
            {
                // -- Vérifier l'autorisation de l'action -- //
                AutorisationDAO.Verification_Autorisation(id_menu_actif, this.con.utilisateur.id_role, GB_Enum_Action_Controller.Lister, ref autorisation_refuse);

                List <object> donnee = new List <object>();

                // -- Selectionner en fonction du menu - //
                #region Securite-Module
                if (id_page == GB_Enum_Menu.Securite_Module)
                {
                    foreach (var val in moduleDAO.Lister())
                    {
                        donnee.Add(
                            new
                        {
                            col_1 = GBClass.HTML_Checkbox_Table(val.id, "module"),
                            col_2 = val.code,
                            col_3 = val.libelle_fr,
                            col_4 = val.libelle_en,
                            col_5 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                        }
                            );
                    }
                }
                #endregion

                #region Securite-Role
                else if (id_page == GB_Enum_Menu.Securite_Role)
                {
                    // -- Si la vue n'est pas soumise -- //
                    if (string.IsNullOrEmpty(id_vue))
                    {
                        foreach (var val in roleDAO.Lister())
                        {
                            donnee.Add(
                                new
                            {
                                col_1 = GBClass.HTML_Checkbox_Table(val.id, "role"),
                                col_2 = val.code,
                                col_3 = val.libelle_fr,
                                col_4 = val.libelle_en,
                                col_5 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                            }
                                );
                        }
                    }
                    // -- Si c'est la vue configuration -- //
                    else if (id_vue == "autorisation")
                    {
                        foreach (var val in (this.con.donnee.autorisation as List <Autorisation>).Where(l => l.id_role == Convert.ToInt64(this.con.donnee.id_role)))
                        {
                            donnee.Add(
                                new
                            {
                                col_1 = GBClass.HTML_Checkbox_Table(val.id, "autorisation"),
                                col_2 = val.menu.code,
                                col_3 = (this.id_lang == 0) ? val.menu.libelle_en
                                                                : val.menu.libelle_fr,
                                col_4 = (val.ajouter) ? @"<i class=""fa fa-check fa-2x""></i>"
                                                          : @"<i class=""fa fa-remove fa-2x""></i>",
                                col_5 = (val.modifier) ? @"<i class=""fa fa-check fa-2x""></i>"
                                                           : @"<i class=""fa fa-remove fa-2x""></i>",
                                col_6 = (val.supprimer) ? @"<i class=""fa fa-check fa-2x""></i>"
                                                            : @"<i class=""fa fa-remove fa-2x""></i>",
                                col_7 = (val.imprimer) ? @"<i class=""fa fa-check fa-2x""></i>"
                                                           : @"<i class=""fa fa-remove fa-2x""></i>",
                                col_8 = (val.lister) ? @"<i class=""fa fa-check fa-2x""></i>"
                                                         : @"<i class=""fa fa-remove fa-2x""></i>"
                            }
                                );
                        }
                    }
                    // -- Si c'est la vue configuration -- //
                    else if (id_vue == "menu")
                    {
                        foreach (var val in (this.con.donnee.autorisation_disponible as List <Autorisation>))
                        {
                            donnee.Add(
                                new
                            {
                                col_1 = $"<input type=\"checkbox\" class=\"flat\" id_menu=\"{val.id_menu}\" name=\"menu\" value=\"menu_{val.id_menu}\" etat=\"false\" >",
                                col_2 = (this.id_lang == 0) ? val.menu.libelle_en
                                                                : val.menu.libelle_fr,
                                col_3 = (this.id_lang == 0) ? val.menu.groupe_menu.libelle_en
                                                                : val.menu.groupe_menu.libelle_fr,
                                col_4 = (this.id_lang == 0) ? val.menu.groupe_menu.module.libelle_en
                                                                : val.menu.groupe_menu.module.libelle_fr,
                                col_5 = $"<input type=\"checkbox\" class=\"flat-blue\" id_menu=\"{val.id_menu}\" name=\"ajouter\" etat=\"false\" />",
                                col_6 = $"<input type=\"checkbox\" class=\"flat-blue\" id_menu=\"{val.id_menu}\" name=\"modifier\" etat=\"false\" />",
                                col_7 = $"<input type=\"checkbox\" class=\"flat-blue\" id_menu=\"{val.id_menu}\" name=\"supprimer\" etat=\"false\" />",
                                col_8 = $"<input type=\"checkbox\" class=\"flat-blue\" id_menu=\"{val.id_menu}\" name=\"imprimer\" etat=\"false\" />",
                                col_9 = $"<input type=\"checkbox\" class=\"flat-blue\" id_menu=\"{val.id_menu}\" name=\"lister\" etat=\"false\" />",
                            }
                                );
                        }
                    }
                }
                #endregion

                #region Securite-Menu
                else if (id_page == GB_Enum_Menu.Securite_Menu)
                {
                    foreach (var val in menuDAO.Lister())
                    {
                        donnee.Add(
                            new
                        {
                            col_1 = GBClass.HTML_Checkbox_Table(val.id, "menu"),
                            col_2 = val.code,
                            col_3 = val.libelle_fr,
                            col_4 = val.libelle_en,
                            col_5 = (id_lang == 0) ? val.groupe_menu.libelle_en
                                                       : val.libelle_fr,
                            col_6 = val.view,
                            col_7 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                        }
                            );
                    }
                }
                #endregion

                #region Module introuvable
                else
                {
                    throw new Exception("Le id_page n'a pas été retourné!");
                }
                #endregion

                // -- Notification -- //
                this.ViewBag.notification = new GBNotification(donnee);
            }
            #region catch & finally
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(true);
                }
                else
                {
                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(ex.Message, true);
                }
            }
            finally
            {
                // -- Mise à jour les données à renvoyer -- //
                if (this.ViewBag.notification.est_echec)
                {
                    this.ViewBag.notification.donnee = new List <object>();

                    // -- Envoi du paramètre si l'autorisation a été refusé -- //
                    this.ViewBag.notification.dynamique.autorisation_refuse = autorisation_refuse;
                }
            }
            #endregion

            // -- Retoure le résultat en objet JSON -- //
            return(Json(
                       GBConvert.To_Object(this.ViewBag)
                       ));
        }
        public override ActionResult Charger_Table(string id_page, string id_vue)
        {
            // -- Variable temporaire de refu d'autorisation -- //
            Boolean autorisation_refuse = false;

            try
            {
                // -- Vérifier l'autorisation de l'action -- //
                AutorisationDAO.Verification_Autorisation(id_menu_actif, this.con.utilisateur.id_role, GB_Enum_Action_Controller.Lister, ref autorisation_refuse);

                List <object> donnee = new List <object>();

                // -- Selectionner en fonction du menu - //
                #region ConfigurationBudget-ExerciceFiscal
                if (id_page == GB_Enum_Menu.ConfigurationBudget_ExerciceFiscal)
                {
                    foreach (var val in exerciceFiscalDAO.Lister())
                    {
                        donnee.Add(
                            new
                        {
                            col_1 = GBClass.HTML_Checkbox_Table(val.id, "exerciceFiscal"),
                            col_2 = val.code,
                            col_3 = val.libelle,
                            col_4 = new DateTime(Convert.ToInt64(val.date_debut)).ToString(AppSettings.FORMAT_DATE),
                            col_5 = new DateTime(Convert.ToInt64(val.date_fin)).ToString(AppSettings.FORMAT_DATE),
                            col_6 = val.statut,
                            col_7 = val.budget_id,
                            col_8 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                        }
                            );
                    }
                }
                #endregion

                #region ConfigurationBudget-DirectionBudget
                else if (id_page == GB_Enum_Menu.ConfigurationBudget_DirectionBudget)
                {
                    foreach (var val in directionBudgetDAO.Lister())
                    {
                        donnee.Add(
                            new
                        {
                            col_1 = GBClass.HTML_Checkbox_Table(val.id, "directionBudget"),
                            col_2 = val.code,
                            col_3 = val.libelle,
                            col_4 = val.chef,
                            col_5 = val.telephone,
                            col_6 = val.remarque,
                            col_7 = val.exercice_fiscal?.code ?? App_Lang.Lang.Empty,
                            col_8 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                        }
                            );
                    }
                }
                #endregion

                #region ConfigurationBudget-AutoriteSignature
                else if (id_page == GB_Enum_Menu.ConfigurationBudget_AutoriteSignature)
                {
                    foreach (var val in autoriteSignatureDAO.Lister())
                    {
                        donnee.Add(
                            new
                        {
                            col_1  = GBClass.HTML_Checkbox_Table(val.id, "autoriteSignature"),
                            col_2  = val.code,
                            col_3  = val.libelle,
                            col_4  = GBToString.MontantToString(val.montant_signature),
                            col_5  = GBToString.MontantToString(val.limite_decouvert_client),
                            col_6  = GBToString.MontantToString(val.debit_max_client),
                            col_7  = GBToString.MontantToString(val.credit_max_client),
                            col_8  = GBToString.MontantToString(val.montant_max_ligne_credit),
                            col_9  = GBToString.MontantToString(val.montant_limite_pret),
                            col_10 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                        }
                            );
                    }
                }
                #endregion

                #region ConfigurationBudget-ParametreBudgetRevenu
                else if (id_page == GB_Enum_Menu.ConfigurationBudget_ParametreBudgetRevenu)
                {
                    foreach (var val in parametreBudgetRevenuDAO.Lister())
                    {
                        donnee.Add(
                            new
                        {
                            col_1 = GBClass.HTML_Checkbox_Table(val.id, "parametreBudgetRevenu"),
                            col_2 = val.code,
                            col_3 = val.libelle,
                            col_4 = val.compte?.code ?? App_Lang.Lang.Empty,
                            col_5 = GBToString.Oui_Non(val.autoriser_control_budget),
                            col_6 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                        }
                            );
                    }
                }
                #endregion

                #region ConfigurationBudget-ParametreBudgetFrais
                else if (id_page == GB_Enum_Menu.ConfigurationBudget_ParametreBudgetFrais)
                {
                    foreach (var val in parametreBudgetFraisDAO.Lister())
                    {
                        donnee.Add(
                            new
                        {
                            col_1 = GBClass.HTML_Checkbox_Table(val.id, "parametreBudgetFrais"),
                            col_2 = val.code,
                            col_3 = val.libelle,
                            col_4 = val.compte?.code ?? App_Lang.Lang.Empty,
                            col_5 = GBToString.Oui_Non(val.autoriser_control_budget),
                            col_6 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id, val.code)
                        }
                            );
                    }
                }
                #endregion

                #region ExerciceFiscal introuvable
                else
                {
                    throw new Exception("Le id_page n'a pas été retourné!");
                }
                #endregion

                // -- Notification -- //
                this.ViewBag.notification = new GBNotification(donnee);
            }
            #region catch & finally
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(true);
                }
                else
                {
                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(ex.Message, true);
                }
            }
            finally
            {
                // -- Mise à jour les données à renvoyer -- //
                if (this.ViewBag.notification.est_echec)
                {
                    this.ViewBag.notification.donnee = new List <object>();

                    // -- Envoi du paramètre si l'autorisation a été refusé -- //
                    this.ViewBag.notification.dynamique.autorisation_refuse = autorisation_refuse;
                }
            }
            #endregion

            // -- Retoure le résultat en objet JSON -- //
            return(Json(
                       GBConvert.To_Object(this.ViewBag)
                       ));
        }
        public override ActionResult Charger_Table(string id_page, string id_vue)
        {
            // -- Variable temporaire de refu d'autorisation -- //
            Boolean autorisation_refuse = false;

            try
            {
                // -- Vérifier l'autorisation de l'action -- //
                AutorisationDAO.Verification_Autorisation(id_menu_actif, this.con.utilisateur.id_role, GB_Enum_Action_Controller.Lister, ref autorisation_refuse);

                List <object> donnee = new List <object>();

                // -- Selectionner en fonction du menu - //
                #region SecuriteUtilisateur-Utilisateur
                if (id_page == GB_Enum_Menu.SecuriteUtilisateur_Utilisateur)
                {
                    // -- Si la vue n'est pas soumise -- //
                    if (string.IsNullOrEmpty(id_vue))
                    {
                        foreach (var val in utilisateurDAO.Lister())
                        {
                            donnee.Add(
                                new
                            {
                                col_1  = GBClass.HTML_Checkbox_Table(val.id_utilisateur, "utilisateur"),
                                col_4  = val.agence?.code ?? string.Empty,
                                col_2  = val.compte,
                                col_3  = val.nom_utilisateur,
                                col_5  = val.profession?.libelle ?? string.Empty,
                                col_6  = GBToString.Oui_Non(val.ouverture_back_date),
                                col_7  = GBToString.Oui_Non(val.ouverture_branch),
                                col_8  = GBToString.Oui_Non(val.ouverture_back_date_travail),
                                col_9  = GBToString.Oui_Non(val.est_suspendu),
                                col_10 = GBToString.Oui_Non(val.acces_historique_compte),
                                col_11 = $"{val.duree_mot_de_passe} {App_Lang.Lang.Month}(s)",
                                col_12 = val.autorite_signature?.code ?? string.Empty,
                                col_13 = GBClass.HTML_Bouton_Modifier_Suppression_Table(val.id_utilisateur, val.compte)
                            }
                                );
                        }
                    }
                    else if (id_vue == "autoriteSignature")
                    {
                        foreach (var val in autoriteSignatureDAO.Lister())
                        {
                            donnee.Add(
                                new
                            {
                                col_0 = val.id,
                                //col_1 = GBClass.HTML_Checkbox_Table(val.id, "autoriteSignature\" value=\"autoriteSignature_{val.id}\">",
                                col_2 = val.code,
                                col_3 = val.libelle,
                                col_4 = GBToString.MontantToString(val.montant_signature),
                                col_5 = GBToString.MontantToString(val.limite_decouvert_client),
                                col_6 = GBToString.MontantToString(val.debit_max_client),
                                col_7 = GBToString.MontantToString(val.credit_max_client),
                                col_8 = GBToString.MontantToString(val.montant_max_ligne_credit),
                                col_9 = GBToString.MontantToString(val.montant_limite_pret),
                                //col_10 = GBClass.HTML_Bouton_Selection_Table(val.id)
                            }
                                );
                        }
                    }
                }
                #endregion

                #region Module introuvable
                else
                {
                    throw new Exception("Le id_page n'a pas été retourné!");
                }
                #endregion

                // -- Notification -- //
                this.ViewBag.notification = new GBNotification(donnee);
            }
            #region catch & finally
            catch (Exception ex)
            {
                // -- Vérifier la nature de l'exception -- //
                if (!GBException.Est_GBexception(ex))
                {
                    // -- Log -- //
                    GBClass.Log.Error(ex);

                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(true);
                }
                else
                {
                    // -- Notificication -- //
                    this.ViewBag.notification = new GBNotification(ex.Message, true);
                }
            }
            finally
            {
                // -- Mise à jour les données à renvoyer -- //
                if (this.ViewBag.notification.est_echec)
                {
                    this.ViewBag.notification.donnee = new List <object>();

                    // -- Envoi du paramètre si l'autorisation a été refusé -- //
                    this.ViewBag.notification.dynamique.autorisation_refuse = autorisation_refuse;
                }
            }
            #endregion

            // -- Retoure le résultat en objet JSON -- //
            return(Json(
                       GBConvert.To_Object(this.ViewBag)
                       ));
        }