public bool Insert(CsUniteComptage pEntity) { try { return(Entities.InsertEntity <Galatee.Entity.Model.UNITECOMPTAGE>(Entities.ConvertObject <Galatee.Entity.Model.UNITECOMPTAGE, CsUniteComptage>(pEntity))); } catch (Exception ex) { throw ex; } }
private void UpdateParentList(CsUniteComptage pUniteComptage) { try { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation) { donnesDatagrid.Add(pUniteComptage); } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { var UniteComptage = donnesDatagrid.First(p => p.PK_ID == pUniteComptage.PK_ID); donnesDatagrid.Remove(UniteComptage); donnesDatagrid.Add(pUniteComptage); } } catch (Exception ex) { throw ex; } }
public UcUniteComptage(object pObjects, SessionObject.ExecMode pExecMode, DataGrid pGrid) { try { InitializeComponent(); Translate(); var categorieClient = new CsUniteComptage(); if (pObjects != null) { ObjetSelectionnee = Utility.ParseObject(categorieClient, pObjects as CsUniteComptage); } ModeExecution = pExecMode; dataGrid = pGrid; if (dataGrid != null) { donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsUniteComptage>; } 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.UniteComptage); } }
private List <CsUniteComptage> GetInformationsFromScreen() { var listObjetForInsertOrUpdate = new List <CsUniteComptage>(); try { if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation) { var UniteComptage = new CsUniteComptage { CODE = Txt_Code.Text, LIBELLE = Txt_Libelle.Text, DATECREATION = DateTime.Now, USERCREATION = UserConnecte.matricule }; if (!string.IsNullOrEmpty(Txt_Code.Text) && donnesDatagrid.FirstOrDefault(p => p.CODE == UniteComptage.CODE) != null) { throw new Exception(Languages.CetElementExisteDeja); } listObjetForInsertOrUpdate.Add(UniteComptage); } if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification) { ObjetSelectionnee.CODE = Txt_Code.Text; ObjetSelectionnee.LIBELLE = Txt_Libelle.Text; ObjetSelectionnee.DATEMODIFICATION = DateTime.Now; ObjetSelectionnee.USERMODIFICATION = UserConnecte.matricule; listObjetForInsertOrUpdate.Add(ObjetSelectionnee); } return(listObjetForInsertOrUpdate); } catch (Exception ex) { Message.ShowError(ex.Message, Languages.UniteComptage); return(null); } }