Esempio n. 1
0
 public BMS_DAL.DS.BMSDS GetFixtureWithRelation()
 {
     BMS_DAL.DS.BMSDS ds = new BMS_DAL.DS.BMSDS();
     using (BMS_DAL.DS.BMSDSTableAdapters.TFixturesTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TFixturesTableAdapter())
     {
         try
         {
             ds.TFixtures.Merge(ta.GetData());
         }
         catch (Exception ex) { throw ex; }
     }
     using (BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter())
     {
         try
         {
             ds.TInvoices.Merge(ta.GetData());
         }
         catch (Exception ex) { throw ex; }
     }
     using (BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter())
     {
         try
         {
             ds.TInvoiceDetails.Merge(ta.GetData());
         }
         catch (Exception ex) { throw ex; }
     }
     return(ds);
 }
Esempio n. 2
0
        public int DeleteFixtureWithRelation(BMS_DAL.DS.BMSDS ds)
        {
            int r = 0;

            if (ds.TInvoiceDetails.GetChanges() != null)
            {
                using (BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter())
                {
                    r += ta.UpdateWithTrans(ds.TInvoiceDetails);
                }
            }
            if (ds.TInvoices.GetChanges() != null)
            {
                using (BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoicesTableAdapter())
                {
                    r += ta.UpdateWithTrans(ds.TInvoices);
                }
            }
            if (ds.TFixtures.GetChanges() != null)
            {
                using (BMS_DAL.DS.BMSDSTableAdapters.TFixturesTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TFixturesTableAdapter())
                {
                    r += ta.UpdateWithTrans(ds.TFixtures);
                }
            }

            return(r);
        }
Esempio n. 3
0
 public BMS_DAL.DS.BMSDS.TInvoiceDetailsDataTable GetInvoiceDetail()
 {
     using (BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter())
     {
         try
         {
             return(ta.GetData());
         }
         catch (Exception ex) { throw ex; }
     }
 }
Esempio n. 4
0
        public int UpdateInvoiceDetail(BMS_DAL.DS.BMSDS.TInvoiceDetailsDataTable dt)
        {
            int r = 0;

            if (dt.GetChanges() != null)
            {
                using (BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter ta = new BMS_DAL.DS.BMSDSTableAdapters.TInvoiceDetailsTableAdapter())
                {
                    r = ta.UpdateWithTrans(dt);
                }
            }
            return(r);
        }
Esempio n. 5
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);
        }