/// <summary> /// 界面加载显示记录信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Form_Room_Load(object sender, EventArgs e) { textBox_name.Text = selfRoomName; if (selfRoomName.Contains("会议室")) { label_roomane.Text = selfRoomName; } else { label_roomane.Text = selfRoomName + "会议室"; } string str = roomIndex + "_" + selfRoomName; //Console.WriteLine(str); DataTable tables = AccessFunction.GetClientProtocol(str); int Rows = tables.Rows.Count; if (tables != null && Rows > 0) { for (int r = 0; r < Rows; r++) { ListViewItem item = new ListViewItem(); item.SubItems.Add(tables.Rows[r][3].ToString()); item.SubItems.Add(tables.Rows[r][5].ToString()); item.SubItems.Add(tables.Rows[r][6].ToString()); item.SubItems.Add(tables.Rows[r][4].ToString()); listView_Schedul.Items.Add(item); } listView_Schedul.EndUpdate(); } textBox_people.Focus(); dateTimePicker_time.MaxDate = DateTime.Now.AddDays(15); //dateTimePicker_time.MinDate = DateTime.Now; dateTimePicker1.MaxDate = DateTime.Now.AddDays(15); //dateTimePicker1.MinDate = DateTime.Now; }
private void dateTimePicker_time_ValueChanged(object sender, EventArgs e) { string str = roomIndex + "_" + selfRoomName; DataTable tables = AccessFunction.GetClientProtocol(str); int Rows = tables.Rows.Count; if (tables != null && Rows > 0) { for (int r = 0; r < Rows; r++) { if (DateTime.Parse(tables.Rows[r][5].ToString()) <= dateTimePicker_time.Value && DateTime.Parse(tables.Rows[r][6].ToString()) >= dateTimePicker_time.Value) { MessageBox.Show(" 当前预定会议室开始时间已有预约记录(" + DateTime.Parse(tables.Rows[r][5].ToString()).ToString("HH:mm") + "-" + DateTime.Parse(tables.Rows[r][6].ToString()).ToString("HH:mm") + "),请重新预约的安排其他时间段 !", " Tips"); return; } } } if (dateTimePicker_time.Value.Date > DateTime.Now.Date) { DialogResult t; //if (Chinese_English) t = MessageBox.Show(" 当前设置的会议室开始时间不是今天,是否自动标记为预约的安排!", " Tips", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); //else // t = MessageBox.Show(" 确定对选中的屏幕单元进行复位操作!", " 提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation); if (t == DialogResult.Yes || t == DialogResult.OK) { checkBoxX1.Checked = true; } } }
private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { string s = roomIndex + "_" + comboBox_name.Text; DataTable tables = AccessFunction.GetClientProtocol(s); int Rows = tables.Rows.Count; if (tables != null && Rows > 0) { for (int r = 0; r < Rows; r++) { if (DateTime.Parse(tables.Rows[r][5].ToString()) <= dateTimePicker1.Value && DateTime.Parse(tables.Rows[r][6].ToString()) >= dateTimePicker1.Value) { MessageBox.Show(" 当前预定会议室开始时间已有预约记录(" + DateTime.Parse(tables.Rows[r][5].ToString()).ToString("HH:mm:00") + "-" + DateTime.Parse(tables.Rows[r][6].ToString()).ToString("HH:mm:00") + "),请重新预约的安排其他时间段 !", " Tips"); return; } } } }