예제 #1
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="e"></param>
        /// <param name="AVerificationResultCollection"></param>
        /// <param name="AVerificationResult"></param>
        /// <param name="FDataColumnComparedTo"></param>
        /// <returns></returns>
        public static Boolean VerifySubscriptionData(DataColumnChangeEventArgs e,
                                                     TVerificationResultCollection AVerificationResultCollection,
                                                     out TVerificationResult AVerificationResult,
                                                     out DataColumn FDataColumnComparedTo)
        {
            Boolean ReturnValue;

            AVerificationResult = null;
            DataColumn FDataColumnComparedTo2 = null;

            if ((e.Column.ColumnName == PSubscriptionTable.GetDateCancelledDBName()) ||
                (e.Column.ColumnName == PSubscriptionTable.GetExpiryDateDBName()) ||
                (e.Column.ColumnName == PSubscriptionTable.GetDateNoticeSentDBName()) ||
                (e.Column.ColumnName == PSubscriptionTable.GetStartDateDBName()) ||
                (e.Column.ColumnName == PSubscriptionTable.GetSubscriptionRenewalDateDBName()) ||
                (e.Column.ColumnName == PSubscriptionTable.GetFirstIssueDBName()) || (e.Column.ColumnName == PSubscriptionTable.GetLastIssueDBName()))
            {
                VerifySubscriptionDates(e, AVerificationResultCollection, out AVerificationResult, out FDataColumnComparedTo2);
            }

            FDataColumnComparedTo = FDataColumnComparedTo2;

            // if (e.Column.Ordinal = (e.Column.Table as PPartnerLocationTable).ColumnEmailAddress.Ordinal) then
            // begin
            // VerifyEMailAddress(e, AVerificationResult);
            // end;
            if ((e.Column.ColumnName == PSubscriptionTable.GetPublicationCopiesDBName()) ||
                (e.Column.ColumnName == PSubscriptionTable.GetNumberIssuesReceivedDBName()) ||
                (e.Column.ColumnName == PSubscriptionTable.GetNumberComplimentaryDBName()))
            {
                VerifyInteger(e, out AVerificationResult);
            }

            // any verification errors?
            if (AVerificationResult == null)
            {
                ReturnValue = true;
            }
            else
            {
                ReturnValue = false;
            }

            return(ReturnValue);
        }
