Example #1
0
        public void SaveRemittanceItem(Guid txID, long remittanceID)
        {
            FnRemittanceDataset ds = (FnRemittanceDataset)TransactionService.GetDS(txID);

            FnRemittanceDataset.FnRemittanceItemDataTable itemDt = new FnRemittanceDataset.FnRemittanceItemDataTable();
            foreach (FnRemittanceDataset.FnRemittanceItemRow row in ds.FnRemittanceItem.Select())
            {
                FnRemittanceDataset.FnRemittanceItemRow tempRow = itemDt.NewFnRemittanceItemRow();
                tempRow.RemittanceID             = row.RemittanceID;
                tempRow.PaymentType              = row.PaymentType;
                tempRow.CurrencyID               = row.CurrencyID;
                tempRow.ForeignCurrencyAdvanced  = (double)Math.Round((decimal)row.ForeignCurrencyAdvanced, 2, MidpointRounding.AwayFromZero);
                tempRow.ExchangeRate             = (double)Math.Round((decimal)row.ExchangeRate, 5, MidpointRounding.AwayFromZero);
                tempRow.ForeignCurrencyRemitted  = (double)Math.Round((decimal)row.ForeignCurrencyRemitted, 2, MidpointRounding.AwayFromZero);
                tempRow.ForeignAmountTHBAdvanced = (double)Math.Round((decimal)row.ForeignAmountTHBAdvanced, 2, MidpointRounding.AwayFromZero);
                tempRow.AmountTHB       = (double)Math.Round((decimal)row.AmountTHB, 2, MidpointRounding.AwayFromZero);
                tempRow.ExchangeRateTHB = (double)Math.Round((decimal)row.ExchangeRateTHB, 5, MidpointRounding.AwayFromZero);
                tempRow.ForeignAmountMainCurrencyAdvanced = (double)Math.Round((decimal)row.ForeignAmountMainCurrencyAdvanced, 2, MidpointRounding.AwayFromZero);
                tempRow.MainCurrencyAmount  = (double)Math.Round((decimal)row.MainCurrencyAmount, 2, MidpointRounding.AwayFromZero);
                tempRow.IsImportFromAdvance = row.IsImportFromAdvance;
                tempRow.Active  = row.Active;
                tempRow.CreBy   = row.CreBy;
                tempRow.CreDate = row.CreDate;
                tempRow.UpdBy   = row.UpdBy;
                tempRow.UpdDate = row.UpdDate;
                tempRow.UpdPgm  = row.UpdPgm;
                itemDt.AddFnRemittanceItemRow(tempRow);
            }

            //ScgeAccountingDaoProvider.FnRemittanceItemDao.Persist(ds.FnRemittanceItem);
            ScgeAccountingDaoProvider.FnRemittanceItemDao.Persist(itemDt);
        }
Example #2
0
        public void Persist(FnRemittanceDataset.FnRemittanceItemDataTable dtRemittanceItem)
        {
            NHibernateAdapter <FnRemittanceItem, long> adapter = new NHibernateAdapter <FnRemittanceItem, long>();

            adapter.UpdateChange(dtRemittanceItem, ScgeAccountingDaoProvider.FnRemittanceItemDao);
            #region Old 24-March-2009
            //FnRemittanceDataset.FnRemittanceItemDataTable insertTable = (FnRemittanceDataset.FnRemittanceItemDataTable)dtRemittanceItem.GetChanges(DataRowState.Added);
            //FnRemittanceDataset.FnRemittanceItemDataTable updateTable = (FnRemittanceDataset.FnRemittanceItemDataTable)dtRemittanceItem.GetChanges(DataRowState.Modified);
            //FnRemittanceDataset.FnRemittanceItemDataTable deleteTable = (FnRemittanceDataset.FnRemittanceItemDataTable)dtRemittanceItem.GetChanges(DataRowState.Deleted);

            //if (insertTable != null)
            //{
            //    foreach (FnRemittanceDataset.FnRemittanceItemRow row in insertTable)
            //    {
            //        FnRemittanceItem remittanceItem = new FnRemittanceItem(row);
            //        this.Save(remittanceItem);
            //    }

            //}
            //if (updateTable != null)
            //{
            //    foreach (FnRemittanceDataset.FnRemittanceItemRow row in insertTable)
            //    {
            //        FnRemittanceItem remittanceItem = new FnRemittanceItem(row);
            //        this.SaveOrUpdate(remittanceItem);
            //    }
            //}
            //if (deleteTable != null)
            //{
            //    foreach (FnRemittanceDataset.FnRemittanceItemRow row in insertTable)
            //    {
            //        long remittanceID = Convert.ToInt64(((DataRow)row)["RemittanceItemID", DataRowVersion.Original].ToString());
            //        FnRemittanceItem remittanceItem = new FnRemittanceItem(row);
            //        this.Delete(remittanceItem);
            //    }
            //}
            #endregion
        }