public StringBuilder GetAd2(string location) { StringBuilder ads = new StringBuilder(); Model.AdvertisingInfo ad = Model.AdvertisingInfo.GetModel(t => t.AI_AdLocation == location); if (ad != null) { ads.Append("<a href=\"" + ad.AI_LinkUrl + "\"" + (ad.AI_IsTarget ? " target=\"_blank\"" : "") + " style=\"background: url(" + ad.AI_AdPic + ") center top no-repeat;\"></a>"); } return(ads); }
/// <summary> /// 添加/编辑 /// </summary> /// <param name="isEdit"></param> /// <param name="p_AdvertisingInfo"></param> public void AEAdvertisingInfo(DealMvc.ControllerBase _CB, bool isEdit, ref Model.AdvertisingInfo p_ai) { Model.AdvertisingInfo m_ai = null; if (isEdit) { m_ai = DealMvc.Model.AdvertisingInfo.GetModel(p_ai.id ?? 0); } else { m_ai = new Model.AdvertisingInfo(); } if (!isEdit) { if (Orm.EntityCore <Model.AdvertisingInfo> .Exists("=id", new object[] { p_ai.id })) { throw new ExceptionEx.MyExceptionMessageBox("已经存在此记录"); } m_ai.AI_AdLocation = p_ai.AI_AdLocation; //AI_AdLocation[Type=string] - 广告位置 m_ai.AI_AdPicWidth = p_ai.AI_AdPicWidth ?? 0; //AI_AdPicWidth[Type= int?] - 像素宽 m_ai.AI_AdPicHeight = p_ai.AI_AdPicHeight ?? 0; //AI_AdPicHeight[Type= int?] - 像素高 } else { } m_ai.AI_AdTitle = p_ai.AI_AdTitle; //AI_AdTitle[Type=string] - 广告语 m_ai.AI_AdPic = string.IsNullOrEmpty(p_ai.AI_AdPic) ? m_ai.AI_AdPic : p_ai.AI_AdPic; //AI_AdPic[Type=string] - 广告图片 m_ai.AI_LinkUrl = p_ai.AI_LinkUrl; //AI_LinkUrl[Type=string] - 链接地址 m_ai.AI_Remarks = p_ai.AI_Remarks; //AI_Remarks[Type=string] - 广告备注 m_ai.AI_IsTarget = p_ai.AI_IsTarget; //AI_IsTarget[Type=bool] - 是否新窗口打开 m_ai.AI_Time = p_ai.AI_Time ?? DateTime.Now; //AI_Time[Type=DateTime?] - 操作时间 m_ai.A = p_ai.A; //A[Type=string] - 扩展A字段 m_ai.B = p_ai.B; //B[Type=string] - 扩展B字段 m_ai.C = p_ai.C; //C[Type=string] - 扩展C字段 m_ai.D = p_ai.D; //D[Type=string] - 扩展D字段 m_ai.E = p_ai.E; //E[Type=string] - 扩展E字段 p_ai = m_ai; if (isEdit) { m_ai.Update(); ExceptionEx.MyExceptionLog.AlertMessage(_CB, "编辑成功"); _CB.IsSaveForm = true; } else { m_ai.Add(); ExceptionEx.MyExceptionLog.AlertMessage(_CB, "添加成功", true); } }
public StringBuilder GetAd(string location) { StringBuilder ads = new StringBuilder(); Model.AdvertisingInfo ad = Model.AdvertisingInfo.GetModel(t => t.AI_AdLocation == location); if (ad != null) { ads.Append("<a href=\"" + ad.AI_LinkUrl + "\"" + (ad.AI_IsTarget ? " target=\"_blank\"" : "") + ">"); //ads.Append("<a>"); //ads.Append("<img src=\"" + ad.AI_AdPic + "\" height=\"" + ad.AI_AdPicHeight + "\" /></a>"); ads.Append("<img src=\"" + ad.AI_AdPic + "\" /></a>"); } return(ads); }