Beispiel #1
0
        /// <summary>
        /// 【视图】新增文章
        /// </summary>
        /// <returns></returns>
        public ViewResult Add(string EventID, string EventName)
        {
            var model = new EventDetail_S();

            model.N_EVENT_ID    = EventID;
            model.VC_EVENT_NAME = EventName;
            return(View(model));
        }
Beispiel #2
0
        /// <summary>
        /// 【视图】专题明细列表
        /// </summary>
        /// <returns></returns>
        public ViewResult List(string EventID)
        {
            EventDetail_S model = new EventDetail_S();

            model.N_EVENT_ID    = EventID;
            model.VC_EVENT_NAME = _EventFacade.Value.GetByID <Event_S>(model.N_EVENT_ID).VC_TITLE;
            return(View(model));
        }
Beispiel #3
0
        /// <summary>
        /// 分页获取专题
        /// </summary>
        /// <param name="article">搜索条件</param>
        /// <param name="pi">分页信息</param>
        /// <returns></returns>
        public JsonResult _EventDetailList(EventDetail_S model, PageInfo pi)
        {
            var data   = _EventDetailFacade.Value.GetEventDetailListPaged(model, pi);
            var result = new
            {
                Rows  = data,
                Total = pi.Total
            };

            return(Json(result));
        }
 /// <summary>
 /// 修改专题明细
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool EditEventDetail(EventDetail_S model)
 {
     using (var factory = new BaseAccess())
     {
         try
         {
             var entity = model.Adapter <EventDetailEntity>(new EventDetailEntity());
             factory.Update <EventDetailEntity>(entity);
             return(true);
         }
         catch
         {
             return(false);
         }
     }
 }
Beispiel #5
0
 public JsonResult _Edit(EventDetail_S model)
 {
     try
     {
         if (_EventDetailFacade.Value.EditEventDetail(model))
         {
             return(Json(AjaxResult.Success(model, "专题明细修改成功!")));
         }
         else
         {
             return(Json(AjaxResult.Success(model, "专题明细修改失败!")));
         }
     }
     catch (Exception ex)
     {
         return(Json(AjaxResult.Error("专题明细修改失败!错误原因:" + ex.Message)));
     }
 }
Beispiel #6
0
        public JsonResult _Add(EventDetail_S model)
        {
            try
            {
                model.N_OP_ID    = CurrentUserContext.UserID;
                model.DT_OP_TIME = DateTime.Now;

                if (_EventDetailFacade.Value.AddEventDetail(model))
                {
                    return(Json(AjaxResult.Success(model, "专题明细新增成功!")));
                }
                else
                {
                    return(Json(AjaxResult.Success(model, "专题明细新增失败!")));
                }
            }
            catch (Exception ex)
            {
                return(Json(AjaxResult.Error("专题明细新增失败!错误原因:" + ex.Message)));
            }
        }
        /// <summary>
        /// 分页获取专题明细列表
        /// </summary>
        /// <param name="model"></param>
        /// <param name="pi"></param>
        /// <returns></returns>
        public List <EventDetail_S> GetEventDetailListPaged(EventDetail_S model, PageInfo pi)
        {
            using (var factory = new BaseAccess())
            {
                List <Orderby <EventDetailEntity> > orders = new List <Orderby <EventDetailEntity> >()
                {
                    new Orderby <EventDetailEntity>(c => c.DT_OP_TIME, SortOrder.Ascending)
                };

                var spec = Specification <EventDetailEntity> .Create(c => true);

                if (!string.IsNullOrWhiteSpace(model.VC_TITLE))
                {
                    spec &= Specification <EventDetailEntity> .Create(c => c.VC_TITLE.Contains(model.VC_TITLE));
                }
                if (!string.IsNullOrWhiteSpace(model.N_EVENT_ID))
                {
                    spec &= Specification <EventDetailEntity> .Create(c => c.N_EVENT_ID == model.N_EVENT_ID);
                }
                var list = factory.GetPage <EventDetailEntity>(pi, spec, orders)
                           .Adapter <EventDetailEntity, EventDetail_S>(new List <EventDetail_S>());
                return(list);
            }
        }