Example #1
0
        public ActionResult Edit(Base_Article a, int caId = 0)
        {
            Base_CatalogArticle ca;

            if (caId > 0)
            {
                ca = _schedule.Article.GetById(caId);
                if (ca.Article.State == ScheduleEvent.OptionReadOnly)
                {
                    return(JsonTips("error", SStr.CantChangeReadonlySchedule));
                }
            }
            else
            {
                a.State = ArticleState.Published;
                ca      = new Base_CatalogArticle
                {
                    CatalogId = ScheduleEvent.Root.Id,
                };
            }
            ca.Article          = a;
            ca.Article.EditorId = CurrentUserId.ToInt();
            ScheduleManager.AdjustAlertTime(ca);
            _schedule.Article.Save(ca);
            // Manager.Save(evt);
            return(JsonTips("success", JStr.SuccessSaved, ca.Article.Title));
        }
Example #2
0
 public SendResult Send(JMessage msg)
 {
     using (var article = SiteManager.Get <ArticleManager>())
     {
         string author = AppManager.Instance.UserManager.GetById(msg.SenderId.ToString()).Name;
         foreach (int id in msg.SendToIds.Union(msg.CopyToIds))
         {
             var ca = article.CreateByCatalog(ScheduleEvent.Root.Id);
             ca.Article.Options = ScheduleEvent.OptionNotice;
             ca.SetExt(ScheduleEvent.Root.AlertBefore, 5);
             ca.SetExt(ScheduleEvent.Root.StartTime, DateTime.Now);
             ca.SetExt(ScheduleEvent.Root.AllDay, true);
             ca.SetExt(ScheduleEvent.Root.ProcessUrl, msg.Url);
             ca.Article.Title      = msg.Title;
             ca.Article.Text       = msg.Content;
             ca.Article.EditorId   = id;
             ca.Article.Author     = author;
             ca.Article.CreateTime = DateTime.Now;
             ScheduleManager.AdjustAlertTime(ca);
             article.Save(ca);
         }
         SendResult result = new SendResult
         {
             MessageId    = msg.Id,
             SentTime     = DateTime.Now,
             PlanSendTime = msg.PlanSendTime,
         };
         return(result);
     }
 }