/// <summary>
        /// 判断座位是否符合预约条件
        /// </summary>
        /// <returns></returns>
        protected bool IsCanBespeak(string schoolNo, string roomNo, string selDate)
        {
            try
            {
                bool     result  = true;
                DateTime nowDate = SeatManage.Bll.ServiceDateTime.Now;
                //SeatManage.ClassModel.School si = SeatManage.Bll.AMS_School.GetSchool(schoolNo).GetType;

                SeatManage.ClassModel.ReadingRoomSetting set = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNo).Setting;
                if (!set.SeatBespeak.Used)
                {
                    FineUI.Alert.ShowInTop("阅览室没有开放预约");
                    result = false;
                }
                if (!dateBespeak(set.SeatBespeak, nowDate, selDate))
                {
                    FineUI.Alert.ShowInTop("该日期不能预约");
                    result = false;
                }
                if (!timeCanBespeak(set.SeatBespeak, nowDate))
                {
                    FineUI.Alert.ShowInTop(string.Format("预约时间为:{0}到{1}", set.SeatBespeak.CanBespeatTimeSpace.BeginTime, set.SeatBespeak.CanBespeatTimeSpace.EndTime));
                    result = false;
                }
                return(result);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
        protected void gridRoomList_OnPreRowDataBound(object sender, FineUI.GridPreRowEventArgs e)
        {
            DateTime        nowDate = SeatManage.Bll.ServiceDateTime.Now;
            DataRowView     row     = e.DataItem as DataRowView;
            string          roomSet = row[5].ToString();
            LinkButtonField lbf     = gridRoomList.FindColumn("seatUsedView") as LinkButtonField;

            if (string.IsNullOrEmpty(roomSet))
            {
                lbf.Icon           = Icon.BulletCross;
                lbf.ToolTip        = "该阅览室没有配置";
                lbf.EnablePostBack = false;
                lbf.Enabled        = false;
                return;
            }

            try
            {
                SeatManage.ClassModel.ReadingRoomSetting set = new SeatManage.ClassModel.ReadingRoomSetting(roomSet);
                if (Code.NowReadingRoomState.ReadingRoomOpenState(set.RoomOpenSet, nowDate) == SeatManage.EnumType.ReadingRoomStatus.Close)
                {
                    lbf.Icon           = Icon.BulletCross;
                    lbf.ToolTip        = "阅览室没有开放";
                    lbf.EnablePostBack = false;
                    lbf.Enabled        = false;
                    return;
                }
                if (!set.SeatBespeak.Used || !set.SeatBespeak.NowDayBespeak)
                {
                    lbf.Icon           = Icon.BulletCross;
                    lbf.ToolTip        = "阅览室没有开放预约";
                    lbf.EnablePostBack = false;
                    lbf.Enabled        = false;
                    return;
                }

                int canBespeakAmount = int.Parse(row[4].ToString());
                if (canBespeakAmount <= 0)
                {
                    lbf.Icon    = Icon.BulletCross;
                    lbf.ToolTip = "没有空余座位";
                    lbf.Enabled = false;
                }
                else
                {
                    lbf.Icon    = Icon.Zoom;
                    lbf.ToolTip = "预约座位";
                    lbf.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                FineUI.Alert.Show(string.Format("阅览室设置不正确:{0}", ex.Message));
            }

            string roomNum = row[0].ToString().Trim();

            lbf.EnablePostBack = false;
            lbf.OnClientClick  = WindowEdit.GetShowReference(string.Format("BespeakNowDaySeatLayout.aspx?roomId={0}", roomNum), "座位视图");
        }
示例#3
0
        string bespeakSureTimeSpan(SeatManage.ClassModel.ReadingRoomSetting set)
        {
            DateTime bespeakTime = DateTime.Now;

            if (bookMode.SelectedIndex == 1)
            {
                if (this.ReadingRoomList[roomNo].Setting.SeatBespeak.SpecifiedTime)
                {
                    bespeakTime = Convert.ToDateTime(spanSelect.Items[spanSelect.SelectedIndex].Value);
                }
                else
                {
                    bespeakTime = Convert.ToDateTime(timeSelect.Items[timeSelect.SelectedIndex].Value);
                }
                DateTime bespeakBeginTime = bespeakTime.AddMinutes(-double.Parse(set.SeatBespeak.ConfirmTime.BeginTime));
                DateTime bespeakEndTime   = bespeakTime.AddMinutes(double.Parse(set.SeatBespeak.ConfirmTime.EndTime));
                return(string.Format("{0}至{1}", bespeakBeginTime.ToShortTimeString(), bespeakEndTime.ToShortTimeString()));
            }
            else
            {
                DateTime bespeakBeginTime = bespeakTime;
                DateTime bespeakEndTime   = bespeakTime.AddMinutes(set.SeatBespeak.SeatKeepTime);
                return(string.Format("{0}至{1}", bespeakBeginTime.ToShortTimeString(), bespeakEndTime.ToShortTimeString()));
            }
        }
示例#4
0
        /// <summary>
        /// 判断座位是否符合预约条件
        /// </summary>
        /// <returns></returns>
        protected bool IsCanBespeak()
        {
            bool result = true;

            SeatManage.ClassModel.ReadingRoomSetting set = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNo).Setting;
            if (!set.SeatBespeak.Used || !set.SeatBespeak.NowDayBespeak)
            {
                FineUI.Alert.ShowInTop("阅览室没有开放预约");
                result = false;
            }
            return(result);
        }
        string bespeakSureTime(SeatManage.ClassModel.ReadingRoomSetting set)
        {
            SeatManage.Bll.T_SM_ReadingRoom bllReadingRoom = new SeatManage.Bll.T_SM_ReadingRoom();
            DateTime bespeakTime = Convert.ToDateTime(bllReadingRoom.GetRoomOpenTimeByDate(set, date).BeginTime);

            if (spanSelect.Visible)
            {
                bespeakTime = Convert.ToDateTime(spanSelect.Items[spanSelect.SelectedIndex].Value);
            }
            else
            {
                bespeakTime = Convert.ToDateTime(timeSelect.Items[timeSelect.SelectedIndex].Value);
            }
            return(string.Format(bespeakTime.ToShortTimeString()));
        }
        string bespeakSureTimeSpan(SeatManage.ClassModel.ReadingRoomSetting set)
        {
            SeatManage.Bll.T_SM_ReadingRoom bllReadingRoom = new SeatManage.Bll.T_SM_ReadingRoom();
            DateTime bespeakTime = Convert.ToDateTime(bllReadingRoom.GetRoomOpenTimeByDate(set, date).BeginTime);

            if (rblModel.SelectedValue == "1")
            {
                if (set.SeatBespeak.SpecifiedTime)
                {
                    bespeakTime = set.SeatBespeak.SpecifiedTimeList[0];
                }
            }
            DateTime bespeakBeginTime = bespeakTime.AddMinutes(-double.Parse(set.SeatBespeak.ConfirmTime.BeginTime));
            DateTime bespeakEndTime   = bespeakTime.AddMinutes(double.Parse(set.SeatBespeak.ConfirmTime.EndTime));

            return(string.Format("{0}至{1}", bespeakBeginTime.ToShortTimeString(), bespeakEndTime.ToShortTimeString()));
        }
示例#7
0
        string bespeakSureTime(SeatManage.ClassModel.ReadingRoomSetting set)
        {
            DateTime bespeakTime = DateTime.Now;

            if (bookMode.SelectedIndex == 1)
            {
                if (this.ReadingRoomList[roomNo].Setting.SeatBespeak.SpecifiedTime)
                {
                    bespeakTime = Convert.ToDateTime(spanSelect.Items[spanSelect.SelectedIndex].Value);
                }
                else
                {
                    bespeakTime = Convert.ToDateTime(timeSelect.Items[timeSelect.SelectedIndex].Value);
                }
            }
            return(string.Format(bespeakTime.ToShortTimeString()));
        }
        string bespeakSureTimeSpan(SeatManage.ClassModel.ReadingRoomSetting set)
        {
            SeatManage.Bll.T_SM_ReadingRoom bllReadingRoom = new SeatManage.Bll.T_SM_ReadingRoom();
            DateTime bespeakTime = Convert.ToDateTime(bllReadingRoom.GetRoomOpenTimeByDate(set, date).BeginTime);

            if (spanSelect.Visible)
            {
                bespeakTime = Convert.ToDateTime(spanSelect.Items[spanSelect.SelectedIndex].Value);
            }
            else
            {
                bespeakTime = Convert.ToDateTime(timeSelect.Items[timeSelect.SelectedIndex].Value);
            }
            DateTime bespeakBeginTime = bespeakTime.AddMinutes(-double.Parse(set.SeatBespeak.ConfirmTime.BeginTime));
            DateTime bespeakEndTime   = bespeakTime.AddMinutes(double.Parse(set.SeatBespeak.ConfirmTime.EndTime));

            return(string.Format("{0}至{1}", bespeakBeginTime.ToShortTimeString(), bespeakEndTime.ToShortTimeString()));
        }
        /// <summary>
        /// 判断座位是否符合预约条件
        /// </summary>
        /// <returns></returns>
        protected bool IsCanBespeak()
        {
            bool     result  = true;
            DateTime nowDate = SeatManage.Bll.ServiceDateTime.Now;

            SeatManage.ClassModel.ReadingRoomSetting set = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNo).Setting;
            if (!set.SeatBespeak.Used)
            {
                FineUI.Alert.ShowInTop("阅览室没有开放预约");
                result = false;
            }
            if (!dateBespeak(set.SeatBespeak, nowDate))
            {
                FineUI.Alert.ShowInTop("该日期不能预约");
                result = false;
            }
            if (!timeCanBespeak(set.SeatBespeak, nowDate))
            {
                FineUI.Alert.ShowInTop(string.Format("预约时间为:{0}到{1}", set.SeatBespeak.CanBespeatTimeSpace.BeginTime, set.SeatBespeak.CanBespeatTimeSpace.EndTime));
                result = false;
            }
            return(result);
        }
