Example #1
0
        /// <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);
            }
        }