/// <summary>
        /// Saves this instance.
        /// </summary>
        /// <returns></returns>
        public int Save()
        {
            var fixedAssetCategory = new FixedAssetCategoryModel
            {
                FixedAssetCategoryId          = View.FixedAssetCategoryId,
                ParentId                      = View.ParentId,
                FixedAssetCategoryCode        = View.FixedAssetCategoryCode,
                FixedAssetCategoryName        = View.FixedAssetCategoryName,
                FixedAssetCategoryForeignName = View.FixedAssetCategoryForeignName,
                DepreciationRate              = View.DepreciationRate,
                LifeTime                      = View.LifeTime,
                Grade                   = View.Grade,
                IsParent                = View.IsParent,
                OrgPriceAccountCode     = View.OrgPriceAccountCode,
                DepreciationAccountCode = View.DepreciationAccountCode,
                CapitalAccountCode      = View.CapitalAccountCode,
                BudgetChapterCode       = View.BudgetChapterCode,
                BudgetCategoryCode      = View.BudgetCategoryCode,
                BudgetGroupCode         = View.BudgetGroupCode,
                BudgetItemCode          = View.BudgetItemCode,
                IsActive                = View.IsActive,
                Unit = View.Unit
            };

            if (View.FixedAssetCategoryId == 0)
            {
                return(Model.AddFixedAssetCategory(fixedAssetCategory));
            }
            return(Model.UpdateFixedAssetCategory(fixedAssetCategory));
        }
        public string Save()
        {
            var fixedAssetCategoryModel = new FixedAssetCategoryModel
            {
                FixedAssetCategoryId   = View.FixedAssetCategoryId,
                FixedAssetCategoryCode = View.FixedAssetCategoryCode.Trim(),
                FixedAssetCategoryName = View.FixedAssetCategoryName.Trim(),
                Description            = View.Description == null ? "" : View.Description.Trim(),
                ParentId              = View.ParentId.Trim(),
                Grade                 = View.Grade,
                IsParent              = View.IsParent,
                LifeTime              = View.LifeTime,
                DepreciationRate      = View.DepreciationRate,
                OrgPriceAccount       = View.OrgPriceAccount,
                DepreciationAccount   = View.DepreciationAccount,
                CapitalAccount        = View.CapitalAccount,
                BudgetChapterCode     = View.BudgetChapterCode,
                BudgetKindItemCode    = View.BudgetKindItemCode,
                BudgetSubKindItemCode = View.BudgetSubKindItemCode,
                BudgetItemCode        = View.BudgetItemCode,
                BudgetSubItemCode     = View.BudgetSubItemCode,
                IsActive              = View.IsActive
            };

            if (View.FixedAssetCategoryId == null)
            {
                return(Model.InsertFixedAssetCategory(fixedAssetCategoryModel));
            }
            return(Model.UpdateFixedAssetCategory(fixedAssetCategoryModel));
        }
Пример #3
0
 internal static FixedAssetCategoryEntity ToDataTransferObject(FixedAssetCategoryModel model)
 {
     return(model == null ? null : AutoMapper.Mapper.Map <FixedAssetCategoryModel, FixedAssetCategoryEntity>(model));
 }