public string GetBidIds(string agency, string category, string location, string title) { string response = String.Empty; AvailBidIdResponse availBidRes = new AvailBidIdResponse(); AvailBidIdResponseAvailBidIds availBidIds = new AvailBidIdResponseAvailBidIds(); try { availBidIds.Bid = GovBidsDAL.FetchDataBidIds(agency, category, location, title).ToArray(); availBidRes.Items = new AvailBidIdResponseAvailBidIds[] { availBidIds }; response = Serialize(availBidRes); } catch (Exception ex) { AvailBidResponseException exception = new AvailBidResponseException(); exception.Error = ex.Message; response = Serialize(exception); } finally { availBidRes = null; availBidIds = null; } return(response); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //loading the dropdown list var list = GovBidsDAL.FetchDataBids(String.Empty, String.Empty, String.Empty, String.Empty); list.Insert(0, new AvailBidResponseAvailBidsBid { ID = "0", Agency = "", Category = "", DateOpened = "", DatePosted = "", ItemID = "0", Location = "", PreBidDate = "", SpecificationsDate = "", Title = "" }); ddlBids.DataSource = list; ddlBids.DataValueField = "ID"; ddlBids.DataTextField = "Title"; ddlBids.DataBind(); } }
public string GetCategories() { string response = String.Empty; Category category = new Category(); try { category.Items = GovBidsDAL.FetchDataCategories().ToArray(); response = Serialize(category); } catch (Exception ex) { AvailBidResponseException exception = new AvailBidResponseException(); exception.Error = ex.Message; response = Serialize(exception); } return(response); }
public string GetLocations() { string response = String.Empty; Location location = new Location(); try { location.Items = GovBidsDAL.FetchDataLocation().ToArray(); response = Serialize(location); } catch (Exception ex) { AvailBidResponseException exception = new AvailBidResponseException(); exception.Error = ex.Message; response = Serialize(exception); } return(response); }
public string GetAgencies() { string response = String.Empty; Agency agency = new Agency(); try { agency.Items = GovBidsDAL.FetchDataAgencies().ToArray(); response = Serialize(agency); } catch (Exception ex) { AvailBidResponseException exception = new AvailBidResponseException(); exception.Error = ex.Message; response = Serialize(exception); } return(response); }
protected void btnPush_Click(object sender, EventArgs e) { //Create our push services broker var push = new PushBroker(); try { if (ddlBids.SelectedItem.Value != null && Convert.ToInt32(ddlBids.SelectedItem.Value) != 0) { //Wire up the events for all the services that the broker registers push.OnNotificationSent += NotificationSent; push.OnNotificationFailed += NotificationFailed; //Apple settings for push string appdatafolder = Server.MapPath("~\\App_Data\\"); var appleCert = File.ReadAllBytes(Path.Combine(appdatafolder, ConfigurationManager.AppSettings["AppleCert"])); //Development = false; Production = True push.RegisterAppleService(new ApplePushChannelSettings(Convert.ToBoolean(ConfigurationManager.AppSettings["IsProduction"]), appleCert, ConfigurationManager.AppSettings["AppleCertPWD"])); push.RegisterWindowsPhoneService(); //fetch all devices for push foreach (var item in GovBidsDAL.FetchDataDeviceTokens()) { switch (item.DeviceType) { case "iOS": //Queue notification push.QueueNotification(new AppleNotification() .ForDeviceToken(item.DeviceToken) .WithAlert(ConfigurationManager.AppSettings["NotificationLabel"] + " : " + GovBidsDAL.FetchDataBidByID(Convert.ToInt32(ddlBids.SelectedItem.Value)).Title) .WithBadge(1) .WithSound(ConfigurationManager.AppSettings["AppleSoundName"])); break; case "WP8": push.QueueNotification(new WindowsPhoneToastNotification() .ForEndpointUri(new Uri(item.DeviceToken)) .ForOSVersion(WindowsPhoneDeviceOSVersion.Eight) .WithBatchingInterval(BatchingInterval.Immediate) .WithNavigatePath("/MainPage.xaml") .WithText1(ConfigurationManager.AppSettings["NotificationLabel"]) .WithText2(GovBidsDAL.FetchDataBidByID(Convert.ToInt32(ddlBids.SelectedItem.Value)).Title)); break; default: break; } } } } catch (Exception) { throw; } finally { //Stop and wait for the queues to drains try { push.StopAllServices(); } catch (Exception) { } push = null; } }