Пример #1
0
        public bool Validate_InsertOpenWindowAdvertisement(out string errorMessage)
        {
            var adInfo           = new AdvertisementInfo(AdvertisementName.Text, PublishmentSystemId, EAdvertisementTypeUtils.GetEnumType(AdvertisementType.SelectedValue), IsDateLimited.Checked, TranslateUtils.ToDateTime(StartDate.Text), TranslateUtils.ToDateTime(EndDate.Text), DateTime.Now, ControlUtils.GetSelectedListControlValueCollection(NodeIDCollectionToChannel), ControlUtils.GetSelectedListControlValueCollection(NodeIDCollectionToContent), ControlUtils.GetSelectedListControlValueCollection(FileTemplateIDCollection), string.Empty);
            var adOpenWindowInfo = new AdvertisementOpenWindowInfo(OpenWindowFileUrl.Text, TranslateUtils.ToInt(OpenWindowHeight.Text), TranslateUtils.ToInt(OpenWindowWidth.Text));

            adInfo.Settings = adOpenWindowInfo.ToString();
            try
            {
                if (isEdit)
                {
                    DataProvider.AdvertisementDao.Update(adInfo);
                }
                else
                {
                    DataProvider.AdvertisementDao.Insert(adInfo);
                }
                errorMessage = string.Empty;
                return(true);
            }
            catch
            {
                errorMessage = "操作失败!";
                return(false);
            }
        }
