Exemplo n.º 1
0
        public int UpdateDS(BMS_DAL.DS.BMSDS ds)
        {
            int r = 0;

            if (ds.GetChanges() != null)
            {
                using (BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter())
                {
                    r = ta.Update(ds);
                }
            }
            return(r);
        }
Exemplo n.º 2
0
        public int UpdateFixtureWithRelation(BMS_DAL.DS.BMSDS ds)
        {
            int r = 0;

            var dschanges = ds.GetChanges();

            using (BMS_DAL.DS.BMSDSTableAdapters.TFixturesTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TFixturesTableAdapter())
            {
                r += ta.UpdateWithTrans((BMS_DAL.DS.BMSDS.TFixturesDataTable)dschanges.Tables["TFixtures"]);
            }
            foreach (DataRow idrow in dschanges.Tables["TInvoices"].AsEnumerable().Where(t => t.RowState.Equals(DataRowState.Unchanged)))
            {
                if ((int)idrow["ID"] < 0)
                {
                    idrow.SetAdded();
                }
                else
                {
                    idrow.SetModified();
                }
            }
            using (BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter())
            {
                r += ta.UpdateWithTrans((BMS_DAL.DS.BMSDS.TInvoicesDataTable)dschanges.Tables["TInvoices"]);
            }
            foreach (DataRow idrow in dschanges.Tables["TInvoiceDetails"].AsEnumerable().Where(t => t.RowState.Equals(DataRowState.Unchanged)))
            {
                if ((int)idrow["ID"] < 0)
                {
                    idrow.SetAdded();
                }
                else
                {
                    idrow.SetModified();
                }
            }
            using (BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter())
            {
                r += ta.UpdateWithTrans((BMS_DAL.DS.BMSDS.TInvoiceDetailsDataTable)dschanges.Tables["TInvoiceDetails"]);
            }

            return(r);
        }