//cateId_pagesize public ActionResult Index(string pageParam) { int pageSize = 20; int pageIndex = 1; int cateId = 0; int rowCount = 0; string[] arr = pageParam.Split(new string[] { "_" }, StringSplitOptions.RemoveEmptyEntries); if (arr.Length == 2) { cateId = int.Parse(arr[0]); pageIndex = int.Parse(arr[1]); } else if (arr.Length == 1) { cateId = int.Parse(arr[0]); } //查询该分类下所有的文章 List <Site_Content> list = SiteServiceClass.Site_Content_SelectPageByc_id(cateId, pageIndex, pageSize, out rowCount); Site_Cates c_info = SiteServiceClass.Site_Cates_SelectByc_id(cateId); ViewBag.pageSize = pageSize; ViewBag.pageIndex = pageIndex; ViewBag.rowCount = rowCount; ViewBag.cateId = cateId; ViewBag.list = list; ViewBag.c_info = c_info; return(View()); }
public int Site_Cates_Insert(Site_Cates obj) { using (SiteCatesAccess access = new SiteCatesAccess()) { return(access.Site_Cates_Insert(obj)); } }
public int Site_Cates_UpdateByc_gid(Site_Cates obj) { using (SiteCatesAccess access = new SiteCatesAccess()) { return(access.Site_Cates_UpdateByc_gid(obj)); } }
public List <Site_Cates> Site_Cates_SelectPage(string cloumns, int pageIndex, int pageSize, string orderBy, string where, out int rowCount) { DbCommand dbCmd = db.GetStoredProcCommand("Proc_Site_Cates_SelectPage"); db.AddOutParameter(dbCmd, "@rowCount", DbType.Int32, 4); db.AddInParameter(dbCmd, "@cloumns", DbType.String, cloumns); db.AddInParameter(dbCmd, "@pageIndex", DbType.Int32, pageIndex); db.AddInParameter(dbCmd, "@pageSize", DbType.Int32, pageSize); db.AddInParameter(dbCmd, "@orderBy", DbType.String, orderBy); db.AddInParameter(dbCmd, "@where", DbType.String, where); List <Site_Cates> list = new List <Site_Cates>(); try { using (IDataReader reader = db.ExecuteReader(dbCmd)) { while (reader.Read()) { //属性赋值 Site_Cates obj = Obj2Model <Site_Cates>(reader); list.Add(obj); } reader.NextResult(); } rowCount = (int)dbCmd.Parameters["@rowCount"].Value; return(list); } catch (Exception e) { throw new Exception(e.Message); } }
public ActionResult CatesEdit() { string c_name = Request["c_name"] ?? string.Empty; string catesType = Request["catesType"] ?? string.Empty; string c_gid = Request["c_gid"] ?? string.Empty; string c_path = Request["c_path"] ?? string.Empty; string tableId = Request["tableId"] ?? string.Empty; Site_Cates info = null; if (string.IsNullOrEmpty(c_gid)) { info = new Site_Cates(); //新增 string guid = Guid.NewGuid().ToString().Substring(0, 8); info.c_gid = guid; info.c_isMainCate = c_path.Length == 2 ? true : false; info.c_createTime = DateTime.Now; info.c_createUser = SiteHelp.CurrentUserName; if (!string.IsNullOrEmpty(tableId)) { info.c_tableId = tableId.ToInt32(); } } else { info = SiteServiceClass.Site_Cates_SelectByc_gid(c_gid); } info.c_name = c_name; info.c_path = c_path; info.c_type = catesType; if (string.IsNullOrEmpty(c_gid)) { int result = SiteServiceClass.Site_Cates_Insert(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "新增成功" } })); } else { return(Json(new { success = false, errors = new { text = "新增失败" } })); } } else { int result = SiteServiceClass.Site_Cates_UpdateByc_gid(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "修改成功" } })); } else { return(Json(new { success = false, errors = new { text = "修改失败" } })); } } }
public static int Site_Cates_UpdateByc_gid(Site_Cates obj) { ISiteService channel = Entity.CreateChannel <ISiteService>(SiteEnum.SiteService.SiteService); var result = channel.Site_Cates_UpdateByc_gid(obj); (channel as IDisposable).Dispose(); return(result); }
public ActionResult CatesEditView() { string c_gid = Request["c_gid"] ?? string.Empty; string tableId = Request["tableId"] ?? string.Empty; Site_Cates info = null; if (string.IsNullOrEmpty(c_gid)) { info = new Site_Cates(); } else { info = SiteServiceClass.Site_Cates_SelectByc_gid(c_gid); } ViewData["window"] = Request["window"] ?? string.Empty; ViewData["info"] = info; ViewData["tableId"] = tableId; return(View()); }
public int Site_Cates_UpdateByc_gid(Site_Cates obj) { DbCommand dbCmd = db.GetStoredProcCommand("Proc_Site_Cates_UpdateByc_gid"); db.AddInParameter(dbCmd, "@c_id", DbType.Int32, obj.c_id); db.AddInParameter(dbCmd, "@c_gid", DbType.String, obj.c_gid); db.AddInParameter(dbCmd, "@c_path", DbType.String, obj.c_path); db.AddInParameter(dbCmd, "@c_isMainCate", DbType.Boolean, obj.c_isMainCate); db.AddInParameter(dbCmd, "@c_tableId", DbType.Int32, obj.c_tableId); db.AddInParameter(dbCmd, "@c_name", DbType.String, obj.c_name); db.AddInParameter(dbCmd, "@c_type", DbType.String, obj.c_type); db.AddInParameter(dbCmd, "@c_createUser", DbType.String, obj.c_createUser); db.AddInParameter(dbCmd, "@c_createTime", DbType.String, obj.c_createTime); try { int returnValue = db.ExecuteNonQuery(dbCmd); return(returnValue); } catch (Exception e) { throw new Exception(e.Message); } }
// GET: Detail public ActionResult Index(string gid) { Site_Content info = SiteServiceClass.Site_Content_SelectByc_gid(gid); if (info != null) { //查询出子分类 Site_Cates c_info = SiteServiceClass.Site_Cates_SelectBaseCateByc_gid(info.c_c_gid); ViewBag.c_info = c_info; if (info.c_status == (int)SiteEnum.SiteItemStatus.待审核 || info.c_status == (int)SiteEnum.SiteItemStatus.关闭) { return(RedirectToAction("NotFound", "Error")); } } else { return(RedirectToAction("Index", "Error")); } ViewBag.info = info; return(View()); }
public Site_Cates Site_Cates_SelectByc_id(int c_id) { DbCommand dbCmd = db.GetStoredProcCommand("Proc_Site_Cates_SelectByc_id"); db.AddInParameter(dbCmd, "@c_id", DbType.Int32, c_id); Site_Cates obj = null; try { using (IDataReader reader = db.ExecuteReader(dbCmd)) { while (reader.Read()) { //属性赋值 obj = Obj2Model <Site_Cates>(reader); } } return(obj); } catch (Exception e) { throw new Exception(e.Message); } }