예제 #1
0
        public int AddPopupzx(PopupMsgPlan pop, string type, int NewsId)
        {
            News        news        = newsBLL.Get("NewsId", NewsId);
            NewsContent newsContent = newsContentBLL.Get("NewsId", NewsId);

            pop.Title   = news.Title;
            pop.ImgUrl  = news.ImgUrl;
            pop.PageUrl = "id=" + news.NewsId;
            pop.NewsId  = news.NewsId;
            pop.Content = string.IsNullOrEmpty(news.NewsAbstract) ? (newsContent.Content.Length > 90 ? StringHelper.NoHTML(newsContent.Content.Substring(0, 90).Trim()) : newsContent.Content) : (news.NewsAbstract.Length > 90 ? news.NewsAbstract.Substring(0, 90).Trim() : news.NewsAbstract.Trim());

            if (type == "add")
            {
                pop.PopupType = 1;
                //if (pop.Content == "" || pop.Content == null)
                //    pop.PopupType = 0;
                pop.Status      = 0;
                pop.CreatedTime = DateTime.Now;
                pop.Editor      = UserCookies.AdminName;

                //不设置开始时间,默认当前时间
                if (pop.BeginTime == null)
                {
                    pop.BeginTime = DateTime.Now;
                }
                //不设置时效的情况下,默认时效为30分钟
                if (pop.EndTime == null)
                {
                    pop.EndTime = Convert.ToDateTime(pop.BeginTime).AddMinutes(30);
                }
                int res = opupMsgPlanBll.Add(pop);
                if (res > 0)
                {
                    NewsPopup np = new NewsPopup();
                    np.NewsId      = NewsId;
                    np.Title       = news.Title;
                    np.Author      = news.Author;
                    np.CreatedTime = news.CreatedTime;
                    np.PushColumn  = pop.PushColumn;
                    newsPopupBll.Add(np);
                }

                SsoServer.SsoPush(res, pop.PushVersion);
                return(res);
            }
            return(0);
        }
예제 #2
0
 /// <summary>
 /// 更新单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Update(NewsPopup obj)
 {
     return(dal.Update(obj));
 }
예제 #3
0
 /// <summary>
 /// 删除单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Delete(NewsPopup obj)
 {
     return(dal.Delete(obj));
 }
예제 #4
0
 /// <summary>
 /// 添加单条数据
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 public int Add(NewsPopup obj)
 {
     return(dal.Add(obj));
 }