示例#10
0
        private void DateBind()
        {
            SeatManage.ClassModel.ReaderInfo reader = EnterOutOperate.GetReaderInfo(this.LoginId);
            if (reader.AtReadingRoom == null)
            {
                lblSeatInfo.Text      = "无";
                btnDelayTime.Enabled  = false;
                btnLeave.Enabled      = false;
                btnShortLeave.Enabled = false;
                return;
            }

            SeatManage.ClassModel.ReadingRoomSetting roomSet = reader.AtReadingRoom.Setting;
            if (roomSet.SeatUsedTimeLimit.Used && roomSet.SeatUsedTimeLimit.IsCanContinuedTime)
            {
                btnDelayTime.Enabled = roomSet.SeatBespeak.AllowDelayTime;
            }
            else
            {
                btnDelayTime.Enabled = false;
            }
            btnLeave.Enabled      = roomSet.SeatBespeak.AllowLeave;
            btnShortLeave.Enabled = roomSet.SeatBespeak.AllowShortLeave;


            if (reader.EnterOutLog != null && reader.EnterOutLog.EnterOutState != EnterOutLogType.Leave)
            {
                switch (reader.EnterOutLog.EnterOutState)
                {
                case EnterOutLogType.ShortLeave:
                    lblSeatInfo.Text      = string.Format("{0} {1}", reader.EnterOutLog.ReadingRoomName, reader.EnterOutLog.ShortSeatNo);
                    lblState.Text         = "暂离";
                    lblHoldTime.Text      = reader.EnterOutLog.EnterOutTime.ToString();
                    btnShortLeave.Enabled = false;
                    btnDelayTime.Enabled  = false;
                    break;

                case EnterOutLogType.BookingConfirmation:
                case EnterOutLogType.SelectSeat:
                case EnterOutLogType.ContinuedTime:
                case EnterOutLogType.ComeBack:
                case EnterOutLogType.ReselectSeat:
                case EnterOutLogType.WaitingSuccess:
                    lblSeatInfo.Text = string.Format("{0} {1}", reader.EnterOutLog.ReadingRoomName, reader.EnterOutLog.ShortSeatNo);
                    lblState.Text    = "在座";
                    lblHoldTime.Text = reader.EnterOutLog.EnterOutTime.ToString();
                    break;

                default:
                    btnDelayTime.Enabled  = false;
                    btnLeave.Enabled      = false;
                    btnShortLeave.Enabled = false;
                    break;
                }
            }
            else
            {
                lblSeatInfo.Text      = "无";
                btnDelayTime.Enabled  = false;
                btnLeave.Enabled      = false;
                btnShortLeave.Enabled = false;
            }
        }
