void Newfrm_CallBack(object sender, CustumEventArgs e)
 {
     TarifFacturationoInserte.Add((CsTarifFacturation)e.Bag);
     ListeTarifFacturation.Add((CsTarifFacturation)e.Bag);
     SessionObject.ListeTarifFacturation = ListeTarifFacturation.ToList();
     LoadDatagrid(ListeTarifFacturation.OrderBy(t => t.CTARCOMP).ToList());
 }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string CTARCOMP = ((Button)e.OriginalSource).Tag.ToString();
            //int tarifselectionne_CTARCOMP = int.Parse(CTARCOMP);
            CsTarifFacturation  tarifselectionne = ListeTarifFacturation.FirstOrDefault(t => t.CTARCOMP == CTARCOMP);
            FrmTarifFacturation Updatefrm        = new FrmTarifFacturation(tarifselectionne, false);

            Updatefrm.CallBack += Newfrm_CallBack;
            ListeTarifFacturation.Remove(tarifselectionne);
            TarifFacturationoInserte.Remove(tarifselectionne);

            Updatefrm.Show();
        }
 private void LoadTarifGenerer(CsVariableDeTarification lavariable)
 {
     try
     {
         //string FK_IDRECHERCHETARIF=string.Empty;
         //string PK_ID=string.Empty;
         //if (cbo_variable_tarification.SelectedItem!=null)
         //{
         //    FK_IDRECHERCHETARIF= ((CsVariableDeTarification)cbo_variable_tarification.SelectedItem).FK_IDRECHERCHETARIF.ToString();
         //    PK_ID=((CsVariableDeTarification)cbo_variable_tarification.SelectedItem).PK_ID.ToString();
         //}
         TarificationServiceClient service = new TarificationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Tarification"));
         int handler = LoadingManager.BeginLoading("Chargement des donnée ...");
         service.LoadTarifGenererAsync(lavariable.FK_IDRECHERCHETARIF.ToString(), lavariable.PK_ID.ToString(), lavariable.PRODUIT);
         service.LoadTarifGenererCompleted += (er, res) =>
         {
             try
             {
                 if (res.Error != null || res.Cancelled)
                 {
                     Message.Show("Erreur dans le traitement : " + res.Error.InnerException.ToString(), "Erreur");
                 }
                 else
                 if (res.Result != null)
                 {
                     //Code de chargement de la grid pr les ligne de redevence
                     foreach (var item in res.Result)
                     {
                         ListeTarifFacturation.Add(item);
                     }
                     //TarifFacturationoInserte = res.Result;
                     LoadDatagrid(ListeTarifFacturation.OrderBy(t => t.CTARCOMP).ToList());
                 }
                 else
                 {
                     Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                  "Erreur");
                 }
                 LoadingManager.EndLoading(handler);
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         };
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 4
0
 public void Save(CsTarifFacturation TarifFacturationoUpdate, int Action)
 {
     try
     {
         TarificationServiceClient service = new TarificationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Tarification"));
         int handler = LoadingManager.BeginLoading("Mise à jour des données ...");
         service.SaveTarifFacturationAsync(TarifFacturationoUpdate, Action);
         service.SaveTarifFacturationCompleted += (er, res) =>
         {
             try
             {
                 if (res.Error != null || res.Cancelled)
                 {
                     Message.Show("Erreur dans le traitement : " + res.Error.InnerException.ToString(), "Erreur");
                 }
                 else
                 if (res.Result != null)
                 {
                     if (res.Result)
                     {
                         LoadDatagrid(ListeTarifFacturation.ToList());
                     }
                     else
                     {
                         Message.Show("Sauvegarde non effectuée avec succès, il se peut que vos modifications n'aient pas été prises en compte",
                                      "Info");
                     }
                 }
                 else
                 {
                     Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs",
                                  "Erreur");
                 }
                 LoadingManager.EndLoading(handler);
             }
             catch (Exception)
             {
                 throw;
             }
         };
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
        public void LoadAllTarifFacturation(int?idCentre, int?idProduit, int?idRedevance, int?idCodeRecherche)
        {
            try
            {
                ListeTarifFacturation.Clear();
                TarificationServiceClient service = new TarificationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Tarification"));
                int handler = LoadingManager.BeginLoading("Chargement des donnée ...");
                service.LoadAllTarifFacturationAsync(idCentre, idProduit, idRedevance, idCodeRecherche);
                service.LoadAllTarifFacturationCompleted += (er, res) =>
                {
                    try
                    {
                        if (res.Error != null || res.Cancelled)
                        {
                            Message.Show("Erreur dans le traitement : " + res.Error.InnerException.ToString(), "Erreur");
                        }
                        else
                        if (res.Result != null)
                        {
                            SessionObject.ListeTarifFacturation = res.Result;
                            //LoadAllDetailTarifFacturation(SessionObject.ListeTarifFacturation);
                            foreach (var item in res.Result)
                            {
                                ListeTarifFacturation.Add(item);
                            }

                            LoadDatagrid(ListeTarifFacturation.OrderBy(t => t.CTARCOMP).ToList());
                        }
                        else
                        {
                            Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs", "Erreur");
                        }
                        LoadingManager.EndLoading(handler);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                };
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 6
0
 public void LoadAllDetailTarifFacturation(List <CsTarifFacturation> lstTatif)
 {
     try
     {
         TarificationServiceClient service = new TarificationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Tarification"));
         service.LoadAllDetailTarifFacturationAsync();
         service.LoadAllDetailTarifFacturationCompleted += (er, res) =>
         {
             try
             {
                 if (res.Error != null || res.Cancelled)
                 {
                     Message.Show("Erreur dans le traitement : " + res.Error.InnerException.ToString(), "Erreur");
                 }
                 else
                 if (res.Result != null)
                 {
                     foreach (var item in lstTatif)
                     {
                         item.DETAILTARIFFACTURATION = res.Result.Where(t => t.FK_IDTARIFFACTURATION == item.PK_ID).ToList();
                         item.LIBELLERECHERCHETARIF  = SessionObject.ListeRechercheTarif.FirstOrDefault(r => r.CODE == item.RECHERCHETARIF).LIBELLE;
                         item.LIBELLEREDEVANCE       = SessionObject.ListeRedevence.FirstOrDefault(r => r.CODE == item.REDEVANCE).LIBELLE;
                         ListeTarifFacturation.Add(item);
                     }
                     LoadDatagrid(ListeTarifFacturation.ToList());
                 }
                 else
                 {
                     Message.Show("Une erreur s'est produite, veuillez consultez le journal des erreurs", "Erreur");
                 }
             }
             catch (Exception ex)
             {
                 throw ex;
             }
         };
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }