/// <summary> /// 获取 CommentsList 翻页列表 /// </summary> /// Create By zhouqi /// 2015/12/2 11:03:07 /// <param name="dp">翻页类 如果PageSize = 0 则不翻页</param> /// <param name="searchCommentsList">CommentsList 查询实体</param> /// <returns></returns> public List <WeaponComments> GetWeaponCommentsList(ref DataPage dp, WeaponComments searchWeaponComments) { //string websitepath = AppSetting.GetString("WebsitePath"); DbCommand cmd = DB.GetStoredProcCommand("WeaponComments_GetList"); //翻页参数 DB.AddInParameter(cmd, DataPage.PageSizeField, DbType.Int32, dp.PageSize); DB.AddInParameter(cmd, DataPage.PageIndexField, DbType.Int32, dp.PageIndex); DB.AddParameter(cmd, DataPage.RowCountField, DbType.Int64, ParameterDirection.InputOutput, String.Empty, DataRowVersion.Default, dp.RowCount); DB.AddInParameter(cmd, WeaponList.WeaponIDField, DbType.Int32, searchWeaponComments.WeaponID); List <WeaponComments> WeaponCommentsList = new List <WeaponComments>(); using (IDataReader dr = DB.ExecuteReader(cmd)) { if (dr.FieldCount > 0) { int coID = dr.GetOrdinal(WeaponComments.IDField); int coWeaponID = dr.GetOrdinal(WeaponComments.WeaponIDField); int coComments = dr.GetOrdinal(WeaponComments.CommentsField); int coCreateTS = dr.GetOrdinal(WeaponComments.CreateTSField); int coWeaponName = dr.GetOrdinal(WeaponComments.WeaponNameField); int coWeaponDesc = dr.GetOrdinal(WeaponComments.WeaponDescField); int coShowPraise = dr.GetOrdinal(WeaponComments.ShowPraiseField); int coPicAddress = dr.GetOrdinal(WeaponComments.PicAddressField); int coSpicAddress = dr.GetOrdinal(WeaponComments.SpicAddressField); int coAvatarName = dr.GetOrdinal(WeaponComments.AvatarNameField); int coLoginName = dr.GetOrdinal(WeaponComments.LoginNameField); int coAreaName = dr.GetOrdinal(WeaponComments.AreaNameField); int coWeaType = dr.GetOrdinal(WeaponComments.WeaTypeField); int coRowID = dr.GetOrdinal(WeaponComments.RowIDField); while (dr.Read()) { WeaponComments weaponComments = new WeaponComments(); weaponComments.ID = dr.IsDBNull(coID) ? (int)0 : dr.GetInt32(coID); weaponComments.WeaponID = dr.IsDBNull(coWeaponID) ? (int)0 : dr.GetInt32(coWeaponID); weaponComments.Comments = dr.IsDBNull(coComments) ? string.Empty : dr.GetString(coComments); weaponComments.CreateTS = dr.IsDBNull(coCreateTS) ? (DateTime)SqlDateTime.Null : dr.GetDateTime(coCreateTS); weaponComments.WeaponName = dr.IsDBNull(coWeaponName) ? string.Empty : dr.GetString(coWeaponName); weaponComments.WeaponDesc = dr.IsDBNull(coWeaponDesc) ? string.Empty : dr.GetString(coWeaponDesc); weaponComments.ShowPraise = dr.IsDBNull(coShowPraise) ? (int)0 : dr.GetInt32(coShowPraise); weaponComments.PicAddress = dr.IsDBNull(coPicAddress) ? string.Empty : dr.GetString(coPicAddress); weaponComments.SpicAddress = dr.IsDBNull(coSpicAddress) ? string.Empty : dr.GetString(coSpicAddress); weaponComments.AvatarName = dr.IsDBNull(coAvatarName) ? string.Empty : dr.GetString(coAvatarName); weaponComments.LoginName = dr.IsDBNull(coLoginName) ? string.Empty : dr.GetString(coLoginName); weaponComments.AreaName = dr.IsDBNull(coAreaName) ? string.Empty : dr.GetString(coAreaName); weaponComments.WeaType = dr.IsDBNull(coWeaType) ? string.Empty : dr.GetString(coWeaType); weaponComments.RowID = dr.IsDBNull(coRowID) ? (long)0 : dr.GetInt64(coRowID); WeaponCommentsList.Add(weaponComments); } } } //获取翻页 dp.RowCount = Convert.ToInt64(DB.GetParameterValue(cmd, DataPage.RowCountField)); return(WeaponCommentsList); }
public ActionResult ShowCommentsList(int wid, int?pageIndex, int?pageSize) { pageIndex = pageIndex ?? 1; pageSize = pageSize ?? 20; WeaponComments weaponcomments = new WeaponComments(); weaponcomments.WeaponID = wid; DataPage datapage = new DataPage() { PageIndex = pageIndex.Value, PageSize = pageSize.Value }; List <WeaponComments> lists = WeapDesignBll.GetWeaponCommentsList(ref datapage, weaponcomments); var data = new { List = lists, Page = datapage }; return(Jsonp(ErrorCode.Succuess, data)); }
public List <WeaponComments> GetWeaponCommentsList(ref DataPage dp, WeaponComments searchWeaponComments) { return(_dal.GetWeaponCommentsList(ref dp, searchWeaponComments)); }
public List <WeaponComments> GetWeaponCommentsList(ref CommonLibs.Common.DataPage dp, WeaponComments searchWeaponComments) { _client = new WeaponDesignService.WeaponDesignServiceClient(); List <WeaponComments> lists = new List <WeaponComments>(); try { lists = _client.GetWeaponCommentsList(ref dp, searchWeaponComments); _client.Close(); return(lists); } catch (Exception ex) { _client.CloseCatch(ex, "GetWeaponCommentsList 获取评论失败"); return(lists); } }