Example #1
0
 void ConnexionSuccess(object sender, EventArgs e)
 {
     try
     {
         FrmCreeCaisse frm = sender as FrmCreeCaisse;
         //CaisseSelection.LIBELLE = frm.CaisseSelectionee;
         UserConnecte.CaisseSelect    = frm.CaisseSelectionee;
         UserConnecte.MatriculeSelect = frm.MatriculeSelectionee;
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #2
0
        void button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // Construction du menu relatif à la fonction du UserConnecte
                Image b = sender as Image;
                //Button b = sender as Button;
                Module = b.Name;
                AuthentInitializeServiceClient client = new AuthentInitializeServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Initialisation"));
                // MessageBox.Show(Module);
                client.GetMenuDuRoleCompleted += (senders, arg) =>
                {
                    if (arg.Cancelled || arg.Error != null)
                    {
                        Message.Show("Error occurs while processing request ! ", Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                        //
                    }

                    dico = arg.Result;

                    if (dico.Count == 0 || dico == null)
                    {
                        Message.Show("Aucun module trouvé " + " " + "Payement module", Galatee.Silverlight.Resources.Langue.errorTitle);
                        return;
                    }
                    else
                    {
                        if (Module == "Caisse")
                        {
                            /// appel menu galatee
                            ///
                            CaisseServiceClient clt = new CaisseServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Caisse"));
                            clt.VerifieEtatCaisseCompleted += (xx, args) =>
                            {
                                try
                                {
                                    if (args.Cancelled || args.Error != null)
                                    {
                                        Message.Show("Error occurs while processing request !", Galatee.Silverlight.Resources.Langue.errorTitle);
                                        return;
                                        //
                                    }
                                    EtatCaisse = args.Result;
                                    if (EtatCaisse == SessionObject.Enumere.EtatDeCaissePasCassier)
                                    {
                                        // Charger le controle de choix de la caisse
                                        FrmCreeCaisse frm = new FrmCreeCaisse();
                                        frm.success += new EventHandler(ConnexionSuccess);
                                        frm.Show();
                                    }
                                    else if (EtatCaisse == SessionObject.Enumere.EtatDeCaisseDejaCloture)
                                    {
                                        Message.Show(Galatee.Silverlight.Resources.Caisse.Langue.MsgCaisseDejaFerme, Galatee.Silverlight.Resources.Langue.errorTitle);
                                        return;
                                    }
                                    else if (EtatCaisse == SessionObject.Enumere.EtatDeCaisseAutreSessionOuvert)
                                    {
                                        Message.ShowWarning("Vous avez ouvert une caisse sur un autre poste " + "\n\r" + "Veuillez la clôturer", "Caisse");
                                        return;
                                    }

                                    else if (EtatCaisse == SessionObject.Enumere.EtatDeCaisseAutreUserSurCaisse)
                                    {
                                        Message.ShowWarning("Un autre utilisateur a une session en cours sur cette caisse " + "\n\r" + "Veuillez consulter l'administrateur", "Caisse");
                                        return;
                                    }

                                    else if (EtatCaisse == SessionObject.Enumere.EtatDeCaisseOuverteALaDemande)
                                    {
                                        Message.Show(Galatee.Silverlight.Resources.Caisse.Langue.MsgCaisseOuverteAlaDemande, Galatee.Silverlight.Resources.Langue.errorTitle);
                                    }

                                    //SessionObject.CaisseOverte = CaisseOverte;
                                    //if (!string.IsNullOrEmpty(CaisseOverte.Caissiere))
                                    //{
                                    //    DialogResult diag = new DialogResult("The day of  as been openned for you . \n Please correct the <<" + CaisseOverte.Raison + ">> and close that day", false, true, false);
                                    //    diag.Closed += new EventHandler(diag_Closed);
                                    //    diag.Show();

                                    //    // new DialogResult("Wrong parameters", false).Show();
                                    //    MessageBox.Show();//, "Payement modul");//, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                    //    return;
                                    //}


                                    RefreshMenuBar();
                                    MenuViewModel viewModel = new MenuViewModel(_mainPage, dico, "Galatee.Silverlight." + Module, Module);
                                    viewModelG = viewModel;

                                    if (!IsRefreh)
                                    {
                                        _mainPage.DataContext = viewModelG;

                                        IsRefreh = true;
                                    }
                                }
                                catch (Exception ex)
                                {
                                    Message.Show(ex, "Module Caisse");
                                }
                            };
                            clt.VerifieEtatCaisseAsync(UserConnecte.matricule, SessionObject.LePosteCourant.FK_IDCAISSE.Value);
                        }

                        else // si le matricule ne correspond pas à celui d'une caissiere
                        {
                            /// Peupler les menus du module select
                            try
                            {
                                RefreshMenuBar();
                                MenuViewModel viewModel = new MenuViewModel(_mainPage, dico, "Galatee.Silverlight." + Module, Module);
                                viewModelG = viewModel;

                                if (!IsRefreh)
                                {
                                    _mainPage.DataContext = viewModelG;

                                    IsRefreh = true;
                                }
                            }
                            catch (Exception ex)
                            {
                                Message.Show(ex, "Module Caisse");
                            }
                        }
                    }
                };
                client.GetMenuDuRoleAsync(UserConnecte.FK_IDFONCTION, Module);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void DoMenuCommand(object param)
        {
            var menuItem = (Galatee.Silverlight.Library.MenuItem)param;

            try
            {
                // pour les item s concernant le changment de langue

                if (menuItem.IsCheckable)
                {
                    //innerpage.Resources[
                }
                if (menuItem.Count == 0 && !string.IsNullOrEmpty(menuItem.Name) && menuItem.IsEnabled)
                {
                    Type   cwType = Type.GetType(menuItem.Name);
                    object cw     = null;

                    if (!menuItem.IsControl)
                    {
                        if (((SessionObject.EtatCaisse == SessionObject.Enumere.EtatDeCaissePasCassier) ||
                             (SessionObject.EtatCaisse == SessionObject.Enumere.EtatDeCaisseNonCloture &&
                              !SessionObject.IsCaisseOuverte)) &&
                            ((menuItem.Name == "Galatee.Silverlight.Caisse.FrmEncaissement") ||
                             (menuItem.Name == "Galatee.Silverlight.Caisse.FrmPaiementDemande") ||
                             (menuItem.Name == "Galatee.Silverlight.Caisse.FrmEncaissementRegroupement") ||
                             (menuItem.Name == "Galatee.Silverlight.Caisse.FrmDemandeTimbre") ||
                             (menuItem.Name == "Galatee.Silverlight.Caisse.FrmAnnulationEncaissement"))
                            )
                        {
                            if (SessionObject.EtatCaisse == SessionObject.Enumere.EtatDeCaissePasCassier)
                            {
                                Message.ShowInformation(Galatee.Silverlight.Resources.Caisse.Langue.MsgPasCaissier, Galatee.Silverlight.Resources.Caisse.Langue.LibelleModule);
                                return;
                            }
                            if (SessionObject.PosteNonCaisse)
                            {
                                Message.ShowInformation("Ce poste n'est pas un poste caisse", Galatee.Silverlight.Resources.Caisse.Langue.LibelleModule);
                                return;
                            }
                            //, MessageBoxButtons.OK, MessageBoxIcon.Information);
                            else if (menuItem.Name != "Galatee.Silverlight.Caisse.UcCashClosure")
                            {
                                Message.ShowInformation(Galatee.Silverlight.Resources.Caisse.Langue.MsgCaisseNonCloture, Galatee.Silverlight.Resources.Caisse.Langue.LibelleModule);//, MessageBoxButtons.OK, MessageBoxIcon.Information);
                                return;
                            }

                            if (SessionObject.EtatCaisse == SessionObject.Enumere.EtatDeCaisseNonCloture)
                            {
                                Message.ShowInformation(Galatee.Silverlight.Resources.Caisse.Langue.MsgCaisseNonCloture, Galatee.Silverlight.Resources.Caisse.Langue.LibelleModule);
                                return;
                            }
                        }
                        string caisse          = UserConnecte.numcaisse;
                        string MatriculeCaisse = UserConnecte.matricule;
                        if (!string.IsNullOrEmpty(UserConnecte.CaisseSelect))
                        {
                            caisse = UserConnecte.CaisseSelect;
                        }
                        if (!string.IsNullOrEmpty(UserConnecte.MatriculeSelect))
                        {
                            MatriculeCaisse = UserConnecte.MatriculeSelect;
                        }

                        if (menuItem.Name == "Galatee.Silverlight.Caisse.frmEtatCaisse" ||
                            menuItem.Name == "Galatee.Silverlight.Caisse.ListeEncaissementJournalière")
                        {
                            List <string> lstDesProfilUser = new List <string>();
                            foreach (Galatee.Silverlight.ServiceAuthenInitialize.CsProfil item in UserConnecte.listeProfilUser)
                            {
                                lstDesProfilUser.Add(item.CODEFONCTION);
                            }
                            if (!lstDesProfilUser.Contains(SessionObject.Enumere.CodeFonctionCaisse))
                            {
                                FrmCreeCaisse frm = new FrmCreeCaisse("NON");
                                frm.Show();
                                return;
                            }
                            else
                            {
                                if (menuItem.Name == "Galatee.Silverlight.Caisse.ListeEncaissementJournalière")
                                {
                                    ListeDesTransactions(SessionObject.LaCaisseCourante);
                                    return;
                                }
                            }
                        }
                        else if (menuItem.Name == "Galatee.Silverlight.Caisse.FrmPaiementDemande" && menuItem.Title == "4002")
                        {
                            cw = Activator.CreateInstance(cwType, new string[] { "Oui" });
                        }

                        else if (menuItem.Name == "Galatee.Silverlight.Recouvrement.FrmAvisDeCoupureSGC" && menuItem.Title == "1300301")
                        {
                            cw = Activator.CreateInstance(cwType, new string[] { "OUI" });
                        }

                        else if (menuItem.Name == "Galatee.Silverlight.Caisse.FrmDuplicatEncaissement" ||
                                 menuItem.Name == "Galatee.Silverlight.Caisse.FrmAnnulationEncaissementManuel" ||
                                 menuItem.Name == "Galatee.Silverlight.Caisse.FrmAnnulationEncaissement")
                        {
                            cw = Activator.CreateInstance(cwType, new string[] { caisse });
                        }
                        else if (menuItem.Name == "Galatee.Silverlight.Accueil.UcInitialisation" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmAutreDemande" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmAbonReabonnement" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.UcInitialisationEP" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.UcInitialisationDepannage" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmInitRemboursementAvance" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmInitRemboursementTravaux" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmModificationAbonnement" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmModificationCompteur" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmModificationBranchement" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmModificationAdresse" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.UcInformationsReclamation" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmModicationClient" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmCorrectionDeDonnees" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.UcInitialisationTransition")
                        {
                            cw = Activator.CreateInstance(cwType, new string[] { retourneTypeDemandeSaisi(menuItem.Title), "OUI" });
                        }


                        else if (menuItem.Name == "Galatee.Silverlight.Facturation.FrmCalculFacturation")
                        {
                            cw = Activator.CreateInstance(cwType, new string[] { retourneTypeActionFacturation(menuItem.Title) });
                        }

                        else if (menuItem.Name == "Galatee.Silverlight.Report.FrmAvisEmisParPIA" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.FrmAvisEmisParControleur" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.FrmAvisEmisParRegroupement" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmListeDeAction" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.FrmEtatCompteur" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.FrmDevisValide" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.FrmTauxDeRecouvrement" ||
                                 menuItem.Name == "Galatee.Silverlight.Facturation.FrmEtatFaturation" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmReeditionEtats" ||
                                 menuItem.Name == "Galatee.Silverlight.Recouvrement.FrmReediterEtat" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.FrmComptabilisation" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.UcStatistiqueReclamation" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmReeditonProgramme" ||
                                 menuItem.Name == "Galatee.Silverlight.Report.FrmListeFacture" ||
                                 menuItem.Name == "Galatee.Silverlight.Accueil.FrmReliaisonCompteur" ||
                                 menuItem.Name == "Galatee.Silverlight.InterfaceComptable.FrmEtatComptat")
                        {
                            cw = Activator.CreateInstance(cwType, new string[] { retourneTypeReport(menuItem.Title) });
                        }


                        // Menu impayés
                        // 1 pour les impayes par categorie
                        // 2 pour les impayes par secteur
                        else if (menuItem.Name == "Galatee.Silverlight.Report.FrmImpayeCategory")
                        {
                            menuItem.Name = "Galatee.Silverlight.Report.FrmEditionImpayes";
                            cwType        = Type.GetType(menuItem.Name);
                            cw            = Activator.CreateInstance(cwType, new string[] { "1" });
                        }
                        else if (menuItem.Name == "Galatee.Silverlight.Report.FrmImpayeSector")
                        {
                            menuItem.Name = "Galatee.Silverlight.Report.FrmEditionImpayes";
                            cwType        = Type.GetType(menuItem.Name);
                            cw            = Activator.CreateInstance(cwType, new string[] { "2" });
                        }

                        else if ((menuItem.Name == "Galatee.Silverlight.Administration.FrmStrategiesSecurite"))
                        {
                            List <string> lstDesProfilUser = new List <string>();
                            foreach (Galatee.Silverlight.ServiceAuthenInitialize.CsProfil item in UserConnecte.listeProfilUser)
                            {
                                lstDesProfilUser.Add(item.CODEFONCTION);
                            }
                            if (!lstDesProfilUser.Contains("001"))
                            {
                                Message.ShowInformation("Cette action n'est possible que par l'administrateur", "Administration");
                                return;
                            }
                        }
                        if ((menuItem.Tdem != null))
                        {
                            int    index  = menuItem.Name.Split('.').Length - 1;
                            string UcName = menuItem.Name.Split('.')[index];
                            if (!string.IsNullOrWhiteSpace(UcName))
                            {
                                menuItem.Name = "Galatee.Silverlight.Devis.UcInitialisation";
                                cwType        = Type.GetType(menuItem.Name);
                                cw            = Activator.CreateInstance(cwType, new string[] { menuItem.Tdem.ToString() });
                            }
                        }
                        if (cw == null)
                        {
                            cw = Activator.CreateInstance(cwType);
                        }
                        ChildWindow form = (ChildWindow)cw;
                        form.Title = menuItem.Text;
                        form.Tag   = menuItem.Name.Split('.')[2];
                        SessionObject.ModuleEnCours     = menuItem.Name.Split('.')[2];
                        SessionObject.IsChargerDashbord = false;
                        form.Show();
                    }
                    else
                    {
                        string[] namespaces = menuItem.Name.Split('.');
                        int      longueur   = namespaces.Length;
                        Utility.ShowPreviewFrame(namespaces[longueur - 1], namespaces[longueur - 2]);
                    }
                }
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, "MenuViewMode");
                //throw ex;
            }
        }