private void btn_saisir_Click(object sender, RoutedEventArgs e) { if (LaDemande.LeTypeDemande.DEMOPTION7 == SessionObject.Enumere.CodeObligatoire) { //UcListeCompteurAuto _ctrl = new UcListeCompteurAuto(LaDemande); //_ctrl.Closed += new EventHandler(_ctrl_Closed); //_ctrl.Show(); } else { UcDemandeSaisieCompteurMt ctrl = new UcDemandeSaisieCompteurMt(LaDemande, LeCompteurSelect); ctrl.Closed += new EventHandler(ctrl_Closed); ctrl.Show(); } }
void ctrl_Closed(object sender, EventArgs e) { UcDemandeSaisieCompteurMt ctr = sender as UcDemandeSaisieCompteurMt; CsTcompteur leCompteur = ctr.EnregisterCompteur(); CsTcompteur leCompeteurSelect = LstType.FirstOrDefault(t => t.POINT == leCompteur.POINT); if (leCompeteurSelect != null) { LeCompteurSelect.ANNEEFAB = leCompteur.ANNEEFAB; LeCompteurSelect.CADCOMP = leCompteur.CADCOMP; LeCompteurSelect.COMPTEUR = leCompteur.COMPTEUR; LeCompteurSelect.MCOMPT = leCompteur.MCOMPT; LeCompteurSelect.SAISIE = "OUI"; } dataGrid1.ItemsSource = null; dataGrid1.ItemsSource = LstType; }
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(); }