Esempio 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);
        }
Esempio n. 2
0
        public void ReFresh(object sender, EventArgs e)
        {
            if (IsDateLimited.Checked)
            {
                StartDateRow.Visible = true;
                EndDateRow.Visible   = true;
            }
            else
            {
                StartDateRow.Visible = false;
                EndDateRow.Visible   = false;
            }

            Level.Visible         = Weight.Visible = false;
            IsDateLimited.Enabled = true;

            var levelType = EAdvLevelTypeUtils.GetEnumType(LevelType.SelectedValue);

            if (levelType == EAdvLevelType.Standard)
            {
                Level.Visible = true;
            }
            else
            {
                Level.Visible = false;
            }

            if (IsWeight.Checked)
            {
                Weight.Visible = true;
            }
            else
            {
                Weight.Visible = false;
            }

            var rotateType = EAdvRotateTypeUtils.GetEnumType(RotateType.SelectedValue);

            if (rotateType == EAdvRotateType.SlideRotate)
            {
                RotateIntervalRow.Visible = true;
            }
            else
            {
                RotateIntervalRow.Visible = false;
            }
        }
Esempio n. 3
0
        public ArrayList GetAdvInfoArrayList(ETemplateType templateType, int adAreaId, int publishmentSystemId, int nodeId, int fileTemplateId)
        {
            var arraylist = new ArrayList();
            var strSql    = new StringBuilder();

            strSql.AppendFormat(@"SELECT AdvID,PublishmentSystemID,AdAreaID,AdvName,Summary, IsEnabled, IsDateLimited, StartDate, EndDate,LevelType,Level,IsWeight,Weight ,RotateType,RotateInterval,NodeIDCollectionToChannel,NodeIDCollectionToContent,FileTemplateIDCollection FROM (SELECT * FROM siteserver_Adv WHERE AdAreaID ={0} AND PublishmentSystemID ={1}) AS ADV", adAreaId, publishmentSystemId);
            if (templateType == ETemplateType.IndexPageTemplate || templateType == ETemplateType.ChannelTemplate)
            {
                strSql.AppendFormat(" WHERE NodeIDCollectionToChannel='{0}' OR NodeIDCollectionToChannel LIKE '{0},%' OR NodeIDCollectionToChannel LIKE '%,{0}' OR NodeIDCollectionToChannel LIKE '%,{0},%'", nodeId.ToString());
            }
            else if (templateType == ETemplateType.ContentTemplate)
            {
                strSql.AppendFormat(" WHERE NodeIDCollectionToContent='{0}' OR NodeIDCollectionToContent LIKE '{0},%' OR NodeIDCollectionToContent LIKE '%,{0}' OR NodeIDCollectionToContent LIKE '%,{0},%'", nodeId.ToString());
            }
            else if (templateType == ETemplateType.FileTemplate)
            {
                strSql.AppendFormat(" WHERE FileTemplateIDCollection='{0}' OR FileTemplateIDCollection LIKE '{0},%' OR FileTemplateIDCollection LIKE '%,{0}' OR FileTemplateIDCollection LIKE '%,{0},%'", fileTemplateId);
            }

            strSql.AppendFormat(@" ORDER BY StartDate ASC");
            using (var rdr = ExecuteReader(strSql.ToString()))
            {
                while (rdr.Read())
                {
                    var i       = 0;
                    var advInfo = new AdvInfo(GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetBool(rdr, i++), GetBool(rdr, i++), GetDateTime(rdr, i++), GetDateTime(rdr, i++), EAdvLevelTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetBool(rdr, i++), GetInt(rdr, i++), EAdvRotateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetString(rdr, i));
                    arraylist.Add(advInfo);
                }
                rdr.Close();
            }

            return(arraylist);
        }
Esempio n. 4
0
        public AdvInfo GetAdvInfo(int advId, int publishmentSystemId)
        {
            AdvInfo advInfo = null;

            var parms = new IDataParameter[]
            {
                GetParameter(ParmAdvId, EDataType.Integer, advId),
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId)
            };

            using (var rdr = ExecuteReader(SqlSelectAdv, parms))
            {
                if (rdr.Read())
                {
                    var i = 0;
                    advInfo = new AdvInfo(GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetBool(rdr, i++), GetBool(rdr, i++), GetDateTime(rdr, i++), GetDateTime(rdr, i++), EAdvLevelTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetBool(rdr, i++), GetInt(rdr, i++), EAdvRotateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetString(rdr, i));
                }
                rdr.Close();
            }

            return(advInfo);
        }
