Beispiel #1
0
        public void ExportSpecialOffers()
        {
            SqlCompactConnection          conn   = new SqlCompactConnection();
            SpecialOffer                  so     = new SpecialOffer();
            SpecialOfferCollection        soCol  = new SpecialOfferCollection();
            SpecialOfferProduct           sop    = new SpecialOfferProduct();
            SpecialOfferProductCollection sopCol = new SpecialOfferProductCollection();

            string where = "startdate <= getdate() and enddate >= getdate()";
            string orderby = "specialofferid";

            try
            {
                //ds = q.GetDataSet(false, sql);
                soCol          = so.GetSpecialOffersCollection(where, orderby);
                conn.SynchForm = this;
                conn.DropSepcialOfferTable();
                conn.CreateSpecialOfferTable();
                conn.AddSpecialOffer(soCol);
                where   = "specialofferid in (select specialofferid from specialoffer where startdate <= getdate() and enddate >= getdate())";
                orderby = "specialofferid";
                sopCol  = sop.GetSpecialOfferProductsCollection(where, orderby);
                conn.DropSepcialOfferProductTable();
                conn.CreateSpecialOfferProductTable();
                conn.AddSpecialOfferProduct(sopCol);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.CloseDatabase();
                conn   = null;
                so     = null;
                soCol  = null;
                sop    = null;
                sopCol = null;
                //ds.Dispose();
                // q = null;
            }
        }