예제 #2
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="Row"></param>
        /// <param name="AVerificationResultCollection"></param>
        /// <param name="VerificationResult"></param>
        /// <param name="AErroneousDC"></param>
        /// <param name="FtmpPartnerKeyValid"></param>
        /// <returns></returns>
        public static Boolean VerifySubscriptionDataFinal(PSubscriptionRow Row,
                                                          out TVerificationResultCollection AVerificationResultCollection,
                                                          out TVerificationResult VerificationResult,
                                                          out DataColumn AErroneousDC,
                                                          Boolean FtmpPartnerKeyValid)
        {
            Boolean ReturnValue;
            Boolean Completed;

            //Boolean NoErrors;
            TVerificationResultCollection TmpCollection = null;

            //TVerificationResult TmpError;
            DataColumn            TmpDC;
            DataColumn            NilDataColumn;
            String                mVerifiedString;
            bool                  mPartnerExists;
            TPartnerClass         mPartnerClass;
            TStdPartnerStatusCode partnerStatus;

            TPartnerClass[] mPartnerClassSet;
            Completed                     = false;
            ReturnValue                   = false;
            VerificationResult            = null;
            AVerificationResultCollection = null;
            AErroneousDC                  = null;

            while (!Completed)
            {
                TmpDC = Row.Table.Columns[PSubscriptionTable.GetStartDateDBName()];
                VerifySubscriptionDates(new DataColumnChangeEventArgs(Row, TmpDC,
                                                                      Row[PSubscriptionTable.GetStartDateDBName()]), TmpCollection, out VerificationResult, out NilDataColumn);

                if (VerificationResult != null)
                {
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetExpiryDateDBName()];
                VerifySubscriptionDates(new DataColumnChangeEventArgs(Row, TmpDC,
                                                                      Row[PSubscriptionTable.GetExpiryDateDBName()]), TmpCollection, out VerificationResult, out NilDataColumn);

                if (VerificationResult != null)
                {
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetSubscriptionRenewalDateDBName()];
                VerifySubscriptionDates(new DataColumnChangeEventArgs(Row, TmpDC,
                                                                      Row[PSubscriptionTable.GetSubscriptionRenewalDateDBName()]), TmpCollection, out VerificationResult, out NilDataColumn);

                if (VerificationResult != null)
                {
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetDateNoticeSentDBName()];
                VerifySubscriptionDates(new DataColumnChangeEventArgs(Row, TmpDC,
                                                                      Row[PSubscriptionTable.GetDateNoticeSentDBName()]), TmpCollection, out VerificationResult, out NilDataColumn);

                if (VerificationResult != null)
                {
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetDateCancelledDBName()];
                VerifySubscriptionDates(new DataColumnChangeEventArgs(Row, TmpDC,
                                                                      Row[PSubscriptionTable.GetDateCancelledDBName()]), TmpCollection, out VerificationResult, out NilDataColumn);

                if (VerificationResult != null)
                {
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetFirstIssueDBName()];
                VerifySubscriptionDates(new DataColumnChangeEventArgs(Row, TmpDC,
                                                                      Row[PSubscriptionTable.GetFirstIssueDBName()]), TmpCollection, out VerificationResult, out NilDataColumn);

                if (VerificationResult != null)
                {
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetLastIssueDBName()];
                VerifySubscriptionDates(new DataColumnChangeEventArgs(Row, TmpDC,
                                                                      Row[PSubscriptionTable.GetLastIssueDBName()]), TmpCollection, out VerificationResult, out NilDataColumn);

                if (VerificationResult != null)
                {
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                // if subscription status is cancelled, is there a partner that gives the gift.
                TmpDC = Row.Table.Columns[PSubscriptionTable.GetGiftFromKeyDBName()];

                if (Row.IsSubscriptionStatusNull())
                {
                    // we go no further:
                    VerificationResult = new TVerificationResult("",
                                                                 "Please select a valid subscription status",
                                                                 "Subscription Status Mandatory",
                                                                 "X_0041",
                                                                 TResultSeverity.Resv_Critical);
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;

                    // escape before we crash
                    return(false);
                }

                if (Row.SubscriptionStatus == "GIFT")
                {
                    // validate partner key again, to be sure!
                    mPartnerClassSet    = new TPartnerClass[0];
                    FtmpPartnerKeyValid = TServerLookup.TMPartner.VerifyPartner(Row.GiftFromKey,
                                                                                mPartnerClassSet,
                                                                                out mPartnerExists,
                                                                                out mVerifiedString,
                                                                                out mPartnerClass,
                                                                                out partnerStatus);
                }

                if ((Row.SubscriptionStatus == "GIFT") && ((!FtmpPartnerKeyValid) || (Row.GiftFromKey == 00000000)))
                {
                    // MessageBox.Show('FtmpPartnerKeyValid: ' + FtmpPartnerKeyValid.toString);
                    VerificationResult = new TVerificationResult("",
                                                                 StrGiftGivenByMandatory,
                                                                 StrGiftGivenByMandatoryTitle,
                                                                 "",
                                                                 TResultSeverity.Resv_Critical);
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetReasonSubsCancelledCodeDBName()];

                if ((Row.SubscriptionStatus == "CANCELLED") && (Row.IsReasonSubsCancelledCodeNull()))
                {
                    VerificationResult = new TVerificationResult("",
                                                                 "Please select reason for the cancellation",
                                                                 "Reason for Cancellation Mandatory",
                                                                 "X_0041",
                                                                 TResultSeverity.Resv_Critical);
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }
                else
                {
                    if ((Row.SubscriptionStatus == "CANCELLED") && (Row.ReasonSubsCancelledCode.Length < 2))
                    {
                        VerificationResult = new TVerificationResult("",
                                                                     "Please select reason for the cancellation",
                                                                     "Reason for Cancellation Mandatory",
                                                                     "X_0041",
                                                                     TResultSeverity.Resv_Critical);
                        Completed    = true;
                        ReturnValue  = false;
                        AErroneousDC = TmpDC;
                        break;
                    }
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetReasonSubsCancelledCodeDBName()];

                if ((Row.SubscriptionStatus == "EXPIRED") && (Row.IsReasonSubsCancelledCodeNull()))
                {
                    VerificationResult = new TVerificationResult("",
                                                                 "Please select reason for the cancellation",
                                                                 "Reason for Cancellation Mandatory",
                                                                 "X_0041",
                                                                 TResultSeverity.Resv_Critical);
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }
                else
                {
                    if ((Row.SubscriptionStatus == "EXPIRED") && (Row.ReasonSubsCancelledCode.Length < 2))
                    {
                        VerificationResult = new TVerificationResult("",
                                                                     "Please select reason for the cancellation",
                                                                     "Reason for Cancellation Mandatory",
                                                                     "X_0041",
                                                                     TResultSeverity.Resv_Critical);
                        Completed    = true;
                        ReturnValue  = false;
                        AErroneousDC = TmpDC;
                        break;
                    }
                }

                TmpDC = Row.Table.Columns[PSubscriptionTable.GetReasonSubsGivenCodeDBName()];
                try
                {
                    if (Row.ReasonSubsGivenCode.Length < 2)
                    {
                        VerificationResult = new TVerificationResult("",
                                                                     "Please select reason for the Gift",
                                                                     "Reason for Gift Mandatory",
                                                                     "X_0041",
                                                                     TResultSeverity.Resv_Critical);
                        Completed    = true;
                        ReturnValue  = false;
                        AErroneousDC = TmpDC;
                        break;
                    }
                }
                catch (Exception)
                {
                    VerificationResult = new TVerificationResult("",
                                                                 "Please select reason why the publication is given",
                                                                 "Reason for Gift Mandatory",
                                                                 "X_0041",
                                                                 TResultSeverity.Resv_Critical);
                    Completed    = true;
                    ReturnValue  = false;
                    AErroneousDC = TmpDC;
                    break;
                }
                Completed   = true;
                ReturnValue = true;
            }

            return(ReturnValue);
        }
예제 #3
0
        /// <summary>
        /// todoComment
        /// </summary>
        /// <param name="e"></param>
        /// <param name="AVerificationResultCollection"></param>
        /// <param name="AVerificationResult"></param>
        /// <param name="FDataColumnComparedTo"></param>
        public static void VerifySubscriptionDates(DataColumnChangeEventArgs e,
                                                   TVerificationResultCollection AVerificationResultCollection,
                                                   out TVerificationResult AVerificationResult,
                                                   out DataColumn FDataColumnComparedTo)
        {
            FDataColumnComparedTo = null;
            AVerificationResult   = null;
            DateTime DateStarted    = new DateTime();
            DateTime DateExpired    = new DateTime();
            DateTime DateRenewed    = new DateTime();
            DateTime DateNoticeSent = new DateTime();
            DateTime DateEnded      = new DateTime();
            DateTime DateFirstSent  = new DateTime();
            DateTime DateLastSent   = new DateTime();
            Boolean  Completed;

            Completed = false;

            if (e.Column.ColumnName == PSubscriptionTable.GetStartDateDBName())
            {
                DateStarted    = TSaveConvert.ObjectToDate(e.ProposedValue);
                DateExpired    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetExpiryDateDBName()]);
                DateRenewed    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetSubscriptionRenewalDateDBName()]);
                DateNoticeSent = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateNoticeSentDBName()]);
                DateEnded      = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateCancelledDBName()]);
                DateFirstSent  = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetFirstIssueDBName()]);
                DateLastSent   = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetLastIssueDBName()]);
            }

            if (e.Column.ColumnName == PSubscriptionTable.GetExpiryDateDBName())
            {
                DateStarted    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetStartDateDBName()]);
                DateExpired    = TSaveConvert.ObjectToDate(e.ProposedValue);
                DateRenewed    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetSubscriptionRenewalDateDBName()]);
                DateNoticeSent = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateNoticeSentDBName()]);
                DateEnded      = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateCancelledDBName()]);
                DateFirstSent  = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetFirstIssueDBName()]);
                DateLastSent   = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetLastIssueDBName()]);
            }

            if (e.Column.ColumnName == PSubscriptionTable.GetSubscriptionRenewalDateDBName())
            {
                DateStarted    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetStartDateDBName()]);
                DateExpired    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetExpiryDateDBName()]);
                DateRenewed    = TSaveConvert.ObjectToDate(e.ProposedValue);
                DateNoticeSent = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateNoticeSentDBName()]);
                DateEnded      = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateCancelledDBName()]);
                DateFirstSent  = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetFirstIssueDBName()]);
                DateLastSent   = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetLastIssueDBName()]);
            }

            if (e.Column.ColumnName == PSubscriptionTable.GetDateNoticeSentDBName())
            {
                DateStarted    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetStartDateDBName()]);
                DateExpired    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetExpiryDateDBName()]);
                DateRenewed    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetSubscriptionRenewalDateDBName()]);
                DateNoticeSent = TSaveConvert.ObjectToDate(e.ProposedValue);
                DateEnded      = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateCancelledDBName()]);
                DateFirstSent  = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetFirstIssueDBName()]);
                DateLastSent   = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetLastIssueDBName()]);
            }

            if (e.Column.ColumnName == PSubscriptionTable.GetDateCancelledDBName())
            {
                DateStarted    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetStartDateDBName()]);
                DateExpired    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetExpiryDateDBName()]);
                DateRenewed    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetSubscriptionRenewalDateDBName()]);
                DateNoticeSent = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateNoticeSentDBName()]);
                DateEnded      = TSaveConvert.ObjectToDate(e.ProposedValue);
                DateFirstSent  = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetFirstIssueDBName()]);
                DateLastSent   = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetLastIssueDBName()]);
            }

            if (e.Column.ColumnName == PSubscriptionTable.GetFirstIssueDBName())
            {
                DateStarted    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetStartDateDBName()]);
                DateExpired    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetExpiryDateDBName()]);
                DateRenewed    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetSubscriptionRenewalDateDBName()]);
                DateNoticeSent = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateNoticeSentDBName()]);
                DateEnded      = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateCancelledDBName()]);
                DateFirstSent  = TSaveConvert.ObjectToDate(e.ProposedValue);
                DateLastSent   = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetLastIssueDBName()]);
            }

            if (e.Column.ColumnName == PSubscriptionTable.GetLastIssueDBName())
            {
                DateStarted    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetStartDateDBName()]);
                DateExpired    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetExpiryDateDBName()]);
                DateRenewed    = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetSubscriptionRenewalDateDBName()]);
                DateNoticeSent = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateNoticeSentDBName()]);
                DateEnded      = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetDateCancelledDBName()]);
                DateFirstSent  = TSaveConvert.ObjectToDate(e.Row[PSubscriptionTable.GetFirstIssueDBName()]);
                DateLastSent   = TSaveConvert.ObjectToDate(e.ProposedValue);
            }

            while (!Completed)
            {
                // when the StartDate has changed, do this:
                if (e.Column.ColumnName == PSubscriptionTable.GetStartDateDBName())
                {
                    FDataColumnComparedTo = e.Column;
                    TPartnerSubscriptionVerification.VerifyDatesAgainstStartDate(DateStarted,
                                                                                 DateExpired,
                                                                                 DateRenewed,
                                                                                 DateNoticeSent,
                                                                                 DateEnded,
                                                                                 DateFirstSent,
                                                                                 DateLastSent,
                                                                                 out AVerificationResult,
                                                                                 out Completed);

                    if (Completed == true)
                    {
                        break;
                    }
                }

                if (e.Column.ColumnName == PSubscriptionTable.GetExpiryDateDBName())
                {
                    FDataColumnComparedTo = e.Column;
                    TPartnerSubscriptionVerification.VerifyDatesAgainstStartDate(DateStarted,
                                                                                 DateExpired,
                                                                                 DateRenewed,
                                                                                 DateNoticeSent,
                                                                                 DateEnded,
                                                                                 DateFirstSent,
                                                                                 DateLastSent,
                                                                                 out AVerificationResult,
                                                                                 out Completed);

                    if (Completed == true)
                    {
                        break;
                    }
                }

                if (e.Column.ColumnName == PSubscriptionTable.GetSubscriptionRenewalDateDBName())
                {
                    FDataColumnComparedTo = e.Column;
                    TPartnerSubscriptionVerification.VerifyDatesAgainstStartDate(DateStarted,
                                                                                 DateExpired,
                                                                                 DateRenewed,
                                                                                 DateNoticeSent,
                                                                                 DateEnded,
                                                                                 DateFirstSent,
                                                                                 DateLastSent,
                                                                                 out AVerificationResult,
                                                                                 out Completed);

                    if (Completed == true)
                    {
                        break;
                    }

                    if (TDateChecks.FirstLesserOrEqualThanSecondDate(DateRenewed, DateTime.Today, "Date Renewed", "Today") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(DateRenewed, DateTime.Today, "DateRenewed", "Today");
                        Completed           = true;
                        break;
                    }

                    if (TDateChecks.FirstLesserOrEqualThanSecondDate(DateRenewed, DateExpired, "Date Renewed", "Date Expired") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(DateRenewed, DateExpired, "Date Renewed", "Date Expired");
                        Completed           = true;
                        break;
                    }

                    if (TDateChecks.FirstLesserOrEqualThanSecondDate(DateRenewed, DateNoticeSent, "Date Renewed", "Date Notice Sent") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(DateRenewed,
                                                                                           DateNoticeSent,
                                                                                           "Date Renewed",
                                                                                           "Date Notice Sent");
                        Completed = true;
                        break;
                    }
                }

                if (e.Column.ColumnName == PSubscriptionTable.GetDateNoticeSentDBName())
                {
                    FDataColumnComparedTo = e.Column;
                    TPartnerSubscriptionVerification.VerifyDatesAgainstStartDate(DateStarted,
                                                                                 DateExpired,
                                                                                 DateRenewed,
                                                                                 DateNoticeSent,
                                                                                 DateEnded,
                                                                                 DateFirstSent,
                                                                                 DateLastSent,
                                                                                 out AVerificationResult,
                                                                                 out Completed);

                    if (Completed == true)
                    {
                        break;
                    }
                }

                if (e.Column.ColumnName == PSubscriptionTable.GetDateCancelledDBName())
                {
                    FDataColumnComparedTo = e.Column;
                    TPartnerSubscriptionVerification.VerifyDatesAgainstStartDate(DateStarted,
                                                                                 DateExpired,
                                                                                 DateRenewed,
                                                                                 DateNoticeSent,
                                                                                 DateEnded,
                                                                                 DateFirstSent,
                                                                                 DateLastSent,
                                                                                 out AVerificationResult,
                                                                                 out Completed);

                    if (Completed == true)
                    {
                        break;
                    }

                    if (TDateChecks.FirstLesserThanSecondDate(DateTime.Today, DateEnded, "Today", "Cancelled") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserThanSecondDate(DateTime.Today, DateEnded, "Today", "Cancelled");
                        Completed           = true;
                        break;
                    }
                }

                if (e.Column.ColumnName == PSubscriptionTable.GetFirstIssueDBName())
                {
                    FDataColumnComparedTo = e.Column;

                    if (TDateChecks.FirstGreaterOrEqualThanSecondDate(DateLastSent, DateFirstSent, "Last Sent", "First Sent") != null)
                    {
                        AVerificationResult = TDateChecks.FirstGreaterOrEqualThanSecondDate(DateLastSent, DateFirstSent, "Last Sent", "First Sent");
                        Completed           = true;
                        break;
                    }

                    if (TDateChecks.FirstLesserOrEqualThanSecondDate(DateStarted, DateFirstSent, "Date Started", "First Sent") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(DateStarted, DateFirstSent, "Date Started", "First Sent");
                        Completed           = true;
                        break;
                    }

                    if (TDateChecks.FirstLesserOrEqualThanSecondDate(DateFirstSent, DateTime.Today, "First Sent", "today") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(DateFirstSent, DateTime.Today, "First Sent", "today");
                        Completed           = true;
                        break;
                    }
                }

                if (e.Column.ColumnName == PSubscriptionTable.GetLastIssueDBName())
                {
                    FDataColumnComparedTo = e.Column;

                    if (TDateChecks.FirstLesserOrEqualThanSecondDate(DateFirstSent, DateLastSent, "First Sent", "Last Sent") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(DateFirstSent, DateLastSent, "First Sent", "Last Sent");
                        Completed           = true;
                        break;
                    }

                    if (TDateChecks.FirstLesserOrEqualThanSecondDate(DateLastSent, DateTime.Today, "Last Sent", "today") != null)
                    {
                        AVerificationResult = TDateChecks.FirstLesserOrEqualThanSecondDate(DateLastSent, DateTime.Today, "Last Sent", "today");
                        Completed           = true;
                        break;
                    }
                }

                Completed = true;
            }
        }
        /// <summary>
        /// Called by the instantiator of this Dialog to retrieve the values of Fields
        /// on the screen.
        /// </summary>
        /// <param name="ARow"></param>
        /// <param name="AFieldsToChange"></param>
        /// <returns>Boolean</returns>
        public Boolean GetReturnedParameters(ref PSubscriptionRow ARow, ref List <String> AFieldsToChange)
        {
            Boolean ReturnValue = true;

            ARow.InitValues();
            AFieldsToChange.Clear();

            // publication code needs to be set, otherwise change can not be performed
            if (cmbPSubscriptionPublicationCode.GetSelectedString() == "")
            {
                return(false);
            }

            ARow.PublicationCode = cmbPSubscriptionPublicationCode.GetSelectedString();

            if (chkChangeSubscriptionStatus.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetSubscriptionStatusDBName());
                ARow.SubscriptionStatus = cmbPSubscriptionSubscriptionStatus.Text;
            }

            if (chkChangeGratisSubscription.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetGratisSubscriptionDBName());
                ARow.GratisSubscription = chkPSubscriptionGratisSubscription.Checked;
            }

            if (chkChangeNumberComplimentary.Checked &&
                txtPSubscriptionNumberComplimentary.NumberValueInt.HasValue)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetNumberComplimentaryDBName());
                ARow.NumberComplimentary = txtPSubscriptionNumberComplimentary.NumberValueInt.Value;
            }

            if (chkChangePublicationCopies.Checked &&
                txtPSubscriptionPublicationCopies.NumberValueInt.HasValue)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetPublicationCopiesDBName());
                ARow.PublicationCopies = txtPSubscriptionPublicationCopies.NumberValueInt.Value;
            }

            if (chkChangeReasonSubsGivenCode.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetReasonSubsGivenCodeDBName());
                ARow.ReasonSubsGivenCode = cmbPSubscriptionReasonSubsGivenCode.GetSelectedString();
            }

            if (chkChangeReasonSubsCancelledCode.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetReasonSubsCancelledCodeDBName());
                ARow.ReasonSubsCancelledCode = cmbPSubscriptionReasonSubsCancelledCode.GetSelectedString();
            }

            if (chkChangeGiftFromKey.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetGiftFromKeyDBName());
                ARow.GiftFromKey = Convert.ToInt64(txtPSubscriptionGiftFromKey.Text);
            }

            if (chkChangeStartDate.Checked &&
                dtpPSubscriptionStartDate.Date.HasValue)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetStartDateDBName());
                ARow.StartDate = dtpPSubscriptionStartDate.Date.Value;
            }

            if (chkChangeExpiryDate.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetExpiryDateDBName());
                ARow.ExpiryDate = dtpPSubscriptionExpiryDate.Date;
            }

            if (chkChangeRenewalDate.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetSubscriptionRenewalDateDBName());
                ARow.SubscriptionRenewalDate = dtpPSubscriptionSubscriptionRenewalDate.Date;
            }

            if (chkChangeDateNoticeSent.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetDateNoticeSentDBName());
                ARow.DateNoticeSent = dtpPSubscriptionDateNoticeSent.Date;
            }

            if (chkChangeDateCancelled.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetDateCancelledDBName());
                ARow.DateCancelled = dtpPSubscriptionDateCancelled.Date;
            }

            if (chkChangeNumberIssuesReceived.Checked &&
                txtPSubscriptionNumberIssuesReceived.NumberValueInt.HasValue)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetNumberIssuesReceivedDBName());
                ARow.NumberIssuesReceived = txtPSubscriptionNumberIssuesReceived.NumberValueInt.Value;
            }

            if (chkChangeFirstIssue.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetFirstIssueDBName());
                ARow.FirstIssue = dtpPSubscriptionFirstIssue.Date;
            }

            if (chkChangeLastIssue.Checked)
            {
                AFieldsToChange.Add(PSubscriptionTable.GetLastIssueDBName());
                ARow.LastIssue = dtpPSubscriptionLastIssue.Date;
            }

            return(ReturnValue);
        }