/// <summary> /// 查询用户 返回列表 酒店数 /// </summary> /// <param name="eBookingUserEntity"></param> /// <returns></returns> public static eBookingUserEntity eBookingUserQuery(eBookingUserEntity eBookingUserEntity) { DataSet dsResult = new DataSet(); dsResult.Tables.Add(new DataTable()); dsResult.Tables[0].Columns.Add(new DataColumn("USERNAME")); dsResult.Tables[0].Columns.Add(new DataColumn("HOTELNAME")); dsResult.Tables[0].Columns.Add(new DataColumn("CREATETIME")); dsResult.Tables[0].Columns.Add(new DataColumn("RECORDCOUNT")); try { eBookingUserDBEntity dbParm = (eBookingUserEntity.eBookingUserDBEntity.Count > 0) ? eBookingUserEntity.eBookingUserDBEntity[0] : new eBookingUserDBEntity(); string DataString = "{\"loginName\":\"" + dbParm.LoginName + "\"," + "\"hotelId\":\"" + dbParm.HotelId + "\"," + "\"operator\":\"" + dbParm.OperatorId + "\"," + "\"pageSize\":\"" + dbParm.PageSize + "\"," + "\"pageNum\":\"" + dbParm.PageNum + "\"}"; string HotelFullRoomUrl = JsonRequestURLBuilder.eBookingUserQuery(); CallWebPage callWebPage = new CallWebPage(); string strJson = callWebPage.CallWebByURL(HotelFullRoomUrl, DataString); //解析json数据 JObject o = JObject.Parse(strJson); if ("success".Equals(JsonRequestURLBuilder.GetJsonStringValue(o, "message").Trim('"'))) { string oList = o.SelectToken("result").ToString(); JArray jsa = (JArray)JsonConvert.DeserializeObject(oList); string oPage = o.SelectToken("page").SelectToken("count").ToString().Trim('"'); //JArray jsa = (JArray)JsonConvert.DeserializeObject(oList); for (int i = 0; i < jsa.Count; i++) { string oHotelInfoList = jsa[i].SelectToken("hotelinfo").ToString(); JObject jsoHotelInfoList = (JObject)jsa[i]; JArray jsoHotelInfo = (JArray)JsonConvert.DeserializeObject(oHotelInfoList); DataRow drRow = dsResult.Tables[0].NewRow(); if (jsoHotelInfo.Count == 1) { JObject jso = (JObject)jsoHotelInfo[0]; drRow["USERNAME"] = JsonRequestURLBuilder.GetJsonStringValue(jsoHotelInfoList, "loginname").Trim('"'); drRow["HOTELNAME"] = JsonRequestURLBuilder.GetJsonStringValue(jso, "hotelname").Trim('"'); drRow["CREATETIME"] = JsonRequestURLBuilder.GetJsonStringValue(jsoHotelInfoList, "createtime").Trim('"'); } else if (jsoHotelInfo.Count > 1) { drRow["USERNAME"] = JsonRequestURLBuilder.GetJsonStringValue(jsoHotelInfoList, "loginname").Trim('"'); drRow["HOTELNAME"] = jsoHotelInfo.Count + "家"; drRow["CREATETIME"] = JsonRequestURLBuilder.GetJsonStringValue(jsoHotelInfoList, "createtime").Trim('"'); } drRow["RECORDCOUNT"] = oPage; dsResult.Tables[0].Rows.Add(drRow); } } } catch (Exception ex) { } eBookingUserEntity.QueryResult = dsResult; return eBookingUserEntity; }
public static eBookingUserEntity eBookingUserQuery(eBookingUserEntity eBookingUserEntity) { eBookingUserEntity.LogMessages.MsgType = MessageType.INFO; eBookingUserEntity.LogMessages.Content = _nameSpaceClass + "eBookingUserQuery"; LoggerHelper.LogWriter(eBookingUserEntity.LogMessages); try { return eBookingUserSA.eBookingUserQuery(eBookingUserEntity); } catch (Exception ex) { eBookingUserEntity.LogMessages.MsgType = MessageType.ERROR; eBookingUserEntity.LogMessages.Content = _nameSpaceClass + "eBookingUserQuery Error: " + ex.Message; LoggerHelper.LogWriter(eBookingUserEntity.LogMessages); throw ex; } }