Esempio n. 5
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. 6
0
        public override void Submit_OnClick(object sender, EventArgs e)
        {
            if (Page.IsPostBack && Page.IsValid)
            {
                try
                {
                    if (_isEdit)
                    {
                        var advInfo = DataProvider.AdvDao.GetAdvInfo(_advId, PublishmentSystemId);
                        advInfo.AdvName                   = AdvName.Text;
                        advInfo.IsEnabled                 = TranslateUtils.ToBool(IsEnabled.SelectedValue);
                        advInfo.IsDateLimited             = IsDateLimited.Checked;
                        advInfo.StartDate                 = TranslateUtils.ToDateTime(StartDate.Text);
                        advInfo.EndDate                   = TranslateUtils.ToDateTime(EndDate.Text);
                        advInfo.NodeIDCollectionToChannel = ControlUtils.GetSelectedListControlValueCollection(NodeIDCollectionToChannel);
                        advInfo.NodeIDCollectionToContent = ControlUtils.GetSelectedListControlValueCollection(NodeIDCollectionToContent);
                        advInfo.FileTemplateIDCollection  = ControlUtils.GetSelectedListControlValueCollection(FileTemplateIDCollection);
                        advInfo.LevelType                 = EAdvLevelTypeUtils.GetEnumType(LevelType.SelectedValue);
                        advInfo.Level          = TranslateUtils.ToInt(Level.SelectedValue);
                        advInfo.IsWeight       = IsWeight.Checked;
                        advInfo.Weight         = TranslateUtils.ToInt(Weight.SelectedValue);
                        advInfo.RotateType     = EAdvRotateTypeUtils.GetEnumType(RotateType.SelectedValue);
                        advInfo.RotateInterval = TranslateUtils.ToInt(RotateInterval.Text);
                        advInfo.Summary        = Summary.Text;

                        DataProvider.AdvDao.Update(advInfo);

                        Body.AddSiteLog(PublishmentSystemId, "修改固定广告", $"广告名称:{advInfo.AdvName}");
                        SuccessMessage("修改广告成功!");
                    }
                    else
                    {
                        var advInfo = new AdvInfo();
                        advInfo.AdAreaID                  = _adAreadId;
                        advInfo.PublishmentSystemID       = PublishmentSystemId;
                        advInfo.AdvName                   = AdvName.Text;
                        advInfo.Summary                   = Summary.Text;
                        advInfo.IsEnabled                 = TranslateUtils.ToBool(IsEnabled.SelectedValue);
                        advInfo.IsDateLimited             = IsDateLimited.Checked;
                        advInfo.StartDate                 = TranslateUtils.ToDateTime(StartDate.Text);
                        advInfo.EndDate                   = TranslateUtils.ToDateTime(EndDate.Text);
                        advInfo.NodeIDCollectionToChannel = ControlUtils.GetSelectedListControlValueCollection(NodeIDCollectionToChannel);
                        advInfo.NodeIDCollectionToContent = ControlUtils.GetSelectedListControlValueCollection(NodeIDCollectionToContent);
                        advInfo.FileTemplateIDCollection  = ControlUtils.GetSelectedListControlValueCollection(FileTemplateIDCollection);
                        advInfo.LevelType                 = EAdvLevelTypeUtils.GetEnumType(LevelType.SelectedValue);
                        advInfo.Level          = TranslateUtils.ToInt(Level.SelectedValue);
                        advInfo.IsWeight       = IsWeight.Checked;
                        advInfo.Weight         = TranslateUtils.ToInt(Weight.SelectedValue);
                        advInfo.RotateType     = EAdvRotateTypeUtils.GetEnumType(RotateType.SelectedValue);
                        advInfo.RotateInterval = TranslateUtils.ToInt(RotateInterval.Text);

                        DataProvider.AdvDao.Insert(advInfo);
                        Body.AddSiteLog(PublishmentSystemId, "新增固定广告", $"广告名称:{advInfo.AdvName}");
                        SuccessMessage("新增广告成功!");
                    }

                    AddWaitAndRedirectScript(PageAdv.GetRedirectUrl(PublishmentSystemId, _adAreadId));
                }
                catch (Exception ex)
                {
                    FailMessage(ex, $"操作失败:{ex.Message}");
                }
            }
        }