コード例 #1
0
        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());
        }
コード例 #2
0
        public void UpdateLargeBanner(LargeBanner banner)
        {
            _largeBannerRepository.Update(banner);

            _cacheManager.RemoveByPattern(CacheKey.LARGE_BANNER_PATTERN_KEY);
        }
コード例 #3
0
 public int InsertLargeBanner(LargeBanner largeBanner)
 {
     return(_largeBannerRepository.Create(largeBanner));
 }