예제 #1
0
        /// <summary>
        /// Event handler for the Soap Client when it finishes a call to GetBids
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void client_GetBidsCompleted(object sender, GetBidsCompletedEventArgs e)
        {
            //Get the progress indicator from the system tray
            var proggressIndicator = SystemTray.GetProgressIndicator(this);

            proggressIndicator.IsIndeterminate = false;
            proggressIndicator.IsVisible       = false;

            //Detect errors
            if (e.Error == null)
            {
                (IsolatedStorageSettings.ApplicationSettings)["LastUpdated"] = DateTime.Now;
                (IsolatedStorageSettings.ApplicationSettings).Save();
                var bids = getBidListFromXml(e.Result);

                //From DB
                using (var databaseManager = new DatabaseManager())
                {
                    var bidsV = (from b in databaseManager.GovBidContext.BidsViewed select b);
                    foreach (var bV in bidsV)
                    {
                        try
                        {
                            bids.First(p => p.ItemID == bV.Id).Viewed = true;
                        }

                        catch { }
                    }

                    databaseManager.GovBidContext.Bids.DeleteAllOnSubmit(databaseManager.GovBidContext.Bids);
                    databaseManager.GovBidContext.Bids.InsertAllOnSubmit(bids);
                    databaseManager.GovBidContext.SubmitChanges();
                }

                listBox1.ItemsSource = bids;
            }

            else
            {
                MessageBox.Show("Error con conexión de internet.");
            }
        }
예제 #2
0
        /// <summary>
        /// Event handler for the Soap Client when it finishes a call to GetBids
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void client_GetBidsCompleted(object sender, GetBidsCompletedEventArgs e)
        {
            //Get the progress indicator from the system tray
            var proggressIndicator = SystemTray.GetProgressIndicator(this);
            proggressIndicator.IsIndeterminate = false;
            proggressIndicator.IsVisible = false;

            //Detect errors
            if (e.Error == null)
            {
                (IsolatedStorageSettings.ApplicationSettings)["LastUpdated"] = DateTime.Now;
                (IsolatedStorageSettings.ApplicationSettings).Save();
                var bids = getBidListFromXml(e.Result);

                //From DB
                using (var databaseManager = new DatabaseManager())
                {
                    var bidsV = (from b in databaseManager.GovBidContext.BidsViewed select b);
                    foreach (var bV in bidsV)
                    {
                        try
                        {
                            bids.First(p => p.ItemID == bV.Id).Viewed = true;
                        }

                        catch { }
                    }

                    databaseManager.GovBidContext.Bids.DeleteAllOnSubmit(databaseManager.GovBidContext.Bids);
                    databaseManager.GovBidContext.Bids.InsertAllOnSubmit(bids);
                    databaseManager.GovBidContext.SubmitChanges();
                }

                listBox1.ItemsSource = bids;
            }

            else
                MessageBox.Show("Error con conexión de internet.");
        }