private void Txt_Centre_TextChanged(object sender, TextChangedEventArgs e)
        {
            if (Txt_Centre.Text.Length == SessionObject.Enumere.TailleCentre)
            {
                CsLotri leLotSelect = new CsLotri();
                if (this.Txt_NumBatch.Tag != null)
                {
                    leLotSelect = (CsLotri)this.Txt_NumBatch.Tag;
                }
                List <CsLotri> _lstLotAfficher = ClasseMethodeGenerique.RetourneDistinctCentre(_ListeLotri.Where(t => t.NUMLOTRI == leLotSelect.NUMLOTRI && t.PERIODE == leLotSelect.PERIODE).ToList());

                if (_lstLotAfficher.FirstOrDefault(t => t.CENTRE == this.Txt_Centre.Text) == null)
                {
                    Message.ShowInformation("Centre inexistant ", "Lot");
                    return;
                }
                else
                {
                    Txt_Centre.Tag = _lstLotAfficher.FirstOrDefault(t => t.CENTRE == this.Txt_Centre.Text);
                }
            }
            if (string.IsNullOrEmpty(this.Txt_Centre.Text))
            {
                Txt_Centre.Tag = null;
            }
        }
        private void ChargerLotriAll(Dictionary <string, List <int> > lstSiteCentre)
        {
            ListeLotri = new List <CsLotri>();
            FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));

            service.ChargerLotriPourDefacturationCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                ListeLotri = args.Result;
                if (ListeLotri == null || ListeLotri.Count == 0)
                {
                    return;
                }
                ListeLotri = ListeLotri.ToList();
                foreach (CsLotri item in ListeLotri)
                {
                    if (item.DFAC != null && item.EXIG != null)
                    {
                        item.DATEEXIG = Convert.ToDateTime(Convert.ToDateTime(item.DFAC) + TimeSpan.FromDays((int)item.EXIG));
                    }
                }
                dataGridlLot.ItemsSource = null;
                dataGridlLot.ItemsSource = ClasseMethodeGenerique.DistinctLotri(ListeLotri);
            };
            service.ChargerLotriPourDefacturationAsync(lstSiteCentre, UserConnecte.matricule, true);
            service.CloseAsync();
        }
 private void btn_Centre_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (_ListeLotri != null)
         {
             this.btn_Centre.IsEnabled = false;
             CsLotri leLotSelect = new CsLotri();
             if (this.Txt_NumBatch.Tag != null)
             {
                 leLotSelect = (CsLotri)this.Txt_NumBatch.Tag;
             }
             List <CsLotri> _lstLotAfficher = ClasseMethodeGenerique.RetourneDistinctCentre(_ListeLotri.Where(t => t.NUMLOTRI == leLotSelect.NUMLOTRI && t.PERIODE == leLotSelect.PERIODE).ToList());
             Dictionary <string, string> _LstColonneAffich = new Dictionary <string, string>();
             _LstColonneAffich.Add("CENTRE", "CENTRE");
             _LstColonneAffich.Add("LIBELLECENTRE", "LIBELLE");
             foreach (CsLotri item in _lstLotAfficher)
             {
                 item.CODE    = item.CENTRE;
                 item.LIBELLE = item.LIBELLECENTRE;
             }
             UcGenerique ctrl = new UcGenerique(_lstLotAfficher, true, "Liste des centres");
             ctrl.Closed += new EventHandler(ucgCentre);
             ctrl.Show();
             this.btn_Centre.IsEnabled = true;
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex, "Erreur");
     }
 }