示例#11
0
        public string EnterLib(string CardNo)
        {
            string[] strs = CardNo.Split(',');
            CardNo = strs[0];
            if (!Verifylicensing())
            {
                return("非法操作,此接口未进行授权!");
            }
            //SeatManage.SeatManageComm.WriteLog.Write("传入卡号:" + strs[0]);
            //SeatManage.SeatManageComm.WriteLog.Write("传入图书馆号:" + strs[1]);
            StringBuilder message      = new StringBuilder();
            string        ReaderNo     = CardNo;
            string        ReaderName   = "";
            string        NowStatus    = "";
            string        BeforeStatus = "";
            string        Error        = "";

            message.Append("<ReaderInfo>");
            message.Append("<ReaderNo>{0}</ReaderNo>");
            message.Append("<ReaderName>{1}</ReaderName>");
            message.Append("<NowStatus>{2}</NowStatus>");
            message.Append("<BeforeStatus>{3}</BeforeStatus>");
            message.Append("<Error>{4}</Error>");
            message.Append("</ReaderInfo>");
            try
            {
                if (string.IsNullOrEmpty(CardNo))
                {
                    throw new Exception("输入的学号为空!");
                }
                SeatManage.ClassModel.AccessSetting accset = SeatManage.Bll.T_SM_SystemSet.GetAccessSetting();
                if (accset == null)
                {
                    throw new Exception("获取通道机设置失败!");
                }
                SeatManage.ClassModel.ReaderInfo reader = SeatManage.Bll.EnterOutOperate.GetReaderInfo(CardNo);
                if (reader == null)
                {
                    throw new Exception("获取不到此学生的信息!");
                }
                if (strs.Length > 1 && reader.AtReadingRoom != null && strs[1] != "00" && reader.AtReadingRoom.Libaray.No != strs[1])
                {
                    throw new Exception("学生在此图书馆未选座位!");
                }
                ReaderNo   = reader.CardNo;
                ReaderName = reader.Name;
                if (reader.EnterOutLog == null)
                {
                    NowStatus    = ((int)SeatManage.EnumType.EnterOutLogType.Leave).ToString();
                    BeforeStatus = ((int)SeatManage.EnumType.EnterOutLogType.Leave).ToString();
                }
                else
                {
                    NowStatus    = ((int)reader.EnterOutLog.EnterOutState).ToString();
                    BeforeStatus = ((int)reader.EnterOutLog.EnterOutState).ToString();
                }
                if (accset.IsUsed && accset.EnterLib)
                {
                    if (reader.EnterOutLog != null && reader.EnterOutLog.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
                    {
                        switch (reader.EnterOutLog.EnterOutState)
                        {
                        case SeatManage.EnumType.EnterOutLogType.BookingConfirmation:
                        case SeatManage.EnumType.EnterOutLogType.ComeBack:
                        case SeatManage.EnumType.EnterOutLogType.ContinuedTime:
                        case SeatManage.EnumType.EnterOutLogType.ReselectSeat:
                        case SeatManage.EnumType.EnterOutLogType.SelectSeat:
                        case SeatManage.EnumType.EnterOutLogType.WaitingSuccess:
                            if (accset.IsReleaseOnSeat && reader.EnterOutLog.EnterOutTime.AddMinutes(accset.LeaveTimeSpan) < SeatManage.Bll.ServiceDateTime.Now)
                            {
                                SeatManage.ClassModel.EnterOutLogInfo enterOutLog = reader.EnterOutLog;
                                enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
                                enterOutLog.TerminalNum   = "";
                                enterOutLog.Remark        = string.Format("读者离开图书馆未刷卡,再次通过通道机进入,系统自动释放{0} {1}号座位", reader.AtReadingRoom.Name, enterOutLog.ShortSeatNo);
                                enterOutLog.EnterOutTime  = SeatManage.Bll.ServiceDateTime.Now;
                                enterOutLog.Flag          = SeatManage.EnumType.Operation.Service;
                                int newId = 0;
                                if (SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId) == SeatManage.EnumType.HandleResult.Failed)
                                {
                                    throw new Exception("更新进出记录失败!");
                                }
                                NowStatus = ((int)SeatManage.EnumType.EnterOutLogType.Leave).ToString();
                                if (accset.AddViolationRecords)
                                {
                                    SeatManage.ClassModel.ViolationRecordsLogInfo vrInfo = new SeatManage.ClassModel.ViolationRecordsLogInfo();
                                    vrInfo.CardNo        = enterOutLog.CardNo;
                                    vrInfo.EnterFlag     = SeatManage.EnumType.ViolationRecordsType.LeaveNotReadCard;
                                    vrInfo.EnterOutTime  = enterOutLog.EnterOutTime.ToString();
                                    vrInfo.Flag          = SeatManage.EnumType.LogStatus.Valid;
                                    vrInfo.ReadingRoomID = enterOutLog.ReadingRoomNo;
                                    vrInfo.SeatID        = enterOutLog.SeatNo;
                                    vrInfo.Remark        = string.Format("读者{0}离开图书馆未刷卡,再次通过通道机,记录违规", ReaderNo);
                                    if (!SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(vrInfo))
                                    {
                                        throw new Exception("添加违规记录失败!");
                                    }
                                }
                            }
                            break;

                        case SeatManage.EnumType.EnterOutLogType.ShortLeave:
                            if (accset.IsComeBack)
                            {
                                DateTime NowTime = SeatManage.Bll.ServiceDateTime.Now;
                                SeatManage.ClassModel.EnterOutLogInfo enterOutLog = reader.EnterOutLog;
                                System.TimeSpan shortleavetimelong = NowTime - enterOutLog.EnterOutTime;
                                enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.ComeBack;
                                enterOutLog.TerminalNum   = "";
                                enterOutLog.Remark        = string.Format("在通道机刷卡暂离回来,暂离时长{0}分钟,继续使用{1} {2}号座位", shortleavetimelong.TotalMinutes.ToString().Split('.')[0], enterOutLog.ReadingRoomName, enterOutLog.ShortSeatNo);
                                enterOutLog.EnterOutTime  = NowTime;
                                enterOutLog.Flag          = SeatManage.EnumType.Operation.Service;
                                int newId = 0;
                                if (SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId) == SeatManage.EnumType.HandleResult.Failed)
                                {
                                    throw new Exception("更新进出记录失败!");
                                }
                                List <SeatManage.ClassModel.WaitSeatLogInfo> waitSeatLogs = SeatManage.Bll.T_SM_SeatWaiting.GetWaitSeatList("", enterOutLog.EnterOutLogID, null, null, null);
                                if (waitSeatLogs.Count > 0)
                                {
                                    SeatManage.ClassModel.WaitSeatLogInfo waitSeatLog = waitSeatLogs[0];
                                    waitSeatLog.NowState     = SeatManage.EnumType.LogStatus.Fail;
                                    waitSeatLog.OperateType  = SeatManage.EnumType.Operation.OtherReader;
                                    waitSeatLog.WaitingState = SeatManage.EnumType.EnterOutLogType.WaitingCancel;
                                    if (!SeatManage.Bll.T_SM_SeatWaiting.UpdateWaitLog(waitSeatLog))
                                    {
                                        throw new Exception("修改等待记录失败!");
                                    }
                                }
                                NowStatus = ((int)SeatManage.EnumType.EnterOutLogType.ComeBack).ToString();
                            }
                            break;
                        }
                    }
                    else
                    {
                        DateTime nowDate = SeatManage.Bll.ServiceDateTime.Now;
                        if (accset.IsBookingConfinmed && reader.BespeakLog.Count > 0)
                        {
                            SeatManage.ClassModel.BespeakLogInfo     bespeaklog = reader.BespeakLog[0];
                            SeatManage.ClassModel.ReadingRoomSetting set        = reader.AtReadingRoom.Setting;
                            DateTime dtBegin = bespeaklog.BsepeakTime.AddMinutes(-double.Parse(set.SeatBespeak.ConfirmTime.BeginTime));
                            DateTime dtEnd   = bespeaklog.BsepeakTime.AddMinutes(double.Parse(set.SeatBespeak.ConfirmTime.EndTime));
                            if (SeatManage.SeatManageComm.DateTimeOperate.DateAccord(dtBegin, dtEnd, nowDate) || (set.SeatBespeak.NowDayBespeak && bespeaklog.SubmitTime == bespeaklog.BsepeakTime))
                            {
                                SeatManage.ClassModel.EnterOutLogInfo seatUsedInfo = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(bespeaklog.SeatNo);
                                if (seatUsedInfo != null && seatUsedInfo.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
                                { //条件满足,说明座位正在使用。
                                    seatUsedInfo.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave;
                                    seatUsedInfo.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
                                    seatUsedInfo.Remark        = string.Format("预约该座位的读者在通道机刷卡确认入座,设置在座读者离开");
                                    seatUsedInfo.Flag          = SeatManage.EnumType.Operation.OtherReader;
                                    int newId = -1;
                                    SeatManage.Bll.EnterOutOperate.AddEnterOutLog(seatUsedInfo, ref newId);
                                }
                                SeatManage.ClassModel.EnterOutLogInfo newEnterOutLog = new SeatManage.ClassModel.EnterOutLogInfo();//构造
                                newEnterOutLog.CardNo        = bespeaklog.CardNo;
                                newEnterOutLog.EnterOutLogNo = SeatManage.SeatManageComm.SeatComm.RndNum();
                                newEnterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.BookingConfirmation;
                                newEnterOutLog.EnterOutType  = SeatManage.EnumType.LogStatus.Valid;
                                newEnterOutLog.Flag          = SeatManage.EnumType.Operation.Reader;
                                newEnterOutLog.ReadingRoomNo = bespeaklog.ReadingRoomNo;
                                newEnterOutLog.SeatNo        = bespeaklog.SeatNo;
                                newEnterOutLog.Remark        = string.Format("在通道机刷卡,入座预约的{0} {1}号座位", bespeaklog.ReadingRoomName, bespeaklog.ShortSeatNum);
                                NowStatus = ((int)SeatManage.EnumType.EnterOutLogType.BookingConfirmation).ToString();
                                int logid = -1;
                                SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(newEnterOutLog, ref logid); //添加入座记录
                                if (result == SeatManage.EnumType.HandleResult.Successed)
                                {
                                    bespeaklog.BsepeakState = SeatManage.EnumType.BookingStatus.Confinmed;
                                    bespeaklog.CancelPerson = SeatManage.EnumType.Operation.Reader;
                                    bespeaklog.CancelTime   = nowDate;
                                    bespeaklog.Remark       = string.Format("在通道机刷卡,入座预约的{0} {1}号座位", bespeaklog.ReadingRoomName, bespeaklog.ShortSeatNum);
                                    SeatManage.Bll.T_SM_SeatBespeak.UpdateBespeakList(bespeaklog);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Error = e.Message;
            }
            return(string.Format(message.ToString(), ReaderNo, ReaderName, NowStatus, BeforeStatus, Error));
        }
        /// <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("");
            }
        }
示例#13
0
        protected void gridRoomList_OnPreRowDataBound(object sender, FineUI.GridPreRowEventArgs e)
        {
            DateTime        selectedDate = this.dpStartDate.SelectedDate.Value;
            DateTime        nowDate      = SeatManage.Bll.ServiceDateTime.Now;
            DataRowView     row          = e.DataItem as DataRowView;
            string          roomSet      = row[5].ToString();
            LinkButtonField lbf          = gridRoomList.FindColumn("seatUsedView") as LinkButtonField;

            if (string.IsNullOrEmpty(roomSet))
            {
                lbf.Icon           = Icon.BulletCross;
                lbf.ToolTip        = "该阅览室没有配置";
                lbf.EnablePostBack = false;
                lbf.Enabled        = false;
                return;
            }
            if (selectedDate.CompareTo(nowDate) <= 0)
            {
                //选择日期小于或者等于当前日期
                lbf.Icon           = Icon.BulletCross;
                lbf.ToolTip        = "日期选择错误";
                lbf.EnablePostBack = false;
                lbf.Enabled        = false;
                return;
            }
            try
            {
                SeatManage.ClassModel.ReadingRoomSetting set = new SeatManage.ClassModel.ReadingRoomSetting(roomSet);

                if (!set.SeatBespeak.Used || set.RoomOpenSet.UninterruptibleModel)
                {
                    lbf.Icon           = Icon.BulletCross;
                    lbf.ToolTip        = "阅览室没有开放预约";
                    lbf.EnablePostBack = false;
                    lbf.Enabled        = false;
                    return;
                }
                if (!dateBespeak(set.SeatBespeak, nowDate))
                {
                    lbf.Icon           = Icon.BulletCross;
                    lbf.ToolTip        = "该日期座位不能预约";
                    lbf.EnablePostBack = false;
                    lbf.Enabled        = false;
                    return;
                }
                if (!timeCanBespeak(set.SeatBespeak, nowDate))
                {
                    lbf.Icon           = Icon.BulletCross;
                    lbf.ToolTip        = string.Format("预约时间为:{0}到{1}", set.SeatBespeak.CanBespeatTimeSpace.BeginTime, set.SeatBespeak.CanBespeatTimeSpace.EndTime);
                    lbf.EnablePostBack = false;
                    lbf.Enabled        = false;
                    return;
                }

                int canBespeakAmount = int.Parse(row[4].ToString());
                if (canBespeakAmount <= 0)
                {
                    lbf.Icon    = Icon.BulletCross;
                    lbf.ToolTip = "座位已被全部预约";
                    lbf.Enabled = false;
                }
                else
                {
                    lbf.Icon    = Icon.Zoom;
                    lbf.ToolTip = "预约座位";
                    lbf.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                FineUI.Alert.Show(string.Format("阅览室设置不正确:{0}", ex.Message));
            }
            string roomNum = row[0].ToString();

            lbf.EnablePostBack = false;
            //加密
            string urlParameters = SeatManage.SeatManageComm.AESAlgorithm.DESEncode(string.Format("roomNo={0}&date={1}", roomNum, this.dpStartDate.SelectedDate.Value.ToBinary()));

            lbf.OnClientClick = WindowEdit.GetShowReference("BespeakSeatLayout.aspx?Param=" + urlParameters, "座位视图");
            //原版
            //lbf.OnClientClick = WindowEdit.GetShowReference(string.Format("BespeakSeatLayout.aspx?roomId={0}&date={1}", roomNum, this.dpStartDate.SelectedDate.Value.ToBinary()), "座位视图");
        }