Exemplo n.º 1
0
        private Int32 SaveRecord()
        {
            AccountCategoryDetails clsDetails = new AccountCategoryDetails();

            clsDetails.AccountSummaryDetails = new AccountSummaryDetails
            {
                AccountSummaryID = Convert.ToInt32(cboAccountSummary.SelectedItem.Value)
            };
            clsDetails.AccountCategoryCode = txtAccountCategoryCode.Text;
            clsDetails.AccountCategoryName = txtAccountCategoryName.Text;

            AccountCategories clsAccountCategory = new AccountCategories();
            Int32             id = clsAccountCategory.Insert(clsDetails);

            clsAccountCategory.CommitAndDispose();

            return(id);
        }
        /// <summary>
        /// ListAccountsByEmployee business method. 
        /// </summary>
        /// <param name="startRowIndex">A startRowIndex value.</param>
        /// <param name="maximumRows">A maximumRows value.</param>
        /// <param name="sortExpression">A sortExpression value.</param>
        /// <param name="employee">A employee value.</param>
        /// <param name="category">A category value.</param>
        /// <param name="status">A status value.</param>
        /// <returns>Returns a List<Account> object.</returns>
        public List<Account> ListAccountsByEmployee(int maximumRows, int startRowIndex, 
            string sortExpression, string employee, AccountCategories? category, AccountStatuses? status,
            out int totalRowCount)
        {
            List<Account> result = default(List<Account>);

            if (string.IsNullOrWhiteSpace(sortExpression))
                sortExpression = "DateSubmitted DESC";

            // Data access component declarations.
            var AccountDAC = new AccountDAL();

            // Step 1 - Calling Select on AccountDAC.
            result = AccountDAC.Select(maximumRows, startRowIndex, sortExpression,
                employee, category, status);

            // Step 2 - Get count.
            totalRowCount = AccountDAC.Count(employee, category, status);

            return result;

        }