Пример #1
0
 /// <summary>
 /// 刷新读者状态
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void btnRefresh_Click(object sender, EventArgs e)
 {
     this.LoginUserInfo = BespeakHandler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);
     ShowReaderState();
 }
Пример #2
0
        /// <summary>
        /// 绑定预约座位列表
        /// </summary>
        /// <param name="readingRoomNo">阅览室编号</param>
        /// <param name="conn"></param>
        private void BindBookSeat(string readingRoomId, string bookDate)
        {
            try
            {
                if (selReadingRoom.SelectedIndex == -1)
                {
                    spanWarmInfo.Visible   = true;
                    spanWarmInfo.InnerText = "请选择阅览室";
                    return;
                }
                string      readingRoomNo = selReadingRoom.Items[selReadingRoom.SelectedIndex].Value;
                List <Seat> seats         = BespeakHandler.GetBookSeatList(this.UserSchoolInfo, DateTime.Parse(bookDate), readingRoomNo);
                if (seats.Count <= 0)
                {
                    spanWarmInfo.Visible   = true;
                    spanWarmInfo.InnerText = "您选择的日期已经没有可预约的座位。";
                }
                List <SeatManage.ClassModel.ReadingRoomInfo> roomList = BespeakHandler.GetCanBespeakReaderRoomInfo(this.UserSchoolInfo, DateTime.Parse(bookDate));
                if (roomList.Count > 0)
                {
                    foreach (SeatManage.ClassModel.ReadingRoomInfo room in roomList)
                    {
                        if (room.No == readingRoomNo)
                        {
                            if (room.Setting.LimitReaderEnter.Used)
                            {
                                bool isenter = false;
                                if (room.Setting.LimitReaderEnter.CanEnter)
                                {
                                    foreach (string t in room.Setting.LimitReaderEnter.ReaderTypes.Split(';'))
                                    {
                                        if (t == this.LoginUserInfo.ReaderType)
                                        {
                                            isenter = true;
                                        }
                                    }
                                }
                                else
                                {
                                    isenter = true;
                                    foreach (string t in room.Setting.LimitReaderEnter.ReaderTypes.Split(';'))
                                    {
                                        if (t == this.LoginUserInfo.ReaderType)
                                        {
                                            isenter = false;
                                        }
                                    }
                                }
                                if (!isenter)
                                {
                                    seats = new List <Seat>();
                                    spanWarmInfo.Visible   = true;
                                    spanWarmInfo.InnerText = "您的读者类型不允许在此阅览室预约。";
                                }
                            }
                            if (room.Setting.SeatBespeak.BespeakArea.BespeakType == BespeakAreaType.Percentage)
                            {
                                int stopSeatCount = 0;
                                foreach (KeyValuePair <string, Seat> item in room.SeatList.Seats)
                                {
                                    if (item.Value.IsSuspended)
                                    {
                                        stopSeatCount++;
                                    }
                                }
                                int bookdCount   = room.SeatList.Seats.Count - seats.Count;
                                int canbookCount = (int)((room.SeatList.Seats.Count - stopSeatCount) * room.Setting.SeatBespeak.BespeakArea.Scale);
                                if (bookdCount >= canbookCount)
                                {
                                    seats = new List <Seat>();
                                    spanWarmInfo.Visible   = true;
                                    spanWarmInfo.InnerText = "您选择的日期已经没有可预约的座位。";
                                }
                            }
                            break;
                        }
                    }
                }

                DataListBookSeat.DataSource = seats;
                DataListBookSeat.DataBind();
                hidBookDate.Value = bookDate;
                hidRrId.Value     = readingRoomId;
            }
            catch (Exception ex)
            {
                spanWarmInfo.Visible        = true;
                spanWarmInfo.InnerText      = ex.Message;
                DataListBookSeat.DataSource = null;
                DataListBookSeat.DataBind();
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.LoginUserInfo == null || this.UserSchoolInfo == null)
            {
                Response.Redirect("Login.aspx");
                return;
            }
            int refreshNum = SeatManage.SeatManageComm.CookiesManager.RefreshNum;

            refreshNum += 1;
            SeatManage.SeatManageComm.CookiesManager.RefreshNum = refreshNum;
            //string cardNo = Session["CardNo"].ToString();
            //string conn = Session["SchoolConnectionString"].ToString();
            //string name = Session["Name"].ToString();
            //string schoolId = Session["SessionSchoolId"].ToString();
            // ReaderInfo reader = this.LoginUserInfo;
            if (IsPostBack)
            {
                try
                {
                    this.LoginUserInfo = BespeakHandler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);
                }
                catch (Exception ex)
                {
                    Response.Redirect("Login.aspx");
                }
            }
            ShowReaderState();
            spanWarmInfo.InnerText = "";
            spanWarmInfo.Visible   = false;
            if (!Page.IsPostBack && refreshNum < 2)
            {
            }
            else
            {
                cmd = Request.Form["subCmd"];
                //SeatManage.IPocketBookOnlineBll.IMainFunctionPageBll mainFunctionBll = new SeatManage.PocketBookOnLine.Bll.MainFunctionBll();
                //ReadingRoomStatus roomState = new ReadingRoomStatus();
                //if (this.LoginUserInfo.AtReadingRoom != null)
                //{
                //    roomState = SeatManage.Bll.NowReadingRoomState.ReadingRoomOpenState(this.LoginUserInfo.AtReadingRoom.Setting.RoomOpenSet, DateTime.Now);
                //}

                switch (cmd)
                {
                case "shortLeave":
                    shortLeaveHandle();                                                                                //设置读者暂离
                    this.LoginUserInfo = BespeakHandler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo); //重新绑定读者状态
                    ShowReaderState();
                    break;

                case "leave":
                    //释放读者座位
                    freeSeat();
                    this.LoginUserInfo = BespeakHandler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);
                    ShowReaderState();
                    break;

                case "LoginOut":
                    this.BespeakHandler = null;
                    Session.Clear();
                    Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(-1);
                    SeatManage.SeatManageComm.CookiesManager.RefreshNum = 0;
                    Response.Redirect("Login.aspx");
                    break;
                }
            }
        }