private void RemplireComboBox(List <CsCanalisation> ListCompteurInit)
        {
            List <CsCanalisation> ListCompteurFinal = new List <CsCanalisation>();

            foreach (CsCanalisation item in ListCompteurInit)
            {
                CsProduit LeProduit = ListeDesProduitDuSite.FirstOrDefault(p => p.CODE == item.PRODUIT);
                if (LeProduit != null)
                {
                    item.LIBELLEPRODUIT = LeProduit.LIBELLE + "   " + item.NUMERO;
                }

                if (item.ETATCOMPT == SessionObject.Enumere.CompteurActifValeur)
                {
                    ListCompteurFinal.Add(item);
                }
            }
            Cbo_Compteur.ItemsSource       = null;
            Cbo_Compteur.ItemsSource       = ListCompteurFinal;
            Cbo_Compteur.DisplayMemberPath = "LIBELLEPRODUIT";
            if (ListCompteurFinal != null && ListCompteurFinal.Count != 0)
            {
                Cbo_Compteur.SelectedItem = ListCompteurFinal[0];
            }
            CanalisationClientSelectionner = (CsCanalisation)Cbo_Compteur.SelectedItem;
        }
        public void EnregistrerInfoSaisie(CsDemande _LaDemande)
        {
            try
            {
                CsCanalisation _LeCompteur = new CsCanalisation();

                _LeCompteur.CENTRE  = _LaDemande.LaDemande.CENTRE;
                _LeCompteur.CLIENT  = _LaDemande.LaDemande.CLIENT;
                _LeCompteur.PRODUIT = _LaDemande.LaDemande.PRODUIT;
                _LeCompteur.NUMDEM  = _LaDemande.LaDemande.NUMDEM;
                _LeCompteur.PROPRIO = "1";
                _LeCompteur.POINT   = 1;
                if (CanalisationAfficher != null && CanalisationAfficher.PK_ID != 0)
                {
                    _LeCompteur.PK_ID = CanalisationAfficher.PK_ID;
                }
                _LeCompteur.NUMERO       = string.IsNullOrEmpty(this.Txt_NumCompteur.Text) ? string.Empty : this.Txt_NumCompteur.Text;
                _LeCompteur.ANNEEFAB     = string.IsNullOrEmpty(this.Txt_AnneeFab.Text) ? string.Empty : this.Txt_AnneeFab.Text;
                _LeCompteur.ETATCOMPT    = SessionObject.Enumere.CompteurActifValeur;
                _LeCompteur.TYPECOMPTEUR = string.IsNullOrEmpty(this.Txt_CodeTypeCompteur.Text) ? "0" : this.Txt_CodeTypeCompteur.Text;

                _LeCompteur.MARQUE           = string.IsNullOrEmpty(this.Txt_CodeMarque.Text) ? "00" : this.Txt_CodeMarque.Text;
                _LeCompteur.DIAMETRE         = string.IsNullOrEmpty(this.Txt_CodeDiametre.Text) ? string.Empty : this.Txt_CodeDiametre.Text;
                _LeCompteur.CADRAN           = Convert.ToByte(Txt_CodeCadran.Text);
                _LeCompteur.COEFLECT         = string.IsNullOrEmpty(this.Txt_CoefDeMultiplication.Text) ? 0 : int.Parse(this.Txt_CoefDeMultiplication.Text);
                _LeCompteur.USERCREATION     = UserConnecte.matricule;
                _LeCompteur.USERMODIFICATION = UserConnecte.matricule;
                _LeCompteur.DATECREATION     = System.DateTime.Now;
                _LeCompteur.DATEMODIFICATION = System.DateTime.Now;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void RetourneInfoCanalisation(int fk_idcentre, string centre, string client, string produit, int?point)
        {
            List <CsCanalisation> _LstCannalisation = new List <CsCanalisation>();

            CanalisationAfficher = new CsCanalisation();
            AcceuilServiceClient service = new AcceuilServiceClient(Utility.Protocole(), Utility.EndPoint("Accueil"));

            service.RetourneCanalisationCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }

                CanalisationAfficher = args.Result.FirstOrDefault(p => p.PRODUIT == produit);
                if (CanalisationAfficher != null)
                {
                    _LstCannalisation.Add(CanalisationAfficher);
                    if (LaDemande.LaDemande.TYPEDEMANDE != SessionObject.Enumere.ChangementCompteur)
                    {
                        LaDemande.LstCanalistion = _LstCannalisation;
                    }
                    string Ordre = LaDemande.LaDemande.ORDRE;
                    if (LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.AbonnementSeul && LaDemande.LaDemande.ORDRE != "01")
                    {
                        Ordre = (int.Parse(LaDemande.LaDemande.ORDRE) - 1).ToString("00");
                    }

                    RetourneEvenement(fk_idcentre, centre, client, Ordre, produit, CanalisationAfficher.POINT);
                }
            };
            service.RetourneCanalisationAsync(fk_idcentre, centre, client, produit, point);
            service.CloseAsync();
        }
