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 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");
     }
 }
 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 #4
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);
        }