/// <summary> /// /// </summary> /// <param name="EventKey">The UnitKey of the conference from which the outreach options are displayed</param> /// <param name="AOwner">The parent form</param> /// <param name="AShowOnlyIfSeveralOptions">Inidcator if the dialog is to be shown if there /// is only one outreach option. True: dialog is shown only if there are more than one option. /// False: dialog is shown always, indipendent of how many outreach options there are</param> /// <param name="ConferenceList">The selected outreach options. It holds the Unit keys /// and the unit names.</param> /// <returns></returns> public static DialogResult OpenSelectOutreachOptionDialog(Int64 EventKey, Form AOwner, bool AShowOnlyIfSeveralOptions, out List <KeyValuePair <long, string> > ConferenceList) { TFrmSelectOutreachOption SelectOutreachOptionDialog; FUnitKey = EventKey; DialogResult DlgResult = DialogResult.Cancel; ConferenceList = new List <KeyValuePair <long, String> >(); // TODO check the handle... SelectOutreachOptionDialog = new TFrmSelectOutreachOption(AOwner); if ((AShowOnlyIfSeveralOptions && (GetOutreachOptionsCount() > 1)) || !AShowOnlyIfSeveralOptions) { DlgResult = SelectOutreachOptionDialog.ShowDialog(AOwner); if (DlgResult == DialogResult.OK) { GetSelectedOutreachOptions(ref ConferenceList, false); } } if (AShowOnlyIfSeveralOptions && (GetOutreachOptionsCount() == 1)) { // We don't show the dialog and we have only one outreach option, then use // this outreach option as result GetSelectedOutreachOptions(ref ConferenceList, true); DlgResult = DialogResult.OK; } return(DlgResult); }
/// <summary> /// read the values from the controls and give them to the calculator /// </summary> /// <param name="ACalculator"></param> /// <param name="AReportAction"></param> public void ReadControls(TRptCalculator ACalculator, TReportActionEnum AReportAction) { if (rbtConference.Checked) { ACalculator.AddParameter("param_conferenceselection", "one conference"); } else if (rbtAllConferences.Checked) { ACalculator.AddParameter("param_conferenceselection", "all conferences"); } if (rbtAllAttendees.Checked) { ACalculator.AddParameter("param_attendeeselection", "all attendees"); } else if (rbtExtract.Checked) { ACalculator.AddParameter("param_attendeeselection", "from extract"); } else if (rbtOneAttendee.Checked) { ACalculator.AddParameter("param_attendeeselection", "one attendee"); } ACalculator.AddParameter("param_partnerkey", txtOneAttendee.Text); ACalculator.AddParameter("param_conferencekey", txtConference.Text); ACalculator.AddParameter("param_conferencename", txtConference.LabelText); ACalculator.AddParameter("param_extractname", txtExtract.Text); TVerificationResult VerificationResult; if ((AReportAction == TReportActionEnum.raGenerate) && (rbtExtract.Checked) && (txtExtract.Text.Length == 0)) { VerificationResult = new TVerificationResult(Catalog.GetString("Select an extract for running the report."), Catalog.GetString("No extract was selected!"), TResultSeverity.Resv_Critical); FPetraUtilsObject.AddVerificationResult(VerificationResult); } if ((AReportAction == TReportActionEnum.raGenerate) && (rbtOneAttendee.Checked) && (txtOneAttendee.Text == "0000000000")) { VerificationResult = new TVerificationResult(Catalog.GetString("Select a partner for whom to run the report."), Catalog.GetString("No partner was selected!"), TResultSeverity.Resv_Critical); FPetraUtilsObject.AddVerificationResult(VerificationResult); } if ((AReportAction == TReportActionEnum.raGenerate) && (rbtConference.Checked) && (txtConference.Text == "0000000000")) { VerificationResult = new TVerificationResult(Catalog.GetString("Select a conference to run the report against to."), Catalog.GetString("No conference was selected!"), TResultSeverity.Resv_Critical); FPetraUtilsObject.AddVerificationResult(VerificationResult); } if (FShowSelectOutreachOptionsDialog && (AReportAction == TReportActionEnum.raGenerate) && (rbtConference.Checked) && (FPetraUtilsObject.GetVerificationResultCount() == 0)) { List <KeyValuePair <long, string> > ConferenceList; DialogResult DlgResult = TFrmSelectOutreachOption.OpenSelectOutreachOptionDialog( Convert.ToInt64(txtConference.Text), FPetraUtilsObject.GetForm(), true, out ConferenceList); if (((DlgResult != DialogResult.OK) || (ConferenceList.Count == 0)) && (DlgResult != DialogResult.None)) { VerificationResult = new TVerificationResult( Catalog.GetString("You must chose at least one outreach option from the \"Select Outreach Option\" Dialog."), Catalog.GetString("No outreach option was selected!"), TResultSeverity.Resv_Critical); FPetraUtilsObject.AddVerificationResult(VerificationResult); } string OutreachOptions = ""; string OutreachOptionsCode = ""; foreach (KeyValuePair <long, string> OutreachOption in ConferenceList) { OutreachOptions = OutreachOptions + OutreachOption.Key.ToString() + ","; OutreachOptionsCode = OutreachOptionsCode + OutreachOption.Value + ","; } if (OutreachOptions.Length > 0) { // Remove the last comma OutreachOptions = OutreachOptions.Remove(OutreachOptions.Length - 1); OutreachOptionsCode = OutreachOptionsCode.Remove(OutreachOptionsCode.Length - 1); } else { OutreachOptions = txtConference.Text; OutreachOptionsCode = txtConference.LabelText; } ACalculator.AddStringParameter("param_conferenceoptions", OutreachOptions); ACalculator.AddParameter("param_conferenceoptionscode", OutreachOptionsCode); } }
/// <summary> /// /// </summary> /// <param name="EventKey">The UnitKey of the conference from which the outreach options are displayed</param> /// <param name="AOwner">The parent form</param> /// <param name="AShowOnlyIfSeveralOptions">Inidcator if the dialog is to be shown if there /// is only one outreach option. True: dialog is shown only if there are more than one option. /// False: dialog is shown always, indipendent of how many outreach options there are</param> /// <param name="ConferenceList">The selected outreach options. It holds the Unit keys /// and the unit names.</param> /// <returns></returns> public static DialogResult OpenSelectOutreachOptionDialog(Int64 EventKey, Form AOwner, bool AShowOnlyIfSeveralOptions, out List <KeyValuePair <long, string>>ConferenceList) { TFrmSelectOutreachOption SelectOutreachOptionDialog; FUnitKey = EventKey; DialogResult DlgResult = DialogResult.Cancel; ConferenceList = new List <KeyValuePair <long, String>>(); // TODO check the handle... SelectOutreachOptionDialog = new TFrmSelectOutreachOption(AOwner); if ((AShowOnlyIfSeveralOptions && (GetOutreachOptionsCount() > 1)) || !AShowOnlyIfSeveralOptions) { DlgResult = SelectOutreachOptionDialog.ShowDialog(AOwner); if (DlgResult == DialogResult.OK) { GetSelectedOutreachOptions(ref ConferenceList, false); } } if (AShowOnlyIfSeveralOptions && (GetOutreachOptionsCount() == 1)) { // We don't show the dialog and we have only one outreach option, then use // this outreach option as result GetSelectedOutreachOptions(ref ConferenceList, true); DlgResult = DialogResult.OK; } return DlgResult; }