protected void Save_Click(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { Response.Redirect("Review.aspx", true); }); }
private void MasterSpeciesListDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { e.InputParameters.Add("year", int.Parse(this.State.SelectedYear)); }); }
protected void btnRegister_Click(object sender, EventArgs e) { if (Page.IsValid) { try { IbaMasterPage.ExceptionHandler(this.Master, () => { RegisterUser(); this.btnRegister.Visible = false; }); this.Master.SetSuccessMessage( "<p>Your account registration has been submitted. You will receive an e-mail confirmation when your account has been activated by a site administrator.</p>"); } catch (SqlException sqlEx) { string message = "A database error has occurred"; if (sqlEx.Message.Contains("UNIQUE KEY")) { message = "The OpenID you have chosen is already in use for another user. Perhaps you have already registered previously?"; } else { Utility.LogSiteError(sqlEx); } this.Master.SetErrorMessage("<p>" + message + "</p>"); } } }
private void SupplementalObservationList_ItemInserting(object sender, ListViewInsertEventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { e.Values.Add("EventId", this.UserState.SiteVisit.Id); }); }
protected void BreedingDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { e.InputParameters.Add("year", int.Parse(this.State.SelectedYear)); }); }
protected void submitReview_Click(object sender, EventArgs e) { if (this.UserState.SiteVisit.PointSurveys.Count.Equals(0)) { Master.SetErrorMessage( "<p>No point surveys have been entered yet. Please return to step 2 and complete at least one point survey for the site visit.</p>"); this.SubmitReview.Enabled = false; } else { IbaMasterPage.ExceptionHandler(this.Master, () => { this.UserState.SiteVisit.IsDataEntryComplete = true; SiteVisitMapper.Update(this.UserState.SiteVisit); this.UserState.SiteVisit = null; this.UserState.PointSurvey = null; this.UserState.PointsCompleted.Clear(); this.UserState.PointsRemaining.Clear(); this.UserState.SamplingPoint = null; Response.Redirect("../Default.aspx", true); }); } }
protected void AvailableYears_ErrorOccurred(object sender, ErrorEventArgs args) { IbaMasterPage.ExceptionHandler(Master, () => { throw args.Exception; }); }
private void AvailableYears_ErrorOccurred(object sender, ErrorEventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { throw e.Exception; }); }
protected void submitSiteConditions_Click(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { _factory.BuildSiteConditionsPresenter() .SaveConditions(this); }); }
protected void AvailableYears_YearChanged(object sender, EventArgs args) { IbaMasterPage.ExceptionHandler(Master, () => { MasterSpeciesListDataSource.Select(); MasterSpeciesCountGrid.DataBind(); }); }
private void SupplementalDataSource_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { e.InputParameters.Add("siteId", siteId.ToString()); e.InputParameters.Add("year", int.Parse(this.State.SelectedYear)); }); }
private void SupplementalDataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { if (e.ReturnValue == null) { this.NoSupplementals.Visible = true; } }); }
protected void AvailableYears_YearChanged(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { this.State.SpeciesResultsTable = ResultsFacade.SiteBySpeciesPivotTable(speciesId, _chartValues, int.Parse(this.State.SelectedYear)); bindSpecies(); getMapDataAndBind(); }); }
protected void NextPoint_Click(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { saveSurvey(); moveToNextPoint(); this.ObservationsList.DataSource = null; this.PointCountObservationDataSource.Select(); }); }
protected void lvUsers_ItemCommand(object sender, ListViewCommandEventArgs e) { this.ItemDataPager.PreRender -= new EventHandler(ItemDataPager_PreRender); //Disable this event handler so that it will not be called during the call of this event handler. IbaMasterPage.ExceptionHandler(this.Master, () => { try { ImageButton ibEditUpdate = e.Item.FindControl("btnEdit") as ImageButton; ImageButton ibDeleteCancel = e.Item.FindControl("btnDelete") as ImageButton; HiddenField IdLabel = e.Item.FindControl("PersonId") as HiddenField; Guid personId = new Guid(IdLabel.Value); HiddenField statusLabel = e.Item.FindControl("StatusLabel") as HiddenField; string status = statusLabel.Value; if (e.CommandName.Equals("EditOrUpdateCommand")) { if (!personId.Equals(Guid.Empty)) { EditProfile.Visible = true; loadDetailUserProfile(PersonFacade.Select(personId)); } } else if (e.CommandName.Equals("DeleteOrCancelCommand")) { if (!personId.Equals(Guid.Empty)) { // Real deletes are only allowed for pending users; others are just inactived if (status.Equals("Pending")) { PersonFacade.Delete(new Person() { Id = personId }); } else { Person toupdate = PersonFacade.Select(personId); toupdate.PersonStatus = Status.Inactive; PersonFacade.Update(toupdate); } loadListViewControl(); this.Master.SetSuccessMessage("<p>Successful user profile delete.</p>"); } } } catch (SqlException exc) { Utility.LogSiteError(exc); this.Master.SetErrorMessage("<p>A database error occurred.</p>"); } }); }
protected void AvailableYears_YearChanged(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { MigrationDataSource.Select(); MigrationView.DataBind(); BreedingDataSource.Select(); BreedingGrid.DataBind(); }); }
private void AvailableYears_YearChanged(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { //SupplementalDataSource.Select(); SupplementalRepeater.DataBind(); this.State.SiteResultsTable = ResultsFacade.SpeciesSitePivotTable(siteId, int.Parse(this.State.SelectedYear)); bindSiteTable(); }); }
protected void Page_Load(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { Master.SetViewActive(); this.AvailableYears.YearChanged += new EventHandler(AvailableYears_YearChanged); this.AvailableYears.ErrorOccurred += new EventHandler <ErrorEventArgs>(AvailableYears_ErrorOccurred); this.MasterSpeciesListDataSource.Selecting += new ObjectDataSourceSelectingEventHandler(MasterSpeciesListDataSource_Selecting); }); }
protected void Page_Load(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { this.AvailableYears.ErrorOccurred += new EventHandler <ErrorEventArgs>(AvailableYears_ErrorOccurred); this.AvailableYears.YearChanged += new EventHandler(AvailableYears_YearChanged); this.BreedingDataSource.Selecting += new ObjectDataSourceSelectingEventHandler(BreedingDataSource_Selecting); this.MigrationDataSource.Selecting += new ObjectDataSourceSelectingEventHandler(MigrationDataSource_Selecting); }); }
protected void Page_Load(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { if (Master.IsAuthenticatedUser()) { Master.SetObservationActive(); AddHandlers(); } }); }
private void SitePointsList_ItemCommand(object sender, ListViewCommandEventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { // User has chosen a new point for which to collect data. Set it as the current point and re-bind the list Guid id = new Guid(e.CommandArgument.ToString()); this.UserState.SamplingPoint = this.UserState.PointsRemaining.Union(this.UserState.PointsCompleted).SingleOrDefault(x => x.Id == id); SitePointsList.DataBind(); }); }
protected void Page_Load(object sender, EventArgs e) { // don't use Master.IsAuthenticatedUser() because that also checks to make sure the user already exists in the system, which doesn't make sense in this context. //if (this.UserState.OpenIdResponse != null && this.UserState.OpenIdResponse.IsAuthenticated) //{ this.Master.ClearMessages(); IbaMasterPage.ExceptionHandler(this.Master, () => { if (!Page.IsPostBack) { initializePage(); } }); //} }
protected void Page_Load(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { Master.SetObservationActive(); if (!Page.IsPostBack) { bindDropDownLists(); if (Master.IsAuthenticatedUser()) { loadCurrentSiteVisit(); } } }); }
protected void Supplemental_Click(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { // don't need to save if the point was skipped if (!string.IsNullOrEmpty(this.Time.Text.Trim())) { saveSurvey(); } // next step is needed to get the point arrays in session set properly moveToNextPoint(); Response.Redirect("~/observations/Supplemental.aspx", true); }); }
protected void Page_Load(object sender, EventArgs e) { this.Master.ClearMessages(); IbaMasterPage.ExceptionHandler(Master, () => { if (Master.IsAuthenticatedUser()) { AddHandlers(); if (!IsPostBack) { this.loadSiteName(); } } }); }
/// <summary> /// Wraps a method call in a try/catch block, passing an ArgumentOutOfRangeException exception to the standard error message routine. /// </summary> /// <param name="master">The master.</param> /// <param name="method">The method.</param> public static void ExceptionHandler(IbaMasterPage master, ExceptionHandlerMethod method) { try { method(); } catch (ArgumentOutOfRangeException outOfRange) { Utility.LogSiteError(outOfRange); master.SetErrorMessage(outOfRange.Message); } catch (InvalidOperationException invalid) { Utility.LogSiteError(invalid); master.SetErrorMessage(invalid.Message); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void Page_Load(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler(this.Master, () => { if (Master.IsAuthenticatedUser()) { Master.SetObservationActive(); AddHandlers(); if (!Page.IsPostBack) { bindControls(); } } }); }
private void SitePointDataSource_Selected(object sender, ObjectDataSourceStatusEventArgs e) { IbaMasterPage.ExceptionHandler(Master, () => { if (this.UserState.PointsRemaining.Count.Equals(0)) { List <SamplingPoint> list = ((List <SamplingPoint>)e.ReturnValue); if (list == null) { Master.SetErrorMessage("No sampling points are defined for Site ID " + this.UserState.SiteVisit.LocationId.ToString()); // TODO log this as an error somehow return; } this.UserState.PointsRemaining.AddRange(list.OrderBy(x => x.Name)); } }); }
protected void Page_Load(object sender, EventArgs e) { IbaMasterPage.ExceptionHandler((IbaMasterPage)Master, () => { addHandlers(); GetSiteId(); if (!Page.IsPostBack) { this.State.SiteResultsTable = ResultsFacade.SpeciesSitePivotTable(siteId, int.Parse(this.State.SelectedYear)); bindSite(siteId); //bindMap(siteId); } bindSiteTable(); }); }
protected void Page_Load(object sender, EventArgs e) { if (Master.IsAuthenticatedUser()) { IbaMasterPage.ExceptionHandler(this.Master, () => { if (!Page.IsPostBack) { this.ItemDataPager.PreRender -= new EventHandler(ItemDataPager_PreRender); //Disable this event handler so that it will not be called during page is loaded first time if (this.UserState.CurrentUser.IsAdministrator) { loadListViewControl(); } else { loadDetailUserProfile(this.UserState.CurrentUser); } } }); } }