Beispiel #1
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;
            }
        }
Beispiel #2
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);
        }
Beispiel #3
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);
        }
Beispiel #4
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}");
                }
            }
        }