private void Txt_CodeCommune_TextChanged(object sender, TextChangedEventArgs e) { if (!string.IsNullOrEmpty(this.Txt_CodeCommune.Text) && this.Txt_CodeCommune.Text.Length == SessionObject.Enumere.TailleCodeQuartier && LstCommuneAll.Where(t => t.FK_IDCENTRE == (int)laDetailDemande.Ag.FK_IDCENTRE).ToList().Count != 0) { CsCommune LaCommuneSelect = ClasseMEthodeGenerique.RetourneObjectFromList(LstCommuneAll.Where(t => t.FK_IDCENTRE == (int)laDetailDemande.Ag.FK_IDCENTRE).ToList(), this.Txt_CodeCommune.Text, "CODE"); if (!string.IsNullOrEmpty(LaCommuneSelect.LIBELLE)) { this.Txt_LibelleCommune.Text = LaCommuneSelect.LIBELLE; this.Txt_CodeCommune.Tag = LaCommuneSelect.PK_ID; } else { var w = new MessageBoxControl.MessageBoxChildWindow(Langue.lbl_Menu, Langue.Msg_CommuneNonTrouve, MessageBoxControl.MessageBoxButtons.Ok, MessageBoxControl.MessageBoxIcon.Information); w.OnMessageBoxClosed += (_, result) => { this.Txt_LibelleCommune.Text = string.Empty; this.Txt_CodeCommune.Text = string.Empty; this.Txt_CodeCommune.Focus(); }; w.Show(); } } }
private void txt_Commune_TextChanged(object sender, TextChangedEventArgs e) { try { if (this.txt_Commune.Text.Length == SessionObject.Enumere.TailleCommune) { CsCommune laCommune = _listeDesCommuneExistantCentre.FirstOrDefault(t => t.CODE == this.txt_Commune.Text); if (laCommune != null) { if ((this.Cbo_Commune.SelectedItem != null && (CsCommune)this.Cbo_Commune.SelectedItem != laCommune) || this.Cbo_Commune.SelectedItem == null) { this.Cbo_Commune.SelectedItem = laCommune; } } else { Message.ShowInformation("Le code saisie n'existe pas", "Accueil"); return; } } } catch (Exception ex) { Message.ShowError(ex.Message, Languages.txtDevis); } }
private void RemplirCommune() { try { if (_listeDesCommuneInitiale != null && _listeDesCommuneInitiale.Count != 0) { Cbo_Commune.ItemsSource = _listeDesCommuneInitiale.OrderBy(t => t.LIBELLE).ToList(); Cbo_Commune.IsEnabled = true; Cbo_Commune.SelectedValuePath = "PK_ID"; Cbo_Commune.DisplayMemberPath = "LIBELLE"; return; } Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient service = new Galatee.Silverlight.ServiceAccueil.AcceuilServiceClient(Utility.ProtocoleFacturation(), Utility.EndPoint("Accueil")); service.ChargerCommuneAsync(); service.ChargerCommuneCompleted += (s, args) => { if (args.Error != null && args.Cancelled) { return; } _listeDesCommuneInitiale.Clear(); List <CsCommune> _listeDesCommuneExistant = new List <CsCommune>(); CsCommune st = null; foreach (ServiceAccueil.CsCommune item in args.Result) { st = new CsCommune(); st.PK_ID = item.PK_ID; st.CODE = item.CODE; st.LIBELLE = item.LIBELLE; _listeDesCommuneExistant = _listeDesCommuneInitiale.Where(t => t.LIBELLE == st.LIBELLE).ToList(); if (_listeDesCommuneExistant == null || _listeDesCommuneExistant.Count == 0) { _listeDesCommuneInitiale.Add(st); } } Cbo_Commune.ItemsSource = _listeDesCommuneInitiale.OrderBy(t => t.LIBELLE).ToList(); Cbo_Commune.IsEnabled = true; Cbo_Commune.SelectedValuePath = "PK_ID"; Cbo_Commune.DisplayMemberPath = "LIBELLE"; if (ObjetSelectionnee != null && ObjetSelectionnee.FK_IDCOMMUNE > 0) { Cbo_Commune.SelectedItem = _listeDesCommuneInitiale.FirstOrDefault(t => t.PK_ID == ObjetSelectionnee.FK_IDCOMMUNE); } }; service.CloseAsync(); } catch (Exception ex) { throw ex; } }
void galatee_OkClickedBtnCommune(object sender, EventArgs e) { UcListeGenerique ctrs = sender as UcListeGenerique; CsCommune _CommuneSelect = (CsCommune)ctrs.MyObject; if (_CommuneSelect != null) { this.Txt_CodeCommune.Text = _CommuneSelect.CODE; this.Txt_CodeCommune.Tag = _CommuneSelect.PK_ID; } }
public bool Insert(CsCommune pCommune) { try { return(Entities.InsertEntity <Galatee.Entity.Model.COMMUNE>(Entities.ConvertObject <Galatee.Entity.Model.COMMUNE, CsCommune>(pCommune))); } catch (Exception ex) { throw ex; } }
private List <CsCommune> GetInformationsFromScreen() { var listObjetForInsertOrUpdate = new List <CsCommune>(); try { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation) { var commune = new CsCommune { CODE = Txt_Code.Text, LIBELLE = Txt_Libelle.Text, FK_IDCENTRE = ((CsCentre)CboCentre.SelectedItem).PK_ID, CENTRE = ((CsCentre)CboCentre.SelectedItem).CODE, DATECREATION = DateTime.Now, USERCREATION = UserConnecte.matricule }; if (!string.IsNullOrEmpty(Txt_Code.Text) && donnesDatagrid.FirstOrDefault(p => p.CODE == commune.CODE && p.CENTRE == commune.CENTRE) != null) { throw new Exception(Languages.CetElementExisteDeja); } listObjetForInsertOrUpdate.Add(commune); } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { ObjetSelectionnee.CODE = Txt_Code.Text; ObjetSelectionnee.LIBELLE = Txt_Libelle.Text; ObjetSelectionnee.FK_IDCENTRE = ((CsCentre)CboCentre.SelectedItem).PK_ID; ObjetSelectionnee.CENTRE = ((CsCentre)CboCentre.SelectedItem).CODE; ObjetSelectionnee.DATECREATION = DateTime.Now; ObjetSelectionnee.USERCREATION = UserConnecte.matricule; listObjetForInsertOrUpdate.Add(ObjetSelectionnee); } return(listObjetForInsertOrUpdate); } catch (Exception ex) { Message.ShowError(ex.Message, Languages.Commune); return(null); } }
private void Cbo_Commune_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { if (Cbo_Commune.SelectedItem != null) { CsCommune commune = Cbo_Commune.SelectedItem as CsCommune; if (commune != null) { Cbo_Commune.SelectedItem = commune; Cbo_Commune.Tag = commune.PK_ID; txt_Commune.Text = commune.CODE ?? string.Empty; RemplirQuartier(commune.PK_ID); } } } catch (Exception ex) { Message.ShowError(ex.Message, Languages.txtDevis); } }
public UcCommune(CsCommune pObject, SessionObject.ExecMode pExecMode, DataGrid pGrid) { try { InitializeComponent(); Translate(); var commune = new CsCommune(); if (pObject != null) { ObjetSelectionnee = Utility.ParseObject(commune, pObject as CsCommune); } ModeExecution = pExecMode; dataGrid = pGrid; RemplirListeDesCentreExistant(); if (dataGrid != null) { donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsCommune>; } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification || (SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation) { if (ObjetSelectionnee != null) { Txt_Code.Text = ObjetSelectionnee.CODE; Txt_Libelle.Text = ObjetSelectionnee.LIBELLE; btnOk.IsEnabled = false; //Txt_Code.IsReadOnly = true; } } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation) { AllInOne.ActivateControlsFromXaml(LayoutRoot, false); } VerifierSaisie(); } catch (Exception ex) { Message.ShowError(ex.Message, Languages.Commune); } }
private void UpdateParentList(CsCommune pCommune) { try { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation) { GetDataNew(); //donnesDatagrid.Add(pCommune); //donnesDatagrid.OrderBy(p => p.PK_ID); } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { GetDataNew(); //var commune = donnesDatagrid.First(p => p.PK_ID == pCommune.PK_ID); //donnesDatagrid.Remove(commune); //donnesDatagrid.Add(pCommune); //donnesDatagrid.OrderBy(p => p.PK_ID); } } catch (Exception ex) { throw ex; } }