示例#1
0
 public CsNatureClient GetById(CsNatureClient entity)
 {
     try
     {
         return(Entities.GetEntityFromQuery <CsNatureClient>(ParamProcedure.PARAM_NATURECLIENT_RETOURNEByCODE(entity.PK_ID)));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
示例#2
0
 public bool Delete(CsNatureClient entity)
 {
     try
     {
         return(Entities.DeleteEntity <Galatee.Entity.Model.NATURECLIENT>(Entities.ConvertObject <Galatee.Entity.Model.NATURECLIENT, CsNatureClient>(entity)));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 private void UpdateParentList(CsNatureClient pNatureClient)
 {
     try
     {
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
         {
             donnesDatagrid.Add(pNatureClient);
         }
         if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Modification)
         {
             var NatureClient = donnesDatagrid.First(p => p.CODE == pNatureClient.CODE);
             donnesDatagrid.Remove(NatureClient);
             donnesDatagrid.Add(pNatureClient);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        public UcNatureClient(object pObjects, SessionObject.ExecMode pExecMode, DataGrid pGrid)
        {
            try
            {
                InitializeComponent();
                Translate();
                var categorieClient = new CsNatureClient();
                if (pObjects != null)
                {
                    ObjetSelectionnee = Utility.ParseObject(categorieClient, pObjects as CsNatureClient);
                }
                ModeExecution = pExecMode;
                dataGrid      = pGrid;
                if (dataGrid != null)
                {
                    donnesDatagrid = dataGrid.ItemsSource as ObservableCollection <CsNatureClient>;
                }
                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.NatureClient);
            }
        }
        private List <CsNatureClient> GetInformationsFromScreen()
        {
            var listObjetForInsertOrUpdate = new List <CsNatureClient>();

            try
            {
                if ((SessionObject.ExecMode)ModeExecution == SessionObject.ExecMode.Creation)
                {
                    var NatureClient = new CsNatureClient
                    {
                        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 == NatureClient.CODE) != null)
                    {
                        throw new Exception(Languages.CetElementExisteDeja);
                    }
                    listObjetForInsertOrUpdate.Add(NatureClient);
                }
                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.NatureClient);
                return(null);
            }
        }