Пример #1
0
        public void Update(AdMaterialInfo adMaterialInfo)
        {
            var adParms = new IDataParameter[]
            {
                GetParameter(ParmAdvertId, EDataType.Integer, adMaterialInfo.AdvID),
                GetParameter(ParmAdmaterialName, EDataType.NVarChar, 50, adMaterialInfo.AdMaterialName),
                GetParameter(ParmAdmaterialType, EDataType.VarChar, 50, EAdvTypeUtils.GetValue(adMaterialInfo.AdMaterialType)),
                GetParameter(ParmCode, EDataType.NText, adMaterialInfo.Code),
                GetParameter(ParmTextWord, EDataType.NVarChar, 255, adMaterialInfo.TextWord),
                GetParameter(ParmTextLink, EDataType.VarChar, 200, adMaterialInfo.TextLink),
                GetParameter(ParmTextColor, EDataType.VarChar, 10, adMaterialInfo.TextColor),
                GetParameter(ParmTextFontSize, EDataType.Integer, adMaterialInfo.TextFontSize),
                GetParameter(ParmImageUrl, EDataType.VarChar, 200, adMaterialInfo.ImageUrl),
                GetParameter(ParmImageLink, EDataType.VarChar, 200, adMaterialInfo.ImageLink),
                GetParameter(ParmImageWidth, EDataType.Integer, adMaterialInfo.ImageWidth),
                GetParameter(ParmImageHeight, EDataType.Integer, adMaterialInfo.ImageHeight),
                GetParameter(ParmImageAlt, EDataType.NVarChar, 50, adMaterialInfo.ImageAlt),
                GetParameter(ParmWeight, EDataType.Integer, adMaterialInfo.Weight),
                GetParameter(ParmIsEnabled, EDataType.VarChar, 18, adMaterialInfo.IsEnabled.ToString()),
                GetParameter(ParmAdmaterialId, EDataType.Integer, adMaterialInfo.AdMaterialID),
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, adMaterialInfo.PublishmentSystemID),
            };

            ExecuteNonQuery(SqlUpdateAdmaterial, adParms);
        }
Пример #2
0
        public IEnumerable GetDataSourceByType(EAdvType adType, int publishmentSystemId)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmAdmaterialType, EDataType.VarChar, 50, EAdvTypeUtils.GetValue(adType)),
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId)
            };

            var enumerable = (IEnumerable)ExecuteReader(SqlSelectAllAdmaterialByType, parms);

            return(enumerable);
        }
Пример #3
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);
        }