/// <summary> /// Add subscription for Partners in selected Extract /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void AddSubscription(System.Object sender, EventArgs e) { PSubscriptionTable SubscriptionTable = new PSubscriptionTable(); PSubscriptionRow SubscriptionRow = SubscriptionTable.NewRowTyped(); PPartnerTable PartnersWithExistingSubs = new PPartnerTable(); int SubscriptionsAdded; String MessageText; if (!WarnIfNotSingleSelection(Catalog.GetString("Add Subscription")) && (GetSelectedDetailRow() != null)) { TFrmUpdateExtractAddSubscriptionDialog dialog = new TFrmUpdateExtractAddSubscriptionDialog(this.FindForm()); dialog.SetExtractName(GetSelectedDetailRow().ExtractName); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dialog.GetReturnedParameters(ref SubscriptionRow); SubscriptionTable.Rows.Add(SubscriptionRow); // perform update of extract data on server side TRemote.MPartner.Partner.WebConnectors.AddSubscription (GetSelectedDetailRow().ExtractId, ref SubscriptionTable, out PartnersWithExistingSubs, out SubscriptionsAdded); MessageText = String.Format(Catalog.GetString( "Subscription {0} successfully added for {1} out of {2} Partner(s) in Extract {3}."), SubscriptionRow.PublicationCode, SubscriptionsAdded, GetSelectedDetailRow().KeyCount, GetSelectedDetailRow().ExtractName); if (PartnersWithExistingSubs.Rows.Count > 0) { MessageText += "\r\n\r\n" + String.Format(Catalog.GetString( "See the following Dialog for the {0} Partner(s) that were already subscribed for this Publication. The Subscription was not added for those Partners."), PartnersWithExistingSubs.Rows.Count); } MessageBox.Show(MessageText, Catalog.GetString("Add Subscription"), MessageBoxButtons.OK, MessageBoxIcon.Information); if (PartnersWithExistingSubs.Rows.Count > 0) { TFrmSimplePartnerListDialog partnerDialog = new TFrmSimplePartnerListDialog(this.FindForm()); partnerDialog.SetExplanation("These partners already have a Subscription for " + SubscriptionRow.PublicationCode, "The Subscription was not added to the following Partners:"); partnerDialog.SetPartnerList(PartnersWithExistingSubs); partnerDialog.ShowDialog(); } } } }
/// <summary> /// Add subscription for Partners in selected Extract /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void AddSubscription(System.Object sender, EventArgs e) { PSubscriptionTable SubscriptionTable = new PSubscriptionTable(); PSubscriptionRow SubscriptionRow = SubscriptionTable.NewRowTyped(); PPartnerTable PartnersWithExistingSubs = new PPartnerTable(); int SubscriptionsAdded; String MessageText; if (!WarnIfNotSingleSelection(Catalog.GetString("Add Subscription")) && (GetSelectedDetailRow() != null)) { TFrmUpdateExtractAddSubscriptionDialog dialog = new TFrmUpdateExtractAddSubscriptionDialog(this.FindForm()); dialog.SetExtractName(GetSelectedDetailRow().ExtractName); if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dialog.GetReturnedParameters(ref SubscriptionRow); SubscriptionTable.Rows.Add(SubscriptionRow); // perform update of extract data on server side TRemote.MPartner.Partner.WebConnectors.AddSubscription (GetSelectedDetailRow().ExtractId, ref SubscriptionTable, out PartnersWithExistingSubs, out SubscriptionsAdded); MessageText = String.Format(Catalog.GetString( "Subscription {0} successfully added for {1} out of {2} Partner(s) in Extract {3}."), SubscriptionRow.PublicationCode, SubscriptionsAdded, GetSelectedDetailRow().KeyCount, GetSelectedDetailRow().ExtractName); if (PartnersWithExistingSubs.Rows.Count > 0) { MessageText += "\r\n\r\n" + String.Format(Catalog.GetString( "See the following Dialog for the {0} Partner(s) that were already subscribed for this Publication. The Subscription was not added for those Partners."), PartnersWithExistingSubs.Rows.Count); } MessageBox.Show(MessageText, Catalog.GetString("Add Subscription"), MessageBoxButtons.OK, MessageBoxIcon.Information); if (PartnersWithExistingSubs.Rows.Count > 0) { TFrmSimplePartnerListDialog partnerDialog = new TFrmSimplePartnerListDialog(this.FindForm()); partnerDialog.SetExplanation("These partners already have a Subscription for " + SubscriptionRow.PublicationCode, "The Subscription was not added to the following Partners:"); partnerDialog.SetPartnerList(PartnersWithExistingSubs); partnerDialog.ShowDialog(); } } } }