Пример #1
0
        /// <summary>
        /// 新增内容块
        /// </summary>
        /// <param name="SiteResourceEntity"></param>
        /// <returns></returns>
        public bool AddSiteBlock(SiteBlockEntity model)
        {
            bool flag = false;
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" @JournalID");
            sqlCommandText.Append(", @ChannelID");
            sqlCommandText.Append(", @Title");
            sqlCommandText.Append(", @Linkurl");
            sqlCommandText.Append(", @TitlePhoto");
            sqlCommandText.Append(", @Note");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("INSERT INTO dbo.SiteBlock ({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, "@Title", DbType.AnsiString, model.Title);
            db.AddInParameter(cmd, "@Linkurl", DbType.AnsiString, model.Linkurl);
            db.AddInParameter(cmd, "@TitlePhoto", DbType.AnsiString, model.TitlePhoto);
            db.AddInParameter(cmd, "@Note", DbType.AnsiString, model.Note);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Пример #2
0
 public ActionResult Save(SiteBlockEntity model)
 {
     ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
     model.JournalID = CurAuthor.JournalID;
     ExecResult result = service.SaveSiteBlock(model);
     return Json(new { result = result.result, msg = result.msg });
 }
Пример #3
0
 private SiteBlockEntity GetModel(Int64 BlockID)
 {
     SiteBlockEntity model = null;
     if (BlockID > 0)
     {
         SiteBlockQuery query = new SiteBlockQuery();
         query.JournalID = CurAuthor.JournalID;
         query.BlockID = BlockID;
         ISiteConfigFacadeService service = ServiceContainer.Instance.Container.Resolve<ISiteConfigFacadeService>();
         model = service.GetSiteBlockModel(query);
     }
     if (model == null)
         model = new SiteBlockEntity();
     return model;
 }
Пример #4
0
 /// <summary>
 /// 新增内容块
 /// </summary>
 /// <param name="SiteBlockEntity"></param>
 /// <returns></returns>
 public bool AddSiteBlock(SiteBlockEntity model)
 {
     return SiteBlockBusProvider.AddSiteBlock(model);
 }
Пример #5
0
 /// <summary>
 /// 编辑内容块
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateSiteBlock(SiteBlockEntity model)
 {
     return SiteBlockBusProvider.UpdateSiteBlock(model);
 }
Пример #6
0
 /// <summary>
 /// 保存内容块
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult Save(SiteBlockEntity model)
 {
     ExecResult execResult = new ExecResult();
     bool result = false;
     model.Title = model.Title.TextFilter();
     model.Linkurl = model.Linkurl.TextFilter();
     model.Note = model.Note.TextFilter();
     if (model.BlockID == 0)
     {
         result = AddSiteBlock(model);
         if (result)
         {
             execResult.result = EnumJsonResult.success.ToString();
             execResult.msg = "新增内容块成功!";
         }
         else
         {
             execResult.result = EnumJsonResult.failure.ToString();
             execResult.msg = "新增内容块失败!";
         }
     }
     else
     {
         result = UpdateSiteBlock(model);
         if (result)
         {
             execResult.result = EnumJsonResult.success.ToString();
             execResult.msg = "修改内容块成功!";
         }
         else
         {
             execResult.result = EnumJsonResult.failure.ToString();
             execResult.msg = "修改内容块失败!";
         }
     }
     return execResult;
 }
Пример #7
0
 /// <summary>
 /// 组装数据
 /// </summary>
 /// <param name="dr"></param>
 /// <returns></returns>
 private SiteBlockEntity MakeSiteBlockModel(IDataReader dr)
 {
     SiteBlockEntity model = new SiteBlockEntity();
     model.BlockID = (Int64)dr["BlockID"];
     model.JournalID = (Int64)dr["JournalID"];
     model.ChannelID = (Int64)dr["ChannelID"];
     model.Title = (String)dr["Title"];
     model.Linkurl = (String)dr["Linkurl"];
     model.TitlePhoto = (String)dr["TitlePhoto"];
     model.Note = (String)dr["Note"];
     model.AddDate = (DateTime)dr["AddDate"];
     return model;
 }
Пример #8
0
        /// <summary>
        /// 编辑内容块
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateSiteBlock(SiteBlockEntity model)
        {
            bool flag = false;
            StringBuilder whereCommandText = new StringBuilder();
            whereCommandText.Append("  BlockID=@BlockID");
            StringBuilder sqlCommandText = new StringBuilder();
            sqlCommandText.Append(" Title=@Title");
            sqlCommandText.Append(", Linkurl=@Linkurl");
            sqlCommandText.Append(", TitlePhoto=@TitlePhoto");
            sqlCommandText.Append(", Note=@Note");

            DbCommand cmd = db.GetSqlStringCommand(String.Format("UPDATE dbo.SiteBlock SET {0} WHERE  {1}", sqlCommandText.ToString(), whereCommandText.ToString()));

            db.AddInParameter(cmd, "@BlockID", DbType.Int64, model.BlockID);
            db.AddInParameter(cmd, "@Title", DbType.AnsiString, model.Title);
            db.AddInParameter(cmd, "@Linkurl", DbType.AnsiString, model.Linkurl);
            db.AddInParameter(cmd, "@TitlePhoto", DbType.AnsiString, model.TitlePhoto);
            db.AddInParameter(cmd, "@Note", DbType.AnsiString, model.Note);

            try
            {
                db.ExecuteNonQuery(cmd);
                flag = true;
            }
            catch (SqlException sqlEx)
            {
                throw sqlEx;
            }
            return flag;
        }
Пример #9
0
 /// <summary>
 /// 编辑内容块
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool UpdateSiteBlock(SiteBlockEntity model)
 {
     return SiteBlockDataAccess.Instance.UpdateSiteBlock(model);
 }
Пример #10
0
 /// <summary>
 /// 新增内容块
 /// </summary>
 /// <param name="SiteBlockEntity"></param>
 /// <returns></returns>
 public bool AddSiteBlock(SiteBlockEntity model)
 {
     return SiteBlockDataAccess.Instance.AddSiteBlock(model);
 }
Пример #11
0
 public ExecResult Save(SiteBlockEntity model)
 {
     ISiteBlockService service = ServiceContainer.Instance.Container.Resolve<ISiteBlockService>();
     return service.Save(model);
 }
 /// <summary>
 /// 保存内容块数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public ExecResult SaveSiteBlock(SiteBlockEntity model)
 {
     HttpClientHelper clientHelper = new HttpClientHelper();
     ExecResult result = clientHelper.Post<ExecResult, SiteBlockEntity>(GetAPIUrl(APIConstant.SITEBLOCK_SAVE), model);
     return result;
 }