/// <summary> /// 增加 /// </summary> /// <param name="ThemeBaseItem">ThemeBaseItem实体对象</param> /// <returns>bool值,判断是否操作成功</returns> public bool Add(ThemeBaseItem model) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@ThemeBaseItemName", model.ThemeBaseItemName), new SqlParameter("@ThemeBaseId", model.ThemeBaseId), new SqlParameter("@OrderIndex", model.OrderIndex), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@ItemFlag", model.ItemFlag) }; return(DBHelper.ExecuteNonQuery("ThemeBaseItem_Add", param)); }
/// <summary> /// 增加 /// </summary> /// <param name="ThemeBaseItem">ThemeBaseItem实体对象</param> /// <returns>int值,返回自增ID</returns> public int AddReturnId(ThemeBaseItem model) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@ThemeBaseItemName", model.ThemeBaseItemName), new SqlParameter("@ThemeBaseId", model.ThemeBaseId), new SqlParameter("@OrderIndex", model.OrderIndex), new SqlParameter("@IsDelete", model.IsDelete), new SqlParameter("@ItemFlag", model.ItemFlag) }; return(Convert.ToInt32(DBHelper.ExecuteScalar("ThemeBaseItem_AddReturnId", param))); }
/// <summary> /// 数据访问通过条件查询并分页排序 /// </summary> /// <param name="WhereString">查询条件</param> /// <param name="PageIndex">当前页码</param> /// <param name="PageSize">页大小(每页显示多少条数据)</param> /// <param name="OrderString">排序条件(排序条件为必须参数)</param> /// <returns>ThemeBaseItem实体类对象</returns> public List <ThemeBaseItem> SelectByWhereAndPage(string WhereString, int PageIndex, int PageSize, string OrderString, out int TotalCount) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@where", WhereString), new SqlParameter("@pageIndex", PageIndex), new SqlParameter("@pageSize", PageSize), new SqlParameter("@orderString", OrderString), new SqlParameter("@TotalCount", ParameterDirection.Output) }; List <ThemeBaseItem> list = new List <ThemeBaseItem>(); ThemeBaseItem model = null; using (SqlDataReader dr = DBHelper.RunProcedure("ThemeBaseItem_SelectByWhereAndPage", param)) { while (dr.Read()) { model = new ThemeBaseItem(); model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]); if (DBNull.Value != dr["ThemeBaseItemName"]) { model.ThemeBaseItemName = dr["ThemeBaseItemName"].ToString(); } if (DBNull.Value != dr["ThemeBaseId"]) { model.ThemeBaseId = Convert.ToInt32(dr["ThemeBaseId"]); } if (DBNull.Value != dr["OrderIndex"]) { model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]); } if (DBNull.Value != dr["IsDelete"]) { model.IsDelete = Convert.ToBoolean(dr["IsDelete"]); } if (DBNull.Value != dr["ItemFlag"]) { model.ItemFlag = dr["ItemFlag"].ToString(); } list.Add(model); } if (dr.NextResult() && dr.Read()) { TotalCount = Convert.ToInt32(dr["TotalCount"]); } else { TotalCount = 0; } } return(list); }
/// <summary> /// 通过条件查询 /// </summary> /// <param name="WhereString">查询条件</param> /// <returns>ThemeBaseItem实体类对象</returns> public List <ThemeBaseItem> SelectByWhere(string WhereString) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@where", WhereString) }; List <ThemeBaseItem> list = new List <ThemeBaseItem>(); ThemeBaseItem model = null; using (SqlDataReader dr = DBHelper.RunProcedure("ThemeBaseItem_SelectByWhere", param)) { while (dr.Read()) { model = new ThemeBaseItem(); model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]); if (DBNull.Value != dr["ThemeBaseItemName"]) { model.ThemeBaseItemName = dr["ThemeBaseItemName"].ToString(); } if (DBNull.Value != dr["ThemeBaseId"]) { model.ThemeBaseId = Convert.ToInt32(dr["ThemeBaseId"]); } if (DBNull.Value != dr["OrderIndex"]) { model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]); } if (DBNull.Value != dr["IsDelete"]) { model.IsDelete = Convert.ToBoolean(dr["IsDelete"]); } if (DBNull.Value != dr["ItemFlag"]) { model.ItemFlag = dr["ItemFlag"].ToString(); } list.Add(model); } } return(list); }
/// <summary> /// 通过Id查询 /// </summary> /// <param name="Id">主键Id</param> /// <returns>ThemeBaseItem实体类对象</returns> public ThemeBaseItem SelectById(int Id) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@ThemeBaseItemId", Id) }; ThemeBaseItem model = new ThemeBaseItem(); using (SqlDataReader dr = DBHelper.RunProcedure("ThemeBaseItem_SelectById", param)) { if (dr.Read()) { model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]); if (DBNull.Value != dr["ThemeBaseItemName"]) { model.ThemeBaseItemName = dr["ThemeBaseItemName"].ToString(); } if (DBNull.Value != dr["ThemeBaseId"]) { model.ThemeBaseId = Convert.ToInt32(dr["ThemeBaseId"]); } if (DBNull.Value != dr["OrderIndex"]) { model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]); } if (DBNull.Value != dr["IsDelete"]) { model.IsDelete = Convert.ToBoolean(dr["IsDelete"]); } if (DBNull.Value != dr["ItemFlag"]) { model.ItemFlag = dr["ItemFlag"].ToString(); } } } return(model); }
/// <summary> /// 查看全部 /// </summary> /// <returns>list集合</returns> public List <ThemeBaseItem> SelectAll() { List <ThemeBaseItem> list = new List <ThemeBaseItem>(); ThemeBaseItem model = null; using (SqlDataReader dr = DBHelper.RunProcedure("ThemeBaseItem_SelectAll", null)) { while (dr.Read()) { model = new ThemeBaseItem(); model.ThemeBaseItemId = Convert.ToInt32(dr["ThemeBaseItemId"]); if (DBNull.Value != dr["ThemeBaseItemName"]) { model.ThemeBaseItemName = dr["ThemeBaseItemName"].ToString(); } if (DBNull.Value != dr["ThemeBaseId"]) { model.ThemeBaseId = Convert.ToInt32(dr["ThemeBaseId"]); } if (DBNull.Value != dr["OrderIndex"]) { model.OrderIndex = Convert.ToInt32(dr["OrderIndex"]); } if (DBNull.Value != dr["IsDelete"]) { model.IsDelete = Convert.ToBoolean(dr["IsDelete"]); } if (DBNull.Value != dr["ItemFlag"]) { model.ItemFlag = dr["ItemFlag"].ToString(); } list.Add(model); } } return(list); }
/// <summary> /// 修改 /// </summary> /// <param name="ThemeBaseItem">ThemeBaseItem实体对象</param> /// <returns>bool值,判断是否操作成功</returns> public bool Change(ThemeBaseItem model) { return(dal.Change(model)); }
/// <summary> /// 增加 /// </summary> /// <param name="ThemeBaseItem">ThemeBaseItem实体对象</param> /// <returns>int值,返回自增ID</returns> public int AddReturnId(ThemeBaseItem model) { return(dal.AddReturnId(model)); }
/// <summary> /// 增加 /// </summary> /// <param name="ThemeBaseItem">ThemeBaseItem实体对象</param> /// <returns>bool值,判断是否操作成功</returns> public bool Add(ThemeBaseItem model) { return(dal.Add(model)); }