private void BindUI(SeatManage.ClassModel.StudyRoomSetting setting, SeatManage.ClassModel.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(); }
/// <summary> /// 数据绑定 /// </summary> private void DataBind() { SeatManage.ClassModel.StudyRoomInfo room = SeatManage.Bll.StudyRoomOperation.GetSingleStudyRoonInfo(Request.QueryString["no"]); if (room == null) { room = new SeatManage.ClassModel.StudyRoomInfo(); } SeatManage.ClassModel.StudyRoomSetting roomSet = room.Setting; if (roomSet == null) { roomSet = new SeatManage.ClassModel.StudyRoomSetting(); } chkUseStudyRoom.Checked = roomSet.IsUseStudyRoom; txtApplicationInfo.Text = roomSet.ApplicationInfo; txtFacilities.Text = roomSet.FacilitiesRenmark; txtPrecautions.Text = roomSet.Precautions; txtOpenTime_H.Text = roomSet.OpenTime.ToShortTimeString().Split(':')[0]; txtOpenTime_M.Text = roomSet.OpenTime.ToShortTimeString().Split(':')[1]; txtEndTime_H.Text = roomSet.CloseTime.ToShortTimeString().Split(':')[0]; txtEndTime_M.Text = roomSet.CloseTime.ToShortTimeString().Split(':')[1]; txtMaxTime.Text = roomSet.MaxBookTime.ToString(); txtCanUse.Text = roomSet.CanUseFacilities; }
protected void Submit_OnClick(object sender, EventArgs e) { SeatManage.ClassModel.StudyRoomInfo room = SeatManage.Bll.StudyRoomOperation.GetSingleStudyRoonInfo(Request.QueryString["no"]); if (room == null) { FineUI.Alert.Show("设置保存失败!"); return; } SeatManage.ClassModel.StudyRoomSetting roomSet = room.Setting; if (roomSet == null) { roomSet = new SeatManage.ClassModel.StudyRoomSetting(); } roomSet.IsUseStudyRoom = chkUseStudyRoom.Checked; roomSet.ApplicationInfo = txtApplicationInfo.Text; roomSet.FacilitiesRenmark = txtFacilities.Text; roomSet.Precautions = txtPrecautions.Text; roomSet.CanUseFacilities = txtCanUse.Text; int maxTime = 0; if (int.TryParse(txtMaxTime.Text, out maxTime)) { if (maxTime > 0) { roomSet.MaxBookTime = maxTime; } else { FineUI.Alert.Show("最大使用时长要大于0!"); return; } } else { FineUI.Alert.Show("最大使用时长格式错误!"); return; } DateTime oTime = new DateTime(); if (DateTime.TryParse(txtOpenTime_H.Text + ":" + txtOpenTime_M.Text, out oTime)) { roomSet.OpenTime = oTime; } else { FineUI.Alert.Show("开放时间格式错误!"); return; } DateTime eTime = new DateTime(); if (DateTime.TryParse(txtEndTime_H.Text + ":" + txtEndTime_M.Text, out eTime)) { roomSet.CloseTime = eTime; } else { FineUI.Alert.Show("关闭时间格式错误!"); return; } if (roomSet.CloseTime <= roomSet.OpenTime) { FineUI.Alert.Show("开放时间不能大于关闭时间!"); return; } try { room.Setting = roomSet; if (SeatManage.Bll.StudyRoomOperation.UpdateStudyRoom(room)) { FineUI.PageContext.RegisterStartupScript(FineUI.ActiveWindow.GetHidePostBackReference()); FineUI.Alert.ShowInTop("保存成功!"); } else { FineUI.Alert.Show("保存失败!"); return; } } catch (Exception ex) { SeatManage.SeatManageComm.WriteLog.Write(ex.Message); FineUI.Alert.Show("保存失败!"); return; } }