/// <summary> /// 删除事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void VRGrid_RowCommand(object sender, FineUI.GridCommandEventArgs e) { if (e.CommandName == "ActionDelete") { SeatManage.ClassModel.ViolationRecordsLogInfo vrinfo = SeatManage.Bll.T_SM_ViolateDiscipline.GetViolationRecords(VRGrid.Rows[e.RowIndex].DataKeys[0].ToString()); if (vrinfo != null) { vrinfo.Flag = LogStatus.Fail; if (!SeatManage.Bll.T_SM_ViolateDiscipline.UpdateViolationRecords(vrinfo)) { FineUI.Alert.ShowInTop("删除失败!"); } //SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo(); //rni.CardNo = vrinfo.CardNo; //rni.AddTime = SeatManage.Bll.ServiceDateTime.Now; //rni.Note = string.Format("{0}记录的违规,{1},过期", vrinfo.EnterOutTime, vrinfo.Remark); //SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni); } else { FineUI.Alert.ShowInTop("删除失败!"); } BindGrid(); } }
protected void btn_btnLeave(object sender, EventArgs e) { SeatManage.ClassModel.EnterOutLogInfo enterOutLog = SeatManage.Bll.T_SM_EnterOutLog.GetUsingEnterOutLogBySeatNo(seatNo); SeatManage.ClassModel.ReadingRoomInfo roomInfo = SeatManage.Bll.T_SM_ReadingRoom.GetSingleRoomInfo(enterOutLog.ReadingRoomNo); enterOutLog.EnterOutState = SeatManage.EnumType.EnterOutLogType.Leave; enterOutLog.Flag = SeatManage.EnumType.Operation.Admin; enterOutLog.Remark = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId); int newId = -1; SeatManage.EnumType.HandleResult result = SeatManage.Bll.EnterOutOperate.AddEnterOutLog(enterOutLog, ref newId); if (result == SeatManage.EnumType.HandleResult.Successed) { SeatManage.ClassModel.RegulationRulesSetting rulesSet = SeatManage.Bll.T_SM_SystemSet.GetRegulationRulesSetting(); if (roomInfo.Setting.IsRecordViolate) { if (roomInfo.Setting.BlackListSetting.Used) { if (roomInfo.Setting.BlackListSetting.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin]) { SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.ViolationRecordsLogInfo(); violationRecords.CardNo = enterOutLog.CardNo; violationRecords.SeatID = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount); violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo; violationRecords.EnterOutTime = SeatManage.Bll.ServiceDateTime.Now.ToString(); violationRecords.EnterFlag = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin; violationRecords.Remark = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId); violationRecords.BlacklistID = "-1"; SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords); } } else if (rulesSet.BlacklistSet.Used && rulesSet.BlacklistSet.ViolateRoule[SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin]) { SeatManage.ClassModel.ViolationRecordsLogInfo violationRecords = new SeatManage.ClassModel.ViolationRecordsLogInfo(); violationRecords.CardNo = enterOutLog.CardNo; violationRecords.SeatID = enterOutLog.SeatNo.Substring(enterOutLog.SeatNo.Length - roomInfo.Setting.SeatNumAmount, roomInfo.Setting.SeatNumAmount); violationRecords.ReadingRoomID = enterOutLog.ReadingRoomNo; violationRecords.EnterOutTime = SeatManage.Bll.ServiceDateTime.Now.ToString(); violationRecords.EnterFlag = SeatManage.EnumType.ViolationRecordsType.LeaveByAdmin; violationRecords.Remark = string.Format("在{0},{1}号座位,被管理员{2},在后台管理网站设置离开", roomInfo.Name, enterOutLog.ShortSeatNo, this.LoginId); violationRecords.BlacklistID = "-1"; SeatManage.Bll.T_SM_ViolateDiscipline.AddViolationRecords(violationRecords); } } FineUI.Alert.ShowInTop("设置读者离开成功", "成功"); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { FineUI.Alert.ShowInTop("设置读者离开失败", "失败"); } }
/// <summary> /// 批量删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSelectDelete_Click(object sender, EventArgs e) { int[] selectindex = VRGrid.SelectedRowIndexArray; if (selectindex.Length > 0) { foreach (int index in selectindex) { SeatManage.ClassModel.ViolationRecordsLogInfo vrinfo = SeatManage.Bll.T_SM_ViolateDiscipline.GetViolationRecords(VRGrid.Rows[index].DataKeys[0].ToString()); if (vrinfo != null) { vrinfo.Flag = LogStatus.Fail; if (!SeatManage.Bll.T_SM_ViolateDiscipline.UpdateViolationRecords(vrinfo)) { FineUI.Alert.ShowInTop("删除失败!"); return; } else { SeatManage.ClassModel.ReaderNoticeInfo rni = new SeatManage.ClassModel.ReaderNoticeInfo(); rni.CardNo = vrinfo.CardNo; rni.Type = NoticeType.DeleteViolation; rni.Note = string.Format("{0}记录的违规,{1},被管理员手动移除", vrinfo.EnterOutTime, vrinfo.Remark); if (SeatManage.Bll.T_SM_ReaderNotice.AddReaderNotice(rni) == 0) { FineUI.Alert.ShowInTop("添加消息失败!"); return; } } } else { FineUI.Alert.ShowInTop("删除失败!"); } } FineUI.Alert.ShowInTop("删除完成!"); BindGrid(); } else { FineUI.Alert.ShowInTop("请先选中需要删除的记录!"); } }
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)); }