Esempio n. 1
0
        ///<Summary>
        ///SaveNew
        ///This method persists a new Categories record to the store
        ///</Summary>
        ///<returns>
        ///void
        ///</returns>
        ///<parameters>
        ///
        ///</parameters>
        public virtual void SaveNew()
        {
            Doing(this);
            IDAOCategories daoCategories = _iCategoriesRepository.New();

            RegisterDataObject(_iCategoriesRepository, _iCategoriesRepository.BaseData(daoCategories));
            BeginTransaction(_iCategoriesRepository, "savenewBOCategories");
            try
            {
                daoCategories.CategoryName = _categoryName;
                daoCategories.Description  = _description;
                daoCategories.Picture      = _picture;
                _iCategoriesRepository.Insert(daoCategories);
                CommitTransaction(_iCategoriesRepository);
                Done(this);

                _categoryID   = daoCategories.CategoryID;
                _categoryName = daoCategories.CategoryName;
                _description  = daoCategories.Description;
                _picture      = daoCategories.Picture;
                _ctrVersion   = daoCategories.CtrVersion;
                _isDirty      = false;
            }
            catch (Exception ex)
            {
                Failed(this, ex);
                RollbackTransaction(_iCategoriesRepository, "savenewBOCategories");
                Handle(this, ex);
            }
        }