protected void Page_Load(object sender, EventArgs e)
        {
            string strparam = Request.QueryString["param"];

            if (string.IsNullOrEmpty(strparam))
            {
                spanWarmInfo.InnerText = "非正常的访问!";
                divHanderPanel.Style.Add("display", "none");
                return;
            }
            Code.ScanCodeParamModel param = new Code.ScanCodeParamModel(strparam);
            if (Request.Cookies["userInfo"] != null)//存在记录的cookies信息
            {
                cardNo              = CookiesManager.GetCookiesValue(CookiesManager.LoginID);
                password            = CookiesManager.GetCookiesValue(CookiesManager.Password);
                schoolId            = CookiesManager.GetCookiesValue(CookiesManager.SchoolId);
                connection          = CookiesManager.GetCookiesValue(CookiesManager.ConnectionString);
                this.UserSchoolInfo = new AMS.Model.AMS_School()
                {
                    Id = int.Parse(schoolId), ConnectionString = connection
                };
                if (this.BespeakHandler == null)
                {
                    this.BespeakHandler = new TcpClient_BespeakSeat.TcpClient_BespeakSeatAllMethod(UserSchoolInfo);
                }
            }
            else
            {
                Response.Redirect(string.Format("/Login.aspx?url=/BookSeat/ScanCode.aspx?param={0}", strparam));
            }
            if (!IsPostBack)
            {
                DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
            }
            else
            {
                string cmd = Request.Form["subCmd"];
                string result;
                switch (cmd)
                {
                case "changeSeat":
                    result = this.BespeakHandler.ChangeSeat(this.UserSchoolInfo, cardNo, param.SeatNum, param.ReadingRoomNum);
                    if (!string.IsNullOrEmpty(result))
                    {
                        this.spanWarmInfo.InnerText = result;
                    }
                    else
                    {
                        this.spanWarmInfo.InnerText = "更换座位成功";
                        DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
                        //this.divHanderPanel.Style.Add("display", "none");
                    }
                    break;

                case "bespeak":
                    SeatManage.ClassModel.BespeakLogInfo bespeakModel = new SeatManage.ClassModel.BespeakLogInfo();
                    bespeakModel.BsepeakState = SeatManage.EnumType.BookingStatus.Waiting;
                    DateTime bespeatDate = DateTime.Parse(string.Format("{0} {1}", DateTime.Now.AddDays(1).ToShortDateString(), lblBookTime.InnerText));
                    bespeakModel.BsepeakTime   = bespeatDate;
                    bespeakModel.CardNo        = cardNo;
                    bespeakModel.ReadingRoomNo = param.ReadingRoomNum;
                    bespeakModel.Remark        = string.Format("读者通过扫码预约座位");
                    bespeakModel.SeatNo        = param.SeatNum;
                    bespeakModel.SubmitTime    = DateTime.Now;
                    try
                    {
                        result = this.BespeakHandler.SubmitBespeakInfo(this.UserSchoolInfo, bespeakModel);
                        lblBeapeakMsg.InnerText = result;
                    }
                    catch
                    (Exception ex)
                    {
                        lblBeapeakMsg.InnerText = ex.Message;
                    }
                    break;
                }
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string strparam = Request.QueryString["param"];

            if (string.IsNullOrEmpty(strparam))
            {
                spanWarmInfo.InnerText = "非正常的访问!";
                divHanderPanel.Style.Add("display", "none");
                return;
            }

            Code.ScanCodeParamModel param = new Code.ScanCodeParamModel(strparam);
            seatNo        = param.SeatNum;
            readingRoomNo = param.ReadingRoomNum;
            if (this.LoginUserInfo != null)//存在记录的cookies信息
            {
                cardNo = this.LoginUserInfo.CardNo;
            }
            else
            {
                string url = Request.Url.AbsoluteUri;
                //string url = "/QRcodeDecode/SeatInfo.aspx?param=" + strparam;
                Response.Redirect(LoginUrl() + "?url=" + url);
            }
            //UserInfo user = SeatManage.Bll.Users_ALL.GetUserInfo(cardNo);
            //SeatManage.ClassModel.ManagerPotency potency = SeatManage.Bll.T_SM_ManagerPotency.GetManangePotencyByLoginID(cardNo);
            //if (user == null || user.UserType != SeatManage.EnumType.UserType.Admin || potency.RightRoomList.All(u => u.No != readingRoomNo))
            //{
            //    spanWarmInfo.InnerText = "您没有权限!";
            //    divHanderPanel.Style.Add("display", "none");
            //    return;
            //}



            if (!IsPostBack)
            {
                //DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
                ShowReaderState();
            }
            else
            {
                string cmd = Request.Form["subCmd"];
                string result;
                switch (cmd)
                {
                case "changeSeat":
                    result = ((SeatManage.IPocketBespeak.IMainFunctionPage_Ex)handler).ChangeSeat(this.UserSchoolInfo, cardNo, param.SeatNum, param.ReadingRoomNum);
                    if (!string.IsNullOrEmpty(result))
                    {
                        this.spanWarmInfo.InnerText = result;
                    }
                    else
                    {
                        this.spanWarmInfo.InnerText = "更换座位成功";
                        //DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
                        ShowReaderState();
                        //this.divHanderPanel.Style.Add("display", "none");
                    }
                    break;

                case "selectSeat":
                    result = ((SeatManage.IPocketBespeak.IMainFunctionPage_Ex)handler).SelectSeat(this.UserSchoolInfo, cardNo, param.SeatNum, param.ReadingRoomNum);
                    if (!string.IsNullOrEmpty(result))
                    {
                        this.spanWarmInfo.InnerText = result;
                    }
                    else
                    {
                        this.spanWarmInfo.InnerText = "选择座位成功";
                        //DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
                        ShowReaderState();
                        //this.divHanderPanel.Style.Add("display", "none");
                    }
                    break;

                case "waitSeat":
                    if (!handler2.IsCanWaitSeat(this.UserSchoolInfo, this.LoginUserInfo.CardNo, readingRoomNo))
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "您等待座位的间隔过短,请稍后重试。";
                    }
                    else
                    {
                        WaitSeatLogInfo waitInfo = new WaitSeatLogInfo();
                        waitInfo.CardNo       = this.LoginUserInfo.CardNo;
                        waitInfo.SeatNo       = seatNo;
                        waitInfo.NowState     = SeatManage.EnumType.LogStatus.Valid;
                        waitInfo.OperateType  = SeatManage.EnumType.Operation.Reader;
                        waitInfo.WaitingState = SeatManage.EnumType.EnterOutLogType.Waiting;
                        result = handler2.SubmitWaitInfo(this.UserSchoolInfo, waitInfo);
                        if (!string.IsNullOrEmpty(result))
                        {
                            this.spanWarmInfo.InnerText = result;
                        }
                        else
                        {
                            this.spanWarmInfo.InnerText = "等待座位成功";
                        }
                    }
                    ShowReaderState();
                    break;

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

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

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

                case "ContinuedWhen":
                    this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);
                    if (this.LoginUserInfo.EnterOutLog != null && this.LoginUserInfo.EnterOutLog.EnterOutState != EnterOutLogType.Leave)
                    {
                        switch (this.LoginUserInfo.EnterOutLog.EnterOutState)
                        {
                        case EnterOutLogType.BookingConfirmation:
                        case EnterOutLogType.SelectSeat:
                        case EnterOutLogType.ContinuedTime:
                        case EnterOutLogType.ComeBack:
                        case EnterOutLogType.ReselectSeat:
                        case EnterOutLogType.WaitingSuccess:
                            this.LoginUserInfo.EnterOutLog.Remark        = "通过手机预约网站延长座位使用时间";
                            this.LoginUserInfo.EnterOutLog.EnterOutState = EnterOutLogType.ContinuedTime;
                            ContinuedWhen();
                            ShowReaderState();
                            break;

                        case EnterOutLogType.ShortLeave:
                            spanWarmInfo.Visible   = true;
                            spanWarmInfo.InnerText = "续时失败,你处于暂离状态";
                            break;
                        }
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "续时失败,您还没有选座";
                    }
                    break;

                case "ComeBack":
                    this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);
                    if (this.LoginUserInfo.EnterOutLog != null && this.LoginUserInfo.EnterOutLog.EnterOutState == EnterOutLogType.ShortLeave)
                    {
                        this.LoginUserInfo.EnterOutLog.Remark        = "通过手机预约网站恢复在座";
                        this.LoginUserInfo.EnterOutLog.EnterOutState = EnterOutLogType.ComeBack;
                        ComeBack();
                        ShowReaderState();
                        break;
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "暂离回来失败,您还没有暂离";
                    }
                    break;

                case "cancel":
                    CancelBookLog(bookNo);
                    confrimSeat();
                    //this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);//重新绑定读者状态
                    ShowReaderState();
                    break;

                case "CancelWait":
                    if (this.LoginUserInfo.WaitSeatLog != null)
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = handler2.CancelWait(this.UserSchoolInfo, this.LoginUserInfo.WaitSeatLog);
                        ShowReaderState();
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有等待的座位";
                    }
                    break;

                case "CancelBook":
                    if (this.LoginUserInfo.BespeakLog != null && this.LoginUserInfo.BespeakLog.Count > 0)
                    {
                        spanWarmInfo.Visible = true;
                        if (handler1.UpdateBookLogsState(this.UserSchoolInfo, int.Parse(this.LoginUserInfo.BespeakLog[0].BsepeaklogID)))
                        {
                            spanWarmInfo.InnerText = "取消预约成功";
                            //confrimSeat();
                            //this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);//重新绑定读者状态
                            ShowReaderState();
                        }
                        else
                        {
                            spanWarmInfo.InnerText = "取消预约取消失败";
                        }
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有预约的座位";
                    }
                    break;

                case "BookConfirm":
                    if (this.LoginUserInfo.BespeakLog != null && this.LoginUserInfo.BespeakLog.Count > 0)
                    {
                        confrimSeat();
                        //this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);//重新绑定读者状态
                        ShowReaderState();
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有预约的座位";
                    }
                    break;
                }
                subCmd.Value = "";
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string strparam = Request.QueryString["param"];

            if (string.IsNullOrEmpty(strparam))
            {
                spanWarmInfo.InnerText = "非正常的访问!";
                divHanderPanel.Style.Add("display", "none");
                return;
            }
            Code.ScanCodeParamModel param = new Code.ScanCodeParamModel(strparam);
            seatNo        = param.SeatNum;
            readingRoomNo = param.ReadingRoomNum;
            //if (Request.Cookies["userInfo"] != null)//存在记录的cookies信息
            //{
            //    cardNo = this.LoginUserInfo.CardNo;
            //}
            if (this.LoginUserInfo != null)//存在记录的cookies信息
            {
                cardNo = this.LoginUserInfo.StudentNo;
            }
            else
            {
                string url = Request.Url.AbsoluteUri;
                //string url = "/QRcodeDecode/SeatInfo.aspx?param=" + strparam;
                Response.Redirect(LoginUrl() + "?url=" + url);
            }
            if (!IsPostBack)
            {
                //DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
                ShowReaderState();
            }
            else
            {
                string cmd = Request.Form["subCmd"];
                string result;
                switch (cmd)
                {
                case "changeSeat":
                    result = weiXinService.ChangeSeat(LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.SeatNo,
                                                      LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.RoomNo, LoginUserInfo.StudentNo,
                                                      UserSchoolInfo.SchoolNo);
                    if (!string.IsNullOrEmpty(result))
                    {
                        spanWarmInfo.InnerText = result;
                    }
                    else
                    {
                        spanWarmInfo.InnerText = "更换座位成功";
                        //DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
                        ShowReaderState();
                        //this.divHanderPanel.Style.Add("display", "none");
                    }
                    break;

                    #region 注释
                case "selectSeat":
                    //此方法需要修改
                    result = "";
                    //result = ((SeatManage.IPocketBespeak.IMainFunctionPage_Ex)handler).SelectSeat(this.UserSchoolInfo, cardNo, param.SeatNum, param.ReadingRoomNum);
                    if (!string.IsNullOrEmpty(result))
                    {
                        this.spanWarmInfo.InnerText = result;
                    }
                    else
                    {
                        this.spanWarmInfo.InnerText = "选择座位成功";
                        //DataBind(cardNo, param.SeatNum, param.ReadingRoomNum);
                        ShowReaderState();
                        //this.divHanderPanel.Style.Add("display", "none");
                    }
                    break;

                    //case "waitSeat":
                    //    if (!handler2.IsCanWaitSeat(this.UserSchoolInfo, this.LoginUserInfo.StudentNo, readingRoomNo))
                    //    {
                    //        spanWarmInfo.Visible = true;
                    //        spanWarmInfo.InnerText = "您等待座位的间隔过短,请稍后重试。";
                    //    }
                    //    else
                    //    {
                    //        WaitSeatLogInfo waitInfo = new WaitSeatLogInfo();
                    //        waitInfo.CardNo = this.LoginUserInfo.StudentNo;
                    //        waitInfo.SeatNo = seatNo;
                    //        waitInfo.NowState = SeatManage.EnumType.LogStatus.Valid;
                    //        waitInfo.OperateType = SeatManage.EnumType.Operation.Reader;
                    //        waitInfo.WaitingState = SeatManage.EnumType.EnterOutLogType.Waiting;
                    //        result = handler2.SubmitWaitInfo(this.UserSchoolInfo, waitInfo);
                    //        if (!string.IsNullOrEmpty(result))
                    //        {
                    //            this.spanWarmInfo.InnerText = result;
                    //        }
                    //        else
                    //        {
                    //            this.spanWarmInfo.InnerText = "等待座位成功";
                    //        }
                    //    }
                    //    ShowReaderState();
                    //    break;
                    #endregion
                case "shortLeave":
                    shortLeaveHandle();    //设置读者暂离
                    //this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);//重新绑定读者状态
                    ShowReaderState();
                    break;

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

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

                    #region 注释
                case "ContinuedWhen":
                    LoginUserInfo = weiXinService.GetUserInfo_WeiXin(LoginUserInfo.StudentNo, UserSchoolInfo.SchoolNo);
                    EnterOutLogType enterOutLogType = new EnterOutLogType();
                    enterOutLogType = (EnterOutLogType)Enum.Parse(typeof(EnterOutLogType), LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.EnterOutState);
                    if (LoginUserInfo.AjmReaderStatus.AjmEnterOutLog != null && enterOutLogType != EnterOutLogType.Leave)
                    {
                        switch (enterOutLogType)
                        {
                        case EnterOutLogType.BookingConfirmation:
                        case EnterOutLogType.SelectSeat:
                        case EnterOutLogType.ContinuedTime:
                        case EnterOutLogType.ComeBack:
                        case EnterOutLogType.ReselectSeat:
                        case EnterOutLogType.WaitingSuccess:
                            LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.Remark        = "通过手机预约网站延长座位使用时间";
                            LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.EnterOutState = EnterOutLogType.ContinuedTime.ToString();
                            ContinuedWhen();
                            ShowReaderState();
                            break;

                        case EnterOutLogType.ShortLeave:
                            spanWarmInfo.Visible   = true;
                            spanWarmInfo.InnerText = "续时失败,你处于暂离状态";
                            break;
                        }
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "续时失败,您还没有选座";
                    }
                    break;

                case "ComeBack":
                    LoginUserInfo = weiXinService.GetUserInfo_WeiXin(LoginUserInfo.StudentNo, UserSchoolInfo.SchoolNo);
                    if (this.LoginUserInfo.AjmReaderStatus.AjmEnterOutLog != null && (EnterOutLogType)Enum.Parse(typeof(EnterOutLogType), LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.EnterOutState) == EnterOutLogType.ShortLeave)
                    {
                        this.LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.Remark        = "通过手机预约网站恢复在座";
                        this.LoginUserInfo.AjmReaderStatus.AjmEnterOutLog.EnterOutState = EnterOutLogType.ComeBack.ToString();
                        ComeBack();
                        ShowReaderState();
                        break;
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "暂离回来失败,您还没有暂离";
                    }
                    break;

                    #endregion
                case "cancel":
                    CancelBookLog(bookNo);
                    confrimSeat();
                    //this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);//重新绑定读者状态
                    ShowReaderState();
                    break;

                case "CancelWait":
                    if (LoginUserInfo.AjmReaderStatus.AjmWaitSeatLogs != null)
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = weiXinService.CancelWait(LoginUserInfo.StudentNo, UserSchoolInfo.SchoolNo);
                        ShowReaderState();
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有等待的座位";
                    }
                    break;

                case "CancelBook":
                    if (LoginUserInfo.AjmReaderStatus.AjmBespeakLogs != null && LoginUserInfo.AjmReaderStatus.AjmBespeakLogs.Count > 0)
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = weiXinService.CancelBesapeakById(int.Parse(LoginUserInfo.AjmReaderStatus.AjmBespeakLogs[0].Id), UserSchoolInfo.SchoolNo);

                        ShowReaderState();
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有预约的座位";
                    }
                    break;

                case "BookConfirm":
                    if (LoginUserInfo.AjmReaderStatus.AjmBespeakLogs != null && this.LoginUserInfo.AjmReaderStatus.AjmBespeakLogs.Count > 0)
                    {
                        confrimSeat();
                        //this.LoginUserInfo = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);//重新绑定读者状态
                        ShowReaderState();
                    }
                    else
                    {
                        spanWarmInfo.Visible   = true;
                        spanWarmInfo.InnerText = "当前没有预约的座位";
                    }
                    break;
                }
                subCmd.Value = "";
            }
        }