コード例 #1
0
        public override PersistenceResult Save()
        {
            PersistenceResult persistenceResult = new PersistenceResult();

            try
            {
                if (this.ID == 0)
                {
                    // obiectul este nou, deci trebuie creat
                    this.ID = BanciDataHelper.GetInstance().Create(PropertiesNamesWithValues);
                    if (bancaList == null)
                    {
                        bancaList = new List <Banca>();
                    }
                    bancaList.Add(this);
                }

                else
                {
                    BanciDataHelper.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 <Banca> GetAll()
 {
     try
     {
         if (bancaList == null)
         {
             bancaList = BanciDataHelper.GetInstance().GetAll().Cast <Banca>().ToList();
         }
         return(bancaList);
     }
     catch (Exception)
     {
         return(null);
     }
 }