/// <summary> /// 获取阅览室布局图 /// </summary> /// <param name="roomNo">阅览室编号</param> /// <param name="schoolNo"></param> /// <returns></returns> public AJM_SeatLayout GetRoomSeatLayout(string roomNo, string schoolNo) { try { IMobileAppDataObtianProxy appService = new MobileAppDataObtainProxy(schoolNo); string result = appService.GetRoomSeatLayout(roomNo); AJM_HandleResult ajmResult = JSONSerializer.Deserialize <AJM_HandleResult>(result); if (ajmResult == null) { throw new Exception("获取全部阅览室的当前的使用状态失败!"); } if (!ajmResult.Result) { throw new Exception(ajmResult.Msg); } AJM_SeatLayout ajmSeatLayout = JSONSerializer.Deserialize <AJM_SeatLayout>(ajmResult.Msg); return(ajmSeatLayout); } catch (Exception ex) { WriteLog.Write(string.Format("获取全部阅览室的当前的使用状态失败:{0}", ex.Message)); return(null); } }
/// <summary> /// 根据阅览室编号获取阅览室布局 /// </summary> /// <param name="roomNum">阅览室编号</param> /// <returns></returns> public string GetRoomSeatLayout(string roomNum) { AJM_HandleResult result = new AJM_HandleResult(); try { if (string.IsNullOrEmpty(roomNum)) { result.Result = false; result.Msg = "阅览室编号不能为空!"; return(JSONSerializer.Serialize(result)); } AJM_SeatLayout ajmSeatLayout = new AJM_SeatLayout(); List <ReadingRoomInfo> roomInfos = SeatManageDateService.GetReadingRoomInfo(new List <string> { roomNum }); if (roomInfos.Count < 0) { result.Result = false; result.Msg = string.Format("编号为{0}的阅览室不存在!", roomNum); return(JSONSerializer.Serialize(result)); } SeatLayout seatLayout = roomInfos[0].SeatList; ajmSeatLayout.ColumsCount = seatLayout.SeatCol; ajmSeatLayout.RowsCount = seatLayout.SeatRow; ajmSeatLayout.IsUpdate = false; foreach (var seat in seatLayout.Seats.Values) { AJM_Element ajmElement = new AJM_Element(); ajmElement.Angle = seat.RotationAngle; ajmElement.BaseHeight = seat.BaseHeight; ajmElement.BaseWidth = seat.BaseWidth; ajmElement.SeatNo = seat.SeatNo; ajmElement.ElementType = "Seat"; ajmElement.HasPower = seat.HavePower; ajmElement.X = seat.PositionX; ajmElement.Y = seat.PositionY; ajmElement.Remark = seat.ShortSeatNo; ajmSeatLayout.ElementList.Add(ajmElement); } foreach (AJM_Element ajmElement in seatLayout.Notes.Select(note => new AJM_Element { Angle = note.RotationAngle, BaseHeight = note.BaseHeight, BaseWidth = note.BaseWidth, ElementType = note.Type.ToString(), X = note.PositionX, Y = note.PositionY, Remark = note.Remark })) { ajmSeatLayout.ElementList.Add(ajmElement); } result.Result = true; result.Msg = JSONSerializer.Serialize(ajmSeatLayout); return(JSONSerializer.Serialize(result)); } catch (Exception ex) { WriteLog.Write(string.Format("获取阅览室布局图遇到异常:{0}", ex.Message)); result.Result = false; result.Msg = "获取阅览室布局执行遇到异常!"; return(JSONSerializer.Serialize(result)); } }