コード例 #1
0
 private bool UpdateAdvertImage(JObject advertimageobject, System.Web.HttpContext context, out Dictionary <string, string> common_ImageNewAdCtrAttr)
 {
     System.Collections.Generic.Dictionary <string, string> xmlNodeString = this.GetXmlNodeString(advertimageobject);
     if (advertimageobject["Id"].ToString().StartsWith("newads_"))
     {
         return(TagsHelper.UpdateNewAdNode(advertimageobject["Id"].ToString(), "image", xmlNodeString, out common_ImageNewAdCtrAttr));
         //return UpdateAdvertCustomWriteToHTML(advertimageobject, context);
     }
     if (advertimageobject["Id"].ToString().StartsWith("logo_"))
     {
         return(TagsHelper.UpdateNewAdNode(advertimageobject["Id"].ToString(), "logo", xmlNodeString, out common_ImageNewAdCtrAttr));
         //return UpdateAdvertCustomWriteToHTML(advertimageobject, context);
     }
     this.message   = string.Format(this.resultformat, "false", "\"修改单张广告图片失败\"");
     this.elementId = advertimageobject["Id"].ToString().Split(new char[]
     {
         '_'
     })[1];
     advertimageobject["Id"]  = this.elementId;
     common_ImageNewAdCtrAttr = null;
     //System.Collections.Generic.Dictionary<string, string> xmlNodeString = this.GetXmlNodeString(advertimageobject);
     return(TagsHelper.UpdateAdNode((int)System.Convert.ToInt32(this.elementId), "image", xmlNodeString));
 }
コード例 #2
0
        public string RendHtml()
        {
            string        type          = (this.AdId.StartsWith("newads_") ? "image" : "logo");
            XmlNode       xmlNode       = TagsHelper.FindNewAdNode(this.AdId, type);
            StringBuilder stringBuilder = new StringBuilder();

            if (xmlNode != null)
            {
                System.Collections.Generic.Dictionary <string, string> dic = new System.Collections.Generic.Dictionary <string, string>();
                System.Collections.Generic.Dictionary <string, string> dic1;
                if ((string.IsNullOrWhiteSpace(xmlNode.Attributes["DivCss"].Value) || string.IsNullOrWhiteSpace(xmlNode.Attributes["ImgStyle"].Value) || string.IsNullOrWhiteSpace(xmlNode.Attributes["ImageAttr"].Value)))
                {
                    if (!string.IsNullOrWhiteSpace(ImgStyle) && string.IsNullOrWhiteSpace(xmlNode.Attributes["ImgStyle"].Value))
                    {
                        dic.Add("ImgStyle", this.ImgStyle);
                    }
                    if (!string.IsNullOrWhiteSpace(DivCss) && string.IsNullOrWhiteSpace(xmlNode.Attributes["DivCss"].Value))
                    {
                        dic.Add("DivCss", this.DivCss);
                    }
                    if (!string.IsNullOrWhiteSpace(ImageAttr) && string.IsNullOrWhiteSpace(xmlNode.Attributes["ImageAttr"].Value))
                    {
                        dic.Add("ImageAttr", this.ImageAttr);
                    }
                }
                if (dic.Count > 0)
                {
                    TagsHelper.UpdateNewAdNode(this.AdId, type, dic, out dic1);
                    xmlNode = TagsHelper.FindNewAdNode(this.AdId, type);
                }
                dic.Clear();
                dic1 = null;
                if (xmlNode.Attributes["ImgStyle"].Value != this.ImgStyle && !string.IsNullOrEmpty(this.ImgStyle))
                {
                    dic.Add("ImgStyle", this.ImgStyle);
                }
                if (xmlNode.Attributes["DivCss"].Value.Replace("cssEdite", "").Replace(" ", "") != this.DivCss.Replace("cssEdite", "").Replace(" ", "") && !string.IsNullOrEmpty(this.DivCss))
                {
                    dic.Add("DivCss", this.DivCss);
                }
                if (xmlNode.Attributes["ImageAttr"].Value != this.ImageAttr && !string.IsNullOrEmpty(this.ImageAttr))
                {
                    dic.Add("ImageAttr", this.ImageAttr);
                }
                if (dic.Count > 0)
                {
                    TagsHelper.UpdateNewAdNode(this.AdId, type, dic, out dic1);
                }
                stringBuilder.AppendFormat("<div class=\"{0}\" type=\"" + type + "\" id=\"{1}\"><a {2}><img src='{3}'class='lazyload'></a></div>", this.DivCss, this.AdId, string.IsNullOrWhiteSpace(Globals.HtmlDecode(xmlNode.Attributes["Url"].Value)) ? "" : ("href=\"" + Globals.HtmlDecode(xmlNode.Attributes["Url"].Value + "\"")), Globals.HtmlDecode(xmlNode.Attributes["Image"].Value), this.ImgStyle, string.IsNullOrWhiteSpace(ImageAttr) ? "" : ImageAttr);
                //stringBuilder.AppendFormat("<div class=\"ad_custom cssEdite\" type=\"custom\" id=\"ads_{0}\" >{1}</div>", this.AdId, Globals.HtmlDecode(xmlNode.Attributes["Html"].Value)).AppendLine();
            }
            else
            {
                System.Collections.Generic.Dictionary <string, string> dic = new System.Collections.Generic.Dictionary <string, string>();
                dic.Add("Url", "");
                dic.Add("Image", "");
                dic.Add("DivCss", this.DivCss);
                dic.Add("ImgStyle", this.ImgStyle);
                System.Collections.Generic.Dictionary <string, string> dic1;
                TagsHelper.UpdateNewAdNode(this.AdId, this.AdId.StartsWith("newads_") ? "image" : "logo", dic, out dic1);
                stringBuilder.AppendFormat("<div class=\"{0}\" type=\"" + type + "\" id=\"{1}\"><a {2}><img src='{3}' class='lazyload'></a></div>", this.DivCss, this.AdId, "", "", this.ImgStyle);
            }
            return(stringBuilder.ToString());
        }