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)
                       ));
        }
Example #2
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 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)
                       ));
        }