/// <summary> /// 获取座位使用情况 /// </summary> public void GetUsingState() { LastSeatCount = AllSeatCount; Layout = EnterOutOperate.GetRoomSeatLayOut(ReadingRoomNo); foreach (KeyValuePair <string, Seat> seat in Layout.Seats) { _seatLayoutList[seat.Key].IsBespeak = false; _seatLayoutList[seat.Key].IsShortLeave = false; _seatLayoutList[seat.Key].IsUsing = false; //_seatLayoutList[seat.Key].IsWaiting = false; switch (seat.Value.SeatUsedState) { case EnterOutLogType.Leave: _seatLayoutList[seat.Key].IsUsing = false; _seatLayoutList[seat.Key].IsBespeak = false; _seatLayoutList[seat.Key].IsShortLeave = false; _seatLayoutList[seat.Key].IsWaiting = false; break; case EnterOutLogType.SelectSeat: case EnterOutLogType.ReselectSeat: case EnterOutLogType.ComeBack: case EnterOutLogType.ContinuedTime: case EnterOutLogType.BookingConfirmation: case EnterOutLogType.WaitingSuccess: _seatLayoutList[seat.Key].IsUsing = true; _seatLayoutList[seat.Key].IsBespeak = false; _seatLayoutList[seat.Key].IsShortLeave = false; _seatLayoutList[seat.Key].IsWaiting = false; LastSeatCount--; break; case EnterOutLogType.ShortLeave: _seatLayoutList[seat.Key].IsUsing = true; _seatLayoutList[seat.Key].IsShortLeave = true; _seatLayoutList[seat.Key].IsBespeak = false; _seatLayoutList[seat.Key].IsWaiting = false; LastSeatCount--; break; case EnterOutLogType.BespeakWaiting: _seatLayoutList[seat.Key].IsUsing = false; _seatLayoutList[seat.Key].IsBespeak = true; _seatLayoutList[seat.Key].IsShortLeave = false; _seatLayoutList[seat.Key].IsWaiting = false; if (!_seatLayoutList[seat.Key].IsCanSelectBespeakSeat) { LastSeatCount--; } break; } } }
public RoomSeatWindow_ViewModel() { WindowHeight = clientObject.ClientSetting.DeviceSetting.SystemResoultion.WindowSize.Size.Y; WindowWidth = clientObject.ClientSetting.DeviceSetting.SystemResoultion.WindowSize.Size.X; WindowLeft = clientObject.ClientSetting.DeviceSetting.SystemResoultion.WindowSize.Location.X; WindowTop = clientObject.ClientSetting.DeviceSetting.SystemResoultion.WindowSize.Location.Y; ReadingRoomName = clientObject.EnterOutLogData.Student.AtReadingRoom.Name; if (clientObject.EnterOutLogData.Student.AtReadingRoom.Setting.SeatChooseMethod.DefaultChooseMethod == SeatManage.EnumType.SelectSeatMode.OptionalMode) { RandomBtn = "Visible"; } if (clientObject.ClientSetting.DeviceSetting.UsingEnterNoForSeat) { KeybroadBtn = "Visible"; } Layout = EnterOutOperate.GetRoomSeatLayOut(clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo); if (DrowSeatLayout != null) { DrowSeatLayout(this, new EventArgs()); } }
/// <summary> /// 绘制Html的座位布局 /// </summary> /// <param name="roomNum">房间编号</param> /// <param name="divTransparentTop">透明层距离顶部的位置</param> /// <param name="divTransparentLeft">透明层距离左边的位置</param> /// <returns></returns> private string drowSeatLayoutHtml(string roomNum, string divTransparentTop, string divTransparentLeft) { if (string.IsNullOrEmpty(roomNum)) { return("阅览室编号不能为空"); } //if (string.IsNullOrEmpty(divTransparentTop) || string.IsNullOrEmpty(divTransparentLeft)) //{ // divTransparentTop = "0"; // divTransparentLeft = "0"; //} try { SeatManage.ClassModel.SeatLayout _SeatLayout = EnterOutOperate.GetRoomSeatLayOut(roomNum); SeatManage.ClassModel.ReadingRoomSetting set = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNum).Setting; SeatManage.ClassModel.SeatLayout bookingSeatLayout = null; if (set.SeatBespeak.SpecifiedTime && set.SeatBespeak.CanBookMultiSpan) { bookingSeatLayout = SeatManage.Bll.T_SM_SeatBespeak.GetBeseakSeatLayout(roomNum, SeatManage.Bll.ServiceDateTime.Now); } if (_SeatLayout == null) { return("获取阅览室座位布局出错了"); } StringBuilder seatLayoutHtml = new StringBuilder(); //布局实际图 //绘制实际图窗体大小 //实际图的长宽 double layoutWidth = (double)(_SeatLayout.SeatCol * 18); double layoutHeight = (double)(_SeatLayout.SeatRow * 18); //实际图和缩略图的比例 double scaleX = (double)layoutWidth / 300; double scaleY = (double)layoutHeight / 300; double transparentScaleX = layoutWidth / 1245; double transparentScaleY = layoutHeight / 685; double moveX = 0; double moveY = 0; if (layoutWidth >= layoutHeight) { scaleY = scaleX; moveY = (layoutWidth - layoutHeight) / 2 / scaleY; } else { scaleX = scaleY; moveX = (layoutHeight - layoutWidth) / 2 / scaleX; } //实际图当前的坐标位置 if (string.IsNullOrEmpty(divTransparentTop) || string.IsNullOrEmpty(divTransparentLeft)) { divTransparentTop = moveY.ToString(); divTransparentLeft = moveX.ToString(); } double layoutTop = (moveY - double.Parse(divTransparentTop)) * scaleY; double layoutLeft = (moveX - double.Parse(divTransparentLeft)) * scaleX; seatLayoutHtml.Append("<div id='divSeatLayoutFrom' class='SeatLayoutFrom'>"); seatLayoutHtml.AppendFormat("<div id='divSeatLayout' class='SeatLayout' style='height:{0}px; width:{1}px;top:{2}px;left:{3}px'>", layoutHeight, layoutWidth, layoutTop, layoutLeft); foreach (SeatManage.ClassModel.Seat seat in _SeatLayout.Seats.Values) { string urlParameters = ""; string shortleaveimg = "../../Images/Node/note_blank.png"; string powerimh = "../../Images/Node/note_blank.png"; string readerimg = "../../Images/Node/note_blank.png"; string seatimg = "../../Images/SeatImage/ImgSeat.png"; //string seatStyle = "";//座位样式 string seatTop = (18 * seat.PositionY).ToString(); //座位顶部位置 string seatLeft = (18 * seat.PositionX).ToString(); //座位左边位置 string tipContent = ""; string used = ""; if (seat.HavePower) { powerimh = "../../Images/SeatImage/ImgPower.png"; } switch (seat.SeatUsedState) { case SeatManage.EnumType.EnterOutLogType.Leave: if (seat.IsSuspended) { readerimg = "../../Images/SeatImage/ImgStopUse.png"; tipContent = string.Format("暂停使用"); } else { if (set.SeatBespeak.SpecifiedTime && set.SeatBespeak.CanBookMultiSpan) { tipContent = string.Format("座位空闲"); urlParameters = string.Format("seatNo={0}&seatShortNo={1}&roomNo={2}&date={3}&timeSpan={4}", seat.SeatNo, seat.ShortSeatNo, roomNum, SeatManage.Bll.ServiceDateTime.Now.ToBinary(), bookingSeatLayout.Seats[seat.SeatNo].CanBespeakStr); } else { tipContent = string.Format("座位空闲"); urlParameters = string.Format("seatNo={0}&seatShortNo={1}&roomNo={2}&date={3}", seat.SeatNo, seat.ShortSeatNo, roomNum, SeatManage.Bll.ServiceDateTime.Now.ToBinary()); } } break; case SeatManage.EnumType.EnterOutLogType.SelectSeat: case SeatManage.EnumType.EnterOutLogType.ReselectSeat: case SeatManage.EnumType.EnterOutLogType.ComeBack: case SeatManage.EnumType.EnterOutLogType.ContinuedTime: case SeatManage.EnumType.EnterOutLogType.BookingConfirmation: case SeatManage.EnumType.EnterOutLogType.WaitingSuccess: case SeatManage.EnumType.EnterOutLogType.ShortLeave: readerimg = "../../Images/SeatImage/ImgReader.png"; seatimg = "../../Images/SeatImage/ImgSeatUse.png"; tipContent = string.Format("已经被使用"); //TODO:无人管理模式事件 break; case SeatManage.EnumType.EnterOutLogType.BespeakWaiting: if (set.SeatBespeak.SpecifiedTime && set.SeatBespeak.CanBookMultiSpan) { tipContent = string.Format("可预约"); urlParameters = string.Format("seatNo={0}&seatShortNo={1}&roomNo={2}&date={3}&timeSpan={4}", seat.SeatNo, seat.ShortSeatNo, roomNum, SeatManage.Bll.ServiceDateTime.Now.ToBinary(), bookingSeatLayout.Seats[seat.SeatNo].CanBespeakStr); } else { shortleaveimg = "../../Images/SeatImage/ImgBook.png"; tipContent = string.Format("已经被预约"); }; break; } if (!string.IsNullOrEmpty(urlParameters)) { urlParameters = SeatManage.SeatManageComm.AESAlgorithm.DESEncode(urlParameters); } string seatdiv = "<div id='{0}' class='SeatBackground' style='left: {1}px; top: {2}px;width: 36px; height: 36px;transform: rotate({3}deg); -o-transform: rotate({3}deg); -webkit-transform: rotate({3}deg);-moz-transform: rotate({3}deg);' onclick='BespeakSeatNowDayClick(\"{4}\")' onmouseover='tipShow(this,\"{5}\")' onmouseout='tipHidden(this)'>" + "<img src='{10}' height='34px' width='34px' />" + "<div style='margin-top: -34px; margin-left: 24px; height: 12px; width: 12px'>" + "<img src='{6}' height='12px' width='12px' />" + "</div>" + "<div style='margin-top: 12px; margin-left: 0px; height: 12px; width: 12px'>" + "<img src='{7}' height='12px' width='12px' />" + "</div>" + "<div style='margin-top: -30px; margin-left: 6px; height: 24px; width: 24px'>" + "<img src='{8}' height='24px' width='24px' />" + "</div>" + "<div style='margin-top: -34px; margin-left: -1px;color:white; transform: rotate(-{3}deg); -o-transform: rotate(-{3}deg);" + "-webkit-transform: rotate(-{3}deg); -moz-transform: rotate(-{3}deg);'>{9}</div></div>"; seatLayoutHtml.AppendFormat(seatdiv, seat.SeatNo, seatLeft, seatTop, seat.RotationAngle, urlParameters, tipContent, shortleaveimg, powerimh, readerimg, seat.ShortSeatNo, seatimg); } //备注 int countNode = 0; foreach (SeatManage.ClassModel.Note note in _SeatLayout.Notes) { countNode += 1; string seatTop = (18 * note.PositionY).ToString(); //座位顶部位置 string seatLeft = (18 * note.PositionX).ToString(); //座位左边位置 string noteImage = "note_blank"; switch (note.Type) { case SeatManage.EnumType.OrnamentType.AirConditioning: noteImage = "note_AirConditioning"; break; case SeatManage.EnumType.OrnamentType.Bookshelf: noteImage = "note_Bookshelf"; break; case SeatManage.EnumType.OrnamentType.Door: noteImage = "note_Door"; break; case SeatManage.EnumType.OrnamentType.PCTable: noteImage = "note_PCTable"; break; case SeatManage.EnumType.OrnamentType.Pillar: noteImage = "note_Pillar"; break; case SeatManage.EnumType.OrnamentType.Plant: noteImage = "note_Plant"; break; case SeatManage.EnumType.OrnamentType.Roundtable: noteImage = "note_Roundtable"; break; case SeatManage.EnumType.OrnamentType.Steps: noteImage = "note_Steps"; break; case SeatManage.EnumType.OrnamentType.Table: noteImage = "note_Table"; break; case SeatManage.EnumType.OrnamentType.Wall: noteImage = "note_Wall"; break; case SeatManage.EnumType.OrnamentType.Window: noteImage = "note_Window"; break; case SeatManage.EnumType.OrnamentType.Elevator: noteImage = "note_Elevator"; break; case SeatManage.EnumType.OrnamentType.Stairway: noteImage = "note_Stairway"; break; } seatLayoutHtml.AppendFormat("<div id='{0}' class='note_blank' style='left: {1}px; top: {2}px;width: {3}px;height: {4}px;transform: rotate({6}deg);-o-transform: rotate({6}deg);-webkit-transform: rotate({6}deg);-moz-transform: rotate({6}deg); '><img src='../../Images/Node/{7}.png' style='width: {3}px;height: {4}px;'/>{5}</div>", countNode, seatLeft, seatTop, note.BaseWidth * 18, note.BaseHeight * 18, note.Remark, note.RotationAngle, noteImage); } seatLayoutHtml.Append("</div>"); seatLayoutHtml.Append("</div>"); //缩略图 seatLayoutHtml.AppendFormat("<div id='divThumbnail' class='Thumbnail' onclick='ThumbnailClick(this,event,{0},{1},{2},{3})' >", scaleX, scaleY, moveX, moveY); foreach (SeatManage.ClassModel.Seat seat in _SeatLayout.Seats.Values) { double width = 24 / scaleX; double height = 24 / scaleY; string style = ""; switch (seat.SeatUsedState) { case SeatManage.EnumType.EnterOutLogType.Leave: style = "ThumbnailSeatFree"; break; case SeatManage.EnumType.EnterOutLogType.SelectSeat: case SeatManage.EnumType.EnterOutLogType.ReselectSeat: case SeatManage.EnumType.EnterOutLogType.ComeBack: case SeatManage.EnumType.EnterOutLogType.ContinuedTime: case SeatManage.EnumType.EnterOutLogType.ShortLeave: case SeatManage.EnumType.EnterOutLogType.BespeakWaiting: case SeatManage.EnumType.EnterOutLogType.BookingConfirmation: case SeatManage.EnumType.EnterOutLogType.WaitingSuccess: style = "ThumbnailSeatUsing"; break; } seatLayoutHtml.AppendFormat("<div id='t{0}' class='{1}' style='left: {2}px; top: {3}px; width: {4}px;height: {5}px;transform: rotate({6}deg);-o-transform: rotate({6}deg);-webkit-transform: rotate({6}deg);-moz-transform: rotate({6}deg); '></div>", seat.SeatNo, style, (18 * seat.PositionX + 3) / scaleX + moveX, (18 * seat.PositionY + 3) / scaleY + moveY, width, height, seat.RotationAngle); } foreach (SeatManage.ClassModel.Note note in _SeatLayout.Notes) { double width = 18 * note.BaseWidth / scaleX; double height = 18 * note.BaseHeight / scaleY; string style = ""; switch (note.Type) { case SeatManage.EnumType.OrnamentType.Plant: case SeatManage.EnumType.OrnamentType.Roundtable: seatLayoutHtml.AppendFormat("<div id='note' class='ThumbnailNote' style='left: {1}px; top: {2}px; width: {3}px;height: {4}px; border:1px solid #F5BF36; -webkit-border-radius:{5}px; -moz-border-radius:{5}px; -o-border-radius:{5}px; border-radius:{5}px;'></div>", style, (18 / scaleX) * (note.PositionX) + moveX, (18 / scaleY) * (note.PositionY) + moveY, width - 1, height - 1, height); continue; case SeatManage.EnumType.OrnamentType.AirConditioning: case SeatManage.EnumType.OrnamentType.Bookshelf: case SeatManage.EnumType.OrnamentType.PCTable: case SeatManage.EnumType.OrnamentType.Pillar: case SeatManage.EnumType.OrnamentType.Steps: case SeatManage.EnumType.OrnamentType.Table: case SeatManage.EnumType.OrnamentType.Wall: case SeatManage.EnumType.OrnamentType.Elevator: style = "ThumbnailNote"; break; } seatLayoutHtml.AppendFormat("<div id='note' class='{0}' style='left: {1}px; top: {2}px; width: {3}px;height: {4}px;transform: rotate({5}deg);-o-transform: rotate({5}deg);-webkit-transform: rotate({5}deg);-moz-transform: rotate({5}deg); '></div>", style, (18 * note.PositionX) / scaleX + moveX, (18 * note.PositionY) / scaleY + moveY, width, height, note.RotationAngle); } seatLayoutHtml.AppendFormat("<div id='divTransparent' class='Transparent' style='left: {0}px; top: {1}px; width: {2}px; height: {3}px;'>", divTransparentLeft, divTransparentTop, (300 - 2 * moveX) / transparentScaleX, (300 - 2 * moveY) / transparentScaleY); seatLayoutHtml.Append("</div>"); seatLayoutHtml.Append("</div>"); return(seatLayoutHtml.ToString()); } catch { return(""); } }
/// <summary> /// 布局座位列表 /// </summary> /// <param name="roomNum"></param> protected void GetSeatList(string roomNum, string state) { SeatLayout _SeatLayout = EnterOutOperate.GetRoomSeatLayOut(roomNum); StringBuilder seatHtml = new StringBuilder(); foreach (Seat seat in _SeatLayout.Seats.Values) { if (seat.IsSuspended) { continue; } string seatStyle = "";//座位样式 string tipContent = ""; string used = ""; string onTime = ""; switch (seat.SeatUsedState) { case EnterOutLogType.Leave: seatStyle = "RealSeatFree"; tipContent = "座位空闲"; used = "空闲"; onTime = "0"; break; case EnterOutLogType.SelectSeat: case EnterOutLogType.ReselectSeat: case EnterOutLogType.ComeBack: case EnterOutLogType.ContinuedTime: case EnterOutLogType.BookingConfirmation: string time = String.Format("{0:HH:mm:ss}", seat.BeginUsedTime); used = "在座"; if (!string.IsNullOrEmpty(seat.MarkTime.ToString()) && seat.MarkTime.CompareTo(DateTime.Parse("1900/1/1")) != 0) { onTime = "1"; TimeSpan ts = ServiceDateTime.Now.Subtract(seat.MarkTime); string ontime = ts.Hours + "小时" + ts.Minutes + "分钟" + ts.Seconds + "秒"; seatStyle = "RealSeatOnTime"; tipContent = string.Format("学号:{0}<br />姓名:{1}<br />入座时间:{2}<br />已计时:{3}", seat.UserCardNo, seat.UserName, time, ontime); } else { onTime = "0"; seatStyle = "RealSeatBusy"; tipContent = string.Format("学号:{0}<br />姓名:{1}<br />入座时间:{2}", seat.UserCardNo, seat.UserName, time); } break; case EnterOutLogType.ShortLeave: onTime = "0"; seatStyle = "RealSeatLeave"; time = String.Format("{0:HH:mm:ss}", seat.BeginUsedTime); tipContent = string.Format("学号:{0}<br />姓名:{1}<br />暂离时间:{2}", seat.UserCardNo, seat.UserName, time); used = "暂离"; break; case EnterOutLogType.BespeakWaiting: onTime = "0"; seatStyle = "RealSeatBusy"; tipContent = "等待预约读者确认入座"; used = "在座"; break; } switch (state) { case "seated": if (used == "在座") { //seatHtml.AppendFormat("<div data-inline='true' class='{0}' data-transition='none' data-role='button' onclick='tipShow(this,\"{1}\");checkSeat({2})'><input id='{3}' type='checkbox' name='ckbSeat' value='{4}' onclick='checkSeat({5})' Style=\"position:static\" /><span Style=\"font-size: 90%;\">{6}</span><br /><span Style=\"font-size: 90%;\">{7}</span></div>", seatStyle, tipContent, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.ShortSeatNo, used); seatHtml.AppendFormat("<div class='{0}' onclick='tipShowPad(this,\"{1}\");checkSeat({2})' style='float: left; width: 75px;height: 70px;background-image: url('../Images/Pad/pink.png');background-repeat: no-repeat;vertical-align: middle;'><br/><input id='{3}' type='checkbox' name='ckbSeat' value='{4}' onclick='checkSeat({5})' Style=\"position:static\" /><span Style=\"font-size: 90%;\">{6}</span><br /><span Style=\"font-size: 90%;\">{7}</span></div>", seatStyle, tipContent, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.ShortSeatNo, used); } break; case "shortLeave": if (used == "暂离") { seatHtml.AppendFormat("<div class='{0}' onclick='tipShowPad(this,\"{1}\");checkSeat({2})' style='float: left; width: 75px;height: 70px;background-image: url('../Images/Pad/blue.png');background-repeat: no-repeat;vertical-align: middle;'><br/><input id='{3}' type='checkbox' name='ckbSeat' value='{4}' onclick='checkSeat({5})' Style=\"position:static\"/><span Style=\"font-size: 90%;\">{6}</span><br /><span Style=\"font-size: 90%;\">{7}</span></div>", seatStyle, tipContent, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.ShortSeatNo, used); } break; case "onTime": if (onTime == "1") { seatHtml.AppendFormat("<div class='{0}' onclick='tipShowPad(this,\"{1}\");checkSeat({2})' style='float: left; width: 75px;height: 70px;vertical-align: middle;background-image: url('../Images/Pad/onTime.png');background-repeat: no-repeat;'><br/><input id='{3}' type='checkbox' name='ckbSeat' value='{4}' onclick='checkSeat({5})' Style=\"position:static\" /><span Style=\"font-size: 90%;\">{6}</span><br /><span Style=\"font-size: 90%;\">{7}</span></div>", seatStyle, tipContent, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.ShortSeatNo, used); } break; case "allSeat": seatHtml.AppendFormat("<div class='{0}' onclick='tipShowPad(this,\"{1}\");checkSeat({2})' style='float: left; width: 75px;height: 70px;background-image: url('../Images/Pad/gray.png');background-repeat: no-repeat;vertical-align: middle;'><br/><input id='{3}' type='checkbox' name='ckbSeat' value='{4}' onclick='checkSeat({5})' Style=\"position:static\"/><span Style=\"font-size: 90%;\">{6}</span><br /><span Style=\"font-size: 90%;\">{7}</span></div>", seatStyle, tipContent, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.SeatNo, seat.ShortSeatNo, used); break; } } seatContent.InnerHtml = seatHtml.ToString(); }
/// <summary> /// 绘制Html的座位布局 /// </summary> /// <param name="roomNum">房间编号</param> /// <param name="divTransparentTop">透明层距离顶部的位置</param> /// <param name="divTransparentLeft">透明层距离左边的位置</param> /// <returns></returns> private string drowSeatLayoutHtml(string roomNum, string divTransparentTop, string divTransparentLeft) { long tmp = 0; if (string.IsNullOrEmpty(roomNum)) { return("阅览室编号不能为空"); } else if (roomNum.Length != 6) { return("阅览室编号长度不符合规定"); } else if (!long.TryParse(roomNum, out tmp)) { return("传入的阅览室编号不符合系统要求"); } try { SeatManage.ClassModel.SeatLayout _SeatLayout = EnterOutOperate.GetRoomSeatLayOut(roomNum); if (_SeatLayout == null) { return("获取阅览室座位布局出错了"); } StringBuilder seatLayoutHtml = new StringBuilder(); //布局实际图 //绘制实际图窗体大小 //实际图的长宽 double layoutWidth = (double)(_SeatLayout.SeatCol * 18); double layoutHeight = (double)(_SeatLayout.SeatRow * 18); //实际图和缩略图的比例 double scaleX = (double)layoutWidth / 300; double scaleY = (double)layoutHeight / 300; double transparentScaleX = layoutWidth / 1245; double transparentScaleY = layoutHeight / 685; double moveX = 0; double moveY = 0; if (layoutWidth >= layoutHeight) { scaleY = scaleX; moveY = (layoutWidth - layoutHeight) / 2 / scaleY; } else { scaleX = scaleY; moveX = (layoutHeight - layoutWidth) / 2 / scaleX; } //实际图当前的坐标位置 if (string.IsNullOrEmpty(divTransparentTop) || string.IsNullOrEmpty(divTransparentLeft)) { divTransparentTop = moveY.ToString(); divTransparentLeft = moveX.ToString(); } double layoutTop = (moveY - double.Parse(divTransparentTop)) * scaleY; double layoutLeft = (moveX - double.Parse(divTransparentLeft)) * scaleX; seatLayoutHtml.Append("<div id='divSeatLayoutFrom' class='SeatLayoutFrom'>"); seatLayoutHtml.AppendFormat("<div id='divSeatLayout' class='SeatLayout' style='height:{0}px; width:{1}px;top:{2}px;left:{3}px'>", layoutHeight, layoutWidth, layoutTop, layoutLeft); foreach (SeatManage.ClassModel.Seat seat in _SeatLayout.Seats.Values) { string shortleaveimg = "../../Images/Node/note_blank.png"; string powerimh = "../../Images/Node/note_blank.png"; string readerimg = "../../Images/Node/note_blank.png"; string seatimg = "../../Images/SeatImage/ImgSeat.png"; //string seatStyle = "";//座位样式 string seatTop = (18 * seat.PositionY).ToString(); //座位顶部位置 string seatLeft = (18 * seat.PositionX).ToString(); //座位左边位置 string tipContent = ""; string used = ""; if (seat.HavePower) { powerimh = "../../Images/SeatImage/ImgPower.png"; } switch (seat.SeatUsedState) { case SeatManage.EnumType.EnterOutLogType.Leave: if (seat.IsSuspended) { seatimg = "../../Images/SeatImage/ImgSeatDisable.png"; readerimg = "../../Images/SeatImage/ImgStopUse.png"; tipContent = string.Format("暂停使用"); used = "3"; } else { tipContent = string.Format("座位空闲"); used = "0"; } break; case SeatManage.EnumType.EnterOutLogType.SelectSeat: case SeatManage.EnumType.EnterOutLogType.ReselectSeat: case SeatManage.EnumType.EnterOutLogType.ComeBack: case SeatManage.EnumType.EnterOutLogType.ContinuedTime: case SeatManage.EnumType.EnterOutLogType.BookingConfirmation: case SeatManage.EnumType.EnterOutLogType.WaitingSuccess: readerimg = "../../Images/SeatImage/ImgReader.png"; seatimg = "../../Images/SeatImage/ImgSeatUsing.png"; string time = String.Format("{0:MM月dd日 HH:mm:ss}", seat.BeginUsedTime); tipContent = string.Format("学号:{0}<br />姓名:{1}<br />入座时间:{2}", seat.UserCardNo, seat.UserName, time); //TODO:无人管理模式事件 used = "1"; break; case SeatManage.EnumType.EnterOutLogType.ShortLeave: seatimg = "../../Images/SeatImage/ImgSeatShortLeave.png"; shortleaveimg = "../../Images/SeatImage/ImgShortLeave.png"; readerimg = "../../Images/SeatImage/ImgShortLeaveReader.png"; time = String.Format("{0:MM月dd日 HH:mm:ss}", seat.BeginUsedTime); tipContent = string.Format("学号:{0}<br />姓名:{1}<br />暂离时间:{2}", seat.UserCardNo, seat.UserName, time); used = "1"; break; case SeatManage.EnumType.EnterOutLogType.BespeakWaiting: shortleaveimg = "../../Images/SeatImage/ImgBook.png"; tipContent = string.Format("已经被预约<br />学号:{0}", seat.UserCardNo); used = "2"; break; } string urlParameters = string.Format("?seatNo={0}&seatShortNo={1}&used={2}", seat.SeatNo, seat.ShortSeatNo, used); string seatdiv = "<div id='{0}' class='SeatBackground' style='left: {1}px; top: {2}px;width: 36px; height: 36px;transform: rotate({3}deg); -o-transform: rotate({3}deg); -webkit-transform: rotate({3}deg);-moz-transform: rotate({3}deg);' onclick='seatClick(\"{4}\")' onmouseover='tipShow(this,\"{5}\")' onmouseout='tipHidden(this)'>" + "<img src='{10}' height='34px' width='34px' />" + "<div style='margin-top: -34px; margin-left: 24px; height: 12px; width: 12px'>" + "<img src='{6}' height='12px' width='12px' />" + "</div>" + "<div style='margin-top: 10px; margin-left: 0px; height: 12px; width: 12px'>" + "<img src='{7}' height='12px' width='12px' />" + "</div>" + "<div style='margin-top: -28px; margin-left: 6px; height: 24px; width: 24px'>" + "<img src='{8}' height='24px' width='24px' />" + "</div>" + "<div style='margin-top: -34px; margin-left: 0px;color:white; transform: rotate(-{3}deg); -o-transform: rotate(-{3}deg);" + "-webkit-transform: rotate(-{3}deg); -moz-transform: rotate(-{3}deg);'>{9}</div></div>"; seatLayoutHtml.AppendFormat(seatdiv, seat.SeatNo, seatLeft, seatTop, seat.RotationAngle, urlParameters, tipContent, shortleaveimg, powerimh, readerimg, seat.ShortSeatNo, seatimg); } //备注 int countNode = 0; foreach (SeatManage.ClassModel.Note note in _SeatLayout.Notes) { countNode += 1; string seatTop = (18 * note.PositionY).ToString(); //座位顶部位置 string seatLeft = (18 * note.PositionX).ToString(); //座位左边位置 string noteImage = "note_blank"; switch (note.Type) { case SeatManage.EnumType.OrnamentType.AirConditioning: noteImage = "note_AirConditioning"; break; case SeatManage.EnumType.OrnamentType.Bookshelf: noteImage = "note_Bookshelf"; break; case SeatManage.EnumType.OrnamentType.Door: noteImage = "note_Door"; break; case SeatManage.EnumType.OrnamentType.PCTable: noteImage = "note_PCTable"; break; case SeatManage.EnumType.OrnamentType.Pillar: noteImage = "note_Pillar"; break; case SeatManage.EnumType.OrnamentType.Plant: noteImage = "note_Plant"; break; case SeatManage.EnumType.OrnamentType.Roundtable: noteImage = "note_Roundtable"; break; case SeatManage.EnumType.OrnamentType.Steps: noteImage = "note_Steps"; break; case SeatManage.EnumType.OrnamentType.Table: noteImage = "note_Table"; break; case SeatManage.EnumType.OrnamentType.Wall: noteImage = "note_Wall"; break; case SeatManage.EnumType.OrnamentType.Window: noteImage = "note_Window"; break; case SeatManage.EnumType.OrnamentType.Elevator: noteImage = "note_Elevator"; break; case SeatManage.EnumType.OrnamentType.Stairway: noteImage = "note_Stairway"; break; } seatLayoutHtml.AppendFormat("<div id='{0}' class='note_blank' style='left: {1}px; top: {2}px;width: {3}px;height: {4}px;transform: rotate({6}deg);-o-transform: rotate({6}deg);-webkit-transform: rotate({6}deg);-moz-transform: rotate({6}deg); '><img src='../../Images/Node/{7}.png' style='width: {3}px;height: {4}px;'/><div style='margin-top: {8}px;transform: rotate(-0deg); -o-transform: rotate(-0deg);-webkit-transform: rotate(-0deg); -moz-transform: rotate(-0deg);'>{5}</div></div>", countNode, seatLeft, seatTop, note.BaseWidth * 18, note.BaseHeight * 18, note.Remark, note.RotationAngle, noteImage, -note.BaseHeight * 9 - 18); } seatLayoutHtml.Append("</div>"); seatLayoutHtml.Append("</div>"); //缩略图 seatLayoutHtml.AppendFormat("<div id='divThumbnail' class='Thumbnail' onclick='ThumbnailClick(this,event,{0},{1},{2},{3})' >", scaleX, scaleY, moveX, moveY); foreach (SeatManage.ClassModel.Seat seat in _SeatLayout.Seats.Values) { double width = 24 / scaleX; double height = 24 / scaleY; string style = ""; switch (seat.SeatUsedState) { case SeatManage.EnumType.EnterOutLogType.Leave: style = "ThumbnailSeatFree"; break; case SeatManage.EnumType.EnterOutLogType.SelectSeat: case SeatManage.EnumType.EnterOutLogType.ReselectSeat: case SeatManage.EnumType.EnterOutLogType.ComeBack: case SeatManage.EnumType.EnterOutLogType.ContinuedTime: case SeatManage.EnumType.EnterOutLogType.ShortLeave: case SeatManage.EnumType.EnterOutLogType.BespeakWaiting: case SeatManage.EnumType.EnterOutLogType.BookingConfirmation: case SeatManage.EnumType.EnterOutLogType.WaitingSuccess: style = "ThumbnailSeatUsing"; break; } seatLayoutHtml.AppendFormat("<div id='t{0}' class='{1}' style='left: {2}px; top: {3}px; width: {4}px;height: {5}px;transform: rotate({6}deg);-o-transform: rotate({6}deg);-webkit-transform: rotate({6}deg);-moz-transform: rotate({6}deg); '></div>", seat.SeatNo, style, (18 * seat.PositionX + 3) / scaleX + moveX, (18 * seat.PositionY + 3) / scaleY + moveY, width, height, seat.RotationAngle); } foreach (SeatManage.ClassModel.Note note in _SeatLayout.Notes) { double width = 18 * note.BaseWidth / scaleX; double height = 18 * note.BaseHeight / scaleY; string style = ""; switch (note.Type) { case SeatManage.EnumType.OrnamentType.Plant: case SeatManage.EnumType.OrnamentType.Roundtable: seatLayoutHtml.AppendFormat("<div id='note' class='ThumbnailNote' style='left: {1}px; top: {2}px; width: {3}px;height: {4}px; border:1px solid #F5BF36; -webkit-border-radius:{5}px; -moz-border-radius:{5}px; -o-border-radius:{5}px; border-radius:{5}px;'></div>", style, (18 / scaleX) * (note.PositionX) + moveX, (18 / scaleY) * (note.PositionY) + moveY, width - 1, height - 1, height); continue; case SeatManage.EnumType.OrnamentType.AirConditioning: case SeatManage.EnumType.OrnamentType.Bookshelf: case SeatManage.EnumType.OrnamentType.PCTable: case SeatManage.EnumType.OrnamentType.Pillar: case SeatManage.EnumType.OrnamentType.Steps: case SeatManage.EnumType.OrnamentType.Table: case SeatManage.EnumType.OrnamentType.Wall: case SeatManage.EnumType.OrnamentType.Elevator: style = "ThumbnailNote"; break; } seatLayoutHtml.AppendFormat("<div id='note' class='{0}' style='left: {1}px; top: {2}px; width: {3}px;height: {4}px;transform: rotate({5}deg);-o-transform: rotate({5}deg);-webkit-transform: rotate({5}deg);-moz-transform: rotate({5}deg); '></div>", style, (18 * note.PositionX) / scaleX + moveX, (18 * note.PositionY) / scaleY + moveY, width, height, note.RotationAngle); } seatLayoutHtml.AppendFormat("<div id='divTransparent' class='Transparent' style='left: {0}px; top: {1}px; width: {2}px; height: {3}px;'>", divTransparentLeft, divTransparentTop, (300 - 2 * moveX) / transparentScaleX, (300 - 2 * moveY) / transparentScaleY); seatLayoutHtml.Append("</div>"); seatLayoutHtml.Append("</div>"); return(seatLayoutHtml.ToString()); } catch { return(""); } }
/// <summary> /// 获取座位使用情况 /// </summary> public void GetSeatLayout() { Layout = EnterOutOperate.GetRoomSeatLayOut(clientObject.EnterOutLogData.EnterOutlog.ReadingRoomNo); }
public void ShowMessage() { viewModel.CloseTime = 60; viewModel.CountDown = new FormCloseCountdown(viewModel.CloseTime); viewModel.CountDown.EventCountdown += CountDown_EventCountdown; viewModel.CountDown.Start(); this.viewModel.LastSeatCount = this.viewModel.AllSeatCount; this.viewModel.Layout = EnterOutOperate.GetRoomSeatLayOut(this.viewModel.ReadingRoomNo); foreach (object obj in this.canvas_Seat.Children) { try { if (obj.GetType().Name == "UC_Seat") { UC_Seat UC = obj as UC_Seat; Seat value = this.viewModel.Layout.Seats.Where(p => p.Value.SeatNo == UC.ViewModel.LongSeatNo).FirstOrDefault().Value; SeatUC_ViewModel value2 = this.viewModel.SeatLayoutList.Where(p => p.Value.LongSeatNo == UC.ViewModel.LongSeatNo).FirstOrDefault().Value; if (value == null || value2 == null) { continue; } UC.ViewModel = value2; UC.ViewModel.IsBespeak = false; UC.ViewModel.IsShortLeave = false; UC.ViewModel.IsUsing = false; switch (value.SeatUsedState) { case EnterOutLogType.Leave: UC.ViewModel.IsUsing = false; UC.ViewModel.IsBespeak = false; UC.ViewModel.IsShortLeave = false; UC.ViewModel.IsWaiting = false; break; case EnterOutLogType.SelectSeat: case EnterOutLogType.ReselectSeat: case EnterOutLogType.ComeBack: case EnterOutLogType.ContinuedTime: case EnterOutLogType.BookingConfirmation: case EnterOutLogType.WaitingSuccess: { UC.ViewModel.IsUsing = true; UC.ViewModel.IsBespeak = false; UC.ViewModel.IsShortLeave = false; UC.ViewModel.IsWaiting = false; this.viewModel.LastSeatCount--; break; } case EnterOutLogType.ShortLeave: { UC.ViewModel.IsUsing = true; UC.ViewModel.IsShortLeave = true; UC.ViewModel.IsBespeak = false; UC.ViewModel.IsWaiting = false; this.viewModel.LastSeatCount--; break; } case EnterOutLogType.BespeakWaiting: { UC.ViewModel.IsUsing = false; UC.ViewModel.IsBespeak = true; UC.ViewModel.IsShortLeave = false; UC.ViewModel.IsWaiting = false; if (!UC.ViewModel.IsCanSelectBespeakSeat) { this.viewModel.LastSeatCount--; } break; } } UC.Background = UC.ViewModel.SeatStateImage; UC.ReaderImg.Fill = UC.ViewModel.ReaderStateImage; UC.PowerImg.Fill = UC.ViewModel.PowerImage; UC.ShortleaveImg.Fill = UC.ViewModel.ShortLeaveImage; UC.BespeakImg.Fill = UC.ViewModel.BespeakImage; } if (obj.GetType().Name == "Rectangle") { Rectangle rectangle = obj as Rectangle; } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } } canvas_Thumbnail.Children.RemoveRange(0, viewModel.Layout.Seats.Count); seatLayout_thumb(); if (viewModel.ClientObject.SeatAutoAddSize) { SystemObject clientObject = SystemObject.GetInstance(); this.Height = viewModel.WindowHeight += clientObject.AddSize; this.Top = viewModel.WindowTop -= clientObject.AddSize; G_bg.Height += clientObject.AddSize; seatLayout(); btn_MaxWindow.Visibility = Visibility.Collapsed; btn_NormnlWindow.Visibility = Visibility.Visible; WPFMessage.MessageHelper.SendMessage(clientObject.MediaClient, SeatManage.EnumType.SendClentMessageType.MoveUp, clientObject.AddSize.ToString()); WeiCharOperationWindowObject.GetInstance().Window.WinChange((int)(Top)); } //this.Topmost = true; this.Owner = ReadingRoomWindowObject.GetInstance().Window; //ReadingRoomWindowObject.GetInstance().Window.Hide(); this.Topmost = true; this.Topmost = false; ShowDialog(); }
private void drowSeatLayout() { _SeatLayout = EnterOutOperate.GetRoomSeatLayOut(clientobject.EnterOutLogData.EnterOutlog.ReadingRoomNo); seatLayout(); }