Esempio n. 1
0
        public void Page_Load(object sender, EventArgs e)
        {
            PageUtils.CheckRequestParameter("PublishmentSystemID");

            _adAreadId = Body.GetQueryInt("AdAreaID");
            if (Body.IsQueryExists("AdvID"))
            {
                _isEdit = true;
                _advId  = Body.GetQueryInt("AdvID");
            }

            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));

                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;
                }

                EBooleanUtils.AddListItems(IsEnabled);
                ControlUtils.SelectListItems(IsEnabled, true.ToString());

                EAdvLevelTypeUtils.AddListItems(LevelType);
                ControlUtils.SelectListItems(LevelType, EAdvLevelTypeUtils.GetValue(EAdvLevelType.Hold));

                EAdvLevelUtils.AddListItems(Level);
                ControlUtils.SelectListItems(Level, EAdvLevelUtils.GetValue(EAdvLevel.Level1));

                EAdvWeightUtils.AddListItems(Weight);
                ControlUtils.SelectListItems(Weight, EAdvWeightUtils.GetValue(EAdvWeight.Level1));

                EAdvRotateTypeUtils.AddListItems(RotateType);
                ControlUtils.SelectListItems(RotateType, EAdvRotateTypeUtils.GetValue(EAdvRotateType.HandWeight));

                if (_isEdit)
                {
                    var advInfo = DataProvider.AdvDao.GetAdvInfo(_advId, PublishmentSystemId);
                    AdvName.Text            = advInfo.AdvName;
                    IsEnabled.SelectedValue = advInfo.IsEnabled.ToString();
                    IsDateLimited.Checked   = advInfo.IsDateLimited;
                    StartDate.Text          = DateUtils.GetDateAndTimeString(advInfo.StartDate);
                    EndDate.Text            = DateUtils.GetDateAndTimeString(advInfo.EndDate);
                    ControlUtils.SelectListItems(NodeIDCollectionToChannel, TranslateUtils.StringCollectionToStringList(advInfo.NodeIDCollectionToChannel));
                    ControlUtils.SelectListItems(NodeIDCollectionToContent, TranslateUtils.StringCollectionToStringList(advInfo.NodeIDCollectionToContent));
                    ControlUtils.SelectListItems(FileTemplateIDCollection, TranslateUtils.StringCollectionToStringList(advInfo.FileTemplateIDCollection));
                    LevelType.SelectedValue  = EAdvLevelTypeUtils.GetValue(advInfo.LevelType);
                    Level.SelectedValue      = advInfo.Level.ToString();
                    IsWeight.Checked         = advInfo.IsWeight;
                    Weight.SelectedValue     = advInfo.Weight.ToString();
                    RotateType.SelectedValue = EAdvRotateTypeUtils.GetValue(advInfo.RotateType);
                    RotateInterval.Text      = advInfo.RotateInterval.ToString();
                    Summary.Text             = advInfo.Summary;
                }

                ReFresh(null, EventArgs.Empty);
            }

            SuccessMessage(string.Empty);
        }
Esempio n. 2
0
        public void Page_Load(object sender, EventArgs e)
        {
            _advId = Body.GetQueryInt("AdvID");

            if (Body.IsQueryExists("AdMaterialID"))
            {
                _theAdMaterialId = Body.GetQueryInt("AdMaterialID");
                if (_theAdMaterialId > 0)
                {
                    _isEdit = true;
                }
            }

            if (!Page.IsPostBack)
            {
                EAdvTypeUtils.AddListItems(AdMaterialType);
                ControlUtils.SelectListItems(AdMaterialType, EAdvTypeUtils.GetValue(EAdvType.HtmlCode));

                EBooleanUtils.AddListItems(IsEnabled);
                ControlUtils.SelectListItems(IsEnabled, true.ToString());

                EAdvWeightUtils.AddListItems(Weight);
                ControlUtils.SelectListItems(Weight, EAdvWeightUtils.GetValue(EAdvWeight.Level1));

                var advInfo = DataProvider.AdvDao.GetAdvInfo(_advId, PublishmentSystemId);
                if (advInfo != null)
                {
                    if (advInfo.RotateType == EAdvRotateType.HandWeight)
                    {
                        phWeight.Visible = true;
                    }
                    else
                    {
                        phWeight.Visible = false;
                    }
                }
                ImageUrl.Attributes.Add("onchange", GetShowImageScript("preview_ImageUrl", PublishmentSystemInfo.PublishmentSystemUrl));

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

                //false -- 不添加水印
                showPopWinString = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, ImageUrl.ClientID, false);
                ImageUrlUpload.Attributes.Add("onclick", showPopWinString);

                FlashUrl.Attributes.Add("onchange", GetShowImageScript("preview_FlashUrl", PublishmentSystemInfo.PublishmentSystemUrl));

                showPopWinString = ModalSelectImage.GetOpenWindowString(PublishmentSystemInfo, FlashUrl.ClientID);
                FlashUrlSelect.Attributes.Add("onclick", showPopWinString);

                //false -- 不添加水印
                showPopWinString = ModalUploadImageSingle.GetOpenWindowStringToTextBox(PublishmentSystemId, FlashUrl.ClientID, false);
                FlashUrlUpload.Attributes.Add("onclick", showPopWinString);

                if (_isEdit)
                {
                    var adMaterialInfo = DataProvider.AdMaterialDao.GetAdMaterialInfo(_theAdMaterialId, PublishmentSystemId);
                    AdMaterialName.Text          = adMaterialInfo.AdMaterialName;
                    AdMaterialType.SelectedValue = EAdvTypeUtils.GetValue(adMaterialInfo.AdMaterialType);
                    IsEnabled.SelectedValue      = adMaterialInfo.IsEnabled.ToString();

                    Code.Text            = adMaterialInfo.Code;
                    TextWord.Text        = adMaterialInfo.TextWord;
                    TextLink.Text        = adMaterialInfo.TextLink;
                    TextColor.Text       = adMaterialInfo.TextColor;
                    TextFontSize.Text    = adMaterialInfo.TextFontSize.ToString();
                    Weight.SelectedValue = adMaterialInfo.Weight.ToString();
                    if (adMaterialInfo.AdMaterialType == EAdvType.Image)
                    {
                        ImageUrl.Text    = adMaterialInfo.ImageUrl;
                        ImageLink.Text   = adMaterialInfo.ImageLink;
                        ImageWidth.Text  = adMaterialInfo.ImageWidth.ToString();
                        ImageHeight.Text = adMaterialInfo.ImageHeight.ToString();
                        ImageAlt.Text    = adMaterialInfo.ImageAlt;
                    }
                    else if (adMaterialInfo.AdMaterialType == EAdvType.Flash)
                    {
                        FlashUrl.Text    = adMaterialInfo.ImageUrl;
                        FlashWidth.Text  = adMaterialInfo.ImageWidth.ToString();
                        FlashHeight.Text = adMaterialInfo.ImageHeight.ToString();
                    }
                }

                ReFresh(null, EventArgs.Empty);
            }

            SuccessMessage(string.Empty);
        }