资源简介
教室及会议室预约系统(C#小程序,课堂作业)
可以实现教室的预约,时段分为2个小时一段
可以预约多个时段,也可以取消预约,取消时需要输入预约时输入的密码。
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Data.SqlClient;
using System.Security.AccessControl;
namespace chooseRoom
{
public partial class Form_index : Form
{
bool exits = false;
string userid = ““;
string filename = ““;
public Form_index()
{
InitializeComponent();
}
private void Form_index_Load(object sender EventArgs e)
{
readAllFile();
List initTimeList = new List();
initTimeList.Add(“...“);
initTimeList.Add(“08:00-10:00“);
initTimeList.Add(“10:00-12:00“);
initTimeList.Add(“12:00-14:00“);
initTimeList.Add(“14:00-16:00“);
initTimeList.Add(“16:00-18:00“);
initTimeList.Add(“18:00-20:00“);
initTimeList.Add(“20:00-22:00“);
comboBox_time.DataSource = initTimeList;
string logname = ““;
logname = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + “\\教室及会议室预约系统“;
if (Directory.Exists(logname) == false)//如果不存在就创建file文件夹
{
Directory.CreateDirectory(logname);
}
logname += “\\roomItem.txt“;
if (File.Exists(@logname) == false)
{
MessageBox.Show(“感谢您使用 教室/会议室 预约系统!“ “欢迎!“);
File.Copy(“roomItem.txt“ logname);
}
List initItemList = new List();
try
{
FileStream fs = File.Open(logname FileMode.Open FileAccess.Read);
StreamReader sr = new StreamReader(fs Encoding.UTF8);
String line;
while ((line = sr.ReadLine()) != null)
{
initItemList.Add(line.ToString());
}
fs.Close();
}
catch (Exception error)
{
Console.WriteLine(error.Message);
//Message返回异常对象中包含的错误信息
}
comboBox_item.DataSource = initItemList;
}
private void userClear()
{
textBox_username.Text = null;
textBox_usertel.Text = null;
textBox_userid.Text = null;
}
private void save_log()
{
if (textBox_username.Text.Length < 1 || textBox_usertel.Text.Length < 1 || textBox_userid.Text.Length < 1)
{
MessageBox.Show(“申请人、申请人电话及申请人证件号不允许为空!“ “警告!“);
return;
}
else {
int time = 0;
if (“...“ == comboBox_time.Text)
{
MessageBox.Show(“请选择申请的时间段!“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-11-08 22:09 cs_roomChoose\
目录 0 2015-11-08 18:50 cs_roomChoose\chooseRoom\
目录 0 2015-11-08 19:07 cs_roomChoose\chooseRoom\chooseRoom\
文件 9826 2015-11-08 21:36 cs_roomChoose\chooseRoom\chooseRoom\Form_index.Designer.cs
文件 11351 2015-11-08 22:06 cs_roomChoose\chooseRoom\chooseRoom\Form_index.cs
文件 5817 2015-11-08 21:36 cs_roomChoose\chooseRoom\chooseRoom\Form_index.resx
文件 507 2015-11-08 18:51 cs_roomChoose\chooseRoom\chooseRoom\Program.cs
目录 0 2015-11-08 18:50 cs_roomChoose\chooseRoom\chooseRoom\Properties\
文件 1450 2015-11-08 18:50 cs_roomChoose\chooseRoom\chooseRoom\Properties\AssemblyInfo.cs
文件 2850 2015-11-08 18:50 cs_roomChoose\chooseRoom\chooseRoom\Properties\Resources.Designer.cs
文件 5612 2015-11-08 18:50 cs_roomChoose\chooseRoom\chooseRoom\Properties\Resources.resx
文件 1097 2015-11-08 18:50 cs_roomChoose\chooseRoom\chooseRoom\Properties\Settings.Designer.cs
文件 249 2015-11-08 18:50 cs_roomChoose\chooseRoom\chooseRoom\Properties\Settings.settings
目录 0 2015-11-08 18:51 cs_roomChoose\chooseRoom\chooseRoom\bin\
目录 0 2015-11-08 20:55 cs_roomChoose\chooseRoom\chooseRoom\bin\Debug\
文件 42 2015-11-08 20:53 cs_roomChoose\chooseRoom\chooseRoom\bin\Debug\2015110839535.crl
文件 33 2015-11-08 20:55 cs_roomChoose\chooseRoom\chooseRoom\bin\Debug\201511087大学生活动中心.crl
文件 15360 2015-11-08 20:59 cs_roomChoose\chooseRoom\chooseRoom\bin\Debug\chooseRoom.exe
文件 32256 2015-11-08 20:59 cs_roomChoose\chooseRoom\chooseRoom\bin\Debug\chooseRoom.pdb
文件 11600 2015-11-08 21:01 cs_roomChoose\chooseRoom\chooseRoom\bin\Debug\chooseRoom.vshost.exe
文件 109 2015-11-08 19:10 cs_roomChoose\chooseRoom\chooseRoom\bin\Debug\roomItem.txt
目录 0 2015-11-08 21:34 cs_roomChoose\chooseRoom\chooseRoom\bin\Release\
文件 15360 2015-11-08 22:06 cs_roomChoose\chooseRoom\chooseRoom\bin\Release\chooseRoom.exe
文件 30208 2015-11-08 22:06 cs_roomChoose\chooseRoom\chooseRoom\bin\Release\chooseRoom.pdb
文件 11600 2015-11-08 22:08 cs_roomChoose\chooseRoom\chooseRoom\bin\Release\chooseRoom.vshost.exe
文件 490 2012-06-06 02:06 cs_roomChoose\chooseRoom\chooseRoom\bin\Release\chooseRoom.vshost.exe.manifest
文件 109 2015-11-08 19:10 cs_roomChoose\chooseRoom\chooseRoom\bin\Release\roomItem.txt
文件 3704 2015-11-08 18:52 cs_roomChoose\chooseRoom\chooseRoom\chooseRoom.csproj
目录 0 2015-11-08 18:50 cs_roomChoose\chooseRoom\chooseRoom\obj\
目录 0 2015-11-08 21:01 cs_roomChoose\chooseRoom\chooseRoom\obj\x86\
目录 0 2015-11-08 20:59 cs_roomChoose\chooseRoom\chooseRoom\obj\x86\Debug\
............此处省略85个文件信息
评论
共有 条评论