public DataTable DeleteRemittanceAdvanceFromTransaction(Guid txID, long advanceID, long remittanceID)
        {
            FnRemittanceDataset fnRemittanceDS = (FnRemittanceDataset)TransactionService.GetDS(txID);

            FnRemittanceDataset.FnRemittanceAdvanceDataTable remittanceAdvanceTable = fnRemittanceDS.FnRemittanceAdvance;
            foreach (FnRemittanceDataset.FnRemittanceAdvanceRow row in remittanceAdvanceTable.Select())
            {
                if (row.RemittanceID == remittanceID && row.AdvanceID == advanceID)
                {
                    row.Delete();
                    break;
                }
            }

            return(remittanceAdvanceTable);
            //return fnRemittanceDS.FnRemittanceAdvance;
        }
        //public void InsertRemittanceAdvance(Guid txID, long tempfnRemittanceID)
        //{
        //    FnRemittanceDataset fnRemittanceDS = (FnRemittanceDataset)TransactionService.GetDS(txID);
        //    FnRemittance fnRemittance = ScgeAccountingQueryProvider.FnRemittanceQuery.FindProxyByIdentity(tempfnRemittanceID);
        //    FnRemittanceDataset.FnRemittanceAdvanceDataTable insertTable = (FnRemittanceDataset.FnRemittanceAdvanceDataTable)fnRemittanceDS.FnRemittanceAdvance.GetChanges(DataRowState.Added);

        //    if (insertTable != null)
        //    {
        //        foreach (FnRemittanceDataset.FnRemittanceAdvanceRow row in insertTable.Rows)
        //        {
        //            FnRemittanceAdvance remittanceAdvance = new FnRemittanceAdvance();
        //            remittanceAdvance.Remittance = fnRemittance;
        //            remittanceAdvance.Advance = new AvAdvanceDocument(row.AdvanceID);
        //            remittanceAdvance.Active = row.Active;
        //            remittanceAdvance.CreBy = row.CreBy;
        //            remittanceAdvance.CreDate = row.CreDate;
        //            remittanceAdvance.UpdBy = row.UpdBy;
        //            remittanceAdvance.UpdDate = row.UpdDate;
        //            remittanceAdvance.UpdPgm = row.UpdPgm;

        //            // if row.BudgetCostElementID < 0 is new record that no data in database.
        //            if (row.RemittanceAdvanceID < 0)
        //            {
        //                ScgeAccountingDaoProvider.FnRemittanceAdvanceDao.Save(remittanceAdvance);
        //            }
        //        }
        //    }
        //}
        //public void UpdateRemittanceAdvance(Guid txID, long tempfnRemittanceID)
        //{
        //    FnRemittanceDataset fnRemittanceDS = (FnRemittanceDataset)TransactionService.GetDS(txID);
        //    FnRemittance fnRemittance = ScgeAccountingQueryProvider.FnRemittanceQuery.FindProxyByIdentity(tempfnRemittanceID);
        //    FnRemittanceDataset.FnRemittanceAdvanceDataTable updateTable = (FnRemittanceDataset.FnRemittanceAdvanceDataTable)fnRemittanceDS.FnRemittanceAdvance.GetChanges(DataRowState.Modified);

        //    if (updateTable != null)
        //    {
        //        foreach (FnRemittanceDataset.FnRemittanceAdvanceRow row in updateTable.Rows)
        //        {
        //            FnRemittanceAdvance remittanceAdvance;
        //            if (row.RemittanceAdvanceID < 0)
        //            {
        //                remittanceAdvance = new FnRemittanceAdvance();
        //            }
        //            else
        //            {
        //                remittanceAdvance = ScgeAccountingQueryProvider.FnRemittanceAdvanceQuery.FindProxyByIdentity(row.RemittanceAdvanceID);
        //            }
        //            remittanceAdvance.Remittance = fnRemittance;
        //            remittanceAdvance.Advance = new AvAdvanceDocument(row.AdvanceID);
        //            remittanceAdvance.Active = row.Active;
        //            remittanceAdvance.CreBy = row.CreBy;
        //            remittanceAdvance.CreDate = row.CreDate;
        //            remittanceAdvance.UpdBy = row.UpdBy;
        //            remittanceAdvance.UpdDate = row.UpdDate;
        //            remittanceAdvance.UpdPgm = row.UpdPgm;

        //            // if row.BudgetCostElementID < 0 is new record that no data in database.
        //            if (row.RemittanceAdvanceID < 0)
        //            {
        //                ScgeAccountingDaoProvider.FnRemittanceAdvanceDao.Save(remittanceAdvance);
        //            }
        //            else
        //            {
        //                ScgeAccountingDaoProvider.FnRemittanceAdvanceDao.SaveOrUpdate(remittanceAdvance);
        //            }
        //        }
        //    }
        //}
        //public void DeleteRemittanceAdvance(Guid txID)
        //{
        //    FnRemittanceDataset fnRemittanceDS = (FnRemittanceDataset)TransactionService.GetDS(txID);
        //    FnRemittanceDataset.FnRemittanceAdvanceDataTable deleteTable = (FnRemittanceDataset.FnRemittanceAdvanceDataTable)fnRemittanceDS.FnRemittanceAdvance.GetChanges(DataRowState.Deleted);

        //    if (deleteTable != null)
        //    {
        //        foreach (FnRemittanceDataset.FnRemittanceItemRow row in deleteTable.Rows)
        //        {
        //            long remittanceItemID = Convert.ToInt64(row["RemittanceItemID", DataRowVersion.Original].ToString());
        //            if (remittanceItemID > 0)
        //            {
        //                FnRemittanceItem remittanceItem = ScgeAccountingQueryProvider.FnRemittanceItemQuery.FindProxyByIdentity(remittanceItemID);
        //                if (remittanceItem != null)
        //                {
        //                    ScgeAccountingDaoProvider.FnRemittanceItemDao.Delete(remittanceItem);
        //                }
        //            }
        //        }
        //    }
        //}

        public void SaveRemittanceAdvance(Guid txID, long remittanceID)
        {
            FnRemittanceDataset ds = (FnRemittanceDataset)TransactionService.GetDS(txID);

            FnRemittanceDataset.FnRemittanceAdvanceDataTable tempAdvance = new FnRemittanceDataset.FnRemittanceAdvanceDataTable();
            foreach (FnRemittanceDataset.FnRemittanceAdvanceRow row in ds.FnRemittanceAdvance.Select())
            {
                FnRemittanceDataset.FnRemittanceAdvanceRow tempRow = tempAdvance.NewFnRemittanceAdvanceRow();
                tempRow.RemittanceID = row.RemittanceID;
                tempRow.AdvanceID    = row.AdvanceID;
                tempRow.Active       = row.Active;
                tempRow.CreBy        = row.CreBy;
                tempRow.CreDate      = row.CreDate;
                tempRow.UpdBy        = row.UpdBy;
                tempRow.UpdDate      = row.UpdDate;
                tempRow.UpdPgm       = row.UpdPgm;
                tempAdvance.AddFnRemittanceAdvanceRow(tempRow);
            }

            //ScgeAccountingDaoProvider.FnRemittanceAdvanceDao.Persist(ds.FnRemittanceAdvance);
            ScgeAccountingDaoProvider.FnRemittanceAdvanceDao.Persist(tempAdvance);
        }
