/// <summary> /// 新增广告 /// </summary> public bool AddNewTitle() { try { if (!string.IsNullOrEmpty(_AdContent) && (_EndDate > _EffectDate)) { AMS_TitleAdModel model = new AMS_TitleAdModel(); model.AdContent = _AdContent; model.EffectDate = _EffectDate; model.EndDate = _EndDate; if (AMS_TitleAdBLL.AddTitleAd(model) == AdvertManage.Model.Enum.HandleResult.Failed) { throw new Exception("发布失败!详情请查看日志文件!"); } return(true); } else { throw new Exception("填写内容有误,请重新检查!"); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); return(false); } }
/// <summary> /// 数据获取 /// </summary> public void GetData() { try { _TitleAdList.Clear(); List <AMS_TitleAdModel> modellist = AMS_TitleAdBLL.GetTitleAd(); foreach (AMS_TitleAdModel model in modellist) { TitleAdViewModel titleVM = new TitleAdViewModel(); titleVM.Id = model.Id; titleVM.EffectDate = model.EffectDate; titleVM.EndDate = model.EndDate; titleVM.AdContent = model.AdContent; _TitleAdList.Add(titleVM); } } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message); } }