/// <summary> /// 删除记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool DeleteStudyBookingLog(StudyBookingLog model) { IWCFService.ISeatManageService seatService = WcfAccessProxy.ServiceProxy.CreateChannelSeatManageService(); try { return(seatService.DeleteStudyBookingLog(model)); } catch (FaultException ex) { SeatManageComm.WriteLog.Write("删除研习间预约记录失败:" + ex.Message); return(false); } finally { ICommunicationObject ICommObjectService = seatService as ICommunicationObject; try { if (ICommObjectService.State == CommunicationState.Faulted) { ICommObjectService.Abort(); } else { ICommObjectService.Close(); } } catch { ICommObjectService.Abort(); } } }
private void BindUI(StudyRoomSetting setting, StudyBookingLog log) { derlist.Value = ""; DateTime sd = setting.OpenTime; while (true) { slbookTime.Items.Add(new ListItem(sd.ToShortTimeString(), sd.ToShortTimeString())); sd = sd.AddMinutes(10); if (sd >= setting.CloseTime) { break; } } string[] cbul = setting.CanUseFacilities.Split(';'); if (cbul.Length > 0) { for (int i = 0; i < cbul.Length; i++) { if (string.IsNullOrEmpty(cbul[i])) { continue; } bool ischeck = false; string[] cbulog = log.Application.UseProjector.Split(';'); if (cbulog.Length > 0) { foreach (string c in cbulog) { if (cbul[i] == c) { ischeck = true; derlist.Value += c + ";"; break; } } } deList += string.Format("<tr>" + "<td style=\"width: 20px\">" + "<input id=\"{0}\" name=\"{0}\" type=\"checkbox\" value=\"{1}\" style=\"height: 15px;width: 15px; left: 0px; margin-top: -3px;\" {2} onclick=\"checkDei('cb_" + i + "')\" />" + "</td>" + "<td style=\"padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 10px\">{1}</td>" + "</tr>", "cb_" + i, cbul[i], ischeck ? "checked=\"true\"" : ""); } } txtApplicantCardNo.Value = log.Application.ApplicantCardNo; txtApplicantDept.Value = log.Application.ApplicantDept; txtApplicantName.Value = log.Application.ApplicantName; txtApplicantPhoneNum.Value = log.Application.ApplicantPhoneNum; txtApplicantType.Value = log.Application.ApplicantType; txtBookDate.Value = log.BespeakTime.ToShortDateString(); txtEmailAddress.Value = log.Application.EmailAddress; txtHeadPerson.Value = log.Application.HeadPerson; txtHeadPersonPhoneNum.Value = log.Application.HeadPersonPhoneNum; txtHeadPersonType.Value = log.Application.HeadPersonType; txtMeetingName.Value = log.Application.MeetingName; txtMembersCount.Value = log.Application.MembersCount.ToString(); txtUseTime.Value = log.UseTime.ToString(); slbookTime.Value = log.BespeakTime.ToShortTimeString(); }
public bool UpdateStudyBookingLog(StudyBookingLog model) { try { if (t_sm_studybookinglog_DAL.Update(model)) { if (!string.IsNullOrEmpty(model.Application.EmailAddress)) { if (model.CheckState == CheckStatus.Adopt) { SeatManage.SeatManageComm.SendEmail.Send(model.Application.EmailAddress, "研习间审核结果通知", "恭喜您,您申请的" + model.StudyRoomName + "已通过审核,申请时间为" + model.BespeakTime + ",使用时长为" + model.UseTime + "分钟,请按时到场并与管理员联系,电话为870304。", false); } if (model.CheckState == CheckStatus.Failure) { SeatManage.SeatManageComm.SendEmail.Send(model.Application.EmailAddress, "研习间审核结果通知", "对不起,您申请的" + model.StudyRoomName + "尚未通过审核,原因为" + model.Remark + ",请重新申请或联系管理员,电话为870304。", false); } } return true; } else { return false; } } catch { throw; } }
public bool DeleteStudyBookingLog(StudyBookingLog model) { try { return t_sm_studybookinglog_DAL.Delete(model.StudyID); } catch { throw; } }
public bool AddStudyBookingLog(StudyBookingLog model) { try { return t_sm_studybookinglog_DAL.Add(model) > 0 ? true : false; } catch { throw; } }
/// <summary> /// 删除记录 /// </summary> /// <param name="model"></param> /// <returns></returns> public static bool DeleteStudyBookingLog(StudyBookingLog model) { IWCFService.ISeatManageService seatService = new WcfServiceForSeatManage.SeatManageDateService(); try { return(seatService.DeleteStudyBookingLog(model)); } catch (FaultException ex) { SeatManageComm.WriteLog.Write("删除研习间预约记录失败:" + ex.Message); return(false); } }
//SeatManage.IPocketBespeak.IBookStudyRoom handler = new SeatManage.PocketBespeak.PecketBespeak_BookStudyRoom(); protected void Page_Load(object sender, EventArgs e) { if (LoginUserInfo == null) { Response.Redirect(LoginUrl()); } roomNo = Request.QueryString["No"]; if (!string.IsNullOrEmpty(Request.QueryString["ID"])) { logID = int.Parse(Request.QueryString["ID"]); } if (!IsPostBack) { txtBookDate.Value = DateTime.Now.ToShortDateString(); StudyRoomSetting setting; StudyBookingLog log; if (logID < 0) { setting = handler.GetStudyRoomInfo(roomNo).Setting; log = new StudyBookingLog(); log.Application.ApplicantCardNo = LoginUserInfo.CardNo; log.Application.ApplicantName = LoginUserInfo.Name; log.BespeakTime = DateTime.Now; } else { log = handler.GetStudyLog(logID); setting = log.RoomSetting; } BindUI(setting, log); } string cmd = Request.Form["subCmd"]; if (IsPostBack) { switch (cmd) { case "LoginOut": Session.Clear(); Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(-1); CookiesManager.RefreshNum = 0; Response.Redirect(LogoutUrl()); break; case "query": Submit(); break; } } }
/// <summary> /// 提交申请记录 /// </summary> /// <param name="logModel"></param> /// <returns></returns> public string SubmitStudyLog(StudyBookingLog logModel) { try { if (logModel == null) { return("提交申请失败"); } string errorMessage = seatManage.CheckBookTime(logModel.BespeakTime, logModel.UseTime, logModel.StudyRoomNo, logModel.StudyID); if (!string.IsNullOrEmpty(errorMessage)) { return(errorMessage); } errorMessage = CheckApplication(logModel.Application); if (!string.IsNullOrEmpty(errorMessage)) { return(errorMessage); } logModel.CheckState = CheckStatus.Checking; if (logModel.StudyID < 1) { if (seatManage.AddStudyBookingLog(logModel)) { return(""); } else { return("提交申请失败"); } } else { if (seatManage.UpdateStudyBookingLog(logModel)) { return(""); } else { return("提交申请失败"); } } } catch (Exception ex) { throw ex; } }
//SeatManage.IPocketBespeak.IBookStudyRoom handler = new SeatManage.PocketBespeak.PecketBespeak_BookStudyRoom(); protected void Page_Load(object sender, EventArgs e) { if (LoginUserInfo == null) { Response.Redirect(LoginUrl()); } BindDataList(); string cmd = Request.Form["subCmd"]; if (IsPostBack) { switch (cmd) { case "LoginOut": Session.Clear(); Response.Cookies["userInfo"].Expires = DateTime.Now.AddDays(-1); CookiesManager.RefreshNum = 0; Response.Redirect(LogoutUrl()); break; case "cancel": StudyBookingLog log = handler.GetStudyLog(int.Parse(logNo.Value)); string result = handler.CancelStudyLog(log); if (string.IsNullOrEmpty(result)) { ClientScript.RegisterStartupScript(GetType(), "closewindow", "alert('取消申请成功!');window.close();", true); } else { ClientScript.RegisterStartupScript(GetType(), "closewindow", "alert('取消申请失败!');window.close();", true); } BindDataList(); break; } } }
/// <summary> /// 更新记录状态 /// </summary> /// <param name="logModel"></param> /// <returns></returns> public string CancelStudyLog(StudyBookingLog logModel) { try { if (logModel == null) { return("修改申请失败"); } logModel.CheckState = CheckStatus.Cancel; if (seatManage.UpdateStudyBookingLog(logModel)) { return(""); } else { return("提交申请失败"); } } catch (Exception ex) { throw ex; } }
private StudyBookingLog DataRowToStudyBookingLog(DataRow dr) { //[CardNo],[StudyID],[SubmitTime],[CheckTime],[BespeakTime],[UseTime],[CheckState],[ChecklPerson],[Remark],[StudyRoomNo],[StudyRoomName],[StudyRoomSetting],[ReaderName],[ApplicationTable] StudyBookingLog model = new StudyBookingLog(); model.Application = new ApplicationTable(dr["ApplicationTable"].ToString()); model.BespeakTime = DateTime.Parse(dr["BespeakTime"].ToString()); model.CardNo = dr["CardNo"].ToString(); model.ChecklPerson = dr["ChecklPerson"].ToString(); model.CheckState = (SeatManage.EnumType.CheckStatus)int.Parse(dr["CheckState"].ToString()); if (!string.IsNullOrEmpty(dr["CheckTime"].ToString())) { model.CheckTime = DateTime.Parse(dr["CheckTime"].ToString()); } model.Remark = dr["Remark"].ToString(); model.StudyID = int.Parse(dr["StudyID"].ToString()); model.StudyRoomNo = dr["StudyRoomNo"].ToString(); model.SubmitTime = DateTime.Parse(dr["SubmitTime"].ToString()); model.UseTime = int.Parse(dr["UseTime"].ToString()); model.ReaderName = dr["ReaderName"].ToString(); model.StudyRoomName = dr["StudyRoomName"].ToString(); model.RoomSetting = new StudyRoomSetting(dr["StudyRoomSetting"].ToString()); return model; }
private void Submit() { StudyBookingLog log; StudyRoomSetting setting; if (logID < 0) { log = new StudyBookingLog(); setting = handler.GetStudyRoomInfo(roomNo).Setting; log.StudyRoomNo = roomNo; } else { log = handler.GetStudyLog(logID); setting = log.RoomSetting; } if (!setting.IsUseStudyRoom) { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "本研习间暂不开放"; ClientScript.RegisterStartupScript(GetType(), "closewindow", "alert('本研习间暂不开放!');location.href='StudyRoomList.aspx';", true); return; } log.Application.ApplicantCardNo = txtApplicantCardNo.Value; log.Application.ApplicantDept = txtApplicantDept.Value; log.Application.ApplicantName = txtApplicantName.Value; log.Application.ApplicantPhoneNum = txtApplicantPhoneNum.Value; log.Application.ApplicantType = txtApplicantType.Value; log.BespeakTime = DateTime.Parse(txtBookDate.Value + " " + slbookTime.Value); log.SubmitTime = DateTime.Now; log.Application.EmailAddress = txtEmailAddress.Value; log.Application.HeadPerson = txtHeadPerson.Value; log.Application.HeadPersonPhoneNum = txtHeadPersonPhoneNum.Value; log.Application.HeadPersonType = txtHeadPersonType.Value; log.Application.MeetingName = txtMeetingName.Value; log.Application.MembersCount = int.Parse(txtMembersCount.Value); log.UseTime = int.Parse(txtUseTime.Value); log.CardNo = txtApplicantCardNo.Value; log.CheckState = CheckStatus.Checking; log.Application.UseProjector = ""; string[] cbulog = derlist.Value.Split(';'); List <string> cbul = new List <string>(); if (cbulog.Length > 0) { foreach (string c in cbulog) { if (string.IsNullOrEmpty(c) || (cbul.Find(u => u == c) != null)) { continue; } cbul.Add(c); log.Application.UseProjector += c + ";"; } } string resultValue = handler.SubmitStudyLog(log); if (!string.IsNullOrEmpty(resultValue)) { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = resultValue; BindUI(setting, log); } else { spanWarmInfo.Visible = true; spanWarmInfo.InnerText = "操作成功"; ClientScript.RegisterStartupScript(GetType(), "closewindow", "alert('申请提交成功!');location.href='StudyFunChoose.aspx';", true); } }