Beispiel #4
0
        private void ChargerLotriAll(List <int> idCentre)
        {
            ListeLotri = new List <CsLotri>();
            FacturationServiceClient service = new FacturationServiceClient(Utility.Protocole(), Utility.EndPoint("Facturation"));

            service.ChargerLotriDejaFactureCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                ListeLotri = args.Result;
                if (ListeLotri == null || ListeLotri.Count == 0)
                {
                    return;
                }
                ListeLotri = ListeLotri.ToList();
                foreach (CsLotri item in ListeLotri)
                {
                    item.DATEEXIG = Convert.ToDateTime(Convert.ToDateTime(item.DFAC) + TimeSpan.FromDays((int)item.EXIG));
                }

                dataGridlLot.ItemsSource = null;
                dataGridlLot.ItemsSource = ClasseMethodeGenerique.DistinctLotri(ListeLotri);
            };
            service.ChargerLotriDejaFactureAsync(idCentre);
            service.CloseAsync();
        }
 private void ucgReturn(object sender, EventArgs e)
 {
     try
     {
         MainView.UcListeGenerique uc = sender as MainView.UcListeGenerique;
         if (uc.GetisOkClick)
         {
             this.Txt_Centre.Text = string.Empty;
             CsLotri lot = (CsLotri)uc.MyObject;
             Txt_NumBatch.Text     = lot.NUMLOTRI;
             this.Txt_NumBatch.Tag = lot;
             produit = listeBatchInit.FirstOrDefault(t => t.NUMLOTRI == Txt_NumBatch.Text).PRODUIT;
             _lstLotCEntreAfficher = ClasseMethodeGenerique.RetourneDistinctCentre(listeBatch.Where(t => t.NUMLOTRI == lot.NUMLOTRI).ToList());
             if (_lstLotCEntreAfficher.Count == 1)
             {
                 List <int> lstCentre = new List <int>();
                 lstCentre.Add(_lstLotCEntreAfficher.First().FK_IDCENTRE);
                 this.Txt_Centre.Text = _lstLotCEntreAfficher.First().CENTRE;
                 this.Txt_Centre.Tag  = lstCentre;
                 //this.Txt_LibelleCentre.Text = _lstLotCEntreAfficher.First().LIBELLECENTRE;
             }
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex, "Erreur");
     }
 }
Beispiel #6
0
 private void btn_batch_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         if (listeBatch != null)
         {
             List <CsLotri> LstLot = new List <CsLotri>();
             Dictionary <string, string> _LstColonneAffich = new Dictionary <string, string>();
             if (chk_LotIsole.IsChecked == true)
             {
                 _LstColonneAffich.Add("NUMLOTRI", "LOT");
                 _LstColonneAffich.Add("PERIODE", "PERIODE");
                 LstLot = Facturation.ClasseMethodeGenerique.DistinctLotriPeriodeProduit(listeBatch.Where(y => y.ETATFAC10 == "O").ToList());
             }
             else
             {
                 _LstColonneAffich.Add("NUMLOTRI", "LOT");
                 _LstColonneAffich.Add("PERIODE", "PERIODE");
                 LstLot = Facturation.ClasseMethodeGenerique.DistinctLotriPeriodeProduit(listeBatch.Where(y => y.ETATFAC10 != "O").ToList());
             }
             this.btn_batch.IsEnabled = false;
             List <CsLotri>            _lstLotAfficher = ClasseMethodeGenerique.RetourneDistinctLotri(LstLot);
             List <object>             obj             = Shared.ClasseMEthodeGenerique.RetourneListeObjet(_lstLotAfficher);
             MainView.UcListeGenerique ucg             = new MainView.UcListeGenerique(obj, _LstColonneAffich, false, "Lots");
             ucg.Closed += new EventHandler(ucgReturn);
             ucg.Show();
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex, "Erreur");
     }
 }
        private void btn_Batch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                List <object>  _LstObj = new List <object>();
                List <CsLotri> _Lstlot = new List <CsLotri>();
                Dictionary <string, string> _LstColonneAffich = new Dictionary <string, string>();

                if (chk_LotIsole.IsChecked == true)
                {
                    _Lstlot = Facturation.ClasseMethodeGenerique.DistinctLotriPeriodeProduit(ListeLotri.Where(y => y.ETATFAC10 == "O").ToList());
                    _LstColonneAffich.Add("NUMLOTRI", "LOT");
                }
                else
                {
                    _Lstlot = Facturation.ClasseMethodeGenerique.DistinctLotriPeriodeProduit(ListeLotri.Where(y => y.ETATFAC10 != "O").ToList());
                    _LstColonneAffich.Add("NUMLOTRI", "LOT");
                    _LstColonneAffich.Add("PERIODE", "PERIODE");
                }
                _LstObj = ClasseMEthodeGenerique.RetourneListeObjet(ClasseMethodeGenerique.DistinctLotri(_Lstlot));

                List <object>             obj  = Shared.ClasseMEthodeGenerique.RetourneListeObjet(_LstObj);
                MainView.UcListeGenerique ctrl = new MainView.UcListeGenerique(obj, _LstColonneAffich, false, "Lots");
                ctrl.Closed += new EventHandler(galatee_OkClickedBatch);
                ctrl.Show();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Error");
            }
        }
