protected void lbSave_Click(object sender, EventArgs e) { var newBanner = new LargeBanner { Title = txtTitle.Text.Trim(), Link = txtLink.Text.Trim(), Enabled = cbEnabled.Checked, MediaAlt = txtTitle.Text.Trim(), Priority = Convert.ToInt32(txtPriority.Text.Trim()), DisplayOnHomePage = cbDisplayOnHomepage.Checked, DisplayOnOffersPage = cbDisplayOnOffersPage.Checked }; if (txtDateFrom.Text.Trim() != string.Empty) { newBanner.StartDate = DateTime.ParseExact(txtDateFrom.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture); } if (txtDateTo.Text.Trim() != string.Empty) { newBanner.EndDate = DateTime.ParseExact(txtDateTo.Text, AppConstant.DATE_FORM1, CultureInfo.InvariantCulture); } newBanner.Id = CampaignService.InsertLargeBanner(newBanner); // Save image string filename = newBanner.Id.ToString() + Path.GetExtension(fuMedia.FileName).ToLower(); string filePath = MediaSettings.LargeBannerLocalPath + filename; if (File.Exists(filePath)) { File.Delete(filePath); } fuMedia.SaveAs(filePath); // Update media newBanner.MediaFilename = filename; CampaignService.UpdateLargeBanner(newBanner); Response.Redirect("/marketing/cms_largebanner_info.aspx?" + QueryKey.MSG_TYPE + "=" + (int)MessageType.BannerCreated + "&" + QueryKey.ID + "=" + newBanner.Id.ToString()); }
public void UpdateLargeBanner(LargeBanner banner) { _largeBannerRepository.Update(banner); _cacheManager.RemoveByPattern(CacheKey.LARGE_BANNER_PATTERN_KEY); }
public int InsertLargeBanner(LargeBanner largeBanner) { return(_largeBannerRepository.Create(largeBanner)); }