/// <summary> /// Gets and updates notification template text. Called when the "Get and update text" button is pressed. /// Expects the CreateNotificationTemplateText method to be run first. /// </summary> private bool GetAndUpdateNotificationTemplateText() { // Get the template NotificationTemplateInfo template = NotificationTemplateInfoProvider.GetNotificationTemplateInfo("MyNewTemplate", CMSContext.CurrentSiteID); //Get the gateway NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); if ((template != null) && (gateway != null)) { // Get the notification template text NotificationTemplateTextInfo updateText = NotificationTemplateTextInfoProvider.GetNotificationTemplateTextInfo(gateway.GatewayID, template.TemplateID); if (updateText != null) { // Update the property updateText.TemplateSubject = updateText.TemplateSubject.ToLower(); // Update the notification template text NotificationTemplateTextInfoProvider.SetNotificationTemplateTextInfo(updateText); return(true); } } return(false); }
/// <summary> /// Creates notification template text. Called when the "Create text" button is pressed. /// </summary> private bool CreateNotificationTemplateText() { // Get the template NotificationTemplateInfo template = NotificationTemplateInfoProvider.GetNotificationTemplateInfo("MyNewTemplate", CMSContext.CurrentSiteID); // Get the gateway NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); if ((template != null) && (gateway != null)) { // Create new notification template text object NotificationTemplateTextInfo newText = new NotificationTemplateTextInfo(); // Set the properties newText.TemplateSubject = "My new text"; newText.TemplateID = template.TemplateID; newText.GatewayID = gateway.GatewayID; newText.TemplateHTMLText = ""; newText.TemplatePlainText = ""; newText.TempalateTextLastModified = DateTime.Now; // Create the notification template text NotificationTemplateTextInfoProvider.SetNotificationTemplateTextInfo(newText); return(true); } return(false); }
/// <summary> /// Gets and bulk updates notification subscriptions. Called when the "Get and bulk update subscriptions" button is pressed. /// Expects the CreateNotificationSubscription method to be run first. /// </summary> private bool GetAndBulkUpdateNotificationSubscriptions() { // Get the gateway NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); // Get the tamplate NotificationTemplateInfo template = NotificationTemplateInfoProvider.GetNotificationTemplateInfo("MyNewTemplate", CMSContext.CurrentSiteID); if ((gateway != null) && (template != null)) { // Prepare the parameters string where = "SubscriptionGatewayID = " + gateway.GatewayID + " AND SubscriptionTemplateID = " + template.TemplateID; // Get the notification subscription DataSet subscriptions = NotificationSubscriptionInfoProvider.GetSubscriptions(where, null); if (!DataHelper.DataSourceIsEmpty(subscriptions)) { foreach (DataRow subscriptionDr in subscriptions.Tables[0].Rows) { // Create object from DataRow NotificationSubscriptionInfo updateSubscription = new NotificationSubscriptionInfo(subscriptions.Tables[0].Rows[0]); // Update the property updateSubscription.SubscriptionEventDisplayName = updateSubscription.SubscriptionEventDisplayName.ToUpper(); // Update the notification subscription NotificationSubscriptionInfoProvider.SetNotificationSubscriptionInfo(updateSubscription); return(true); } } } return(false); }
/// <summary> /// Creates notification subscription. Called when the "Create subscription" button is pressed. /// </summary> private bool CreateNotificationSubscription() { // Get the gateway NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); // Get the tamplate NotificationTemplateInfo template = NotificationTemplateInfoProvider.GetNotificationTemplateInfo("MyNewTemplate", CMSContext.CurrentSiteID); if ((gateway != null) && (template != null)) { // Create new notification subscription object NotificationSubscriptionInfo newSubscription = new NotificationSubscriptionInfo(); // Set the properties newSubscription.SubscriptionEventDisplayName = "My new subscription"; newSubscription.SubscriptionGatewayID = gateway.GatewayID; newSubscription.SubscriptionTemplateID = template.TemplateID; newSubscription.SubscriptionTime = DateTime.Now; newSubscription.SubscriptionUserID = CMSContext.CurrentUser.UserID; newSubscription.SubscriptionTarget = ""; newSubscription.SubscriptionLastModified = DateTime.Now; newSubscription.SubscriptionSiteID = CMSContext.CurrentSiteID; // Create the notification subscription NotificationSubscriptionInfoProvider.SetNotificationSubscriptionInfo(newSubscription); return(true); } return(false); }
protected void Page_Load(object sender, EventArgs e) { // Get query strings if (gatewayId == 0) { gatewayId = ValidationHelper.GetInteger(Request.QueryString["gatewayid"], 0); } if (QueryHelper.GetInteger("saved", 0) == 1) { // Show message ShowChangesSaved(); } // initializes breadcrumbs string[,] pageTitleTabs = new string[2, 3]; pageTitleTabs[0, 0] = GetString("notifications.gateways"); pageTitleTabs[0, 1] = "~/CMSModules/Notifications/Development/Gateways/Gateway_List.aspx"; pageTitleTabs[0, 2] = ""; pageTitleTabs[1, 0] = GetString("notifications.gateway.newitem"); pageTitleTabs[1, 1] = ""; pageTitleTabs[1, 2] = ""; // Get resource strings lblSettings.Text = GetString("notifications.gateway.settings"); valDisplayName.ErrorMessage = GetString("notifications.gateway.requiresdisplayname"); valClassName.ErrorMessage = GetString("notifications.gateway.requiresclassname"); valCodeName.ErrorMessage = GetString("general.requirescodename"); valAssemblyName.ErrorMessage = GetString("notifications.gateway.requiresassemblyname"); if (!RequestHelper.IsPostBack()) { // Edit if (gatewayId > 0) { NotificationGatewayInfo ngi = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(gatewayId); EditedObject = ngi; if (ngi != null) { txtAssemblyName.Text = ngi.GatewayAssemblyName; txtClassName.Text = ngi.GatewayClassName; txtCodeName.Text = ngi.GatewayName; txtDescription.Text = ngi.GatewayDescription; txtDisplayName.Text = ngi.GatewayDisplayName; chkEnabled.Checked = ngi.GatewayEnabled; chkSupportsHTML.Checked = ngi.GatewaySupportsHTMLText; chkSupportsSubject.Checked = ngi.GatewaySupportsEmail; chkSupportsPlain.Checked = ngi.GatewaySupportsPlainText; pageTitleTabs[1, 0] = ngi.GatewayDisplayName; } } } // Set up page title control CurrentMaster.Title.Breadcrumbs = pageTitleTabs; }
/// <summary> /// Gets and bulk updates notification gateways. Called when the "Get and bulk update gateways" button is pressed. /// Expects the CreateNotificationGateway method to be run first. /// </summary> private bool GetAndBulkUpdateNotificationGateways() { // Prepare the parameters string where = "GatewayName LIKE N'MyNewGateway%'"; // Get the data DataSet gateways = NotificationGatewayInfoProvider.GetGateways(where, null); if (!DataHelper.DataSourceIsEmpty(gateways)) { // Loop through the individual items foreach (DataRow gatewayDr in gateways.Tables[0].Rows) { // Create object from DataRow NotificationGatewayInfo modifyGateway = new NotificationGatewayInfo(gatewayDr); // Update the property modifyGateway.GatewayDisplayName = modifyGateway.GatewayDisplayName.ToUpper(); // Update the notification gateway NotificationGatewayInfoProvider.SetNotificationGatewayInfo(modifyGateway); } return(true); } return(false); }
/// <summary> /// Deletes notification subscription. Called when the "Delete subscription" button is pressed. /// Expects the CreateNotificationSubscription method to be run first. /// </summary> private bool DeleteNotificationSubscription() { // Get the gateway NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); // Get the template NotificationTemplateInfo template = NotificationTemplateInfoProvider.GetNotificationTemplateInfo("MyNewTemplate", CMSContext.CurrentSiteID); if ((gateway != null) && (template != null)) { // Prepare the parameters string where = "SubscriptionGatewayID = " + gateway.GatewayID + " AND SubscriptionTemplateID = " + template.TemplateID; // Get the notification subscription DataSet subscriptions = NotificationSubscriptionInfoProvider.GetSubscriptions(where, null); if (!DataHelper.DataSourceIsEmpty(subscriptions)) { // Create object from DataRow NotificationSubscriptionInfo deleteSubscription = new NotificationSubscriptionInfo(subscriptions.Tables[0].Rows[0]); // Delete the notification subscription NotificationSubscriptionInfoProvider.DeleteNotificationSubscriptionInfo(deleteSubscription); return(deleteSubscription != null); } } return(false); }
protected void Page_Load(object sender, EventArgs e) { // If ID�s not specified return if ((TemplateID == 0) || (GatewayID == 0)) { return; } // Get gateway name NotificationGatewayInfo ngi = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(GatewayID); if (ngi == null) { throw new Exception("NotificationGatewayInfo with this GatewayID does not exist."); } // Setup control according to NotificationGatewayInfo plcSubject.Visible = ngi.GatewaySupportsEmail; plcPlainText.Visible = ngi.GatewaySupportsPlainText; plcHTMLText.Visible = ngi.GatewaySupportsHTMLText; if (plcHTMLText.Visible) { // Initialize HTML editor htmlText.AutoDetectLanguage = false; htmlText.DefaultLanguage = Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlText.EditorAreaCSS = CssStylesheetInfoProvider.GetHtmlEditorAreaCss(SiteContext.CurrentSiteName); htmlText.ToolbarSet = "Basic"; htmlText.MediaDialogConfig.UseFullURL = true; htmlText.LinkDialogConfig.UseFullURL = true; htmlText.QuickInsertConfig.UseFullURL = true; } // If gateway does not support any of text fields inform about it. if (!ngi.GatewaySupportsEmail && !ngi.GatewaySupportsHTMLText && !ngi.GatewaySupportsPlainText) { ShowWarning(string.Format(GetString("notifications.templatetext.notextbox"), HTMLHelper.HTMLEncode(ngi.GatewayDisplayName))); } // Get existing TemplateTextInfoObject or create new object NotificationTemplateTextInfo ntti = NotificationTemplateTextInfoProvider.GetNotificationTemplateTextInfo(GatewayID, TemplateID); if (ntti == null) { ntti = new NotificationTemplateTextInfo(); } // Set edited object EditedObject = ntti; // Setup properties if (!URLHelper.IsPostback()) { TemplateSubject = ntti.TemplateSubject; TemplateHTMLText = ntti.TemplateHTMLText; TemplatePlainText = ntti.TemplatePlainText; } }
/// <summary> /// Deletes notification gateway. Called when the "Delete gateway" button is pressed. /// Expects the CreateNotificationGateway method to be run first. /// </summary> private bool DeleteNotificationGateway() { // Get the notification gateway NotificationGatewayInfo deleteGateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); // Delete the notification gateway NotificationGatewayInfoProvider.DeleteNotificationGatewayInfo(deleteGateway); return(deleteGateway != null); }
protected void btnOK_Click(object sender, EventArgs e) { // Load or create new NotificationGatewayInfo NotificationGatewayInfo ngi = null; if (gatewayId > 0) { ngi = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(gatewayId); EditedObject = ngi; } else { ngi = new NotificationGatewayInfo(); ngi.GatewayGUID = Guid.NewGuid(); } // Check code name if ((ngi.GatewayName != txtCodeName.Text)) { NotificationGatewayInfo testNgi = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(txtCodeName.Text); if ((testNgi != null) && (testNgi.GatewayID != ngi.GatewayID)) { // Show error message ShowError(GetString("general.uniquecodenameerror")); return; } } string result = ValidateForm(); if (result != "") { // Show error message ShowError(result); return; } // Update values ngi.GatewayAssemblyName = txtAssemblyName.Text.Trim(); ngi.GatewayClassName = txtClassName.Text.Trim(); ngi.GatewayDescription = txtDescription.Text.Trim(); ngi.GatewayDisplayName = txtDisplayName.Text.Trim(); ngi.GatewayName = txtCodeName.Text.Trim(); ngi.GatewaySupportsEmail = chkSupportsSubject.Checked; ngi.GatewaySupportsHTMLText = chkSupportsHTML.Checked; ngi.GatewaySupportsPlainText = chkSupportsPlain.Checked; ngi.GatewayEnabled = chkEnabled.Checked; NotificationGatewayInfoProvider.SetNotificationGatewayInfo(ngi); gatewayId = ngi.GatewayID; URLHelper.Redirect("Gateway_Edit.aspx?saved=1&gatewayid=" + gatewayId.ToString()); }
protected void Page_Load(object sender, EventArgs e) { // Show info message if changes were saved if (QueryHelper.GetInteger("saved", 0) == 1) { lblInfo.Visible = true; lblInfo.Text = GetString("general.changessaved"); } templateId = QueryHelper.GetInteger("templateid", 0); gatewayId = QueryHelper.GetInteger("gatewayid", 0); this.templateTextElem.TemplateID = templateId; this.templateTextElem.GatewayID = gatewayId; gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(gatewayId); if (gateway != null) { // Header actions string[,] actions = new string[1, 11]; // Save button actions[0, 0] = HeaderActions.TYPE_SAVEBUTTON; actions[0, 1] = GetString("General.Save"); actions[0, 5] = GetImageUrl("CMSModules/CMS_Content/EditMenu/save.png"); actions[0, 6] = "save"; actions[0, 8] = "true"; this.CurrentMaster.HeaderActions.LinkCssClass = "ContentSaveLinkButton"; this.CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; this.CurrentMaster.HeaderActions.Actions = actions; // Initializes page breadcrumbs string[,] breadcrumbs = new string[2, 3]; breadcrumbs[0, 0] = GetString("notification.templatetexteditlist"); breadcrumbs[0, 1] = "~/CMSModules/Notifications/Development/Templates/Template_Edit_Text.aspx?templateId=" + templateId; breadcrumbs[1, 0] = gateway.GatewayDisplayName; this.CurrentMaster.Title.Breadcrumbs = breadcrumbs; // Macros help this.lnkMoreMacros.Text = GetString("notification.template.text.helplnk"); this.lblHelpHeader.Text = GetString("notification.template.text.helpheader"); DisplayHelperTable(); } }
/// <summary> /// Gets and updates notification gateway. Called when the "Get and update gateway" button is pressed. /// Expects the CreateNotificationGateway method to be run first. /// </summary> private bool GetAndUpdateNotificationGateway() { // Get the notification gateway NotificationGatewayInfo updateGateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); if (updateGateway != null) { // Update the property updateGateway.GatewayDisplayName = updateGateway.GatewayDisplayName.ToLower(); // Update the notification gateway NotificationGatewayInfoProvider.SetNotificationGatewayInfo(updateGateway); return(true); } return(false); }
/// <summary> /// Creates notification gateway. Called when the "Create gateway" button is pressed. /// </summary> private bool CreateNotificationGateway() { // Create new notification gateway object NotificationGatewayInfo newGateway = new NotificationGatewayInfo(); // Set the properties newGateway.GatewayDisplayName = "My new gateway"; newGateway.GatewayName = "MyNewGateway"; newGateway.GatewayAssemblyName = "MyNewGateway"; newGateway.GatewayClassName = "MyNewGateway"; newGateway.GatewayDescription = "MyNewGateway"; newGateway.GatewaySupportsEmail = true; newGateway.GatewaySupportsPlainText = true; newGateway.GatewaySupportsHTMLText = true; newGateway.GatewayEnabled = true; // Create the notification gateway NotificationGatewayInfoProvider.SetNotificationGatewayInfo(newGateway); return(true); }
/// <summary> /// Deletes notification template text. Called when the "Delete text" button is pressed. /// Expects the CreateNotificationTemplateText method to be run first. /// </summary> private bool DeleteNotificationTemplateText() { // Get the template NotificationTemplateInfo template = NotificationTemplateInfoProvider.GetNotificationTemplateInfo("MyNewTemplate", CMSContext.CurrentSiteID); //Get the gateway NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); if ((template != null) && (gateway != null)) { // Get the notification template text NotificationTemplateTextInfo deleteText = NotificationTemplateTextInfoProvider.GetNotificationTemplateTextInfo(gateway.GatewayID, template.TemplateID); // Delete the notification template text NotificationTemplateTextInfoProvider.DeleteNotificationTemplateTextInfo(deleteText); return(deleteText != null); } return(false); }
protected void Page_Load(object sender, EventArgs e) { // Show info message if changes were saved if (QueryHelper.GetBoolean("saved", false)) { // Show message ShowChangesSaved(); } templateId = QueryHelper.GetInteger("templateid", 0); gatewayId = QueryHelper.GetInteger("gatewayid", 0); templateTextElem.TemplateID = templateId; templateTextElem.GatewayID = gatewayId; NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(gatewayId); if (gateway != null) { CurrentMaster.HeaderActions.ActionPerformed += HeaderActions_ActionPerformed; CurrentMaster.HeaderActions.ActionsList.Add(new SaveAction()); // Initializes page breadcrumbs PageBreadcrumbs.Items.Add(new BreadcrumbItem() { Text = GetString("notification.templatetexteditlist"), RedirectUrl = "~/CMSModules/Notifications/Development/Templates/Template_Edit_Text.aspx?templateId=" + templateId }); PageBreadcrumbs.Items.Add(new BreadcrumbItem() { Text = gateway.GatewayDisplayName }); // Macros help lnkMoreMacros.Text = GetString("notification.template.text.helplnk"); lblHelpHeader.Text = GetString("notification.template.text.helpheader"); DisplayHelperTable(); } }
/// <summary> /// Gets and bulk updates notification template texts. Called when the "Get and bulk update texts" button is pressed. /// Expects the CreateNotificationTemplateText method to be run first. /// </summary> private bool GetAndBulkUpdateNotificationTemplateTexts() { // Get the template NotificationTemplateInfo template = NotificationTemplateInfoProvider.GetNotificationTemplateInfo("MyNewTemplate", CMSContext.CurrentSiteID); //Get the gateway NotificationGatewayInfo gateway = NotificationGatewayInfoProvider.GetNotificationGatewayInfo("MyNewGateway"); if ((template != null) && (gateway != null)) { // Prepare the parameters string where = ""; where = SqlHelperClass.AddWhereCondition(where, "TemplateID = " + template.TemplateID, "AND"); where = SqlHelperClass.AddWhereCondition(where, "GatewayID = " + gateway.GatewayID, "AND"); // Get the data DataSet texts = NotificationTemplateTextInfoProvider.GetNotificationTemplateTexts(where, null); if (!DataHelper.DataSourceIsEmpty(texts)) { // Loop through the individual items foreach (DataRow textDr in texts.Tables[0].Rows) { // Create object from DataRow NotificationTemplateTextInfo modifyText = new NotificationTemplateTextInfo(textDr); // Update the property modifyText.TemplateSubject = modifyText.TemplateSubject.ToUpper(); // Update the notification template text NotificationTemplateTextInfoProvider.SetNotificationTemplateTextInfo(modifyText); } return(true); } } return(false); }
protected void Page_Load(object sender, EventArgs e) { // If ID´s not specified return if ((this.TemplateID == 0) || (this.GatewayID == 0)) { return; } // Get resource strings lblHTMLText.ResourceString = "notification.template.html"; lblPlainText.ResourceString = "notification.template.plain"; lblSubject.ResourceString = "general.subject"; // Get gateway name NotificationGatewayInfo ngi = NotificationGatewayInfoProvider.GetNotificationGatewayInfo(this.GatewayID); if (ngi == null) { throw new Exception("NotificationGatewayInfo with this GatewayID does not exist."); } // Setup control according to NotificationGatewayInfo this.plcSubject.Visible = ngi.GatewaySupportsEmail; this.plcPlainText.Visible = ngi.GatewaySupportsPlainText; this.plcHTMLText.Visible = ngi.GatewaySupportsHTMLText; if (this.plcHTMLText.Visible) { // Initialize HTML editor htmlText.AutoDetectLanguage = false; htmlText.DefaultLanguage = System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName; htmlText.EditorAreaCSS = FormHelper.GetHtmlEditorAreaCss(CMSContext.CurrentSiteName); htmlText.ToolbarSet = "Basic"; htmlText.MediaDialogConfig.UseFullURL = true; htmlText.LinkDialogConfig.UseFullURL = true; htmlText.QuickInsertConfig.UseFullURL = true; } // If gateway does not support any of text fields inform about it. if (!ngi.GatewaySupportsEmail && !ngi.GatewaySupportsHTMLText && !ngi.GatewaySupportsPlainText) { noneStyle = "width:100%"; plcNoTextbox.Visible = true; lblNoTextbox.Text = string.Format(GetString("notifications.templatetext.notextbox"), HTMLHelper.HTMLEncode(ngi.GatewayDisplayName)); } // Get existing TemplateTextInfoObject or create new object NotificationTemplateTextInfo ntti = NotificationTemplateTextInfoProvider.GetNotificationTemplateTextInfo(this.GatewayID, this.TemplateID); if (ntti == null) { ntti = new NotificationTemplateTextInfo(); } // Setup properties if (!URLHelper.IsPostback()) { this.TemplateSubject = ntti.TemplateSubject; this.TemplateHTMLText = ntti.TemplateHTMLText; this.TemplatePlainText = ntti.TemplatePlainText; } }
/// <summary> /// Gets and bulk updates notification gateways. Called when the "Get and bulk update gateways" button is pressed. /// Expects the CreateNotificationGateway method to be run first. /// </summary> private bool GetAndBulkUpdateNotificationGateways() { // Prepare the parameters string where = "GatewayName LIKE N'MyNewGateway%'"; // Get the data DataSet gateways = NotificationGatewayInfoProvider.GetGateways(where, null); if (!DataHelper.DataSourceIsEmpty(gateways)) { // Loop through the individual items foreach (DataRow gatewayDr in gateways.Tables[0].Rows) { // Create object from DataRow NotificationGatewayInfo modifyGateway = new NotificationGatewayInfo(gatewayDr); // Update the property modifyGateway.GatewayDisplayName = modifyGateway.GatewayDisplayName.ToUpper(); // Update the notification gateway NotificationGatewayInfoProvider.SetNotificationGatewayInfo(modifyGateway); } return true; } return false; }
/// <summary> /// Creates notification gateway. Called when the "Create gateway" button is pressed. /// </summary> private bool CreateNotificationGateway() { // Create new notification gateway object NotificationGatewayInfo newGateway = new NotificationGatewayInfo(); // Set the properties newGateway.GatewayDisplayName = "My new gateway"; newGateway.GatewayName = "MyNewGateway"; newGateway.GatewayAssemblyName = "MyNewGateway"; newGateway.GatewayClassName = "MyNewGateway"; newGateway.GatewayDescription = "MyNewGateway"; newGateway.GatewaySupportsEmail = true; newGateway.GatewaySupportsPlainText = true; newGateway.GatewaySupportsHTMLText = true; newGateway.GatewayEnabled = true; // Create the notification gateway NotificationGatewayInfoProvider.SetNotificationGatewayInfo(newGateway); return true; }