/// <summary>
        /// Deletes the account category.
        /// </summary>
        /// <param name="accountCategory">The account category.</param>
        /// <returns>System.String.</returns>
        public string DeleteAccountCategory(AccountCategoryEntity accountCategory)
        {
            const string sql = @"uspDelete_AccountCategory";

            object[] parms = { "@AccountCategoryID", accountCategory.AccountCategoryId };
            return(Db.Delete(sql, true, parms));
        }
Beispiel #2
0
        /// <summary>
        /// Inserts the account category.
        /// </summary>
        /// <param name="accountCategoryEntity">The account category entity.</param>
        /// <returns>AccountCategoryResponse.</returns>
        public AccountCategoryResponse InsertAccountCategory(AccountCategoryEntity accountCategoryEntity)
        {
            var response = new AccountCategoryResponse {
                Acknowledge = AcknowledgeType.Success
            };

            try
            {
                if (!accountCategoryEntity.Validate())
                {
                    foreach (string error in accountCategoryEntity.ValidationErrors)
                    {
                        response.Message += error + Environment.NewLine;
                    }
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                accountCategoryEntity.AccountCategoryId = AccountCategoryDao.InsertAccountCategory(accountCategoryEntity);
                if (!string.IsNullOrEmpty(response.Message))
                {
                    response.Acknowledge = AcknowledgeType.Failure;
                    return(response);
                }
                response.AccountCategoryId = accountCategoryEntity.AccountCategoryId;
                return(response);
            }
            catch (Exception ex)
            {
                response.Acknowledge = AcknowledgeType.Failure;
                response.Message     = ex.Message;
                return(response);
            }
        }
Beispiel #3
0
 /// <summary>
 /// Takes the specified account categories.
 /// </summary>
 /// <param name="accountCategories">The account categories.</param>
 /// <returns>System.Object[][].</returns>
 private object[] Take(AccountCategoryEntity accountCategories)
 {
     return(new object[]
     {
         "@AccountCategoryId", accountCategories.AccountCategoryId,
         "@AccountCategoryName", accountCategories.AccountCategoryName,
         "@AccountCategoryKind", accountCategories.AccountCategoryKind,
         "@DetailByBudgetSource", accountCategories.DetailByBudgetSource,
         "@DetailByBudgetChapter", accountCategories.DetailByBudgetChapter,
         "@DetailByBudgetKindItem", accountCategories.DetailByBudgetKindItem,
         "@DetailByBudgetItem", accountCategories.DetailByBudgetItem,
         "@DetailByBudgetSubItem", accountCategories.DetailByBudgetSubItem,
         "@DetailByMethodDistribute", accountCategories.DetailByMethodDistribute,
         "@DetailByAccountingObject", accountCategories.DetailByAccountingObject,
         "@DetailByActivity", accountCategories.DetailByActivity,
         "@DetailByProject", accountCategories.DetailByProject,
         "@DetailByTask", accountCategories.DetailByTask,
         "@DetailBySupply", accountCategories.DetailBySupply,
         "@DetailByInventoryItem", accountCategories.DetailByInventoryItem,
         "@DetailByFixedAsset", accountCategories.DetailByFixedAsset,
         "@DetailByBankAccount", accountCategories.DetailByBankAccount,
         "@DetailByFund", accountCategories.DetailByFund,
         "@IsActive", accountCategories.IsActive
     });
 }
 /// <summary>
 /// Takes the specified account categories.
 /// </summary>
 /// <param name="accountCategories">The account categories.</param>
 /// <returns>System.Object[][].</returns>
 private object[] Take(AccountCategoryEntity accountCategories)
 {
     return(new object[]
     {
         "@AccountCategoryID", accountCategories.AccountCategoryId,
         "@AccountCategoryCode", accountCategories.AccountCategoryCode,
         "@AccountCategoryName", accountCategories.AccountCategoryName,
         "@ForeignName", accountCategories.ForeignName,
         "@ParentID", accountCategories.ParentId,
         "@Grade", accountCategories.Grade,
         "@IsDetail", accountCategories.IsDetail,
         "@IsActive", accountCategories.IsActive
     });
 }
        public List <AccountCategoryEntity> GetAccountsCategory(string connectionString)
        {
            List <AccountCategoryEntity> listAccount = new List <AccountCategoryEntity>();

            using (var context = new MISAEntity(connectionString))
            {
                var categories = context.AccountCategories.ToList();
                foreach (var result in categories)
                {
                    var accountCategory = new AccountCategoryEntity();

                    accountCategory.AccountCategoryId        = result.AccountCategoryID;
                    accountCategory.AccountCategoryKind      = result.AccountCategoryKind ?? 0;
                    accountCategory.DetailByBudgetSource     = result.DetailByBudgetSource;
                    accountCategory.DetailByBudgetChapter    = result.DetailByBudgetChapter;
                    accountCategory.DetailByBudgetKindItem   = result.DetailByBudgetKindItem;
                    accountCategory.DetailByBudgetItem       = result.DetailByBudgetItem;
                    accountCategory.DetailByBudgetSubItem    = result.DetailByBudgetSubItem;
                    accountCategory.DetailByMethodDistribute = result.DetailByMethodDistribute;
                    accountCategory.DetailByAccountingObject = result.DetailByAccountingObject;
                    accountCategory.DetailByActivity         = result.DetailByActivity;
                    accountCategory.DetailByProject          = result.DetailByProject;
                    accountCategory.DetailByTask             = result.DetailByTask;
                    accountCategory.DetailBySupply           = result.DetailBySupply;
                    accountCategory.DetailByInventoryItem    = result.DetailByInventoryItem;
                    accountCategory.DetailByFixedAsset       = result.DetailByFixedAsset;
                    accountCategory.DetailByFund             = result.DetailByFund;
                    accountCategory.DetailByBankAccount      = result.DetailByBankAccount;
                    accountCategory.IsActive            = result.Inactive == true ? false:true;
                    accountCategory.AccountCategoryName = result.AccountCategoryName;


                    listAccount.Add(accountCategory);
                }
            }

            return(listAccount);
        }
        /// <summary>
        /// Updates the account category.
        /// </summary>
        /// <param name="accountCategory">The account category.</param>
        /// <returns>System.String.</returns>
        public string UpdateAccountCategory(AccountCategoryEntity accountCategory)
        {
            const string sql = "uspUpdate_AccountCategory";

            return(Db.Update(sql, true, Take(accountCategory)));
        }
        /// <summary>
        /// Inserts the account category.
        /// </summary>
        /// <param name="accountCategory">The account category.</param>
        /// <returns>System.Int32.</returns>
        public int InsertAccountCategory(AccountCategoryEntity accountCategory)
        {
            const string sql = "uspInsert_AccountCategory";

            return(Db.Insert(sql, true, Take(accountCategory)));
        }