private void WhenAddBanner(string templateName, string bannerName, string taste) { _bannerController.AddBanner(new AddBannerReq() { TemplateName = templateName, BannerName = bannerName, OrderId = 1, VariablesOptions = new List <VariableOption>() { new VariableOption { VarName = "image", ResxName = $"{taste}PizzaImage" }, new VariableOption { VarName = "title", ResxName = $"{taste}PizzaTitle" }, } }); }
/// ----------------------------------------------------------------------------- /// <summary> /// cmdUpdate_Click runs when the Update Button is clicked /// </summary> /// <remarks> /// </remarks> /// <history> /// [cnurse] 9/21/2004 Updated to reflect design changes for Help, 508 support /// and localisation /// </history> /// ----------------------------------------------------------------------------- protected void OnUpdateClick(object sender, EventArgs e) { try { //Only Update if the Entered Data is val if (Page.IsValid) { if (!cmdCopy.Visible) { BannerId = -1; } DateTime StartDate = Null.NullDate; if (!String.IsNullOrEmpty(txtStartDate.Text)) { StartDate = Convert.ToDateTime(txtStartDate.Text); } DateTime EndDate = Null.NullDate; if (!String.IsNullOrEmpty(txtEndDate.Text)) { EndDate = Convert.ToDateTime(txtEndDate.Text); } //Create an instance of the Banner DB component var objBanner = new BannerInfo(); objBanner.BannerId = BannerId; objBanner.VendorId = VendorId; objBanner.BannerName = txtBannerName.Text; objBanner.BannerTypeId = Convert.ToInt32(cboBannerType.SelectedItem.Value); objBanner.GroupName = DNNTxtBannerGroup.Text; objBanner.ImageFile = ctlImage.Url; if (!String.IsNullOrEmpty(txtWidth.Text)) { objBanner.Width = int.Parse(txtWidth.Text); } else { objBanner.Width = 0; } if (!String.IsNullOrEmpty(txtHeight.Text)) { objBanner.Height = int.Parse(txtHeight.Text); } else { objBanner.Height = 0; } objBanner.Description = txtDescription.Text; objBanner.URL = ctlURL.Url; objBanner.Impressions = int.Parse(txtImpressions.Text); objBanner.CPM = double.Parse(txtCPM.Text); objBanner.StartDate = StartDate; objBanner.EndDate = EndDate; objBanner.Criteria = int.Parse(optCriteria.SelectedItem.Value); objBanner.CreatedByUser = UserInfo.UserID.ToString(); var objBanners = new BannerController(); if (BannerId == Null.NullInteger) { //Add the banner within the Banners table objBanners.AddBanner(objBanner); } else { //Update the banner within the Banners table objBanners.UpdateBanner(objBanner); } //Redirect back to the portal home page Response.Redirect(EditUrl("VendorId", VendorId.ToString()), true); } } catch (Exception exc) //Module failed to load { Exceptions.ProcessModuleLoadException(this, exc); } }