private void BindControls(StandingsReportState state) { /// Bind and display grids _dispatcher.Dispatch(state); //int dealerNo = GetDealerNo(); //int participantUserId = GetParticipantUserId(); //int minQualId = GetMinQualId(); ////int paymentId = GetPaymentId(); ////if (paymentId > 0) //// BindPaymentControls(paymentId); ////else //if (minQualId > 0 && participantUserId > 0) // BindMinQualControls(participantUserId, minQualId); //else if (participantUserId > 0) // BindParticipantControls(participantUserId); //else //{ // BindDealerControls(dealerNo); // BindCorporateControls(); //} }
private void BindControls(StandingsReportState state) { /// Bind and display grids _dispatcher.Dispatch(state); SetPageState(state, DealerNo, ParticipantId); }
private void SetPageState(StandingsReportState state, string dealerNo, string salesPersonId) { string pageHeading = blank; bool showStandingsLink = false; bool showParticipantLink = false; switch (state) { case StandingsReportState.Summary: pageHeading = "Standings Summary"; break; case StandingsReportState.ParticipantDetail: pageHeading = "Participant Detail"; showStandingsLink = true; break; case StandingsReportState.MinQualifierDetail: pageHeading = "Minimum Qualifier Detail"; showStandingsLink = showParticipantLink = true; break; case StandingsReportState.TieBreakersDetail: pageHeading = "Tie Breakers"; showStandingsLink = true; break; case StandingsReportState.BonusRankingsDetail: pageHeading = "Bonus Rankings Detail"; showStandingsLink = true; break; } lblPageHeading.Text = pageHeading; btnToStandings.Visible = showStandingsLink; btnToParticipantDetail.Visible = showParticipantLink; lblSeparator.Visible = showStandingsLink && showParticipantLink; BindParticipantDetail(state, dealerNo, salesPersonId); }
private void BindParticipantDetail(StandingsReportState state, string dealerNo, string salesPersonId) { bool isProperState = state == StandingsReportState.ParticipantDetail || state == StandingsReportState.MinQualifierDetail; pnlParticipant.Visible = isProperState; if (!isProperState || String.IsNullOrEmpty(dealerNo) && String.IsNullOrEmpty(salesPersonId)) return; var detail = DataHelper.GetParticipantDetail(PID, dealerNo, salesPersonId).FirstOrDefault(); pnlParticipantName.Visible = detail != null && !String.IsNullOrEmpty(detail.salesPersonId); if (detail != null) { lblParticipant.Text = detail.salesPersonId + " - " + detail.LastName + ", " + detail.FirstName; lblDealer.Text = detail.dealerno + " - " + detail.dealername; lblTotalEligibleAmount.Text = detail.TotalEligibleAmount.ToString("c"); lblPreviouslyPaidAmount.Text = detail.PreviouslyPaidAmount.ToString("c"); lblPendingAmount.Text = detail.PendingAmount.ToString("c"); lblEstimatedDepositDate.Text = detail.EstimatedDepositDate.HasValue ? detail.EstimatedDepositDate.Value.ToShortDateString() : blank; } }
/// When this is called, GridList must already be populated, i.e. grids already instantiated and /// inserted into control hierarchy. This just determines which grids are visible. public abstract void Dispatch(StandingsReportState state);
public void Dispatch(StandingsReportState state, string paramName, object paramValue) { SetGridsInputParamValue(paramName, paramValue); Dispatch(state); }
public override void Dispatch(StandingsReportState state) { Dispatch(state, GetUserAccessLevel(User)); }
public StandingsReportStateChangeEventArgs(StandingsReportState dispatcherState, string dealerNo, string salesPersonId, int? minQualRowNum) { DispatcherState = dispatcherState; DealerNo = dealerNo; SalesPersonId = salesPersonId; MinQualRowNum = minQualRowNum; }
private void RaiseStateChangedEvent(StandingsReportState state, string dealerNo, string salesPersonId, int? minQualRowNum) { if (StateChanged != null) StateChanged(this, new StandingsReportStateChangeEventArgs(state, dealerNo, salesPersonId, minQualRowNum)); }
private void Dispatch(StandingsReportState state, AccessLevel accessLevel) { if (GridList == null || !GridList.Any() /*empty*/ ) return; ResetVisibility(false); ExecuteOnGrids(g => true, g => g.ClearSelection()); // They can't see anything so no need to do any work. if (accessLevel == AccessLevel.None) return; // Results need to be filtered by DealerNo. if (accessLevel != AccessLevel.All) { SetGridsInputParamValue(DEALERNO, User.Dealerno); // Results need to be further filtered down to Subordinates only. if (accessLevel != AccessLevel.Dealer) { SetGridsInputParamValue(PARTICIPANTUSERID, User.EmpID); SetGridsInputParamValue(SUBORDSONLY, true); } } switch (state) { case StandingsReportState.Summary: SetSummary(accessLevel); break; case StandingsReportState.ParticipantDetail: SetParticipantDetail(accessLevel); break; case StandingsReportState.MinQualifierDetail: SetMinQualifierDetail(accessLevel); break; case StandingsReportState.TieBreakersDetail: SetTieBreakersDetail(accessLevel); break; case StandingsReportState.BonusRankingsDetail: SetBonusRankingsDetail(accessLevel); break; } BindVisibleGrids(); /// for temporary debugging, populate all grids with same data. //var rows = DummyInquiryDB.GetData().ToList(); //ExecuteOnGrids(g => true, g => g.DataBind(DataFetcher.FetchData(g.DataFetchCommand, 1))); }