Beispiel #8
0
        private void Chargelotri(Dictionary <string, List <int> > lesDeCentre, bool IsLotCourant, string Periode)
        {
            FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));

            service.ChargerLotriPourSaisieCompleted += (_, es) =>
            {
                try
                {
                    if (es != null && es.Cancelled)
                    {
                        Message.ShowError("Aucun lot trouvé", "Facturation");
                        return;
                    }

                    if (es.Result == null || es.Result.Count == 0)
                    {
                        Message.ShowError("Aucun lot trouvé", "Facturation");
                        return;
                    }
                    if (es.Result != null && es.Result.Count != 0)
                    {
                        listeBatchInit = es.Result;
                        listeBatch     = ClasseMethodeGenerique.RetourneDistinctNumLot(es.Result);
                        if (listeBatch != null && listeBatch.Count == 1)
                        {
                            Txt_NumBatch.Text     = listeBatch.First().NUMLOTRI;
                            this.Txt_NumBatch.Tag = listeBatch.First();

                            _lstCentreDuLot = ClasseMethodeGenerique.RetourneDistinctCentre(listeBatch.Where(t => t.NUMLOTRI == listeBatch.First().NUMLOTRI&& t.PERIODE == listeBatch.First().PERIODE).ToList());
                            if (_lstCentreDuLot != null && _lstCentreDuLot.Count == 1)
                            {
                                this.Txt_Centre.Text     = _lstCentreDuLot.First().CENTRE;
                                this.Txt_Centre.Tag      = _lstCentreDuLot.First();
                                ListeDesSelectTourneeLot = listeBatchInit.Where(t => t.FK_IDCENTRE == _lstCentreDuLot.First().FK_IDCENTRE&& t.NUMLOTRI == Txt_NumBatch.Text).ToList();
                                if (ListeDesSelectTourneeLot != null && ListeDesSelectTourneeLot.Count == 1)
                                {
                                    this.Txt_zone.Text = ListeDesSelectTourneeLot.First().TOURNEE;
                                }
                            }
                        }
                    }
                    ListeDesTourneeLot = new List <CsLotri>();
                    if (listeBatch.Count != 0)
                    {
                        ListeDesTourneeLot = ClasseMethodeGenerique.RetourneDistinctTournee(listeBatch);
                    }
                    this.btn_batch.IsEnabled     = true;
                    this.Txt_NumBatch.IsReadOnly = false;
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, "Erreur");
                }
            };
            service.ChargerLotriPourSaisieAsync(lesDeCentre, UserConnecte.matricule, IsLotCourant, Periode);
        }
        private void ChargerListeLotri(Dictionary <string, List <int> > lesDeCentre, bool IsLotCourant, string Periode)
        {
            _ListeLotri = new List <CsLotri>();
            try
            {
                FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));
                service.ChargerLotriPourEditionIndexCompleted += (s, args) =>
                {
                    try
                    {
                        if (args.Error != null && args.Cancelled)
                        {
                            Message.ShowError("Erreur d'invocation du service.", "Erreur");
                            return;
                        }

                        if (args.Result == null)
                        {
                            Message.ShowError("Aucune donnée retournée du système.", "Erreur");
                            return;
                        }
                        _ListeLotri              = args.Result;
                        ListeDesLotriAfficher    = new List <CsLotri>();
                        ListeDesTourneeLot       = new List <CsLotri>();
                        this.btn_batch.IsEnabled = true;
                        if (_ListeLotri.Count != 0)
                        {
                            ListeDesLotriAfficher = ClasseMethodeGenerique.RetourneDistinctLotri(_ListeLotri);
                            ListeDesTourneeLot    = ClasseMethodeGenerique.RetourneDistinctTournee(_ListeLotri);
                        }
                    }
                    catch (Exception ex)
                    {
                        Message.ShowError(ex, "Erreur");
                    }
                };
                service.ChargerLotriPourEditionIndexAsync(lesDeCentre, IsLotCourant, Periode);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #10