Пример #2
0
        public void Page_Load(object sender, EventArgs e)
        {
            if (IsForbidden)
            {
                return;
            }

            PageUtils.CheckRequestParameter("PublishmentSystemID");
            if (Body.IsQueryExists("AdvertisementName"))
            {
                isEdit = true;
                editAdvertisementName = Body.GetQueryString("AdvertisementName");
                if (DataProvider.AdvertisementDao.IsExists(editAdvertisementName, PublishmentSystemId))
                {
                    editAdvertisementType = DataProvider.AdvertisementDao.GetAdvertisementType(editAdvertisementName, PublishmentSystemId);
                }
                else
                {
                    ErrorLabel.Text = $"不存在名称为“{editAdvertisementName}”的广告!";
                    SetActivePanel(WizardPanel.OperatingError, OperatingError);
                    return;
                }
            }

            if (!Page.IsPostBack)
            {
                var pageTitle = isEdit ? "编辑漂浮广告" : "添加漂浮广告";
                BreadCrumb(AppManager.Cms.LeftMenu.IdFunction, AppManager.Cms.LeftMenu.Function.IdAdvertisement, pageTitle, AppManager.Cms.Permission.WebSite.Advertisement);

                ltlPageTitle.Text = pageTitle;

                StartDate.Text = DateUtils.GetDateAndTimeString(DateTime.Now);
                EndDate.Text   = DateUtils.GetDateAndTimeString(DateTime.Now.AddMonths(1));

                EAdvertisementTypeUtils.AddListItems(AdvertisementType);
                ControlUtils.SelectListItems(AdvertisementType, EAdvertisementTypeUtils.GetValue(EAdvertisementType.FloatImage));

                var nodeIdList = DataProvider.NodeDao.GetNodeIdListByPublishmentSystemId(PublishmentSystemId);
                var nodeCount  = nodeIdList.Count;
                isLastNodeArray = new bool[nodeCount];
                foreach (int theNodeID in nodeIdList)
                {
                    var nodeInfo = NodeManager.GetNodeInfo(PublishmentSystemId, theNodeID);

                    var title    = WebUtils.GetChannelListBoxTitle(PublishmentSystemId, nodeInfo.NodeId, nodeInfo.NodeName, nodeInfo.NodeType, nodeInfo.ParentsCount, nodeInfo.IsLastNode, isLastNodeArray);
                    var listitem = new ListItem(title, nodeInfo.NodeId.ToString());
                    NodeIDCollectionToChannel.Items.Add(listitem);
                    title = title + $"({nodeInfo.ContentNum})";
                    var listitem2 = new ListItem(title, nodeInfo.NodeId.ToString());
                    NodeIDCollectionToContent.Items.Add(listitem2);
                }

                var fileTemplateInfoList = DataProvider.TemplateDao.GetTemplateInfoListByType(PublishmentSystemId, ETemplateType.FileTemplate);
                if (fileTemplateInfoList.Count > 0)
                {
                    foreach (var fileTemplateInfo in fileTemplateInfoList)
                    {
                        var listitem = new ListItem(fileTemplateInfo.CreatedFileFullName, fileTemplateInfo.TemplateId.ToString());
                        FileTemplateIDCollection.Items.Add(listitem);
                    }
                }
                else
                {
                    FileTemplateIDCollectionRow.Visible = false;
                }

                EPositionTypeUtils.AddListItems(PositionType, ERollingType.Static);

                ERollingTypeUtils.AddListItems(RollingType);
                ControlUtils.SelectListItems(RollingType, ERollingTypeUtils.GetValue(ERollingType.FollowingScreen));

                var showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, ImageUrl.ClientID);
                SelectImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, ImageUrl.ClientID);
                UploadImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, ScreenDownImageUrl.ClientID);
                ScreenDownSelectImage.Attributes.Add("onclick", showPopWinString);

                showPopWinString = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, ScreenDownImageUrl.ClientID);
                ScreenDownUploadImage.Attributes.Add("onclick", showPopWinString);

                SetActivePanel(WizardPanel.AdvertisementBase, AdvertisementBase);

                if (isEdit)
                {
                    var adInfo = DataProvider.AdvertisementDao.GetAdvertisementInfo(editAdvertisementName, PublishmentSystemId);
                    AdvertisementName.Text          = adInfo.AdvertisementName;
                    AdvertisementName.Enabled       = false;
                    AdvertisementType.SelectedValue = EAdvertisementTypeUtils.GetValue(editAdvertisementType);

                    IsDateLimited.Checked = adInfo.IsDateLimited;
                    StartDate.Text        = DateUtils.GetDateAndTimeString(adInfo.StartDate);
                    EndDate.Text          = DateUtils.GetDateAndTimeString(adInfo.EndDate);
                    ControlUtils.SelectListItems(NodeIDCollectionToChannel, TranslateUtils.StringCollectionToStringList(adInfo.NodeIDCollectionToChannel));
                    ControlUtils.SelectListItems(NodeIDCollectionToContent, TranslateUtils.StringCollectionToStringList(adInfo.NodeIDCollectionToContent));
                    ControlUtils.SelectListItems(FileTemplateIDCollection, TranslateUtils.StringCollectionToStringList(adInfo.FileTemplateIDCollection));

                    if (adInfo.AdvertisementType == EAdvertisementType.FloatImage)
                    {
                        var adFloatImageInfo = new AdvertisementFloatImageInfo(adInfo.Settings);
                        IsCloseable.Checked       = adFloatImageInfo.IsCloseable;
                        ePositionType             = adFloatImageInfo.PositionType;
                        PositionX.Text            = adFloatImageInfo.PositionX.ToString();
                        PositionY.Text            = adFloatImageInfo.PositionY.ToString();
                        RollingType.SelectedValue = ERollingTypeUtils.GetValue(adFloatImageInfo.RollingType);

                        NavigationUrl.Text = adFloatImageInfo.NavigationUrl;
                        ImageUrl.Text      = adFloatImageInfo.ImageUrl;
                        Height.Text        = adFloatImageInfo.Height.ToString();
                        Width.Text         = adFloatImageInfo.Width.ToString();
                    }
                    else if (adInfo.AdvertisementType == EAdvertisementType.ScreenDown)
                    {
                        var adScreenDownInfo = new AdvertisementScreenDownInfo(adInfo.Settings);
                        ScreenDownNavigationUrl.Text = adScreenDownInfo.NavigationUrl;
                        ScreenDownImageUrl.Text      = adScreenDownInfo.ImageUrl;
                        ScreenDownDelay.Text         = adScreenDownInfo.Delay.ToString();
                        ScreenDownWidth.Text         = adScreenDownInfo.Width.ToString();
                        ScreenDownHeight.Text        = adScreenDownInfo.Height.ToString();
                    }
                    else if (adInfo.AdvertisementType == EAdvertisementType.OpenWindow)
                    {
                        var adOpenWindowInfo = new AdvertisementOpenWindowInfo(adInfo.Settings);
                        OpenWindowFileUrl.Text = adOpenWindowInfo.FileUrl;
                        OpenWindowWidth.Text   = adOpenWindowInfo.Width.ToString();
                        OpenWindowHeight.Text  = adOpenWindowInfo.Height.ToString();
                    }
                }
                ReFresh(null, EventArgs.Empty);
            }

            SuccessMessage(string.Empty);
        }
Пример #3
0
 public OpenWindowScript(PublishmentSystemInfo publishmentSystemInfo, int uniqueID, AdvertisementInfo adInfo)
 {
     this.publishmentSystemInfo = publishmentSystemInfo;
     this.uniqueID    = uniqueID;
     adOpenWindowInfo = new AdvertisementOpenWindowInfo(adInfo.Settings);
 }