void traitementListViewItems(DataGrid d, CsCasind LeCasSelectionner) { try { //isUnChecking = false; CsCasind item = d.SelectedItem as CsCasind; CheckBox _item = (CheckBox)this.dataGrid1.Columns[0].GetCellContent(d.SelectedItem as CsCasind) as CheckBox; if (_item.IsChecked.Value) { if (ListeCasSelect.FirstOrDefault(p => p.CODE == LeCasSelectionner.CODE) == null) { ListeCasSelect.Add(LeCasSelectionner); } _item.IsChecked = true; } else { if (ListeCasSelect.FirstOrDefault(p => p.CODE == LeCasSelectionner.CODE) != null) { ListeCasSelect.Remove(LeCasSelectionner); } _item.IsChecked = false; } } catch (Exception ex) { throw ex; } }
public CwCasReleveIndex(CsCasind pObject, SessionObject.ExecMode pExecMode, DataGrid pGrid) { try { InitializeComponent(); if (pObject != null) { ObjetSelectionnee = pObject; } ModeExecution = pExecMode; dataGrid = pGrid; if (dataGrid != null) { donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsCasind>; } this.CboEnqueteNonConfirmee.ItemsSource = this.ConstituerListeGroupeBoxFacturation(); this.CboEnqueteNonConfirmee.DisplayMemberPath = "LIBELLE"; this.CboEnqueteNonConfirmee.SelectedValuePath = "CODE"; this.CboSansEnqueteOuConfirmee.ItemsSource = this.ConstituerListeGroupeBoxFacturation(); this.CboSansEnqueteOuConfirmee.DisplayMemberPath = "LIBELLE"; this.CboSansEnqueteOuConfirmee.SelectedValuePath = "CODE"; this.CboIndex.ItemsSource = this.ConstituerListeGroupeBoxSaisie(); this.CboIndex.DisplayMemberPath = "LIBELLE"; this.CboIndex.SelectedValuePath = "CODE"; this.CboCompteur.ItemsSource = this.ConstituerListeGroupeBoxSaisie(); this.CboCompteur.DisplayMemberPath = "LIBELLE"; this.CboCompteur.SelectedValuePath = "CODE"; this.CboConsommation.ItemsSource = this.ConstituerListeGroupeBoxSaisie(); this.CboConsommation.DisplayMemberPath = "LIBELLE"; this.CboConsommation.SelectedValuePath = "CODE"; RemplirListeDesCentreExistant(ObjetSelectionnee); if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification || (SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation) { if (ObjetSelectionnee != null) { RemplirComboInformationComplementaire(ObjetSelectionnee); ChargerDonnees(ObjetSelectionnee); OKButton.IsEnabled = false; //TxtCas.IsReadOnly = true; } } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation) { AllInOne.ActivateControlsFromXaml(LayoutRoot, false); } VerifierSaisie(); } catch (Exception ex) { Message.ShowError(ex.Message, Languages.Parametrage); } }
private void ChargerDonnees(CsCasind pCasind) { try { TxtCas.Text = !string.IsNullOrEmpty(pCasind.CODE) ? pCasind.CODE : string.Empty; TxtLibelle.Text = !string.IsNullOrEmpty(pCasind.LIBELLE) ? pCasind.LIBELLE : string.Empty; //TxtLienSurLaFacture.Text = !string.IsNullOrEmpty(pCasind.LIBFAC) ? pCasind.LIBFAC : string.Empty; foreach (CsLibelle index in CboIndex.ItemsSource) { if (index.LIBELLE == pCasind.SAISIEINDEX) { CboIndex.SelectedItem = index; break; } } foreach (CsLibelle compteur in CboCompteur.ItemsSource) { if (compteur.LIBELLE == pCasind.SAISIECOMPTEUR) { CboCompteur.SelectedItem = compteur; break; } } foreach (CsLibelle consommation in CboConsommation.ItemsSource) { if (consommation.LIBELLE == pCasind.SAISIECONSO) { CboConsommation.SelectedItem = consommation; break; } } foreach (CsLibelle enqueteNonConfirmee in CboEnqueteNonConfirmee.ItemsSource) { if (enqueteNonConfirmee.CODE == pCasind.APRESENQUETE) { CboEnqueteNonConfirmee.SelectedItem = enqueteNonConfirmee; break; } } foreach (CsLibelle SansEnqueteOuConfirmee in CboSansEnqueteOuConfirmee.ItemsSource) { if (SansEnqueteOuConfirmee.CODE == pCasind.SANSENQUETE) { CboSansEnqueteOuConfirmee.SelectedItem = SansEnqueteOuConfirmee; break; } } } catch (Exception ex) { throw ex; } }
void IsSaisieValider(CsEvenement LaSaisie, List <CsCasind> LstCas) { LeEvtSelect = new CsEvenement(); LeEvtSelect = LaSaisie; CsCasind LeCasRecherche = LstCas.FirstOrDefault(p => p.CODE == LaSaisie.CAS); if (LeCasRecherche == null) { Message.ShowInformation("Cas interdit", "Erreur"); IsEtatSaisie = false; return; } else { // Saisie d'index if (LeCasRecherche.SAISIEINDEX == SessionObject.Enumere.CodeObligatoire) { if (string.IsNullOrEmpty(LaSaisie.INDEXEVT.ToString())) { Message.ShowInformation("La saisie de l'index est obligatoire", "Alert"); IsEtatSaisie = false; return; } } if (LeCasRecherche.SAISIEINDEX == SessionObject.Enumere.CodeInterdit) { if (!string.IsNullOrEmpty(LaSaisie.INDEXEVT.ToString())) { Message.ShowInformation("La saisie de l'index est Interdite", "Alert"); IsEtatSaisie = false; return; } } // // Saisie de la consomation if (LeCasRecherche.SAISIECONSO == SessionObject.Enumere.CodeObligatoire) { if (string.IsNullOrEmpty(LaSaisie.CONSO.ToString())) { Message.ShowInformation("La saisie de la consommation est obligatoire", "Alert"); IsEtatSaisie = false; return; } } else if (LeCasRecherche.SAISIECONSO == SessionObject.Enumere.CodeInterdit) { if (!string.IsNullOrEmpty(LaSaisie.CONSO.ToString())) { Message.ShowInformation("La saisie de la consommation est Interdit", "Alert"); IsEtatSaisie = false; return; } } } IsCasValider(LaSaisie); }
void IsSaisieValider(CsEvenement LaSaisie, List <CsCasind> LstCas) { LeEvtSelect = new CsEvenement(); LeEvtSelect = LaSaisie; CsCasind LeCasRecherche = LstCas.FirstOrDefault(p => p.CODE == LaSaisie.CAS); if (LeCasRecherche == null) { Message.ShowInformation(Galatee.Silverlight.Resources.Index.Langue.msg_CasInexistant, "Erreur"); dataGrid1.IsEnabled = false; return; } else { // Saisie d'index if (LeCasRecherche.SAISIEINDEX == SessionObject.Enumere.CodeObligatoire) { if (string.IsNullOrEmpty(this.Txt_IndexSaisi.Text)) { Message.ShowInformation(Galatee.Silverlight.Resources.Index.Langue.msg_SaisiConsoObligatoire, "Alert"); dataGrid1.IsEnabled = false; return; } } if (LeCasRecherche.SAISIEINDEX == SessionObject.Enumere.CodeInterdit) { if (!string.IsNullOrEmpty(this.Txt_IndexSaisi.Text)) { Message.ShowInformation(Galatee.Silverlight.Resources.Index.Langue.msg_SaisiConsoInterdite, "Alert"); dataGrid1.IsEnabled = false; return; } } // // Saisie de la consomation if (LeCasRecherche.SAISIECONSO == SessionObject.Enumere.CodeObligatoire) { //if (LaSaisie.CONSO != null && string.IsNullOrEmpty(this.Txt_Consomation.Text)) //{ // Message.ShowInformation(Galatee.Silverlight.Resources.Index.Langue.msg_SaisiConsoObligatoire, "Alert"); // dataGrid1.IsEnabled = false; // return; //} } else if (LeCasRecherche.SAISIECONSO == SessionObject.Enumere.CodeInterdit) { ////if (!string.IsNullOrEmpty(LaSaisie.CONSO.ToString())) //if (!string.IsNullOrEmpty(this.Txt_Consomation.Text.ToString())) //{ // Message.ShowInformation(Galatee.Silverlight.Resources.Index.Langue.msg_SaisiConsoInterdite, "Alert"); // dataGrid1.IsEnabled = false; // return; //} } } IsCasValider(LaSaisie); }
public bool Delete(CsCasind pCasind) { try { return(Entities.DeleteEntity <Galatee.Entity.Model.CASIND>(Entities.ConvertObject <Galatee.Entity.Model.CASIND, CsCasind>(pCasind))); } catch (Exception ex) { throw ex; } }
public List <CsCasind> SelectAllCasDeReleveByCentreCas(CsCasind pCasind) { try { return(Entities.GetEntityListFromQuery <CsCasind>(ParamProcedure.PARAM_CASIND_RETOURNEByCas(pCasind.PK_ID))); } catch (Exception ex) { throw ex; } }
private void RemplirListeDesCentreExistant(CsCasind pCasind) { try { ParametrageClient client = new ParametrageClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Parametrage")); client.SelectAllCentreCompleted += (ssender, args) => { if (args.Cancelled || args.Error != null) { string error = args.Error.Message; Message.ShowError(error, Languages.CasDeReleve); return; } if (args.Result == null) { Message.ShowError(Languages.msgErreurChargementDonnees, Languages.Parametrage); return; } else { //this.CboCentre.ItemsSource = args.Result; //this.CboCentre.DisplayMemberPath = "Libelle"; //this.CboCentre.SelectedValuePath = "PK_CodeCentre"; //if (pCasind != null) //{ // foreach (CsCentre centre in CboCentre.ItemsSource) // { // if (centre.PK_ID == pCasind.FK_IDCENTRE) // { // CboCentre.SelectedItem = centre; // break; // } // } //} } }; client.SelectAllCentreAsync(); } catch (Exception ex) { throw ex; } }
void galatee_OkClicked(object sender, EventArgs e) { try { UcListeGenerique ctrs = sender as UcListeGenerique; if (ctrs.GetisOkClick) { CsCasind _lstCas = (CsCasind)ctrs.MyObject; if (_lstCas != null) { this.Txt_CasEnCour.Text = _lstCas.CODE; } } this.btn_cas.IsEnabled = true; } catch (Exception ex) { throw ex; } }
private void dgMyDataGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { DataGrid dg = (sender as DataGrid); var allObjects = dg.ItemsSource as List <CsCasind>; if (dg.SelectedItem != null) { CsCasind SelectedObject = (CsCasind)dg.SelectedItem; if (SelectedObject.IsSelect == false) { SelectedObject.IsSelect = true; } else { SelectedObject.IsSelect = false; } this.OKButton.IsEnabled = true; } }
private void RenseignerLesCasgen(CsCasind pCasind) { List <string> ColListName = new List <string>(); CsCasind item = null; try { if (CboCasEcrasable.Items.Count > 0) { if (MyCasind == null) { MyCasind = new List <CsCasind>(); for (int i = 0; i < CboCasEcrasable.Items.Count; i++) { item = new CsCasind(); item = (CsCasind)CboCasEcrasable.Items[i]; MyCasind.Add(item); string colName = "CASGEN" + (i + 1).ToString(); ColListName.Add(colName); } } var properties = pCasind.GetType().GetProperties(); foreach (var f in properties) { if (ColListName.Contains(f.Name.ToUpper())) { int index = int.Parse(f.Name.Substring(f.Name.Length - 1, 1)); var casreleve = MyCasind[index - 1]; string casgen = casreleve.CODE; f.SetValue(pCasind, casgen, null); } } } } catch (Exception ex) { throw ex; } }
private void RemplirComboInformationComplementaire(CsCasind pCasind) { try { List <CsCasind> ListEcrasable = new List <CsCasind>(); ListEcrasable = this.ConstruireListeComboInformationComplementaire(pCasind); if (ListEcrasable != null && ListEcrasable.Count > 0) { this.CboCasEcrasable.Items.Clear(); CboCasEcrasable.ItemsSource = null; foreach (CsCasind item in ListEcrasable) { this.CboCasEcrasable.Items.Add(item); } this.CboCasEcrasable.DisplayMemberPath = "LIBELLE"; this.CboCasEcrasable.SelectedValuePath = "PK_ID"; //CboCasEcrasable.SelectedIndex = 0; } } catch (Exception ex) { throw ex; } }
private List <CsCasind> GetInformationsFromScreen() { var listObjetForInsertOrUpdate = new List <CsCasind>(); try { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation) { var casind = new CsCasind(); casind.CODE = TxtCas.Text; casind.LIBELLE = TxtLibelle.Text; //casind.LIBFAC = TxtLienSurLaFacture.Text; //if (CboCentre.SelectedItem != null) //{ // casind.CENTRE = ((CsCentre)CboCentre.SelectedItem).CODE; // casind.FK_IDCENTRE = ((CsCentre)CboCentre.SelectedItem).PK_ID; //} if (CboIndex.SelectedItem != null) { casind.SAISIEINDEX = ((CsLibelle)CboIndex.SelectedItem).CODE; } if (CboCompteur.SelectedItem != null) { casind.SAISIECOMPTEUR = ((CsLibelle)CboCompteur.SelectedItem).CODE; } if (CboConsommation.SelectedItem != null) { casind.SAISIECONSO = ((CsLibelle)CboConsommation.SelectedItem).CODE; } if (CboEnqueteNonConfirmee.SelectedItem != null) { casind.APRESENQUETE = ((CParametre)CboEnqueteNonConfirmee.SelectedItem).CODE; casind.FK_IDTYPEFACTURATIONAPRESENQUETE = ((CParametre)CboEnqueteNonConfirmee.SelectedItem).PK_ID; } if (CboSansEnqueteOuConfirmee.SelectedItem != null) { casind.SANSENQUETE = ((CParametre)CboSansEnqueteOuConfirmee.SelectedItem).CODE; casind.FK_IDTYPEFACTURATIONSANSENQUETE = ((CParametre)CboSansEnqueteOuConfirmee.SelectedItem).PK_ID; } RenseignerLesCasgen(casind); casind.DATECREATION = DateTime.Now; casind.USERCREATION = UserConnecte.matricule; if (!string.IsNullOrEmpty(TxtCas.Text) && donnesDatagrid.FirstOrDefault(p => p.CODE == casind.CODE) != null) { throw new Exception(Languages.CetElementExisteDeja); } listObjetForInsertOrUpdate.Add(casind); } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { ObjetSelectionnee.CODE = TxtCas.Text; ObjetSelectionnee.LIBELLE = TxtLibelle.Text; //ObjetSelectionnee.LIBFAC = TxtLienSurLaFacture.Text; //if (CboCentre.SelectedItem != null) //{ // ObjetSelectionnee.FK_IDCENTRE = ((CsCentre)CboCentre.SelectedItem).PK_ID; // ObjetSelectionnee.CENTRE = ((CsCentre)CboCentre.SelectedItem).CODE; //} if (CboIndex.SelectedItem != null) { ObjetSelectionnee.SAISIEINDEX = ((CsLibelle)CboIndex.SelectedItem).CODE; } if (CboCompteur.SelectedItem != null) { ObjetSelectionnee.SAISIECOMPTEUR = ((CsLibelle)CboCompteur.SelectedItem).CODE; } if (CboConsommation.SelectedItem != null) { ObjetSelectionnee.SAISIECONSO = ((CsLibelle)CboConsommation.SelectedItem).CODE; } if (CboEnqueteNonConfirmee.SelectedItem != null) { ObjetSelectionnee.APRESENQUETE = ((CParametre)CboEnqueteNonConfirmee.SelectedItem).CODE; ObjetSelectionnee.FK_IDTYPEFACTURATIONAPRESENQUETE = ((CParametre)CboEnqueteNonConfirmee.SelectedItem).PK_ID; } if (CboSansEnqueteOuConfirmee.SelectedItem != null) { ObjetSelectionnee.SANSENQUETE = ((CParametre)CboSansEnqueteOuConfirmee.SelectedItem).CODE; ObjetSelectionnee.FK_IDTYPEFACTURATIONSANSENQUETE = ((CParametre)CboSansEnqueteOuConfirmee.SelectedItem).PK_ID; } RenseignerLesCasgen(ObjetSelectionnee); ObjetSelectionnee.DATEMODIFICATION = DateTime.Now; ObjetSelectionnee.USERMODIFICATION = UserConnecte.matricule; listObjetForInsertOrUpdate.Add(ObjetSelectionnee); } return(listObjetForInsertOrUpdate); } catch (Exception ex) { throw ex; } }
private List <CsCasind> ConstruireListeComboInformationComplementaire(CsCasind pCasind) { List <CsCasind> ListeEcrasable = new List <CsCasind>(); try { CsCasind CasEcrasable1 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN1)) { CasEcrasable1.CODE = pCasind.CASGEN1.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN1.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable1.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable1); } } } CsCasind CasEcrasable2 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN2)) { CasEcrasable2.CODE = pCasind.CASGEN2.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN2.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable2.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable2); } } } CsCasind CasEcrasable3 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN3)) { CasEcrasable3.CODE = pCasind.CASGEN3.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN3.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable3.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable3); } } } CsCasind CasEcrasable4 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN4)) { CasEcrasable4.CODE = pCasind.CASGEN4.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN4.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable4.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable4); } } } CsCasind CasEcrasable5 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN5)) { CasEcrasable5.CODE = pCasind.CASGEN5.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN5.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable5.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable5); } } } CsCasind CasEcrasable6 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN6)) { CasEcrasable6.CODE = pCasind.CASGEN6.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN6.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable6.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable6); } } } CsCasind CasEcrasable7 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN7)) { CasEcrasable7.CODE = pCasind.CASGEN7.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN7.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable7.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable7); } } } CsCasind CasEcrasable8 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN8)) { CasEcrasable8.CODE = pCasind.CASGEN8.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN8.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable8.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable8); } } } CsCasind CasEcrasable9 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN9)) { CasEcrasable9.CODE = pCasind.CASGEN9.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN9.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable9.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable9); } } } CsCasind CasEcrasable10 = new CsCasind(); if (!string.IsNullOrEmpty(pCasind.CASGEN10)) { CasEcrasable10.CODE = pCasind.CASGEN10.ToString(); if (donnesDatagrid != null && donnesDatagrid.Count > 0) { var libelle = donnesDatagrid.FirstOrDefault(p => p.CODE == pCasind.CASGEN10.ToString()); if (libelle != null && !string.IsNullOrEmpty(libelle.LIBELLE)) { CasEcrasable10.LIBELLE = libelle.LIBELLE; ListeEcrasable.Add(CasEcrasable10); } } } return(ListeEcrasable); } catch (Exception ex) { throw ex; } }