/// <summary> /// 添加数据 /// </summary> /// <param name="model">数据对象模型</param> /// <returns></returns> public int Insert(Config_Page model) { var parameters = new List<SqlParameter> { this.SqlServer.CreateSqlParameter( "PID", SqlDbType.Int, model.PID, ParameterDirection.Input ), this.SqlServer.CreateSqlParameter( "Type", SqlDbType.Int, model.Type, ParameterDirection.Input ), this.SqlServer.CreateSqlParameter( "Name", SqlDbType.VarChar, model.Name, ParameterDirection.Input ), this.SqlServer.CreateSqlParameter( "Content", SqlDbType.Text, model.Content, ParameterDirection.Input ), this.SqlServer.CreateSqlParameter( "Source", SqlDbType.VarChar, model.Source, ParameterDirection.Input ), this.SqlServer.CreateSqlParameter( "ReferenceID", SqlDbType.Int, null, ParameterDirection.Output) }; try { this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "[sp_Config_Page_Insert]", parameters, null); return (int)parameters.Find(parameter => parameter.ParameterName == "ReferenceID").Value; } catch (Exception exception) { throw new Exception("Exception - ConfigPageDA - Insert", exception); } }
public ActionResult AddContent(string name) { var model = new Config_Page { PID = 0, Content = "一级节点", Name = name, Source = "source", Type = 1 }; var configService = new ConfigPageService(); if (configService.Insert(model) > 0) { return Json(new AjaxResponse { State = 1, Message = "添加目录成功" }); } return Json(new AjaxResponse { State = 0, Message = "添加止录失败" }); }
public ActionResult Destroy([DataSourceRequest] DataSourceRequest request, Config_Page product) { try { if (product != null) { this.configPageService = new ConfigPageService(); if (this.configPageService.DeleteRow(product.ID) > 0) { return Json(new[] { product }.ToDataSourceResult(request, ModelState)); } } } catch (Exception exception) { throw new Exception(exception.Message, exception); } return Json(string.Empty); }
public ActionResult ModifyLink([DataSourceRequest] DataSourceRequest request, Config_Page config) { if (config != null && ModelState.IsValid) { this.configPageService = new ConfigPageService(); this.configPageService.UpdateLink(config); } return Json(new[] { config }.ToDataSourceResult(request, ModelState)); }
public ActionResult InsertLink(int brandId, string Source, string Name) { var model = new Config_Page { PID = brandId, Name = Name, Source = Source, Type = 4, Content = "content" }; try { this.configPageService = new ConfigPageService(); var returnVaue = this.configPageService.Insert(model); if (returnVaue > 0) { return Json("添加成功"); } } catch (Exception exception) { throw new Exception(exception.Message, exception); } return Json(string.Empty); }
public ActionResult ModifyContent(int ID, string Name, int pid, string Content) { this.configPageService = new ConfigPageService(); if (ID == -1) { var model = new Config_Page { Name = Name, Content = Content, Type = 1, PID = pid, Source = "default" }; if (configPageService.Insert(model) > 0) { return Json(new AjaxResponse { Data = 1, Message = "添加成功" }); } } var received = this.configPageService.UpdateContent(ID, Content, Name); if (received > 0) { // todo : 需要类型参数 return Json(new AjaxResponse { Data = 1, Message = "修改成功" }); } return Json(string.Empty); }
public ActionResult InsertPromoteMessage(string Name, string Content) { var model = new Config_Page { PID = 31, Type = 3, Name = Name, Content = Content, Source = "default" }; this.configPageService = new ConfigPageService(); var recevieId = this.configPageService.Insert(model); if (recevieId > 0) { return Json(new AjaxResponse { Data = 1, Message = "添加成功" }); } return Json(new AjaxResponse { Data = 0, Message = "操作失败" }); }
/// <summary> /// 修改链接操作 /// </summary> /// <param name="config"></param> /// <returns></returns> public int UpdateLink(Config_Page config) { var parameters = new List<SqlParameter> { this.SqlServer.CreateSqlParameter( "id", SqlDbType.Int, config.ID, ParameterDirection.Input ), this.SqlServer.CreateSqlParameter( "source", SqlDbType.VarChar, config.Source, ParameterDirection.Input ), this.SqlServer.CreateSqlParameter( "name", SqlDbType.NVarChar, config.Name, ParameterDirection.Input ) }; return this.SqlServer.ExecuteNonQuery(CommandType.StoredProcedure, "sp_ConfigPage_UpdateLink", parameters, null); }
/// <summary> /// 获取帮助正文 /// </summary> /// <param name="id"></param> /// <returns></returns> public string GetHelpContent(Config_Page content) { if (content == null) return ""; StringBuilder sb = new StringBuilder(); sb.Append("<dt class=\"uc_help_top\">" + content.Name + "</dt>"); sb.Append("<dd class=\"uc_help_conent\">" + content.Content + ""); sb.Append("</dd>"); return sb.ToString(); }
public int UpdateLink(Config_Page config) { return this.configPageDA.UpdateLink(config); }
/// <summary> /// 添加内容 /// </summary> /// <param name="model">数据实体对象</param> /// <returns></returns> public int Insert(Config_Page model) { return this.configPageDA.Insert(model); }