Ejemplo n.º 1
0
        public void Update(AdvInfo advInfo)
        {
            var adParms = new IDataParameter[]
            {
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, advInfo.PublishmentSystemID),
                GetParameter(ParmAdvAreaid, EDataType.Integer, advInfo.AdAreaID),
                GetParameter(ParmAdvName, EDataType.NVarChar, 50, advInfo.AdvName),
                GetParameter(ParmSummary, EDataType.Text, advInfo.Summary),
                GetParameter(ParmIsEnabled, EDataType.VarChar, 18, advInfo.IsEnabled.ToString()),
                GetParameter(ParmIsDateLimited, EDataType.VarChar, 18, advInfo.IsDateLimited.ToString()),
                GetParameter(ParmStartDate, EDataType.DateTime, advInfo.StartDate),
                GetParameter(ParmEndDate, EDataType.DateTime, advInfo.EndDate),
                GetParameter(ParmLevelType, EDataType.NVarChar, 50, EAdvLevelTypeUtils.GetValue(advInfo.LevelType)),
                GetParameter(ParmLevel, EDataType.Integer, advInfo.Level),
                GetParameter(ParmIsWeight, EDataType.VarChar, 18, advInfo.IsWeight.ToString()),
                GetParameter(ParmWeight, EDataType.Integer, advInfo.Weight),
                GetParameter(ParmRotateType, EDataType.NVarChar, 50, EAdvRotateTypeUtils.GetValue(advInfo.RotateType)),
                GetParameter(ParmRotateInterval, EDataType.Integer, advInfo.RotateInterval),
                GetParameter(ParmNodeIdCollectionToChannel, EDataType.NVarChar, 4000, advInfo.NodeIDCollectionToChannel),
                GetParameter(ParmNodeIdCollectionToContent, EDataType.NVarChar, 4000, advInfo.NodeIDCollectionToContent),
                GetParameter(ParmFiletemplateIdCollection, EDataType.NVarChar, 4000, advInfo.FileTemplateIDCollection),
                GetParameter(ParmAdvId, EDataType.Integer, advInfo.AdvID)
            };

            ExecuteNonQuery(SqlUpdateAdv, adParms);
        }
Ejemplo n.º 2
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);
        }