Beispiel #1
0
        /// <summary>
        /// 根据卡列号更新读者信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static SeatManage.EnumType.HandleResult UpdateByCardId(SeatManage.ClassModel.ReaderInfo model)
        {
            IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService();
            bool error = false;

            try
            {
                return(seatService.UpdateReaderInfoByCardId(model));
            }
            catch (FaultException ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("根据卡列号更新读者信息:" + ex.Message);
                return(EnumType.HandleResult.Failed);
            }
            finally
            {
                ICommunicationObject ICommObjectService = seatService as ICommunicationObject;
                try
                {
                    if (ICommObjectService.State == CommunicationState.Faulted)
                    {
                        ICommObjectService.Abort();
                    }
                    else
                    {
                        ICommObjectService.Close();
                    }
                }
                catch
                {
                    ICommObjectService.Abort();
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// 根据学号获取读者信息
 /// </summary>
 /// <param name="cardNum"></param>
 /// <returns></returns>
 public string GetBaseReaderInfo(string cardNum)
 {
     try
     {
         SeatManage.ClassModel.ReaderInfo reader = seatDataService.GetReader(cardNum, false);
         if (reader != null)
         {
             JM_ReaderInfo jm_Reader = new JM_ReaderInfo();
             jm_Reader.CardId = reader.CardID;
             jm_Reader.CardNo = reader.CardNo;
             jm_Reader.Name   = reader.Name;
             jm_Reader.Sex    = reader.Sex;
             return(SeatManage.SeatManageComm.JSONSerializer.Serialize(jm_Reader));
         }
         else
         {
             JM_HandleResult result = new JM_HandleResult();
             result.Result = false;
             result.Msg    = "对不起,此读者信息不存在";
             return(SeatManage.SeatManageComm.JSONSerializer.Serialize(result));
         }
     }
     catch (Exception ex)
     {
         SeatManage.SeatManageComm.WriteLog.Write("根据学号获取读者信息遇到异常:" + ex.Message);
         JM_HandleResult result = new JM_HandleResult();
         result.Result = false;
         result.Msg    = "执行遇到异常!";
         return(SeatManage.SeatManageComm.JSONSerializer.Serialize(result));
     }
 }
 public override void DataBind()
 {
     SeatManage.ClassModel.ReaderInfo reader = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);
     if (!reader.PecketWebSetting.UseBookSeat)
     {
         btn_book.Visible = false;
     }
     if (!reader.PecketWebSetting.UseWaitSeat)
     {
         btn_WaitSeat.Visible = false;
     }
 }
Beispiel #4
0
        /// <summary>
        /// 根据卡列号更新读者信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static SeatManage.EnumType.HandleResult UpdateByCardId(SeatManage.ClassModel.ReaderInfo model)
        {
            IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService();
            bool error = false;

            try
            {
                return(seatService.UpdateReaderInfoByCardId(model));
            }
            catch (FaultException ex)
            {
                error = true;
                SeatManageComm.WriteLog.Write("根据卡列号更新读者信息:" + ex.Message);
                return(EnumType.HandleResult.Failed);
            }
        }
Beispiel #5
0
        public override void DataBind()
        {
            SeatManage.ClassModel.ReaderInfo reader = handler.GetReaderInfo(this.UserSchoolInfo, this.LoginUserInfo.CardNo);
            if (reader.AtReadingRoom == null)
            {
                return;
            }

            SeatManage.ClassModel.ReadingRoomSetting roomSet = reader.AtReadingRoom.Setting;
            if (roomSet.SeatUsedTimeLimit.Used && roomSet.SeatUsedTimeLimit.IsCanContinuedTime)
            {
                this.btn_ContinuedWhen.Visible = true;
            }
            else
            {
                this.btn_ContinuedWhen.Visible = false;
            }
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool UpdateByCardId(SeatManage.ClassModel.ReaderInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_SM_Reader set ");
            strSql.Append("CardNo=@CardNo,");
            strSql.Append("ReaderName=@ReaderName,");
            strSql.Append("Sex=@Sex,");
            strSql.Append("ReaderTypeName=@ReaderTypeName,");
            strSql.Append("ReaderDeptName=@ReaderDeptName,");
            strSql.Append("ReaderProName=@ReaderProName,");
            strSql.Append("Flag=@Flag");
            strSql.Append(" where CardId=@CardId ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CardNo",         SqlDbType.NVarChar, 20),
                new SqlParameter("@ReaderName",     SqlDbType.NVarChar, 30),
                new SqlParameter("@Sex",            SqlDbType.NVarChar,  1),
                new SqlParameter("@ReaderTypeName", SqlDbType.NVarChar, 30),
                new SqlParameter("@ReaderDeptName", SqlDbType.NVarChar, 30),
                new SqlParameter("@ReaderProName",  SqlDbType.NVarChar, 30),
                new SqlParameter("@Flag",           SqlDbType.NVarChar, 10),
                new SqlParameter("@CardID",         SqlDbType.NVarChar, 20)
            };
            parameters[0].Value = model.CardNo;
            parameters[1].Value = model.Name;
            parameters[2].Value = model.Sex;
            parameters[3].Value = model.ReaderType;
            parameters[4].Value = model.Dept;
            parameters[5].Value = model.Pro;
            parameters[6].Value = model.Flag;
            parameters[7].Value = model.CardID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #7
0
 /// <summary>
 /// 通过物理卡号获取学号
 /// </summary>
 /// <param name="cardId"></param>
 /// <returns></returns>
 private string GetCardNo(string cardId)
 {
     try
     {
         SeatManage.ClassModel.ReaderInfo reader = SeatManage.Bll.T_SM_Reader.GetReaderByCardId(cardId);
         if (reader != null)
         {
             return(reader.CardNo);
         }
         else
         {
             return(cardId);
         }
     }
     catch (Exception EX)
     {
         throw EX;
     }
 }
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(SeatManage.ClassModel.ReaderInfo model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_SM_Reader(");
            strSql.Append("CardNo,CardID,ReaderName,Sex,ReaderTypeName,ReaderDeptName,ReaderProName,Flag)");
            strSql.Append(" values (");
            strSql.Append("@CardNo,@CardID,@ReaderName,@Sex,@ReaderTypeName,@ReaderDeptName,@ReaderProName,@Flag)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CardNo",         SqlDbType.NVarChar,  20),
                new SqlParameter("@CardID",         SqlDbType.NVarChar,  20),
                new SqlParameter("@ReaderName",     SqlDbType.NVarChar,  30),
                new SqlParameter("@Sex",            SqlDbType.NVarChar,   1),
                new SqlParameter("@ReaderTypeName", SqlDbType.NVarChar, 300),
                new SqlParameter("@ReaderDeptName", SqlDbType.NVarChar, 300),
                new SqlParameter("@ReaderProName",  SqlDbType.NVarChar, 300),
                new SqlParameter("@Flag",           SqlDbType.NVarChar, 10)
            };
            parameters[0].Value = model.CardNo;
            parameters[1].Value = model.CardID;
            parameters[2].Value = model.Name;
            parameters[3].Value = model.Sex;
            parameters[4].Value = model.ReaderType;
            parameters[5].Value = model.Dept;
            parameters[6].Value = model.Pro;
            parameters[7].Value = model.Flag;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #9
0
        /// <summary>
        /// 绑定UI元素
        /// </summary>
        /// <param name="seatNo"></param>
        /// <param name="seatShortNo"></param>GetBespeakLogInfoBySeatNo
        void BindUIElement(string seatNo, string seatShortNo, DateTime date)
        {
            SeatManage.ClassModel.ReadingRoomInfo room           = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNo);
            SeatManage.Bll.T_SM_ReadingRoom       bllReadingRoom = new SeatManage.Bll.T_SM_ReadingRoom();
            foreach (DateTime dt in room.Setting.SeatBespeak.SpecifiedTimeList)
            {
                DropDownList_Time.Items.Add(new FineUI.ListItem(dt.ToShortTimeString(), dt.ToShortTimeString()));
            }
            DateTime minTime = DateTime.Parse(date.ToShortDateString() + " " + bllReadingRoom.GetRoomOpenTimeByDate(room.Setting, date.ToShortDateString()).BeginTime);

            while (true)
            {
                minTime = minTime.AddMinutes(10);
                if (minTime.Date > date.Date)
                {
                    break;
                }
                if (Code.NowReadingRoomState.ReadingRoomOpenState(room.Setting.RoomOpenSet, minTime) == SeatManage.EnumType.ReadingRoomStatus.Close)
                {
                    continue;
                }
                DropDownList_FreeTime.Items.Add(new FineUI.ListItem(minTime.ToShortTimeString(), minTime.ToShortTimeString()));
            }
            if (!room.Setting.SeatBespeak.SpecifiedBespeak)
            {
                rblModel.Hidden = true;
            }
            if (rblModel.SelectedValue == "0")
            {
                DropDownList_FreeTime.Hidden = true;
                DropDownList_Time.Hidden     = true;
            }
            else
            {
                if (!room.Setting.SeatBespeak.SpecifiedTime)
                {
                    DropDownList_Time.Hidden     = true;
                    DropDownList_FreeTime.Hidden = false;
                }
                else
                {
                    DropDownList_FreeTime.Hidden = true;
                    DropDownList_Time.Hidden     = false;
                }
            }
            lblbeginDate.Text     = date.ToShortDateString();
            this.lblSeatNo.Text   = seatShortNo;
            this.lblRoomName.Text = room.Name;
            //判断自己是否已经预约座位
            List <SeatManage.EnumType.BookingStatus> bespeakStatus = new List <SeatManage.EnumType.BookingStatus>();

            bespeakStatus.Add(SeatManage.EnumType.BookingStatus.Waiting);
            List <SeatManage.ClassModel.BespeakLogInfo> readerBespeaklist = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoByCardNo(this.LoginId, date);//.GetBespeakList(this.LoginId, null, date, 0, bespeakStatus);

            if (readerBespeaklist.Count > 0)
            {
                FineUI.Alert.ShowInTop("您选择的日期已经预约了座位,请先取消原来的预约。");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断座位是否被别人预约
            List <SeatManage.ClassModel.BespeakLogInfo> list = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoBySeatNo(seatNo, date);

            roomOpenTime.Value   = bllReadingRoom.GetRoomOpenTimeByDate(room.Setting, date.ToShortDateString()).BeginTime;
            this.lblEndDate.Text = bespeakSureTimeSpan(room.Setting);
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].BsepeakState == SeatManage.EnumType.BookingStatus.Waiting)
                {
                    FineUI.Alert.ShowInTop("座位已经被别人预约,请预约其他座位");
                    btnBespeak.Enabled = false;
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            //判断是否已加入黑名单
            List <SeatManage.ClassModel.BlackListInfo> blacklistInfoByCardNo = SeatManage.Bll.T_SM_Blacklist.GetBlackListInfo(this.LoginId);

            SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            if (room.Setting.UsedBlacklistLimit && blacklistInfoByCardNo.Count > 0)
            {
                if (room.Setting.BlackListSetting.Used)
                {
                    bool isblack = false;
                    foreach (SeatManage.ClassModel.BlackListInfo blinfo in blacklistInfoByCardNo)
                    {
                        if (blinfo.ReadingRoomID == room.No)
                        {
                            isblack = true;
                            break;
                        }
                    }
                    if (isblack)
                    {
                        FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
                else
                {
                    FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                    PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            if (room.Setting.LimitReaderEnter.Used)
            {
                SeatManage.ClassModel.ReaderInfo readerInfo = SeatManage.Bll.EnterOutOperate.GetReaderInfo(this.LoginId);
                string[] litype = room.Setting.LimitReaderEnter.ReaderTypes.Split(';');
                if (!room.Setting.LimitReaderEnter.CanEnter)
                {
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                            PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                            return;
                        }
                    }
                }
                else
                {
                    bool isintype = false;
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            isintype = true;
                            break;
                        }
                    }
                    if (!isintype)
                    {
                        FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
            }

            btnBespeak.Enabled = true;
        }
        /// <summary>
        /// 绑定UI元素
        /// </summary>
        /// <param name="seatNo"></param>
        /// <param name="seatShortNo"></param>GetBespeakLogInfoBySeatNo
        void BindUIElement(string seatNo, string seatShortNo, DateTime date)
        {
            SeatManage.ClassModel.ReadingRoomInfo room           = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(roomNo);
            SeatManage.Bll.T_SM_ReadingRoom       bllReadingRoom = new SeatManage.Bll.T_SM_ReadingRoom();
            foreach (DateTime dt in room.Setting.SeatBespeak.SpecifiedTimeList)
            {
                if (dt <= date)
                {
                    continue;
                }
                DropDownList_Time.Items.Add(new FineUI.ListItem(dt.ToShortTimeString(), dt.ToShortTimeString()));
            }
            DateTime minTime = date.AddMinutes(10 - date.Minute % 10);

            while (true)
            {
                minTime = minTime.AddMinutes(10);
                if (minTime.Date > date.Date)
                {
                    break;
                }
                if (Code.NowReadingRoomState.ReadingRoomOpenState(room.Setting.RoomOpenSet, minTime) == SeatManage.EnumType.ReadingRoomStatus.Close)
                {
                    continue;
                }
                DropDownList_FreeTime.Items.Add(new FineUI.ListItem(minTime.ToShortTimeString(), minTime.ToShortTimeString()));
            }
            if (!room.Setting.SeatBespeak.SpecifiedBespeak)
            {
                rblModel.Hidden = true;
            }
            if (rblModel.SelectedValue == "0")
            {
                DropDownList_FreeTime.Hidden = true;
                DropDownList_Time.Hidden     = true;
            }
            else
            {
                if (!room.Setting.SeatBespeak.SpecifiedTime)
                {
                    DropDownList_Time.Hidden     = true;
                    DropDownList_FreeTime.Hidden = false;
                }
                else
                {
                    DropDownList_FreeTime.Hidden = true;
                    DropDownList_Time.Hidden     = false;
                }
            }
            lblbeginDate.Text     = date.ToShortDateString();
            this.lblSeatNo.Text   = seatShortNo;
            this.lblRoomName.Text = room.Name;
            //判断自己是否已经预约座位
            List <SeatManage.EnumType.BookingStatus> bespeakStatus = new List <SeatManage.EnumType.BookingStatus>();

            bespeakStatus.Add(SeatManage.EnumType.BookingStatus.Waiting);
            List <SeatManage.ClassModel.BespeakLogInfo> readerBespeaklist = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoByCardNo(this.LoginId, date);//.GetBespeakList(this.LoginId, null, date, 0, bespeakStatus);

            if (readerBespeaklist.Count > 0)
            {
                FineUI.Alert.ShowInTop("您今天已有预约的座位,请先取消原来的预约。");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断可预约次数是否超过
            readerBespeaklist = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakList(this.LoginId, null, date, 0, new List <SeatManage.EnumType.BookingStatus> {
                SeatManage.EnumType.BookingStatus.Confinmed
            });                                                                                                                                                                                          //.GetBespeakList(this.LoginId, null, date, 0, bespeakStatus);
            if (readerBespeaklist.Count >= room.Setting.SeatBespeak.BespeakSeatCount)
            {
                FineUI.Alert.ShowInTop("您一天只能预约" + room.Setting.SeatBespeak.BespeakSeatCount + "次座位。");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断读者是否有座位
            if (!room.Setting.SeatBespeak.BespeatWithOnSeat)
            {
                SeatManage.ClassModel.EnterOutLogInfo eol = SeatManage.Bll.T_SM_EnterOutLog.GetEnterOutLogInfoByCardNo(this.LoginId);
                if (eol != null && eol.EnterOutState != SeatManage.EnumType.EnterOutLogType.Leave)
                {
                    FineUI.Alert.ShowInTop("您已有座位,不能再预约座位");
                    btnBespeak.Enabled = false;
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            //判断操作次数
            if (SeatManage.Bll.EnterOutOperate.CheckReaderChooseSeatTimesByReadingRoom(this.LoginId, room.Setting.PosTimes, room.No))
            {
                FineUI.Alert.ShowInTop("您的选座/预约操作过于频繁,请稍后重试");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断座位是否被别人使用
            SeatManage.ClassModel.Seat seat = SeatManage.Bll.T_SM_Seat.GetSeatInfoBySeatNo(seatNo);
            if (seat.SeatUsedState != SeatManage.EnumType.EnterOutLogType.Leave)
            {
                FineUI.Alert.ShowInTop("座位已经被别人选择,请预约其他座位");
                btnBespeak.Enabled = false;
                PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                return;
            }
            //判断座位是否被预约
            List <SeatManage.ClassModel.BespeakLogInfo> list = SeatManage.Bll.T_SM_SeatBespeak.GetBespeakLogInfoBySeatNo(seatNo, date);

            seatKeepTime.Value   = room.Setting.SeatBespeak.SeatKeepTime.ToString();
            this.lblEndDate.Text = string.Format("{0}至{1}", date.ToShortTimeString(), date.AddMinutes(room.Setting.SeatBespeak.SeatKeepTime).ToShortTimeString());
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].BsepeakState == SeatManage.EnumType.BookingStatus.Waiting)
                {
                    FineUI.Alert.ShowInTop("座位已经被别人预约,请预约其他座位");
                    btnBespeak.Enabled = false;
                    PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            //判断是否已加入黑名单
            List <SeatManage.ClassModel.BlackListInfo> blacklistInfoByCardNo = SeatManage.Bll.T_SM_Blacklist.GetBlackListInfo(this.LoginId);

            SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting();
            if (room.Setting.UsedBlacklistLimit && blacklistInfoByCardNo.Count > 0)
            {
                if (room.Setting.BlackListSetting.Used)
                {
                    bool isblack = false;
                    foreach (SeatManage.ClassModel.BlackListInfo blinfo in blacklistInfoByCardNo)
                    {
                        if (blinfo.ReadingRoomID == room.No)
                        {
                            isblack = true;
                            break;
                        }
                    }
                    if (isblack)
                    {
                        FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
                else
                {
                    FineUI.Alert.ShowInTop("你已进入黑名单,不能在该阅览室预约座位");
                    PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                    return;
                }
            }
            if (room.Setting.LimitReaderEnter.Used)
            {
                SeatManage.ClassModel.ReaderInfo readerInfo = SeatManage.Bll.EnterOutOperate.GetReaderInfo(this.LoginId);
                string[] litype = room.Setting.LimitReaderEnter.ReaderTypes.Split(';');
                if (!room.Setting.LimitReaderEnter.CanEnter)
                {
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                            PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                            return;
                        }
                    }
                }
                else
                {
                    bool isintype = false;
                    foreach (string type in litype)
                    {
                        if (type == readerInfo.ReaderType)
                        {
                            isintype = true;
                            break;
                        }
                    }
                    if (!isintype)
                    {
                        FineUI.Alert.ShowInTop("你的读者类型不能在该阅览室预约座位");
                        PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference());
                        return;
                    }
                }
            }

            btnBespeak.Enabled = true;
        }