/// <summary> /// 新增友情链接 /// </summary> /// <param name="siteNoticeEntity"></param> /// <returns></returns> public bool AddFriendlyLink(FriendlyLinkEntity model) { bool flag = false; StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" @JournalID"); sqlCommandText.Append(", @ChannelID"); sqlCommandText.Append(", @SiteName"); sqlCommandText.Append(", @SiteUrl"); sqlCommandText.Append(", @LogoUrl"); sqlCommandText.Append(", @LinkType"); sqlCommandText.Append(", @SortID"); DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.FriendlyLink ({0},AddDate) VALUES ({1},getdate())", sqlCommandText.ToString().Replace("@", ""), sqlCommandText.ToString())); db.AddInParameter(cmd, "@JournalID", DbType.Int64, model.JournalID); db.AddInParameter(cmd, "@ChannelID", DbType.Int64, model.ChannelID); db.AddInParameter(cmd, "@SiteName", DbType.AnsiString, model.SiteName); db.AddInParameter(cmd, "@SiteUrl", DbType.AnsiString, model.SiteUrl); db.AddInParameter(cmd, "@LogoUrl", DbType.AnsiString, model.LogoUrl); db.AddInParameter(cmd, "@LinkType", DbType.Byte, model.LinkType); db.AddInParameter(cmd, "@SortID", DbType.Int32, model.SortID); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }
public ActionResult Save(FriendlyLinkEntity model) { ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); model.JournalID = CurAuthor.JournalID; ExecResult result = service.SaveFriendlyLink(model); return Json(new { result = result.result, msg = result.msg }); }
private FriendlyLinkEntity GetModel(Int64 LinkID) { FriendlyLinkEntity model = null; if (LinkID > 0) { FriendlyLinkQuery query = new FriendlyLinkQuery(); query.JournalID = CurAuthor.JournalID; query.LinkID = LinkID; ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>(); model = service.GetFriendlyLinkModel(query); } if (model == null) model = new FriendlyLinkEntity(); return model; }
public ExecResult Save(FriendlyLinkEntity model) { IFriendlyLinkService service = ServiceContainer.Instance.Container.Resolve<IFriendlyLinkService>(); return service.Save(model); }
/// <summary> /// 编辑友情链接 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateFriendlyLink(FriendlyLinkEntity model) { return FriendlyLinkDataAccess.Instance.UpdateFriendlyLink(model); }
/// <summary> /// 新增友情链接 /// </summary> /// <param name="siteNoticeEntity"></param> /// <returns></returns> public bool AddFriendlyLink(FriendlyLinkEntity model) { return FriendlyLinkDataAccess.Instance.AddFriendlyLink(model); }
/// <summary> /// 新增友情链接 /// </summary> /// <param name="siteNoticeEntity"></param> /// <returns></returns> public bool AddFriendlyLink(FriendlyLinkEntity model) { return FriendlyLinkBusProvider.AddFriendlyLink(model); }
/// <summary> /// 编辑友情链接 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateFriendlyLink(FriendlyLinkEntity model) { return FriendlyLinkBusProvider.UpdateFriendlyLink(model); }
/// <summary> /// 保存友情链接 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult Save(FriendlyLinkEntity model) { ExecResult execResult = new ExecResult(); bool result = false; model.SiteName = model.SiteName.TextFilter(); model.SiteUrl = model.SiteUrl.TextFilter(); if (model.LinkID == 0) { result = AddFriendlyLink(model); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "新增友情链接成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "新增友情链接失败!"; } } else { result = UpdateFriendlyLink(model); if (result) { execResult.result = EnumJsonResult.success.ToString(); execResult.msg = "修改友情链接成功!"; } else { execResult.result = EnumJsonResult.failure.ToString(); execResult.msg = "修改友情链接失败!"; } } return execResult; }
/// <summary> /// 保存友情链接数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public ExecResult SaveFriendlyLink(FriendlyLinkEntity model) { HttpClientHelper clientHelper = new HttpClientHelper(); ExecResult result = clientHelper.Post<ExecResult, FriendlyLinkEntity>(GetAPIUrl(APIConstant.FRIENDLYLINK_SAVE), model); return result; }
/// <summary> /// 组装数据 /// </summary> /// <param name="dr"></param> /// <returns></returns> private FriendlyLinkEntity MakeFriendlyLinkModel(IDataReader dr) { FriendlyLinkEntity model = new FriendlyLinkEntity(); model.LinkID = (Int64)dr["LinkID"]; model.JournalID = (Int64)dr["JournalID"]; model.ChannelID = (Int64)dr["ChannelID"]; model.SiteName = (String)dr["SiteName"]; model.SiteUrl = (String)dr["SiteUrl"]; model.LogoUrl = (String)dr["LogoUrl"]; model.LinkType = (Byte)dr["LinkType"]; model.SortID = (Int32)dr["SortID"]; model.AddDate = (DateTime)dr["AddDate"]; return model; }
/// <summary> /// 编辑友情链接 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdateFriendlyLink(FriendlyLinkEntity model) { bool flag = false; StringBuilder whereCommandText = new StringBuilder(); whereCommandText.Append(" LinkID=@LinkID"); StringBuilder sqlCommandText = new StringBuilder(); sqlCommandText.Append(" SiteName=@SiteName"); sqlCommandText.Append(", SiteUrl=@SiteUrl"); sqlCommandText.Append(", LogoUrl=@LogoUrl"); sqlCommandText.Append(", LinkType=@LinkType"); sqlCommandText.Append(", SortID=@SortID"); DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.FriendlyLink SET {0} WHERE {1}", sqlCommandText.ToString(), whereCommandText.ToString())); db.AddInParameter(cmd, "@LinkID", DbType.Int64, model.LinkID); db.AddInParameter(cmd, "@SiteName", DbType.AnsiString, model.SiteName); db.AddInParameter(cmd, "@SiteUrl", DbType.AnsiString, model.SiteUrl); db.AddInParameter(cmd, "@LogoUrl", DbType.AnsiString, model.LogoUrl); db.AddInParameter(cmd, "@LinkType", DbType.Byte, model.LinkType); db.AddInParameter(cmd, "@SortID", DbType.Int32, model.SortID); try { db.ExecuteNonQuery(cmd); flag = true; } catch (SqlException sqlEx) { throw sqlEx; } return flag; }