public bool Insert(CsAppareils cAppareils)
 {
     try
     {
         return(Entities.InsertEntity <Galatee.Entity.Model.APPAREILS>(Entities.ConvertObject <Galatee.Entity.Model.APPAREILS, CsAppareils>(cAppareils)));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
 public UcAppareils(object[] pObjects, SessionObject.ExecMode[] pExecMode, DataGrid[] pGrid)
 {
     try
     {
         InitializeComponent();
         Translate();
         var categorieClient = new CsAppareils();
         if (pObjects[0] != null)
         {
             ObjetSelectionnee = Utility.ParseObject(categorieClient, pObjects[0] as CsAppareils);
         }
         ModeExecution = pExecMode[0];
         dataGrid      = pGrid[0];
         if (dataGrid != null)
         {
             donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsAppareils>;
         }
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification ||
             (SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation)
         {
             if (ObjetSelectionnee != null)
             {
                 Txt_CodeAppareil.Text = Convert.ToString(ObjetSelectionnee.CodeAppareil);
                 Txt_Designation.Text  = ObjetSelectionnee.Designation;
                 Txt_DETAILS.Text      = ObjetSelectionnee.Details;
                 txt_TpsUtil.Text      = ObjetSelectionnee.TEMPSUTILISATION.ToString();
             }
         }
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Consultation)
         {
             AllInOne.ActivateControlsFromXaml(LayoutRoot, false);
         }
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
         {
             Txt_CodeAppareil.Text = "";
             Txt_Designation.Text  = "";
             Txt_DETAILS.Text      = "";
             txt_TpsUtil.Text      = "";
         }
         //VerifierSaisie();
     }
     catch (Exception ex)
     {
         Message.Show(ex.Message, Languages.Appareils);
     }
 }
 private void UpdateParentList(CsAppareils pAppareils)
 {
     try
     {
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
         {
             GetDataNew();
         }
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification)
         {
             GetDataNew();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private List <CsAppareils> GetInformationsFromScreen()
        {
            var listObjetForInsertOrUpdate = new List <CsAppareils>();

            try
            {
                if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
                {
                    int TEMPSUTILISATION = 0;
                    var appareils        = new CsAppareils
                    {
                        CodeAppareil     = Txt_CodeAppareil.Text,
                        Designation      = Txt_Designation.Text,
                        Details          = Txt_DETAILS.Text,
                        TEMPSUTILISATION = int.TryParse(txt_TpsUtil.Text, out TEMPSUTILISATION) == true?TEMPSUTILISATION:0,
                        DATECREATION     = DateTime.Now,
                        USERCREATION     = UserConnecte.matricule
                    };
                    if (!string.IsNullOrEmpty(Txt_CodeAppareil.Text) && donnesDatagrid.FirstOrDefault(p => p.CodeAppareil == appareils.CodeAppareil) != null)
                    {
                        throw new Exception(Languages.CetElementExisteDeja);
                    }
                    listObjetForInsertOrUpdate.Add(appareils);
                }
                if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification)
                {
                    ObjetSelectionnee.CodeAppareil     = Txt_CodeAppareil.Text;
                    ObjetSelectionnee.Designation      = Txt_Designation.Text;
                    ObjetSelectionnee.Details          = Txt_DETAILS.Text;
                    ObjetSelectionnee.TEMPSUTILISATION = Convert.ToInt32(txt_TpsUtil.Text);
                    ObjetSelectionnee.DATECREATION     = DateTime.Now;
                    ObjetSelectionnee.USERCREATION     = UserConnecte.matricule;
                    listObjetForInsertOrUpdate.Add(ObjetSelectionnee);
                }
                return(listObjetForInsertOrUpdate);
            }
            catch (Exception ex)
            {
                Message.ShowError(ex.Message, Languages.Appareils);
                return(null);
            }
        }