Beispiel #4
0
        void AfficherCannalisationDemande(CsCanalisation LaCanalisation)
        {
            this.Txt_ReferenceClient.Text = (string.IsNullOrEmpty(LaCanalisation.CLIENT)) ? string.Empty : LaCanalisation.CLIENT;

            this.Txt_NumCompteur.Text = (string.IsNullOrEmpty(LaCanalisation.NUMERO)) ? string.Empty : LaCanalisation.NUMERO;
            this.Txt_AnneeFab.Text    = (string.IsNullOrEmpty(LaCanalisation.ANNEEFAB)) ? string.Empty : LaCanalisation.ANNEEFAB;

            if (LaCanalisation.PRODUIT != SessionObject.Enumere.ElectriciteMT)
            {
                this.Txt_LibelleDiametre.Text = (string.IsNullOrEmpty(LaCanalisation.CODECALIBRECOMPTEUR)) ? string.Empty : LaCanalisation.CODECALIBRECOMPTEUR;
            }
            else
            {
                this.Txt_LibelleDiametre.Text = (string.IsNullOrEmpty(LaCanalisation.LIBELLETYPECOMPTAGE)) ? string.Empty : LaCanalisation.LIBELLETYPECOMPTAGE;
            }

            this.Txt_LibelleMarque.Text = (string.IsNullOrEmpty(LaCanalisation.LIBELLEMARQUE)) ? string.Empty : LaCanalisation.LIBELLEMARQUE;

            this.Txt_CodeTypeCompteur.Text = (LstTypeCompteur.FirstOrDefault(c => c.PK_ID == LaCanalisation.FK_IDTYPECOMPTEUR) == null) ? string.Empty : LstTypeCompteur.FirstOrDefault(c => c.PK_ID == LaCanalisation.FK_IDTYPECOMPTEUR).CODE;
            this.Txt_CodeMarque.Text       = (LstMarque.FirstOrDefault(c => c.PK_ID == LaCanalisation.FK_IDMARQUECOMPTEUR) == null) ? string.Empty : LstMarque.FirstOrDefault(c => c.PK_ID == LaCanalisation.FK_IDMARQUECOMPTEUR).CODE;
            if (LaCanalisation.CADRAN != null)
            {
                this.Txt_CodeCadran.Text = LaCanalisation.CADRAN.Value.ToString();
            }
            this.Txt_LibelleDiametre.Tag = LaCanalisation.FK_IDCALIBRE;
        }
        private void chk_Checked(object sender, RoutedEventArgs e)
        {
            demandecheck = ((CheckBox)sender).Tag as CsCanalisation;
            CsCanalisation _LaDemandeSelect = new CsCanalisation();

            if (this.dgDemande.SelectedItem != null)
            {
                _LaDemandeSelect = (CsCanalisation)this.dgDemande.SelectedItem;
            }
            if (_LaDemandeSelect.PK_ID != 0)
            {
                LstCompteurValide.Add(_LaDemandeSelect);
            }
        }
        private void RemplireCannalisationProduit(CsCanalisation _LaCannalisationSelect)
        {
            try
            {
                this.tab5_txt_NumCompteur.Text         = string.IsNullOrEmpty(_LaCannalisationSelect.NUMERO) ? string.Empty : _LaCannalisationSelect.NUMERO;
                this.tab5_txt_AnnefabricCompteur.Text  = string.IsNullOrEmpty(_LaCannalisationSelect.ANNEEFAB) ? string.Empty : _LaCannalisationSelect.ANNEEFAB;
                this.tab5_txt_LibelleTypeCompteur.Text = string.IsNullOrEmpty(_LaCannalisationSelect.LIBELLETYPECOMPTEUR) ? string.Empty : _LaCannalisationSelect.LIBELLETYPECOMPTEUR;
                this.tab5_txt_NumCompteur.Text         = string.IsNullOrEmpty(_LaCannalisationSelect.NUMERO) ? string.Empty : _LaCannalisationSelect.NUMERO;
                this.tab5_txt_MarqueCompteur.Text      = string.IsNullOrEmpty(_LaCannalisationSelect.LIBELLEMARQUE) ? string.Empty : _LaCannalisationSelect.LIBELLEMARQUE;


                if (_LaCannalisationSelect.PRODUIT != SessionObject.Enumere.ElectriciteMT)
                {
                    this.tab5_txt_LibelleDiametreCompteur.Text = string.IsNullOrEmpty(_LaCannalisationSelect.LIBELLEREGLAGECOMPTEUR) ? string.Empty : _LaCannalisationSelect.LIBELLEREGLAGECOMPTEUR;
                }
                else
                {
                    this.tab5_txt_LibelleDiametreCompteur.Text = string.IsNullOrEmpty(_LaCannalisationSelect.LIBELLETYPECOMPTAGE) ? string.Empty : _LaCannalisationSelect.LIBELLETYPECOMPTAGE;
                }

                this.tab5_txt_CoefDeMultiplication.Text = _LaCannalisationSelect.COEFLECT.ToString();
                if (_LaCannalisationSelect.COEFLECT == 0)
                {
                    this.tab5_Chk_CoefMultiplication.IsChecked = false;
                }
                else
                {
                    tab5_Chk_CoefMultiplication.IsChecked = true;
                }

                if (_LaCannalisationSelect.POSE != null)
                {
                    this.tab5_txt_DateMiseEnService.Text = Convert.ToDateTime(_LaCannalisationSelect.POSE).ToShortDateString();
                }

                if (_LaCannalisationSelect.DEPOSE != null)
                {
                    this.tab5_txt_DateFinServce.Text = Convert.ToDateTime(_LaCannalisationSelect.DEPOSE).ToShortDateString();
                }


                this.tab5_txt_LibelleDigit.Text = _LaCannalisationSelect.CADRAN.ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void CheckBox_Unchecked_1(object sender, RoutedEventArgs e)
        {
            CsCanalisation demandecheck = ((CheckBox)sender).Tag as CsCanalisation;


            CsCanalisation _LaDemandeSelect = new CsCanalisation();

            if (this.dgDemande.SelectedItem != null)
            {
                _LaDemandeSelect = (CsCanalisation)this.dgDemande.SelectedItem;
            }
            if (_LaDemandeSelect.PK_ID != 0)
            {
                LstCompteurValide = LstCompteurValide.Where(c => c.PK_ID != demandecheck.PK_ID).ToList();
            }
        }
        private void ChargerEvenementNonFacture(CsCanalisation LaCanalisationSelect)
        {
            List <CsEvenement> LstEvenement = new  List <CsEvenement>();

            try
            {
                FacturationServiceClient service = new FacturationServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Facturation"));
                service.RetourneEvenementNonFactCompleted += (s, args) =>
                {
                    try
                    {
                        if (args != null && args.Cancelled)
                        {
                            Message.ShowError("Erreur survenue lors de l'appel serveur. Veuillez reessayer svp ", "");
                            return;
                        }

                        if (args.Result == null)
                        {
                            Message.ShowError("Aucune donnée retournée par le système.", "Information");
                            return;
                        }

                        LstEvenement.Clear();
                        LstEvenement.AddRange(args.Result.EventLotriNull);
                        LstEvenement.AddRange(args.Result.EventPageri);
                        LstEvenement.AddRange(args.Result.EventPagisol);

                        if (LstEvenement.Count != 0)
                        {
                            LstEvenement = AffecterInfoPrecedente(LstEvenement.OrderBy(p => p.NUMEVENEMENT).ToList());
                            UcSaisieIndividuelle Ctrl = new UcSaisieIndividuelle(LstEvenement, args.Result.ConsoPrecedent, args.Result.CONSOMOYENNE);
                            Ctrl.Show();
                        }
                    }
                    catch (Exception ex)
                    {
                        Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
                    }
                };
                service.RetourneEvenementNonFactAsync(LaCanalisationSelect);
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
            }
        }
 private void ChargerDetailProgramme(ServiceAccueil.CsProgarmmation leProgramme)
 {
     try
     {
         AcceuilServiceClient service1 = new AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil"));
         service1.ChargerListeDonneeProgramReeditionCompleted += (sr, res) =>
         {
             if (res != null && res.Cancelled)
             {
                 return;
             }
             if (res.Result != null && res.Result.Count != 0)
             {
                 Programme = res.Result;
                 var lstElmtDevis = Programme.Select(p => new { p.NUMDEM, p.CLIENT, p.CODEMATERIELDEVIS, p.NOM, p.COMPTEUR }).Distinct().ToList();
                 List <CsCanalisation> lstProg = new List <CsCanalisation>();
                 foreach (var item in lstElmtDevis)
                 {
                     CsCanalisation Prog = new CsCanalisation();
                     Prog.NUMDEM        = item.NUMDEM;
                     Prog.CLIENT        = item.CLIENT;
                     Prog.NOMCLIENT     = item.NOM;
                     Prog.LIBELLEMARQUE = item.CODEMATERIELDEVIS;
                     Prog.NUMERO        = item.COMPTEUR;
                     lstProg.Add(Prog);
                 }
                 dgDemande.ItemsSource                  = null;
                 dgDemande.ItemsSource                  = lstProg;
                 this.txt_Equipe.Text                   = leProgramme.LIBELLEEQUIPE;
                 this.txt_DateProgramme.Text            = leProgramme.DATEPROGRAMME.Value.ToShortDateString();
                 Programme.ForEach(t => t.NUMFOURNITURE = leProgramme.LIBELLEEQUIPE);
                 Programme.ForEach(t => t.NUMDEVIS      = leProgramme.DATEPROGRAMME.Value.ToShortDateString());
             }
             else
             {
                 Message.Show("Aucune demande trouvé", "Information");
             }
         };
         service1.ChargerListeDonneeProgramReeditionAsync(leProgramme.NUMPROGRAMME, leProgramme.FK_IDEQUIPE.Value);
         service1.CloseAsync();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        void AfficherCannalisationDemande(CsCanalisation LaCanalisation, CsEvenement LeEvt)
        {
            CsEvenement _LeEvt = new CsEvenement();

            if ((LaDemande.LeTypeDemande.CODE == SessionObject.Enumere.ChangementCompteur && NumCompteur == 1) || LaDemande.LeTypeDemande.CODE != SessionObject.Enumere.ChangementCompteur)
            {
                this.Txt_NumCompteur.Text = (string.IsNullOrEmpty(LaCanalisation.NUMERO)) ? string.Empty : LaCanalisation.NUMERO;
                this.Txt_AnneeFab.Text    = (string.IsNullOrEmpty(LaCanalisation.ANNEEFAB)) ? string.Empty : LaCanalisation.ANNEEFAB;

                this.Txt_CodeTypeCompteur.Text = (string.IsNullOrEmpty(LaCanalisation.TYPECOMPTEUR)) ? string.Empty : LaCanalisation.TYPECOMPTEUR;
                CsTcompteur _LeTypeCompte = ClasseMEthodeGenerique.RetourneObjectFromList(LstTypeCompteur, this.Txt_CodeTypeCompteur.Text, "CODE");
                if (!string.IsNullOrEmpty(_LeTypeCompte.LIBELLE))
                {
                    LeTypeCompteurSelect = _LeTypeCompte;
                    this.Txt_LibelleTypeCompteur.Text = _LeTypeCompte.LIBELLE;
                }

                this.Txt_CodeMarque.Text = (string.IsNullOrEmpty(LaCanalisation.MARQUE)) ? string.Empty : LaCanalisation.MARQUE;
                CsMarqueCompteur _LaMarque = ClasseMEthodeGenerique.RetourneObjectFromList(LstMarque, this.Txt_CodeMarque.Text, "CODE");
                if (!string.IsNullOrEmpty(_LaMarque.LIBELLE))
                {
                    this.Txt_LibelleMarque.Text = _LaMarque.LIBELLE;
                }

                this.Txt_CodeCadran.Text = LaCanalisation.CADRAN.Value.ToString();
                CsCadran _LeCadran = ClasseMEthodeGenerique.RetourneObjectFromList(LstCadran, this.Txt_CodeCadran.Text, "CODECADRAN");
                if (!string.IsNullOrEmpty(_LeCadran.LIBELLE))
                {
                    this.Txt_LibelleDigit.Text = _LeCadran.LIBELLE;
                    LeCadranSelect             = _LeCadran;
                }

                this.Txt_CodeDiametre.Text = (string.IsNullOrEmpty(LaCanalisation.DIAMETRE)) ? string.Empty : LaCanalisation.DIAMETRE;
                CsDiacomp _LeDiametre = ClasseMEthodeGenerique.RetourneObjectFromList(LstDiametre, this.Txt_CodeDiametre.Text, "CODE");
                if (!string.IsNullOrEmpty(_LeDiametre.LIBELLE))
                {
                    LeDiametreSelect = _LeDiametre;
                    this.Txt_LibelleDiametre.Text = _LeDiametre.LIBELLE;
                }

                if (LaCanalisation.COEFLECT != 0)
                {
                    this.Chk_CoefMultiplication.IsChecked = true;
                }
            }
        }
        private void CheckBox_Checked_2(object sender, RoutedEventArgs e)
        {
            demandecheck = ((CheckBox)sender).Tag as CsCanalisation;

            CsCanalisation _LaDemandeSelect = new CsCanalisation();

            if (this.dgDemande.SelectedItem != null)
            {
                _LaDemandeSelect = (CsCanalisation)this.dgDemande.SelectedItem;
            }
            if (_LaDemandeSelect.PK_ID != null && _LaDemandeSelect.PK_ID != 0)
            {
                LstDemandeValide.Add(demandecheck);
            }

            MiseAjourElementDevis();
        }
        private void ChargerDonneeCompteurSelectionne(CsCanalisation compteur)
        {
            try
            {
                CsSaisiIndexIndividuel prec = horslot.IndexInfo.FirstOrDefault(i => i.POINT == compteur.POINT);

                // renseigner les infos de l'évenement précédent

                Txt_periodePrec.Text    = prec.ConsoPrecedent.First().PERIODE;
                Txt_ReadingPrec.Text    = prec.ConsoPrecedent.First().INDEXEVT == null ? string.Empty:prec.ConsoPrecedent.First().INDEXEVT.ToString();
                Txt_CasLibellePrec.Text = prec.ConsoPrecedent.First().LIBELLECASPRECEDENT;
                txt_coefPrec.Text       = prec.ConsoPrecedent.First().COEFLECT == null ?string.Empty: prec.ConsoPrecedent.First().COEFLECT.ToString();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #13
0
        private void RemplireOngletEvenement(CsCanalisation _LeEvtSelect, CsEvenement _leDernierEvt)
        {
            if (!string.IsNullOrEmpty(_leDernierEvt.DERPERF))
            {
                this.Txt_periodeFactureF.Text = ClasseMEthodeGenerique.FormatPeriodeMMAAAA(_leDernierEvt.DERPERF);
            }

            if (!string.IsNullOrEmpty(_leDernierEvt.DERPERFN))
            {
                this.Txt_periodeFactureN.Text = ClasseMEthodeGenerique.FormatPeriodeMMAAAA(_leDernierEvt.DERPERFN);
            }

            this.Txt_IndexFacture.Text   = string.IsNullOrEmpty(_leDernierEvt.INDEXEVT.ToString()) ? string.Empty : _leDernierEvt.INDEXEVT.ToString();
            this.Txt_ConsoFacture.Text   = string.IsNullOrEmpty(_leDernierEvt.CONSO.ToString()) ? string.Empty : _leDernierEvt.CONSO.ToString();
            this.Txt_CasFacture.Text     = string.IsNullOrEmpty(_leDernierEvt.CAS) ? string.Empty : _leDernierEvt.CAS;
            this.Txt_Quantite.Text       = string.IsNullOrEmpty(_leDernierEvt.CONSOFAC.ToString()) ? string.Empty : _leDernierEvt.CONSOFAC.ToString();
            this.Txt_Quantite.IsReadOnly = true;
        }
 private void OKButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (SessionObject.Enumere.ElectriciteMT == this.Txt_produit.Text)
         {
             ChargerLstEvenementNonFacture(LstCanalisationProduit);
         }
         else
         {
             CsCanalisation _LaCanalisationSelect = (CsCanalisation)this.Cbo_Compteur.SelectedItem;
             ChargerLstEvenementNonFacture(LstCanalisationProduit);
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex, Galatee.Silverlight.Resources.Langue.errorTitle);
     }
 }
 private void dtgCompteur_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (this.dtgCompteur.SelectedIndex >= 0)
         {
             CsCanalisation _LeCompteurSelect = (CsCanalisation)this.dtgCompteur.SelectedItem;
             RemplireCannalisationProduit(_LeCompteurSelect);
             if (laDetailDemande.LstEvenement != null && laDetailDemande.LstEvenement.Count != 0)
             {
                 RemplireOngletEvenement(laDetailDemande.LstEvenement.Where(p => p.PRODUIT == _LeCompteurSelect.PRODUIT && p.POINT == _LeCompteurSelect.POINT).ToList());
             }
         }
     }
     catch (Exception ex)
     {
         Message.ShowError(ex.Message, Galatee.Silverlight.Resources.Accueil.Langue.lbl_Menu);
     }
 }
        private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            LeCompteurSelect = new CsCanalisation();
            indexSelect      = this.dataGrid1.SelectedIndex;

            if (this.dataGrid1.SelectedIndex >= 0)
            {
                LeCompteurSelect  = (CsCanalisation)this.dataGrid1.SelectedItem;
                LeEvenementSelect = ClasseMEthodeGenerique.DernierEvenementFacture(LstEvenement, LaDemande.LaDemande.PRODUIT);
                if (LeEvenementSelect == null)
                {
                    LeEvenementSelect = ClasseMEthodeGenerique.DernierEvenement(LstEvenement, LaDemande.LaDemande.PRODUIT);
                }

                DateDernierEvt = LeEvenementSelect.DATEEVT;
                IndexInit      = LeEvenementSelect.INDEXEVT;
                RemplireOngletEvenement(LeCompteurSelect, LeEvenementSelect);
            }
        }
Beispiel #17
0
        private void dgMyDataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            DataGrid dg         = (sender as DataGrid);
            var      allObjects = dg.ItemsSource as List <CsCanalisation>;

            if (dg.SelectedItem != null)
            {
                CsCanalisation SelectedObject = (CsCanalisation)dg.SelectedItem;
                if (SelectedObject.IsSelect == false)
                {
                    SelectedObject.IsSelect       = true;
                    SelectedObject.ETATDUCOMPTEUR = "Livré";
                }
                else
                {
                    SelectedObject.IsSelect       = false;
                    SelectedObject.ETATDUCOMPTEUR = "";
                }
            }
        }
 public UcDemandeDetailModifCompteur(CsCanalisation _leCompteur, string _typeDemande)
 {
     InitializeComponent();
     Translate();
     TypeDemande          = _typeDemande;
     CanalisationAfficher = _leCompteur;
     if (LaDemande.LstCanalistion == null)
     {
         LaDemande.LstCanalistion = new List <CsCanalisation>();
     }
     if (LaDemande.LstEvenement == null)
     {
         LaDemande.LstEvenement = new List <CsEvenement>();
     }
     ChargerCadran();
     ChargerMarque();
     ChargerTypeCompteur();
     ChargerDiametreCompteur();
     AfficherCannalisationDemande(_leCompteur);
 }
        private void Cbo_Compteur_SelectionChanged_1(object sender, SelectionChangedEventArgs e)
        {
            try
            {
                CsCanalisation compteur = Cbo_Compteur.SelectedItem as CsCanalisation;
                compteurSelected = compteur;
                if (compteur == null)
                {
                    return;
                }

                CsSaisiIndexIndividuel prec = horslot.IndexInfo.FirstOrDefault(i => i.POINT == compteur.POINT);
                LeEvtSelect = prec.ConsoPrecedent.First();
                RenseignerInfoConsommationPrecedente(prec.ConsoPrecedent);
            }
            catch (Exception ex)
            {
                Message.ShowError(ex, "Erreur");
            }
        }
        void _ctrl_Closed(object sender, EventArgs e)
        {
            //UcListeCompteurAuto ctr = sender as UcListeCompteurAuto;
            CsCompteur  _LeCompteurSelectDatagrid = new CsCompteur();
            CsTcompteur _LeCompteurSelect         = new CsTcompteur();


            //_LeCompteurSelectDatagrid = (CsCompteur)ctr.dataGrid1.SelectedItem;
            LeCompteurSelect.COMPTEUR = _LeCompteurSelectDatagrid.NUMERO;
            LeCompteurSelect.MCOMPT   = _LeCompteurSelectDatagrid.MARQUE;
            //LeCompteurSelect.TCOMP = _LeCompteurSelectDatagrid.TCOMPT;
            LeCompteurSelect.ANNEEFAB = _LeCompteurSelectDatagrid.ANNEEFAB;
            LeCompteurSelect.POINT    = determinePoint(LeCompteurSelect.TCOMP);
            LeCompteurSelect.SAISIE   = "Oui";

            //Inserer canalisation
            CsCanalisation _LeCanalisation = new CsCanalisation();
            //_LeCanalisation.CENTRE = LaDemande.CENTRE;
            //_LeCanalisation.CLIENT = LaDemande.CLIENT;
            //_LeCanalisation.ORDRE = LaDemande.ORDRE;
            //_LeCanalisation.POINT = LaDemande.POINT;
            //_LeCanalisation.ANNEEFAB = string.IsNullOrEmpty(_LeCompteurSelectDatagrid.ANNEEFAB) ? string.Empty : _LeCompteurSelectDatagrid.ANNEEFAB;
            //_LeCanalisation.MCOMPT = string.IsNullOrEmpty(_LeCompteurSelectDatagrid.MCOMPT) ? string.Empty : _LeCompteurSelectDatagrid.MCOMPT;
            //_LeCanalisation.COMPTEUR = string.IsNullOrEmpty(_LeCompteurSelectDatagrid.COMPTEUR) ? string.Empty : _LeCompteurSelectDatagrid.COMPTEUR ;
            //_LeCanalisation.CADCOMPT = string.IsNullOrEmpty(_LeCompteurSelectDatagrid.CADCOMP) ? string.Empty : _LeCompteurSelectDatagrid.CADCOMP;
            //_LeCanalisation.TCOMPT = LeCompteurSelect.PK_TYPE ;
            //if (LaDemande.TYPEDEMANDE == SessionObject.Enumere.AbonnementSeul ||
            //    LaDemande.TYPEDEMANDE == SessionObject.Enumere.BranchementAbonement)
            //    _LeCanalisation.ETATCOMPT = SessionObject.Enumere.CompteurActifValeur;

            //if (!string.IsNullOrEmpty(_LeCanalisation.COMPTEUR))
            //{
            //    if (LstCanalisation.FirstOrDefault(p=>p.TCOMPT  == _LeCanalisation.TCOMPT  )==null )
            //    LstCanalisation.Add(_LeCanalisation);
            //}
            UcDemandeSaisieCompteurMt ctrl = new UcDemandeSaisieCompteurMt(LaDemande, LeCompteurSelect);

            ctrl.Closed += new EventHandler(ctrl_Closed);
            ctrl.Show();
        }
        private void chk_Checked(object sender, RoutedEventArgs e)
        {
            List <CsCanalisation> lesElementsDesDevisSelect = new List <CsCanalisation>();

            demandecheck = ((CheckBox)sender).Tag as CsCanalisation;
            CsCanalisation _LaDemandeSelect = new CsCanalisation();

            if (this.dgDemande.SelectedItem != null)
            {
                _LaDemandeSelect = (CsCanalisation)this.dgDemande.SelectedItem;
            }
            if (_LaDemandeSelect.PK_ID != 0)
            {
                List <CsCanalisation> lesDemandeSelect = ((List <CsCanalisation>) this.dgDemande.ItemsSource).Where(t => t.IsSelect == true).ToList();
                foreach (CsCanalisation item in lesDemandeSelect)
                {
                    lesElementsDesDevisSelect.AddRange(LstCannalisation.Where(t => t.FK_IDDEMANDE == item.FK_IDDEMANDE).ToList());
                }
            }
            var reglemntParModereg = (from p in lesElementsDesDevisSelect
                                      group new { p } by new { p.LIBELLEMATERIEL, p.FK_IDMATERIELDEVIS } into pResult
                                      select new
            {
                pResult.Key.LIBELLEMATERIEL,
                pResult.Key.FK_IDMATERIELDEVIS,
                QUANTITE = (int)pResult.Where(t => t.p.FK_IDMATERIELDEVIS == pResult.Key.FK_IDMATERIELDEVIS).Sum(o => o.p.QUANTITE)
            });
            List <CsCanalisation> lstEltDevisAffiche = new List <CsCanalisation>();

            foreach (var item in reglemntParModereg)
            {
                lstEltDevisAffiche.Add(new CsCanalisation()
                {
                    LIBELLEMATERIEL = item.LIBELLEMATERIEL, QUANTITE = item.QUANTITE
                });
            }

            dgAutreMateriel.ItemsSource = null;
            dgAutreMateriel.ItemsSource = lstEltDevisAffiche;
        }
        private void RemplireOngletEvenement(CsCanalisation _LeEvtSelect, CsEvenement _leDernierEvt)
        {
            //LaDemande.DRES = DateResil;
            //this.Txt_PeriodeEnCour.Text = (!string.IsNullOrEmpty(LaDemande.DRES)) ? LaDemande.DRES.Substring(3, 7) : string.Empty;
            //if (string.IsNullOrEmpty(this.Txt_PeriodeEnCour.Text))
            //this.Txt_PeriodeEnCour.Text = (!string.IsNullOrEmpty(LaDemande.PERIODE)) ? LaDemande.PERIODE : string.Empty;
            //this.Txt_point.Text = _LeEvtSelect.POINT.ToString();

            if (!string.IsNullOrEmpty(_leDernierEvt.DERPERF))
            {
                this.Txt_periodeFactureF.Text = ClasseMEthodeGenerique.FormatPeriodeMMAAAA(_leDernierEvt.DERPERF);
            }

            if (!string.IsNullOrEmpty(_leDernierEvt.DERPERFN))
            {
                this.Txt_periodeFactureN.Text = ClasseMEthodeGenerique.FormatPeriodeMMAAAA(_leDernierEvt.DERPERFN);
            }

            this.Txt_IndexFacture.Text = string.IsNullOrEmpty(_leDernierEvt.INDEXEVT.ToString()) ? string.Empty : _leDernierEvt.INDEXEVT.ToString();
            this.Txt_ConsoFacture.Text = string.IsNullOrEmpty(_leDernierEvt.CONSO.ToString()) ? string.Empty : _leDernierEvt.CONSO.ToString();
            this.Txt_CasFacture.Text   = string.IsNullOrEmpty(_leDernierEvt.CAS) ? string.Empty : _leDernierEvt.CAS;
        }
 public UcDemandeDetailModifCompteur(CsDemande _LaDemande, int _NumCompteur, bool _IsUpdate)
 {
     InitializeComponent();
     Translate();
     LaDemande   = _LaDemande;
     TypeDemande = _LaDemande.LaDemande.TYPEDEMANDE;
     if (LaDemande.LstCanalistion == null)
     {
         LaDemande.LstCanalistion = new List <CsCanalisation>();
     }
     if (LaDemande.LstEvenement == null)
     {
         LaDemande.LstEvenement = new List <CsEvenement>();
     }
     CanalisationAfficher = LaDemande.LstCanalistion[0];
     IsUpdate             = _IsUpdate;
     ChargerCadran();
     ChargerMarque();
     ChargerTypeCompteur();
     ChargerDiametreCompteur();
     NumCompteur = _NumCompteur;
     ChargerDonnees();
 }
        private void RetourneInfoCompteur(int fk_idcentre, string centre, string client, string produit)
        {
            CsCanalisation       CompteurClientRecherche = new CsCanalisation();
            AcceuilServiceClient service = new AcceuilServiceClient(Utility.Protocole(), Utility.EndPoint("Accueil"));

            service.RetourneCanalisationCompleted += (s, args) =>
            {
                if (args != null && args.Cancelled)
                {
                    return;
                }
                if (args.Result != null)
                {
                    CompteurClientRecherche = args.Result.FirstOrDefault(p => p.PRODUIT == produit);
                    TabItem tabItem1 = new TabItem();
                    tabItem1.Header             = "ANCIENNES DONNEES";
                    laDemande.LaDemande.PRODUIT = CompteurClientRecherche.PRODUIT;
                    _LectrlCompteur             = new UcDemandeDetailModifCompteur(CompteurClientRecherche, laDemande.LaDemande.TYPEDEMANDE);

                    tabItem1.Content = _LectrlCompteur;
                    tabControl1.Items.Add(tabItem1);
                    tabControl1.SelectedItem = tabItem1;

                    //laDemande.Branchement.PK_ID = BranchementClientRecherche.PK_ID;
                    //laDemande.Branchement.FK_IDCLIENT = BranchementClientRecherche.FK_IDCLIENT;

                    TabItem tabItem2 = new TabItem();
                    tabItem2.Header  = "NOUVELLES DONNEES";
                    _LectrlCompteur  = new UcDemandeDetailModifCompteur(laDemande, 1, true);
                    tabItem2.Content = _LectrlCompteur;
                    tabControl1.Items.Add(tabItem2);
                    tabControl1.SelectedItem = tabItem2;
                }
            };
            service.RetourneCanalisationAsync(fk_idcentre, centre, client, produit, null);
            service.CloseAsync();
        }
 void ChargerDonnees()
 {
     try
     {
         if (TypeDemande != SessionObject.Enumere.ModificationCompteur)
         {
             CsCanalisation _LaCannalisationAfficher = new CsCanalisation();
             if (LaDemande.LstCanalistion != null && LaDemande.LstCanalistion.Count != 0)
             {
                 _LaCannalisationAfficher = LaDemande.LstCanalistion[0];
             }
             CsEvenement _LeEvtAffiche = new CsEvenement();
             if (LaDemande.LstCanalistion != null && LaDemande.LstCanalistion.Count != 0)
             {
                 _LeEvtAffiche = LaDemande.LstEvenement[0];
             }
             AfficherCannalisationDemande(_LaCannalisationAfficher, _LeEvtAffiche);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 private void Cbo_Compteur_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     CanalisationClientSelectionner = (CsCanalisation)Cbo_Compteur.SelectedItem;
     RetourneInfoDernierEvenemt(LaDemande.LaDemande.FK_IDCENTRE, LaDemande.LaDemande.CENTRE, LaDemande.LaDemande.CLIENT, LaDemande.LaDemande.ORDRE, LaDemande.LaDemande.PRODUIT, CanalisationClientSelectionner.POINT);
 }
Beispiel #27
0
        void AfficherCannalisation(CsCanalisation NouvoCompteur, CsCanalisation AncienCompteur)
        {
            this.Txt_NumCompteur.Text = (string.IsNullOrEmpty(AncienCompteur.NUMERO)) ? string.Empty : AncienCompteur.NUMERO;
            this.Txt_AnneeFab.Text    = string.IsNullOrEmpty(AncienCompteur.ANNEEFAB) ? string.Empty : AncienCompteur.ANNEEFAB;

            this.Txt_CodeTypeCompteur.Text    = (string.IsNullOrEmpty(AncienCompteur.TYPECOMPTEUR)) ? string.Empty : AncienCompteur.TYPECOMPTEUR;
            this.Txt_LibelleTypeCompteur.Text = (string.IsNullOrEmpty(AncienCompteur.LIBELLETYPECOMPTEUR)) ? string.Empty : AncienCompteur.LIBELLETYPECOMPTEUR;

            this.Txt_CodeMarque.Text    = (string.IsNullOrEmpty(AncienCompteur.MARQUE)) ? string.Empty : AncienCompteur.MARQUE;
            this.Txt_LibelleMarque.Text = (string.IsNullOrEmpty(AncienCompteur.LIBELLEMARQUE)) ? string.Empty : AncienCompteur.LIBELLEMARQUE;

            this.Txt_LibelleDiametre.Text = (string.IsNullOrEmpty(AncienCompteur.CODECALIBRECOMPTEUR)) ? string.Empty : AncienCompteur.CODECALIBRECOMPTEUR;

            this.Txt_CodeCadran.Text = AncienCompteur.CADRAN == null ? string.Empty : AncienCompteur.CADRAN.Value.ToString();


            this.Txt_NouvNumCompteur.Text = (string.IsNullOrEmpty(AncienCompteur.NUMERO)) ? string.Empty : NouvoCompteur.NUMERO;
            this.Txt_NouvAnneeFab.Text    = string.IsNullOrEmpty(NouvoCompteur.ANNEEFAB) ? string.Empty : NouvoCompteur.ANNEEFAB;

            this.Txt_NouvCodeTypeCompteur.Text    = (string.IsNullOrEmpty(NouvoCompteur.TYPECOMPTEUR)) ? string.Empty : NouvoCompteur.TYPECOMPTEUR;
            this.Txt_NouvLibelleTypeCompteur.Text = (string.IsNullOrEmpty(NouvoCompteur.LIBELLETYPECOMPTEUR)) ? string.Empty : NouvoCompteur.LIBELLETYPECOMPTEUR;

            this.Txt_NouvCodeMarque.Text    = (string.IsNullOrEmpty(NouvoCompteur.MARQUE)) ? string.Empty : NouvoCompteur.MARQUE;
            this.Txt_NouvLibelleMarque.Text = (string.IsNullOrEmpty(NouvoCompteur.LIBELLEMARQUE)) ? string.Empty : NouvoCompteur.LIBELLEMARQUE;

            this.Txt_NouvLibelleDiametre.Text = (string.IsNullOrEmpty(NouvoCompteur.CODECALIBRECOMPTEUR)) ? string.Empty : NouvoCompteur.CODECALIBRECOMPTEUR;

            this.Txt_NouvCodeCadran.Text = NouvoCompteur.CADRAN == null ? string.Empty : NouvoCompteur.CADRAN.Value.ToString();

            if (this.Txt_NumCompteur.Text != this.Txt_NouvNumCompteur.Text)
            {
                this.Txt_NouvNumCompteur.FontWeight = FontWeights.ExtraBold;
                this.Txt_NouvNumCompteur.FontStyle  = FontStyles.Italic;
            }
            if (this.Txt_NouvAnneeFab.Text != this.Txt_AnneeFab.Text)
            {
                this.Txt_NouvAnneeFab.FontWeight = FontWeights.ExtraBold;
                this.Txt_NouvAnneeFab.FontStyle  = FontStyles.Italic;
            }
            if (this.Txt_CodeTypeCompteur.Text != this.Txt_NouvCodeTypeCompteur.Text)
            {
                this.Txt_NouvCodeTypeCompteur.FontWeight    = FontWeights.ExtraBold;
                this.Txt_NouvLibelleTypeCompteur.FontWeight = FontWeights.ExtraBold;
                this.Txt_NouvCodeTypeCompteur.FontStyle     = FontStyles.Italic;
                this.Txt_NouvLibelleTypeCompteur.FontStyle  = FontStyles.Italic;
            }
            if (this.Txt_NouvCodeMarque.Text != this.Txt_CodeMarque.Text)
            {
                this.Txt_NouvCodeMarque.FontWeight    = FontWeights.ExtraBold;
                this.Txt_NouvLibelleMarque.FontWeight = FontWeights.ExtraBold;
                this.Txt_NouvCodeMarque.FontStyle     = FontStyles.Italic;
                this.Txt_NouvLibelleMarque.FontStyle  = FontStyles.Italic;
            }
            if (this.Txt_NouvLibelleDiametre.Text != this.Txt_LibelleDiametre.Text)
            {
                this.Txt_NouvLibelleDiametre.FontWeight = FontWeights.ExtraBold;
                this.Txt_NouvLibelleDiametre.FontStyle  = FontStyles.Italic;
            }
            if (this.Txt_NouvCodeCadran.Text != this.Txt_CodeCadran.Text)
            {
                this.Txt_NouvCodeCadran.FontWeight = FontWeights.ExtraBold;
                this.Txt_NouvCodeCadran.FontStyle  = FontStyles.Italic;
            }
        }
Beispiel #28
0
        void galatee_Check(object sender, EventArgs e)
        {
            UcDetailCompteur ctrs = sender as UcDetailCompteur;

            if (ctrs.isOkClick)
            {
                int i = 1;
                List <CsCompteur> _LesCompteurs = (List <CsCompteur>)ctrs.MyObject;

                foreach (CsCompteur _LeCompteur in _LesCompteurs)
                {
                    CsCanalisation canal = new CsCanalisation()
                    {
                        CENTRE              = demandecheck.CENTRE,
                        CLIENT              = demandecheck.CLIENT,
                        NUMDEM              = demandecheck.NUMDEM,
                        PRODUIT             = demandecheck.PRODUIT,
                        PROPRIO             = "1",
                        MARQUE              = _LeCompteur.MARQUE,
                        TYPECOMPTEUR        = _LeCompteur.TYPECOMPTEUR,
                        NUMERO              = _LeCompteur.NUMERO,
                        INFOCOMPTEUR        = _LeCompteur.NUMERO,
                        FK_IDCENTRE         = demandecheck.FK_IDCENTRE,
                        FK_IDPRODUIT        = int.Parse(demandecheck.FK_IDPRODUIT.ToString()),
                        FK_IDMAGAZINVIRTUEL = _LeCompteur.PK_ID,
                        //FK_IDCOMPTEUR  = _LeCompteur.PK_ID,
                        FK_IDTYPECOMPTEUR   = _LeCompteur.FK_IDTYPECOMPTEUR,
                        FK_IDMARQUECOMPTEUR = _LeCompteur.FK_IDMARQUECOMPTEUR,
                        FK_IDCALIBRE        = _LeCompteur.FK_IDCALIBRECOMPTEUR,
                        FK_IDDEMANDE        = demandecheck.PK_ID,
                        LIBELLETYPECOMPTEUR = _LeCompteur.NUMERO,
                        POSE              = System.DateTime.Now,
                        USERCREATION      = UserConnecte.matricule,
                        USERMODIFICATION  = UserConnecte.matricule,
                        DATECREATION      = System.DateTime.Now,
                        DATEMODIFICATION  = System.DateTime.Now,
                        FK_IDPROPRIETAIRE = 1,
                    };
                    if (leReglageCompteur != null)
                    {
                        canal.FK_IDREGLAGECOMPTEUR = leReglageCompteur.PK_ID;
                    }

                    lesCanalisationACree.Add(canal);

                    if (i == _LesCompteurs.Count)
                    {
                        LstDemande.FirstOrDefault(c => c.NUMDEM == ((CsDemandeBase)this.dgDemande.SelectedItem).NUMDEM).COMPTEUR += _LeCompteur.NUMERO;
                        LstDemande.FirstOrDefault(c => c.FK_IDMAGAZINVIRTUEL == ((CsDemandeBase)this.dgDemande.SelectedItem).FK_IDMAGAZINVIRTUEL).FK_IDMAGAZINVIRTUEL += _LeCompteur.PK_ID;
                    }
                    else
                    {
                        LstDemande.FirstOrDefault(c => c.NUMDEM == ((CsDemandeBase)this.dgDemande.SelectedItem).NUMDEM).COMPTEUR += _LeCompteur.NUMERO + ", ";
                        LstDemande.FirstOrDefault(c => c.FK_IDMAGAZINVIRTUEL == ((CsDemandeBase)this.dgDemande.SelectedItem).FK_IDMAGAZINVIRTUEL).FK_IDMAGAZINVIRTUEL += _LeCompteur.PK_ID;
                    }


                    i++;
                }
                //dgDemande.ItemsSource = null;
                dgDemande.ItemsSource = LstDemande;
            }
        }
Beispiel #29
0
        public CsTcompteur  EnregisterCompteur()
        {
            try
            {
                CsCanalisation _LeCompteur = new CsCanalisation();
                _LeCompteur.CENTRE           = LaDemande.LaDemande.CENTRE;
                _LeCompteur.CLIENT           = LaDemande.LaDemande.CLIENT;
                _LeCompteur.PRODUIT          = LaDemande.LaDemande.PRODUIT;
                _LeCompteur.NUMDEM           = LaDemande.LaDemande.NUMDEM;
                _LeCompteur.POINT            = int.Parse(LeCompteurSelect.POINT.ToString());
                _LeCompteur.TYPECOMPTEUR     = LeCompteurSelect.CODE;
                _LeCompteur.TYPECOMPTAGE     = LaDemande.Branchement.TYPECOMPTAGE;
                _LeCompteur.NUMERO           = string.IsNullOrEmpty(this.Txt_NumCompteur.Text) ? string.Empty : this.Txt_NumCompteur.Text;
                _LeCompteur.ANNEEFAB         = string.IsNullOrEmpty(this.Txt_AnneeFab.Text) ? string.Empty : this.Txt_AnneeFab.Text;
                _LeCompteur.MARQUE           = string.IsNullOrEmpty(this.Txt_MarqueCompteur.Text) ? string.Empty : this.Txt_MarqueCompteur.Text;
                _LeCompteur.CADRAN           = System.Convert.ToByte(Txt_CadranCompteur.Text);
                _LeCompteur.USERCREATION     = UserConnecte.matricule;
                _LeCompteur.USERMODIFICATION = UserConnecte.matricule;
                _LeCompteur.DATECREATION     = System.DateTime.Now;
                _LeCompteur.DATEMODIFICATION = System.DateTime.Now;

                CsEvenement _LeEvt    = new CsEvenement();
                int?        _AncIndex = _LeEvt.INDEXEVT;
                _LeEvt.NUMDEM            = LaDemande.LaDemande.NUMDEM;
                _LeEvt.CENTRE            = LaDemande.LaDemande.CENTRE;
                _LeEvt.CLIENT            = LaDemande.LaDemande.CLIENT;
                _LeEvt.ORDRE             = LaDemande.LaDemande.ORDRE;
                _LeEvt.PRODUIT           = LaDemande.LaDemande.PRODUIT;
                _LeEvt.DIAMETRE          = _LeCompteur.DIAMETRE;
                _LeEvt.TYPECOMPTEUR      = _LeCompteur.TYPECOMPTEUR;
                _LeCompteur.TYPECOMPTAGE = LaDemande.Branchement.TYPECOMPTAGE;
                _LeEvt.COMPTEUR          = _LeCompteur.NUMERO;
                _LeEvt.POINT             = _LeCompteur.POINT;
                _LeEvt.IDCANALISATION    = _LeCompteur.PK_ID;
                _LeEvt.MATRICULE         = LaDemande.LaDemande.MATRICULE;
                _LeEvt.INDEXEVT          = null;
                if (!string.IsNullOrEmpty(this.Txt_Index.Text))
                {
                    _LeEvt.INDEXEVT = int.Parse(this.Txt_Index.Text);
                }

                if (LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.ChangementCompteur ||
                    LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.FermetureBrt ||
                    LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.DeposeCompteur)
                {
                    _LeEvt.CAS = SessionObject.Enumere.CasDeposeCompteur;
                }
                else
                {
                    _LeEvt.CAS = SessionObject.Enumere.CasPoseCompteur;
                }

                _LeEvt.CODEEVT = SessionObject.Enumere.EvenementCodeNormale;
                _LeEvt.STATUS  = SessionObject.Enumere.EvenementCree;

                _LeEvt.USERCREATION     = UserConnecte.matricule;
                _LeEvt.USERMODIFICATION = UserConnecte.matricule;
                _LeEvt.DATECREATION     = System.DateTime.Now;
                _LeEvt.DATEMODIFICATION = System.DateTime.Now;


                if (LaDemande.LstCanalistion != null && LaDemande.LstCanalistion.Count != 0)
                {
                    CsCanalisation _LaCan = LaDemande.LstCanalistion.FirstOrDefault(p => p.POINT == _LeCompteur.POINT);
                    if (_LaCan != null)
                    {
                        LaDemande.LstCanalistion.Remove(_LaCan);
                    }
                    LaDemande.LstCanalistion.Add(_LeCompteur);
                }
                else
                {
                    LaDemande.LstCanalistion.Add(_LeCompteur);
                }

                if (LaDemande.LstEvenement != null && LaDemande.LstEvenement.Count != 0)
                {
                    CsEvenement _LeEvtR = LaDemande.LstEvenement.FirstOrDefault(p => p.POINT == _LeCompteur.POINT);
                    if (_LeEvtR != null)
                    {
                        LaDemande.LstEvenement.Remove(_LeEvtR);
                    }
                    LaDemande.LstEvenement.Add(_LeEvt);
                }
                else
                {
                    LaDemande.LstEvenement.Add(_LeEvt);
                }


                CsTcompteur leCompteur = new CsTcompteur()
                {
                    POINT    = int.Parse(LeCompteurSelect.POINT.ToString()),
                    COMPTEUR = string.IsNullOrEmpty(this.Txt_NumCompteur.Text) ? string.Empty : this.Txt_NumCompteur.Text,
                    ANNEEFAB = string.IsNullOrEmpty(this.Txt_AnneeFab.Text) ? string.Empty : this.Txt_AnneeFab.Text,
                    MCOMPT   = string.IsNullOrEmpty(this.Txt_MarqueCompteur.Text) ? string.Empty : this.Txt_MarqueCompteur.Text,
                    CADCOMP  = string.IsNullOrEmpty(this.Txt_CadranCompteur.Text) ? string.Empty : this.Txt_CadranCompteur.Text
                };
                return(leCompteur);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        private void    CreeEvenement(CsEvenement _LeEvt, CsCanalisation _LeCompteur)
        {
            try
            {
                if (!string.IsNullOrEmpty(this.Txt_IndexSaisi.Text) &&
                    !string.IsNullOrEmpty(this.Txt_PeriodeEnCour.Text) &&
                    !string.IsNullOrEmpty(this.Txt_DateRelEncour.Text) &&
                    !string.IsNullOrEmpty(this.Txt_CasEnCour.Text))
                {
                    _LeEvt.NUMDEM       = LaDemande.LaDemande.NUMDEM;
                    _LeEvt.INDEXEVT     = string.IsNullOrEmpty(this.Txt_IndexSaisi.Text) ? 0 : int.Parse(this.Txt_IndexSaisi.Text);
                    _LeEvt.CONSO        = string.IsNullOrEmpty(this.Txt_ConsoEnCours.Text) ? 0 : int.Parse(this.Txt_ConsoEnCours.Text);
                    _LeEvt.DATEEVT      = null;
                    _LeEvt.FACTURE      = null;
                    _LeEvt.ENQUETE      = string.Empty;
                    _LeEvt.FACPER       = string.Empty;
                    _LeEvt.DERPERF      = string.Empty;
                    _LeEvt.DERPERFN     = string.Empty;
                    _LeEvt.REGCONSO     = null;
                    _LeEvt.REGIMPUTE    = null;
                    _LeEvt.CONSOFAC     = 0;
                    _LeEvt.MATRICULE    = UserConnecte.matricule;
                    _LeEvt.COMPTEUR     = _LeCompteur.NUMERO;
                    _LeEvt.TYPECOMPTEUR = _LeCompteur.TYPECOMPTEUR;
                    _LeEvt.COEFLECT     = _LeCompteur.COEFLECT;
                    _LeEvt.COEFCOMPTAGE = _LeCompteur.COEFCOMPTAGE;
                    _LeEvt.COEFLECT     = _LeCompteur.COEFLECT;
                    _LeEvt.CAS          = this.Txt_CasEnCour.Text;
                    _LeEvt.PERIODE      = ClasseMEthodeGenerique.FormatPeriodeAAAAMM(this.Txt_PeriodeEnCour.Text);

                    _LeEvt.INDEXEVTPRECEDENT = string.IsNullOrEmpty(this.Txt_IndexFacture.Text)? 0: int.Parse(this.Txt_IndexFacture.Text);
                    if (!string.IsNullOrEmpty(this.Txt_DateRelEncour.Text))
                    {
                        _LeEvt.DATEEVT = DateTime.Parse(this.Txt_DateRelEncour.Text);
                    }

                    if (LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.Resiliation)
                    {
                        _LeEvt.CODEEVT = SessionObject.Enumere.EvenementCodeResiliation;
                    }

                    if (LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.FactureManuelle ||
                        LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.AvoirConsomation)
                    {
                        _LeEvt.CODEEVT = SessionObject.Enumere.EvenementCodeFactureIsole;
                    }

                    if (LaDemande.LaDemande.TYPEDEMANDE == SessionObject.Enumere.Resiliation)
                    {
                        _LeEvt.LOTRI = LaDemande.LaDemande.CENTRE + SessionObject.Enumere.LotriTermination;
                    }
                    else
                    {
                        _LeEvt.LOTRI = LaDemande.LaDemande.CENTRE + SessionObject.Enumere.LotriManuel;
                    }

                    _LeEvt.STATUS = SessionObject.Enumere.EvenementReleve;

                    _LeEvt.NUMEVENEMENT     = MaxNumEvt + 1;
                    _LeEvt.USERCREATION     = UserConnecte.matricule;
                    _LeEvt.USERMODIFICATION = UserConnecte.matricule;
                    _LeEvt.DATECREATION     = System.DateTime.Now.Date;
                    _LeEvt.DATEMODIFICATION = System.DateTime.Now.Date;

                    CsEvenement _LeEvenement = LstEvenementCree.FirstOrDefault(p => p.COMPTEUR == LeCompteurSelect.NUMERO);
                    if (_LeEvenement != null)
                    {
                        LstEvenementCree.Remove(_LeEvenement);
                    }
                    LstEvenementCree.Add(_LeEvt);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }