/// <summary> /// /// </summary> /// <param name="ACancelDate"></param> /// <returns></returns> public Boolean PerformCancelAllSubscriptions(DateTime ACancelDate) { Boolean ReturnValue; TFrmSubscriptionsCancelAllDialog Scd; string ReasonEnded; DateTime DateEnded; ArrayList SubscrCancelled; int UpdateCounter; String SubscrCancelledString = ""; ReturnValue = true; /* Check whether there are any Subscriptions that can be cancelled */ if (CancelAllSubscriptionsCount() > 0) { /* Open 'Cancel All Subscriptions' Dialog */ Scd = new TFrmSubscriptionsCancelAllDialog(this.ParentForm); if (ACancelDate != DateTime.MinValue) { Scd.DateEnded = ACancelDate; } Scd.ShowDialog(); if (Scd.DialogResult != System.Windows.Forms.DialogResult.Cancel) { /* Get values from the Dialog */ Scd.GetReturnedParameters(out ReasonEnded, out DateEnded); /* Cancel the Subscriptions */ SubscrCancelled = CancelAllSubscriptions(ReasonEnded, DateEnded, false); /* Build a String to tell the user what Subscriptions were cancelled. */ for (UpdateCounter = 0; UpdateCounter <= SubscrCancelled.Count - 1; UpdateCounter += 1) { SubscrCancelledString = SubscrCancelledString + " " + SubscrCancelled[UpdateCounter].ToString() + Environment.NewLine; } /* Update the Grid UserControl to reflect the changes in the records. */ grdDetails.Refresh(); /* Finally, select the first record in the Grid and update the Detail */ /* UserControl (this one might have been Canceled) */ grdDetails.SelectRowInGrid(1); /* reset counter in tab header */ DoRecalculateScreenParts(); /* Tell the user that cancelling of Subscriptions was succesful */ MessageBox.Show(String.Format(Catalog.GetString("The following {0} Subscription(s) was/were cancelled:" + "\r\n" + "{1}" + "\r\n" + "The Partner has no active Subscriptions left."), SubscrCancelled.Count, SubscrCancelledString), Catalog.GetString("All Subscriptions Cancelled"), MessageBoxButtons.OK, MessageBoxIcon.Information); } else { /* User pressed Cancel in the Dialog. Tell the user that nothing was done. */ MessageBox.Show(Catalog.GetString("No Subscriptions were cancelled."), Catalog.GetString("Cancel All Subscriptions"), MessageBoxButtons.OK, MessageBoxIcon.Information); ReturnValue = false; } Scd.Dispose(); } else { /* Tell the user that there are no Subscriptions that can be canceled. */ MessageBox.Show(Catalog.GetString("There are no Subscriptions to cancel."), Catalog.GetString("Cancel All Subscriptions"), MessageBoxButtons.OK, MessageBoxIcon.Information); } return ReturnValue; }
/// <summary> /// /// </summary> /// <param name="ACancelDate"></param> /// <returns></returns> public Boolean PerformCancelAllSubscriptions(DateTime ACancelDate) { Boolean ReturnValue; TFrmSubscriptionsCancelAllDialog Scd; string ReasonEnded; DateTime DateEnded; ArrayList SubscrCancelled; int UpdateCounter; String SubscrCancelledString = ""; ReturnValue = true; /* Check whether there are any Subscriptions that can be cancelled */ if (CancelAllSubscriptionsCount() > 0) { /* Open 'Cancel All Subscriptions' Dialog */ Scd = new TFrmSubscriptionsCancelAllDialog(this.ParentForm); if (ACancelDate != DateTime.MinValue) { Scd.DateEnded = ACancelDate; } Scd.ShowDialog(); if (Scd.DialogResult != System.Windows.Forms.DialogResult.Cancel) { /* Get values from the Dialog */ Scd.GetReturnedParameters(out ReasonEnded, out DateEnded); /* Cancel the Subscriptions */ SubscrCancelled = CancelAllSubscriptions(ReasonEnded, DateEnded, false); /* Build a String to tell the user what Subscriptions were cancelled. */ for (UpdateCounter = 0; UpdateCounter <= SubscrCancelled.Count - 1; UpdateCounter += 1) { SubscrCancelledString = SubscrCancelledString + " " + SubscrCancelled[UpdateCounter].ToString() + Environment.NewLine; } /* Update the Grid UserControl to reflect the changes in the records. */ grdDetails.Refresh(); /* Finally, select the first record in the Grid and update the Detail */ /* UserControl (this one might have been Canceled) */ grdDetails.SelectRowInGrid(1); /* reset counter in tab header */ DoRecalculateScreenParts(); /* Tell the user that cancelling of Subscriptions was succesful */ MessageBox.Show(String.Format(Catalog.GetString("The following {0} Subscription(s) was/were cancelled:" + "\r\n" + "{1}" + "\r\n" + "The Partner has no active Subscriptions left."), SubscrCancelled.Count, SubscrCancelledString), Catalog.GetString("All Subscriptions Cancelled"), MessageBoxButtons.OK, MessageBoxIcon.Information); } else { /* User pressed Cancel in the Dialog. Tell the user that nothing was done. */ MessageBox.Show(Catalog.GetString("No Subscriptions were cancelled."), Catalog.GetString("Cancel All Subscriptions"), MessageBoxButtons.OK, MessageBoxIcon.Information); ReturnValue = false; } Scd.Dispose(); } else { /* Tell the user that there are no Subscriptions that can be canceled. */ MessageBox.Show(Catalog.GetString("There are no Subscriptions to cancel."), Catalog.GetString("Cancel All Subscriptions"), MessageBoxButtons.OK, MessageBoxIcon.Information); } return(ReturnValue); }