예제 #3
0
        public void Persist(FnRemittanceDataset.FnRemittanceAdvanceDataTable dtRemittanceAdvance)
        {
            NHibernateAdapter <FnRemittanceAdvance, long> adapter = new NHibernateAdapter <FnRemittanceAdvance, long>();

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

            //if (insertTable != null)
            //{
            //    foreach (FnRemittanceDataset.FnRemittanceAdvanceRow row in dtRemittanceAdvance)
            //    {
            //        FnRemittanceAdvance remittanceAdvance = new FnRemittanceAdvance(row);
            //        this.Save(remittanceAdvance);
            //    }
            //}
            //if (updateTable != null)
            //{
            //    foreach (FnRemittanceDataset.FnRemittanceAdvanceRow row in dtRemittanceAdvance)
            //    {
            //        FnRemittanceAdvance remittanceAdvance = new FnRemittanceAdvance(row);
            //        this.SaveOrUpdate(remittanceAdvance);
            //    }
            //}
            //if (deleteTable != null)
            //{
            //    foreach (FnRemittanceDataset.FnRemittanceAdvanceRow row in dtRemittanceAdvance)
            //    {
            //        long remittanceID = Convert.ToInt64(((DataRow)row)["RemittanceAdvanceID", DataRowVersion.Original].ToString());
            //        FnRemittanceAdvance remittanceAdvance = new FnRemittanceAdvance(row);
            //        this.Delete(remittanceAdvance);
            //    }
            //}
            #endregion
        }