コード例 #1
0
        public static bool AddUnpostedVoucher(AccountingTransactionTempDto voucherEntryDto)
        {
            try
            {
                var newVoucherNo = AccountingDataProvider.GetLastVoucherNo();

                var entity = new tAccountingTransactionTemp
                {
                    CompanyId = voucherEntryDto.CompanyId,
                    CreditAccount = voucherEntryDto.CreditAccount,
                    DebitAccount = voucherEntryDto.DebitAccount,
                    AccountingYearId = voucherEntryDto.AccountingYearId,
                    VoucherNo = newVoucherNo,
                    Currency = voucherEntryDto.CurrencyCode,
                    LineId = voucherEntryDto.LineId,
                    Total = voucherEntryDto.Total,
                    UserId = voucherEntryDto.UserId,
                    ValueTotal = voucherEntryDto.ValueTotal,
                    VoucherDate = voucherEntryDto.VoucherDate,

                };
                var result = AccountingDataProvider.AddUnpostedVoucher(entity);

                if (result == 1)
                {
                    AccountingDataProvider.DeleteLastVoucherInformation(new tLastVoucherInformation
                                                                            {LastVoucherNo = newVoucherNo});
                    AccountingDataProvider.AddLastVoucherInformation(new tLastVoucherInformation
                                                                         {LastVoucherNo = newVoucherNo + 1});
                    return true;
                }
                return false;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
コード例 #2
0
        public static AccountingTransactionTempDto GetUnpostedVoucherByNo(int voucherNo)
        {
            try
            {
                var table = AccountingDataProvider.GetUnpostedVoucherByNo(voucherNo);

                var model = new AccountingTransactionTempDto
                {
                    CompanyId = table.CompanyId,
                    CreditAccount = table.CreditAccount,
                    CreditAccountName = AccountingDataProvider.GetAccountByCode(table.CompanyId, table.CreditAccount).AccountName,
                    DebitAccount = table.DebitAccount,
                    DebitAccountName = AccountingDataProvider.GetAccountByCode(table.CompanyId, table.DebitAccount).AccountName,
                    AccountingYearId = table.AccountingYearId,
                    VoucherNo = table.VoucherNo,
                    CurrencyCode = table.Currency,
                    LineId = table.LineId,
                    Total = table.Total,
                    UserId = table.UserId,
                    ValueTotal = table.ValueTotal,
                    VoucherDate = table.VoucherDate

                };

                return model;
            }

            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
コード例 #3
0
        public static bool UpdateUnpostedVoucher(AccountingTransactionTempDto voucherEntryDto)
        {
            try
            {
                var entity = new tAccountingTransactionTemp
                {
                    CompanyId = voucherEntryDto.CompanyId,
                    CreditAccount = voucherEntryDto.CreditAccount,
                    DebitAccount = voucherEntryDto.DebitAccount,
                    AccountingYearId = voucherEntryDto.AccountingYearId,
                    VoucherNo = voucherEntryDto.VoucherNo,
                    Currency = voucherEntryDto.CurrencyCode,
                    LineId = voucherEntryDto.LineId,
                    Total = voucherEntryDto.Total,
                    UserId = voucherEntryDto.UserId,
                    ValueTotal = voucherEntryDto.ValueTotal,
                    VoucherDate = voucherEntryDto.VoucherDate,

                };

                var result = AccountingDataProvider.UpdateUnpostedVoucher(entity);

                if (result == 1)
                {
                    return true;
                }
                return false;
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
コード例 #4
0
        public static IEnumerable<AccountingTransactionTempDto> GetAllUnpostedVoucher()
        {
            try
            {
                var vouchers = AccountingDataProvider.GetAllUnpostedVoucher() as List<tAccountingTransactionTemp>;
                var voucherViewModel = new List<AccountingTransactionTempDto>();
                AccountingTransactionTempDto model;

                if (vouchers != null)
                {
                    vouchers.ForEach(delegate(tAccountingTransactionTemp table)
                    {
                        model = new AccountingTransactionTempDto
                        {
                            CompanyId = table.CompanyId,
                            CreditAccount = table.CreditAccount,
                            CreditAccountName = AccountingDataProvider.GetAccountByCode(table.CompanyId, table.CreditAccount).AccountName,
                            DebitAccount = table.DebitAccount,
                            DebitAccountName = AccountingDataProvider.GetAccountByCode(table.CompanyId, table.DebitAccount).AccountName,
                            AccountingYearId = table.AccountingYearId,
                            VoucherNo = table.VoucherNo,
                            CurrencyCode = table.Currency,
                            LineId = table .LineId,
                            Total = table.Total,
                            UserId = table.UserId,
                            ValueTotal = table.ValueTotal,
                            VoucherDate = table.VoucherDate

                        };
                        voucherViewModel.Add(model);
                    }
                        );

                    return voucherViewModel;
                }
            }

            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }

            return null;
        }