Пример #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);
        }
        /// <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);
        }