Exemple #1
0
 private void EditerListeCasDuLot(string Lotri, string LeCentre, string LaTournee, List <CsCasind> ListCas)
 {
     try
     {
         string                   key             = Utility.getKey();
         List <CsCasind>          ListDesCasDuLot = new List <CsCasind>();
         FacturationServiceClient service         = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));
         service.EditerListeDesCasCompleted += (s, args) =>
         {
             try
             {
                 if (args.Error != null && args.Cancelled)
                 {
                     Message.ShowError("Erreur survenue lors de l'appel serveur", "Erreur");
                     return;
                 }
                 Utility.ActionImpressionDirect(SessionObject.CheminImpression, key, "EtatListeDesCas", "Index");
             }
             catch (Exception ex)
             {
                 Message.ShowError(ex, "Erreur");
             }
         };
         service.EditerListeDesCasAsync(Lotri, LeCentre, LaTournee, ListCas, key);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            var dictionaryParam = new Dictionary <string, string>();

            try
            {
                dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation);
                dictionaryParam.Add("RptParam_DateModification", Languages.DateModification);
                dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation);
                dictionaryParam.Add("RptParam_UserModification", Languages.UserModification);
                dictionaryParam.Add("RptParam_Title", Languages.ListeExoneration.ToUpper());
                dictionaryParam.Add("Rpt_RegCli", Languages.Regroupement.ToUpper());
                dictionaryParam.Add("Rpt_Produit", Languages.LibelleProduit.ToUpper());
                dictionaryParam.Add("Rpt_Centre", Languages.Centre.ToUpper());
                dictionaryParam.Add("Rpt_Avance", Languages.Avance.ToUpper());
                dictionaryParam.Add("Rpt_Dossier", Languages.Dossier.ToUpper());
                dictionaryParam.Add("Rpt_Police", Languages.Police.ToUpper());
                dictionaryParam.Add("Rpt_Traitement", Languages.Traitement.ToUpper());

                if (DonnesDatagrid.Count == 0)
                {
                    throw new Exception(Languages.AucuneDonneeAImprimer);
                }

                var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.RegroupementClient, Languages.QuestionImpressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question);
                messageBox.OnMessageBoxClosed += (_, result) =>
                {
                    if (messageBox.Result == MessageBoxResult.OK)
                    {
                        string key     = Utility.getKey();
                        var    service = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                        service.EditerListeRegExoCompleted += (snder, print) =>
                        {
                            if (print.Cancelled || print.Error != null)
                            {
                                Message.ShowError(print.Error.Message, Languages.RegroupementExoneration);
                                return;
                            }
                            if (!print.Result)
                            {
                                Message.ShowError(Languages.ErreurImpressionDonnees, Languages.RegroupementExoneration);
                                return;
                            }
                            Utility.ActionImpressionDirect(null, key, "RegExo", "Parametrage");
                        };
                        service.EditerListeRegExoAsync(key, dictionaryParam);
                    }
                    else
                    {
                        return;
                    }
                };
                messageBox.Show();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.RegroupementExoneration);
            }
        }
        private void Imprimer()
        {
            var dictionaryParam = new Dictionary <string, string>();

            try
            {
                if (ListeRedevance != null && ListeRedevance.Count == 0)
                {
                    throw new Exception(Languages.AucuneDonneeAImprimer);
                }
                dictionaryParam.Add("RptParam_Centre", Languages.Centre.ToUpper());
                dictionaryParam.Add("RptParam_Libelle", Languages.ColonneLibelle.ToUpper());
                dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation);
                dictionaryParam.Add("RptParam_DateModification", Languages.DateModification);
                dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation);
                dictionaryParam.Add("RptParam_UserModification", Languages.UserModification);
                dictionaryParam.Add("Rpt_Redevance", Languages.Redevance.ToUpper());
                dictionaryParam.Add("RptParam_Title", Languages.ListeRedevance.ToUpper());
                dictionaryParam.Add("Rpt_Tranche", Languages.ColonneTranche.ToUpper());
                dictionaryParam.Add("Rpt_Produit", Languages.Produit.ToUpper());
                dictionaryParam.Add("Rpt_NatureClient", Languages.NatureClient.ToUpper());
                var w = new MessageBoxControl.MessageBoxChildWindow(Languages.Redevance, Languages.QuestionImpressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question);
                w.OnMessageBoxClosed += (_, result) =>
                {
                    if (w.Result == MessageBoxResult.OK)
                    {
                        var    service = new ParametrageClient(Utility.Protocole(), Utility.EndPoint("Parametrage"));
                        string key     = Utility.getKey();
                        service.EditerListeRedevanceCompleted += (snder, print) =>
                        {
                            if (print.Cancelled || print.Error != null)
                            {
                                Message.ShowError(print.Error.Message, Languages.Redevance);
                                return;
                            }
                            if (!print.Result)
                            {
                                Message.ShowError(Languages.ErreurImpressionDonnees, Languages.Redevance);
                                return;
                            }
                            Utility.ActionImpressionDirect(null, key, "Redevance", "Parametrage");
                        };
                        service.EditerListeRedevanceAsync(key, dictionaryParam, ListeRedevance);
                    }
                    else
                    {
                        return;
                    }
                };
                w.Show();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.Redevance);
            }
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            var dictionaryParam = new Dictionary <string, string>();

            try
            {
                dictionaryParam.Add("RptParam_CODE", Languages.Code.ToUpper());
                dictionaryParam.Add("RptParam_PRODUIT", Languages.LibelleProduit.ToUpper());
                dictionaryParam.Add("RptParam_LibelleDIAMETRE", Languages.LibelleDIAMETRE.ToUpper());
                dictionaryParam.Add("RptParam_DESIGNATION", Languages.lblDESIGNATION.ToUpper());
                dictionaryParam.Add("RptParam_DIAMETRE", Languages.LibelleDIAMETRE.ToUpper());
                dictionaryParam.Add("RptParam_QUANTITY", Languages.LibelleQUANTITY.ToUpper());

                dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation);
                dictionaryParam.Add("RptParam_DateModification", Languages.DateModification);
                dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation);
                dictionaryParam.Add("RptParam_UserModification", Languages.UserModification);
                dictionaryParam.Add("RptParam_Title", Languages.ListeCaisse.ToUpper());
                if (DonnesDatagrid.Count == 0)
                {
                    throw new Exception(Languages.AucuneDonneeAImprimer);
                }
                var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.LibelleProduit, Languages.QuestionImpressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question);
                messageBox.OnMessageBoxClosed += (_, result) =>
                {
                    if (messageBox.Result == MessageBoxResult.OK)
                    {
                        string key     = Utility.getKey();
                        var    service = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                        service.EditerListeFournitureCompleted += (snder, print) =>
                        {
                            if (print.Cancelled || print.Error != null)
                            {
                                string error = print.Error.Message;
                                Message.ShowError(error, Languages.LibelleProduit);
                            }
                            if (!print.Result)
                            {
                                Message.ShowError(Languages.ErreurImpressionDonnees, Languages.LibelleProduit);
                            }
                            Utility.ActionImpressionDirect(null, key, "Fourniture", "Parametrage");
                        };
                        //service.EditerListeCaisseAsync(key, dictionaryParam);
                    }
                    else
                    {
                        return;
                    }
                };
                messageBox.Show();
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Languages.Fourniture);
            }
        }
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            var dictionaryParam = new Dictionary <string, string>();

            try
            {
                dictionaryParam.Add("RptParam_Code", Languages.Code.ToUpper());
                dictionaryParam.Add("RptParam_Libelle", Languages.Libelle.ToUpper());
                dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation);
                dictionaryParam.Add("RptParam_DateModification", Languages.DateModification);
                dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation);
                dictionaryParam.Add("RptParam_UserModification", Languages.UserModification);
                dictionaryParam.Add("RptParam_Title", Languages.ListeCelluleSiege.ToUpper());

                if (DonnesDatagrid.Count == 0)
                {
                    throw new Exception(Languages.AucuneDonneeAImprimer);
                }

                var messageBox = new MessageBoxControl.MessageBoxChildWindow(Languages.LibelleCelluleSiege, Languages.QuestionImpressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question);
                messageBox.OnMessageBoxClosed += (_, result) =>
                {
                    if (messageBox.Result == MessageBoxResult.OK)
                    {
                        var key     = Utility.getKey();
                        var service = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                        service.EditerListeCelluleDuSiegeCompleted += (snder, print) =>
                        {
                            if (print.Cancelled || print.Error != null)
                            {
                                var dialogResult = new DialogResult(print.Error.Message, Languages.LibelleCelluleSiege, false, true, false);
                                dialogResult.Closed += new EventHandler(DialogResultOk);
                                dialogResult.Show();
                            }
                            if (!print.Result)
                            {
                                var dialogResult = new DialogResult(Languages.ErreurImpressionDonnees, Languages.LibelleCelluleSiege, false, true, false);
                                dialogResult.Closed += new EventHandler(DialogResultOk);
                                dialogResult.Show();
                            }
                            Utility.ActionImpressionDirect(null, key, "CelluleDuSiege", "Parametrage");
                        };
                        service.EditerListeCelluleDuSiegeAsync(key, dictionaryParam);
                    }
                    else
                    {
                        return;
                    }
                };
                messageBox.Show();
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Languages.LibelleCelluleSiege);
            }
        }
        private void Imprimer()
        {
            var dictionaryParam = new Dictionary <string, string>();

            try
            {
                if (DonnesDatagrid.Count == 0)
                {
                    throw new Exception(Languages.AucuneDonneeAImprimer);
                }
                dictionaryParam.Add("Rpt_Code", Languages.ColonneCode.ToUpper());
                dictionaryParam.Add("RptParam_Libelle", Languages.ColonneLibelle.ToUpper());
                dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation);
                dictionaryParam.Add("RptParam_DateModification", Languages.DateModification);
                dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation);
                dictionaryParam.Add("RptParam_UserModification", Languages.UserModification);
                //dictionaryParam.Add("Rpt_ParamCentre", Languages.Centre.ToUpper());
                dictionaryParam.Add("Rpt_Param_Commune", Languages.Commune.ToUpper());
                dictionaryParam.Add("RptParam_Title", Languages.ListeQuartier.ToUpper());
                var w = new MessageBoxControl.MessageBoxChildWindow("Quartier", Languages.QuestionImpressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question);
                w.OnMessageBoxClosed += (_, result) =>
                {
                    if (w.Result == MessageBoxResult.OK)
                    {
                        var    service = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                        string key     = Utility.getKey();
                        service.EditerListeQuartierCompleted += (snder, print) =>
                        {
                            if (print.Cancelled || print.Error != null)
                            {
                                Message.ShowError(print.Error.Message, "Quartier");
                                return;
                            }
                            if (!print.Result)
                            {
                                Message.ShowError(Languages.ErreurImpressionDonnees, "Quartier");
                                return;
                            }
                            Utility.ActionImpressionDirect(SessionObject.CheminImpression, key, "Quartiers", "Parametrage");
                        };
                        service.EditerListeQuartierAsync(key, dictionaryParam, null);
                    }
                    else
                    {
                        return;
                    }
                };
                w.Show();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Quartier");
            }
        }
        private void Imprimer()
        {
            var dictionaryParam = new Dictionary <string, string>();

            try
            {
                if (DonnesDatagrid.Count == 0)
                {
                    throw new Exception(Languages.AucuneDonneeAImprimer);
                }
                dictionaryParam.Add("RptParam_Code", Languages.ColonneCode.ToUpper());
                dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation);
                dictionaryParam.Add("RptParam_DateModification", Languages.DateModification);
                dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation);
                dictionaryParam.Add("RptParam_UserModification", Languages.UserModification);
                dictionaryParam.Add("RptParam_RoleName", Languages.ColonneRoleName.ToUpper());
                dictionaryParam.Add("RptParam_RoleDisplayName", Languages.ColonneRoleDisplayName.ToUpper());
                dictionaryParam.Add("RptParam_EstAdmin", Languages.ColonneEstAdmin.ToUpper());
                dictionaryParam.Add("RptParam_Title", Languages.Fonction.ToUpper());
                var w = new MessageBoxControl.MessageBoxChildWindow(Languages.Parametrage, Languages.QuestionImpressionDonnees, MessageBoxControl.MessageBoxButtons.YesNo, MessageBoxControl.MessageBoxIcon.Question);
                w.OnMessageBoxClosed += (_, result) =>
                {
                    if (w.Result == MessageBoxResult.OK)
                    {
                        string key     = Utility.getKey();
                        var    service = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                        service.EditerListeFonctionCompleted += (snder, print) =>
                        {
                            if (print.Cancelled || print.Error != null)
                            {
                                Message.Show(print.Error.Message, Languages.Parametrage);
                                return;
                            }
                            if (!print.Result)
                            {
                                Message.Show(Languages.ErreurImpressionDonnees, Languages.Parametrage);
                                return;
                            }
                            Utility.ActionImpressionDirect(null, key, "Fonction", "Parametrage");
                        };
                        service.EditerListeFonctionAsync(key, dictionaryParam);
                    }
                    else
                    {
                        return;
                    }
                };
                w.Show();
            }
            catch (Exception ex)
            {
                Message.Show(ex.Message, Languages.Parametrage);
            }
        }
        private void DialogResultPrint(object sender, EventArgs e)
        {
            var dictionaryParam = new Dictionary <string, string>();

            try
            {
                dictionaryParam.Add("RptParam_Libelle", Languages.Libelle.ToUpper());
                dictionaryParam.Add("RptParam_DateCreation", Languages.DateCreation);
                dictionaryParam.Add("RptParam_DateModification", Languages.DateModification);
                dictionaryParam.Add("RptParam_UserCreation", Languages.UserCreation);
                dictionaryParam.Add("RptParam_UserModification", Languages.UserModification);
                dictionaryParam.Add("Rpt_Centre", Languages.Centre.ToUpper());
                dictionaryParam.Add("Rpt_Site", Languages.Site.ToUpper());
                dictionaryParam.Add("Rpt_TypeCentre", Languages.LibelleTypeCentre.ToUpper());
                dictionaryParam.Add("RptParam_Title", Languages.ListeCentre.ToUpper());
                var ctrs = sender as DialogResult;
                if (ctrs != null && ctrs.Yes) // permet de tester si l'utilisateur a click sur Ok ou NON
                {
                    var    service = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage"));
                    string key     = Utility.getKey();
                    service.EditerListeCentreCompleted += (snder, print) =>
                    {
                        if (print.Cancelled || print.Error != null)
                        {
                            Message.ShowError(print.Error.Message, Languages.Centre);
                            return;
                        }
                        if (!print.Result)
                        {
                            Message.ShowError(Languages.ErreurImpressionDonnees, Languages.Centre);
                            return;
                        }
                        Utility.ActionImpressionDirect(SessionObject.CheminImpression, key, "Centre", "Parametrage");
                    };
                    service.EditerListeCentreAsync(key, dictionaryParam);
                }
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.Centre);
            }
        }