public bool AddSiteNotice(SiteNoticeEntity siteNoticeEntity) { bool flag = false; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" @JournalID"); sqlCommandText.Append(", @ChannelID"); sqlCommandText.Append(", @Title"); sqlCommandText.Append(", @Keywords"); sqlCommandText.Append(", @Description"); sqlCommandText.Append(", @Content"); sqlCommandText.Append(", @FjPath"); DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.SiteDescribe ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString())); db.AddInParameter(cmd,"@JournalID",DbType.Int64,siteNoticeEntity.JournalID); db.AddInParameter(cmd, "@ChannelID", DbType.Int64, siteNoticeEntity.ChannelID); db.AddInParameter(cmd, "@Title", DbType.String, siteNoticeEntity.Title); db.AddInParameter(cmd, "@Keywords", DbType.String, siteNoticeEntity.Keywords); db.AddInParameter(cmd, "@Description", DbType.String, siteNoticeEntity.Description); db.AddInParameter(cmd,"@Content",DbType.String,siteNoticeEntity.Content); db.AddInParameter(cmd, "@FjPath", DbType.String, siteNoticeEntity.FjPath); try { db.ExecuteNonQuery(cmd); flag = true; } catch(SqlException sqlEx) { throw sqlEx; } return flag; }
public ActionResult Save(SiteNoticeEntity model) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); model.JournalID = CurAuthor.JournalID; if (!string.IsNullOrWhiteSpace(model.Content)) model.Content = Server.UrlDecode(model.Content); ExecResult result = service.SaveSiteNotice(model); return Json(new { result = result.result, msg = result.msg }); }
/// <summary> /// 从存储媒介删除实体数据 /// </summary> /// <param name="siteNotice">SiteNoticeEntity实体对象</param> /// <returns>true:删除成功 false:删除失败</returns> public bool DeleteSiteNotice(SiteNoticeEntity siteNotice) { return SiteNoticeBusProvider.DeleteSiteNotice(siteNotice); }
/// <summary> /// 将实体数据存入存储媒介(持久化一个对象) /// </summary> /// <param name="siteNotice">SiteNoticeEntity实体对象</param> /// <returns>true:存储成功 false:存储失败</returns> public bool AddSiteNotice(SiteNoticeEntity siteNotice) { return SiteNoticeBusProvider.AddSiteNotice(siteNotice); }
/// <summary> /// 更新存储媒介中的实体数据 /// </summary> /// <param name="siteNotice">SiteNoticeEntity实体对象</param> /// <returns>true:更新成功 false:更新失败</returns> public bool UpdateSiteNotice(SiteNoticeEntity siteNotice) { return SiteNoticeBusProvider.UpdateSiteNotice(siteNotice); }
/// <summary> /// 保存站点公告 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult Save(SiteNoticeEntity model) { ExecResult execResult = new ExecResult(); bool result = false; model.Title = model.Title.TextFilter(); model.Keywords = model.Keywords.TextFilter(); model.Description = model.Description.TextFilter(); model.Content = model.Content.HtmlFilter(); if (model.NoticeID == 0) { result = AddSiteNotice(model); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "新增成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "新增失败!"; } } else { result = UpdateSiteNotice(model); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "修改成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "修改失败!"; } } return execResult; }
public bool UpdateSiteNotice(SiteNoticeEntity siteNoticeEntity) { bool flag = false; StringBuilder whereCommandText = new StringBuilder(); whereCommandText.Append(" DesID=@DesID"); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" Title=@Title"); sqlCommandText.Append(", Keywords=@Keywords"); sqlCommandText.Append(", Description=@Description"); sqlCommandText.Append(", Content=@Content"); sqlCommandText.Append(", FjPath=@FjPath"); DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.SiteDescribe SET {0} WHERE {1}", sqlCommandText.ToString(), whereCommandText.ToString())); db.AddInParameter(cmd, "@DesID", DbType.Int64, siteNoticeEntity.NoticeID); db.AddInParameter(cmd,"@Title",DbType.AnsiString,siteNoticeEntity.Title); db.AddInParameter(cmd,"@Keywords",DbType.AnsiString,siteNoticeEntity.Keywords); db.AddInParameter(cmd,"@Description",DbType.AnsiString,siteNoticeEntity.Description); db.AddInParameter(cmd,"@Content",DbType.AnsiString,siteNoticeEntity.Content); db.AddInParameter(cmd, "@FjPath", DbType.AnsiString, siteNoticeEntity.FjPath); try { db.ExecuteNonQuery(cmd); flag = true; } catch(SqlException sqlEx) { throw sqlEx; } return flag; }
public List<SiteNoticeEntity> MakeSiteNoticeList(IDataReader dr) { List<SiteNoticeEntity> list=new List<SiteNoticeEntity>(); while(dr.Read()) { SiteNoticeEntity siteNoticeEntity=new SiteNoticeEntity(); siteNoticeEntity.NoticeID = (Int64)dr["DesID"]; siteNoticeEntity.JournalID = (Int64)dr["JournalID"]; siteNoticeEntity.ChannelID = (Int64)dr["ChannelID"]; siteNoticeEntity.Title = (String)dr["Title"]; siteNoticeEntity.Keywords = (String)dr["Keywords"]; siteNoticeEntity.Description = (String)dr["Description"]; siteNoticeEntity.Content = (String)dr["Content"]; siteNoticeEntity.FjPath = (String)dr["FjPath"]; siteNoticeEntity.AddDate = (DateTime)dr["AddDate"]; list.Add(siteNoticeEntity); } dr.Close(); return list; }
public SiteNoticeEntity MakeSiteNotice(DataRow dr) { SiteNoticeEntity siteNoticeEntity=null; if(dr!=null) { siteNoticeEntity=new SiteNoticeEntity(); siteNoticeEntity.NoticeID = (Int64)dr["DesID"]; siteNoticeEntity.JournalID = (Int64)dr["JournalID"]; siteNoticeEntity.ChannelID = (Int64)dr["ChannelID"]; siteNoticeEntity.Title = (String)dr["Title"]; siteNoticeEntity.Keywords = (String)dr["Keywords"]; siteNoticeEntity.Description = (String)dr["Description"]; siteNoticeEntity.Content = (String)dr["Content"]; siteNoticeEntity.FjPath = (String)dr["FjPath"]; siteNoticeEntity.AddDate = (DateTime)dr["AddDate"]; } return siteNoticeEntity; }
public bool DeleteSiteNotice(SiteNoticeEntity siteNoticeEntity) { bool flag = false; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append("DELETE FROM dbo.SiteDescribe"); sqlCommandText.Append(" WHERE DesID=@DesID"); DbCommand cmd = db.GetSqlStringCommand(sqlCommandText.ToString()); db.AddInParameter(cmd, "@DesID", DbType.Int64, siteNoticeEntity.NoticeID); try { db.ExecuteNonQuery(cmd); flag = true; } catch(SqlException sqlEx) { throw sqlEx; } return flag; }
public ExecResult Save(SiteNoticeEntity model) { ISiteNoticeService service = ServiceContainer.Instance.Container.Resolve<ISiteNoticeService>(); return service.Save(model); }
private SiteNoticeEntity GetModel(Int64 NoticeID) { SiteNoticeEntity model = null; if (NoticeID > 0) { SiteNoticeQuery query = new SiteNoticeQuery(); query.JournalID = CurAuthor.JournalID; query.NoticeID = NoticeID; ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); model = service.GetSiteNoticeModel(query); } if (model == null) model = new SiteNoticeEntity(); return model; }
/// <summary> /// 从存储媒介删除实体数据 /// </summary> /// <param name="siteNotice">SiteNoticeEntity实体对象</param> /// <returns>true:删除成功 false:删除失败</returns> public bool DeleteSiteNotice(SiteNoticeEntity siteNotice) { return SiteNoticeDataAccess.Instance.DeleteSiteNotice(siteNotice); }
/// <summary> /// 将实体数据存入存储媒介(持久化一个对象) /// </summary> /// <param name="siteNotice">SiteNoticeEntity实体对象</param> /// <returns>true:存储成功 false:存储失败</returns> public bool AddSiteNotice(SiteNoticeEntity siteNotice) { return SiteNoticeDataAccess.Instance.AddSiteNotice(siteNotice); }
/// <summary> /// 保存站点公告数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveSiteNotice(SiteNoticeEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, SiteNoticeEntity>(GetAPIUrl(APIConstant.SITENOTICE__SAVE), model); return result; }