Пример #1
0
        public override GestiuneBusiness.DataHelper.Kernel.PersistenceResult Save()
        {
            PersistenceResult persistenceResult = new PersistenceResult();

            try
            {
                if (this.ID == 0)
                {
                    // obiectul este nou, deci trebuie creat
                    this.ID = DelegatiDataHelper.GetInstance().Create(PropertiesNamesWithValues);
                    if (delegatList == null)
                    {
                        delegatList = new List <Delegat>();
                    }
                    delegatList.Add(this);
                }
                else
                {
                    DelegatiDataHelper.GetInstance().Update(PropertiesNamesWithValues, this.ID);
                }
                persistenceResult.Status  = Enums.StatusEnum.Saved;
                persistenceResult.Message = StringSaveSuccess;
            }
            catch (Exception ex)
            {
                persistenceResult.Status            = Enums.StatusEnum.Errors;
                persistenceResult.Message           = StringSaveFail;
                persistenceResult.ExceptionOccurred = ex;
            }
            return(persistenceResult);
        }
Пример #2
0
 public static List <Delegat> GetAll()
 {
     try
     {
         if (delegatList == null)
         {
             delegatList = DelegatiDataHelper.GetInstance().GetAll().Cast <Delegat>().ToList();
         }
         return(delegatList);
     }
     catch (Exception)
     {
         return(null);
     }
 }