public static bool DeleteUnpostedVoucher(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.DeleteUnpostedVoucher(entity);

                if (result == 1)
                {
                    return(true);
                }
                return(false);
            }
            catch (Exception exception)
            {
                throw new Exception(exception.Message);
            }
        }
        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);
            }
        }
 private void UpdateFields(AccountingTransactionTempDto template)
 {
     cboDebitAccount.SelectedValue  = template.DebitAccount;
     cboCreditAccount.SelectedValue = template.CreditAccount;
     cboCurrency.SelectedValue      = template.CurrencyCode;
     txtTotal.Text       = template.Total.ToString();
     txtValueTotal.Text  = template.ValueTotal.ToString();
     dtpVoucherDate.Text = template.VoucherDate.ToShortDateString();
     txtLineId.Text      = template.LineId.ToString();
 }
        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);
        }