0
        private void Chargelotri(List <int> lstCentreHAbilite)
        {
            FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));

            service.RetourneListeLotNonTraiteCompleted += (_, es) =>
            {
                try
                {
                    if (es != null && es.Cancelled)
                    {
                        Message.ShowError("", "");
                        //LoadingManager.EndLoading(result);
                        return;
                    }

                    if (es.Result == null || es.Result.Count == 0)
                    {
                        Message.ShowError("", "");
                        //LoadingManager.EndLoading(result);
                        return;
                    }

                    if (es.Result != null && es.Result.Count != 0)
                    {
                        listeBatch = ClasseMethodeGenerique.RetourneDistinctNumLot(es.Result);
                    }

                    ListeDesTourneeLot = new List <CsLotri>();
                    if (listeBatch.Count != 0)
                    {
                        ListeDesTourneeLot = ClasseMethodeGenerique.RetourneDistinctTournee(listeBatch);
                    }

                    this.btn_batch.IsEnabled = true;
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, "Erreur");
                }
            };
            service.RetourneListeLotNonTraiteAsync(lstCentreHAbilite);
        }
        private void btn_Batch_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                List <object> _LstObj = new List <object>();
                _LstObj = Shared.ClasseMEthodeGenerique.RetourneListeObjet(ClasseMethodeGenerique.DistinctLotri(ListeLotri));
                Dictionary <string, string> _LstColonneAffich = new Dictionary <string, string>();
                _LstColonneAffich.Add("NUMLOTRI", "LOT");
                _LstColonneAffich.Add("PERIODE", "PERIODE");

                List <object>             obj  = Shared.ClasseMEthodeGenerique.RetourneListeObjet(_LstObj);
                MainView.UcListeGenerique ctrl = new MainView.UcListeGenerique(obj, _LstColonneAffich, false, "Lots");
                ctrl.Closed += new EventHandler(galatee_OkClickedBatch);
                ctrl.Show();
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, "Error");
            }
        }
        private void ChargerLotriPourEnquete(Dictionary <string, List <int> > lesDeCentre, bool IsFacturationCourante, string Periode)
        {
            FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));

            service.ChargerLotriPourEnqueteCompleted += (_, es) =>
            {
                try
                {
                    if (es != null && es.Cancelled)
                    {
                        Message.ShowError("", "");
                        return;
                    }

                    if (es.Result == null || es.Result.Count == 0)
                    {
                        Message.ShowError("", "");
                        return;
                    }

                    if (es.Result != null && es.Result.Count != 0)
                    {
                        listeBatchInit = es.Result;
                        listeBatch     = ClasseMethodeGenerique.RetourneDistinctNumLot(es.Result);
                    }

                    ListeDesTourneeLot = new List <CsLotri>();
                    if (listeBatch.Count != 0)
                    {
                        ListeDesTourneeLot = ClasseMethodeGenerique.RetourneDistinctTournee(listeBatch);
                    }

                    this.btn_batch.IsEnabled = true;
                }
                catch (Exception ex)
                {
                    Message.ShowError(ex, "Erreur");
                }
            };
            service.ChargerLotriPourEnqueteAsync(lesDeCentre, IsFacturationCourante, Periode);
        }
 private void btn_batch_Click_1(object sender, RoutedEventArgs e)
 {
     try
     {
         if (listeBatch != null)
         {
             List <CsLotri> _lstLotAfficher = ClasseMethodeGenerique.RetourneDistinctLotri(listeBatch);
             Dictionary <string, string> _LstColonneAffich = new Dictionary <string, string>();
             _LstColonneAffich.Add("NUMLOTRI", "LOT");
             _LstColonneAffich.Add("PERIODE", "PERIODE");
             List <object>             obj = Shared.ClasseMEthodeGenerique.RetourneListeObjet(_lstLotAfficher);
             MainView.UcListeGenerique ucg = new MainView.UcListeGenerique(obj, _LstColonneAffich, false, "Lots");
             ucg.Closed += new EventHandler(ucgReturn);
             ucg.Show();
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex, "Erreur");
     }
 }
        private void ChargerLotriAll(List <int> lstCentreHabilitation)
        {
            ListeLotri = new List <CsLotri>();
            FacturationServiceClient service = new FacturationServiceClient(Utility.Protocole(), Utility.EndPoint("Facturation"));

            service.ChargerLotriPourCalculCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                if (args.Result == null || args.Result.Count == 0)
                {
                    return;
                }

                ListeLotri = args.Result;
                this.btn_Batch.IsEnabled = true;
                ListeLotri = args.Result.Where(t => !ClasseMethodeGenerique.IsLotIsole(t)).OrderBy(p => p.NUMLOTRI).ToList();
                ListeLotri.AddRange(ClasseMethodeGenerique.LissLotIsoleUer(args.Result));
            };
            service.ChargerLotriPourCalculAsync(lstCentreHabilitation);
            service.CloseAsync();
        }
        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (this.cmbFacture.SelectedItem != null)
                {
                    prgBar.Visibility = System.Windows.Visibility.Visible;
                    CsEnteteFacture laFactureSelect = (CsEnteteFacture)this.cmbFacture.SelectedItem;
                    string          RDlc            = "FactureSimple";

                    List <CsEnteteFacture> lstClientSelect = new List <CsEnteteFacture>();
                    lstClientSelect.Add(laFactureSelect);
                    if (laFactureSelect.PRODUIT == SessionObject.Enumere.ElectriciteMT)
                    {
                        RDlc = "FactureSimpleMT";
                    }

                    if (laFactureSelect.PRODUIT == SessionObject.Enumere.Eau)
                    {
                        RDlc = "FactureSimpleO";
                    }

                    // Envoi des factures au service
                    Shared.ClasseMEthodeGenerique.SetMachineAndPortFromEndPoint(Utility.EndPoint("Facturation"));
                    FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));
                    string key = Utility.getKey();
                    service.EnvoyerFacturesAsync(lstClientSelect, RDlc);
                    service.EnvoyerFacturesCompleted += (er, res) =>
                    {
                        try
                        {
                            prgBar.Visibility = System.Windows.Visibility.Collapsed;

                            if (res.Error != null || res.Cancelled)
                            {
                                //LoadingManager.EndLoading(loaderHandler);
                                throw new Exception("Cannot display report");
                            }
                            if (res.Result != null)
                            {
                                List <CsFactureClient> lstGenerale = res.Result;
                                List <CsFactureClient> lesClient   = ClasseMethodeGenerique.RetourneDistinctClientFacture(res.Result);
                                string print = "Imprimé le " + DateTime.Now + " sur le poste " + SessionObject.LePosteCourant.NOMPOSTE + " par " + UserConnecte.nomUtilisateur + "(" + UserConnecte.matricule + ") du centre " + UserConnecte.LibelleCentre;

                                foreach (CsFactureClient item in lesClient)
                                {
                                    Dictionary <string, string> param = new Dictionary <string, string>();
                                    param.Add("TypeEdition", "Duplicata");
                                    param.Add("Print", print);
                                    List <CsFactureClient> lstDetailClient = lstGenerale.Where(t => t.Centre == item.Centre && t.Client == item.Client).ToList();
                                    Utility.ActionDirectOrientation <ServicePrintings.CsFactureClient, ServiceFacturation.CsFactureClient>(lstDetailClient, param, SessionObject.CheminImpression, RDlc, "Facturation", false);
                                    //prgBar.Visibility = System.Windows.Visibility.Collapsed;
                                }
                                this.DialogResult = true;
                            }
                        }
                        catch (Exception ex)
                        {
                            throw ex;
                        }
                        finally
                        {
                        }
                    };
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }