public promotion_events CreatePromotion(promotion_events info, out string error)
 {
     error = string.Empty;
     try
     {
         db.promotion_events.Add(info);
         db.SaveChanges();
         return info;
     }
     catch (System.Data.Entity.Validation.DbEntityValidationException ex)
     {
         error = Share.BaseTool.FormatExceptionMessage(ex);
         return null;
     }
 }
 public promotion_events CreatePromotion(promotion_events info, out string error)
 {
     error = string.Empty;
     try
     {
         promotion_events_DA da = new promotion_events_DA();
         da.CreatePromotion(info, out error);
         return info;
     }
     catch (Exception ex)
     {
         error += Share.BaseTool.FormatExceptionMessage(ex);
         return null;
     }
 }
        public ActionResult CreatePromotionEvent(string name, string date1, string date2, string content, string remark)
        {
            List<SelectListItem> eventtype = (Share.EnumOperate.ToKeyValues(typeof(PromotionEventType))
             .Select(t => new SelectListItem() { Value = t.Key.ToString(), Text = t.Value, Selected = t.Key == 0 })).ToList();
            ViewBag.eventtype = eventtype;

            if (string.IsNullOrEmpty(date1) || string.IsNullOrEmpty(date2))
            {
                ViewBag.ErrorMessage = "请选择日期";
                return View();
            }

            promotion_events info = new promotion_events();
            info.Initial();
            info.name = name;
            info.hospital_id = 0;
            info.contents = content;
            info.face_type = 0; //面向对象
            info.startdate = BaseTool.GetDateTime(date1);
            info.enddate = BaseTool.GetDateTime(date2);
            info.attachfile = "";

            string error = string.Empty;
            promotion_events_Bll bll = new promotion_events_Bll();
            bll.CreatePromotion(info, out error);

            if (!string.IsNullOrEmpty(error))
            {
                ViewBag.ErrorMessage = "添加活动失败!";
            }
            return View(info);
        }