📄 form1.cs
字号:
this.Session.TabIndex = 4;
this.Session.Text = "";
this.Session.Visible = false;
//
// Odg
//
this.Odg.DataMember = "";
this.Odg.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.Odg.Location = new System.Drawing.Point(320, 64);
this.Odg.Name = "Odg";
this.Odg.Size = new System.Drawing.Size(320, 192);
this.Odg.TabIndex = 1;
this.Odg.DoubleClick += new System.EventHandler(this.Odg_DoubleClick);
//
// groupBox6
//
this.groupBox6.Controls.Add(this.search3);
this.groupBox6.Controls.Add(this.CancelOrder);
this.groupBox6.Controls.Add(this.DeleteOutOfDate);
this.groupBox6.Controls.Add(this.groupBox7);
this.groupBox6.Controls.Add(this.Pre_TID);
this.groupBox6.Controls.Add(this.label13);
this.groupBox6.Controls.Add(this.Pre_CustID);
this.groupBox6.Controls.Add(this.label12);
this.groupBox6.Location = new System.Drawing.Point(24, 32);
this.groupBox6.Name = "groupBox6";
this.groupBox6.Size = new System.Drawing.Size(232, 320);
this.groupBox6.TabIndex = 0;
this.groupBox6.TabStop = false;
this.groupBox6.Text = "groupBox6";
//
// search3
//
this.search3.Location = new System.Drawing.Point(8, 280);
this.search3.Name = "search3";
this.search3.Size = new System.Drawing.Size(72, 24);
this.search3.TabIndex = 7;
this.search3.Text = "查询";
this.search3.Click += new System.EventHandler(this.search3_Click);
//
// CancelOrder
//
this.CancelOrder.Location = new System.Drawing.Point(128, 224);
this.CancelOrder.Name = "CancelOrder";
this.CancelOrder.TabIndex = 6;
this.CancelOrder.Text = "取消预定";
this.CancelOrder.Click += new System.EventHandler(this.CancelOrder_Click);
//
// DeleteOutOfDate
//
this.DeleteOutOfDate.Location = new System.Drawing.Point(8, 224);
this.DeleteOutOfDate.Name = "DeleteOutOfDate";
this.DeleteOutOfDate.TabIndex = 5;
this.DeleteOutOfDate.Text = "删除";
this.DeleteOutOfDate.Click += new System.EventHandler(this.DeleteOutOfDate_Click);
//
// groupBox7
//
this.groupBox7.Controls.Add(this.T);
this.groupBox7.Controls.Add(this.P);
this.groupBox7.Location = new System.Drawing.Point(8, 24);
this.groupBox7.Name = "groupBox7";
this.groupBox7.Size = new System.Drawing.Size(200, 56);
this.groupBox7.TabIndex = 4;
this.groupBox7.TabStop = false;
this.groupBox7.Text = "类别";
//
// T
//
this.T.Location = new System.Drawing.Point(120, 24);
this.T.Name = "T";
this.T.Size = new System.Drawing.Size(48, 24);
this.T.TabIndex = 1;
this.T.Text = "团体";
//
// P
//
this.P.Location = new System.Drawing.Point(24, 24);
this.P.Name = "P";
this.P.Size = new System.Drawing.Size(48, 24);
this.P.TabIndex = 0;
this.P.Text = "个人";
this.P.CheckedChanged += new System.EventHandler(this.P_CheckedChanged);
//
// Pre_TID
//
this.Pre_TID.Location = new System.Drawing.Point(74, 144);
this.Pre_TID.Name = "Pre_TID";
this.Pre_TID.Size = new System.Drawing.Size(134, 21);
this.Pre_TID.TabIndex = 3;
this.Pre_TID.Text = "";
//
// label13
//
this.label13.Location = new System.Drawing.Point(8, 144);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(48, 23);
this.label13.TabIndex = 2;
this.label13.Text = "团体ID";
this.label13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// Pre_CustID
//
this.Pre_CustID.Location = new System.Drawing.Point(72, 96);
this.Pre_CustID.Name = "Pre_CustID";
this.Pre_CustID.Size = new System.Drawing.Size(136, 21);
this.Pre_CustID.TabIndex = 1;
this.Pre_CustID.Text = "";
//
// label12
//
this.label12.Location = new System.Drawing.Point(8, 96);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(56, 23);
this.label12.TabIndex = 0;
this.label12.Text = "身份证号";
this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(704, 501);
this.Controls.Add(this.gb1);
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.gb1.ResumeLayout(false);
this.Pre_Order.ResumeLayout(false);
this.Personal.ResumeLayout(false);
this.groupBox1.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dg)).EndInit();
this.Team.ResumeLayout(false);
this.groupBox5.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Tdg)).EndInit();
this.Process.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.Odg)).EndInit();
this.groupBox6.ResumeLayout(false);
this.groupBox7.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Clear_Click(object sender, System.EventArgs e)//散客预定信息清空
{
CustID.Clear();
RoNo.Clear();
Desposit.Clear();
}
private void Commit_Click(object sender, System.EventArgs e)//散客预定信息录入
{
Operate op=new Operate();
bool result;
result=op.P_Info_Insert(CustID.Text,Convert.ToString(OrderTime.Value),RoNo.Text,Convert.ToString(LeaveTime.Value),Convert.ToDecimal(Desposit.Text));
if(result==true)
{ MessageBox.Show("预定信息录入成功!!");
}
else
{
MessageBox.Show("预定信息录入成功!!");
}
int Num=Convert.ToInt32(op.GetPOrderID(CustID.Text));
op.Update_OrderID(RoNo.Text,Num);
}
private void Search_Click(object sender, System.EventArgs e)//散客房间查询
{
Operate op=new Operate();
dg.DataSource=(op.CreateDataSource(RType.SelectedItem.ToString(),RState.SelectedItem.ToString())).Tables["Table"];
}
private void Form1_Load(object sender, System.EventArgs e)
{
Operate op=new Operate ();
ArrayList al=op.GetRoomType();
for(int i=0;i<al.Count;i++)
{
RType.Items.Add(al[i]);//散客预定
TRType.Items.Add(al[i]);//团队预定
}
ArrayList Al=op.GetRoomState();
for(int i=0;i<Al.Count;i++)
{
RState.Items.Add(Al[i]);//散客预定
TRState.Items.Add(Al[i]);//团队预定
}
}
private void TSearch_Click(object sender, System.EventArgs e)//获取客房信息
{
Operate op=new Operate();
Tdg.DataSource=(op.CreateDataSource(TRType.SelectedItem.ToString(),TRState.SelectedItem.ToString())).Tables["Table"];
}
private void TCommit_Click(object sender, System.EventArgs e)//团体预定信息录入
{
Operate op=new Operate();
for(int i=0;i<RNos.Items.Count;i++)//更新客房状态
{
op.RoomStateChange(RNos.Items[i].ToString());
}
//录入团队预定信息
bool result=op.T_Info_Insert(Team_ID.Text,Convert.ToString(T_OrderTime.Value),Convert.ToString(T_LeaveTime.Value),Convert.ToDecimal(T_Desposit.Text));
if(result==true)
{
MessageBox.Show("预定信息录入成功!!");
}
else
{
MessageBox.Show("预定信息录入失败!!");
}
//更新OrderID
int Num=Convert.ToInt32(op.GetTOrderID(Team_ID.Text));
for(int i=0;i<RNos.Items.Count;i++)
{
op.Update_OrderID(RNos.Items[i].ToString(),Num);
}
}
private void TClear_Click(object sender, System.EventArgs e)//清空团队预定信息
{
Team_ID.Clear();
RoomCount.Clear();
RNos.Items.Clear();
T_Desposit.Clear();
}
private void PCancel_Click(object sender, System.EventArgs e)//取消个人所选定的房间号
{
RoNo.Clear();
}
private void TCancel_Click(object sender, System.EventArgs e)//取消团体预定的房间号
{
RNos.Items.RemoveAt(RNos.SelectedIndex);
}
private void P_CheckedChanged(object sender, System.EventArgs e)//设置TextBox是否可写
{
if(P.Checked==true)
{
Pre_TID.ReadOnly=true;
Pre_CustID.ReadOnly=false;
}
else
{
Pre_CustID.ReadOnly=true;
Pre_TID.ReadOnly=false;
}
}
private void Tdg_DoubleClick(object sender, System.EventArgs e)//选择个人预定房间号
{
RNos.Items.Add(Tdg[Tdg.CurrentRowIndex,0].ToString());
}
private void dg_DoubleClick(object sender, System.EventArgs e)//选择团体预定房间号
{
RoNo.Text=dg[dg.CurrentRowIndex,0].ToString();
}
private void DeleteOutOfDate_Click(object sender, System.EventArgs e)//获取预定未到信息
{
Operate op=new Operate();
bool result= op.DeleteOutOfDateInfo(DateTime.Now.ToString());
if(result==true)
{
MessageBox.Show("预定未到信息已删除!!");
}
else
{
MessageBox.Show("没有找到预定未到信息!!");
}
}
private void search3_Click(object sender, System.EventArgs e)
{
Operate op=new Operate();
if(P.Checked==true)
Odg.DataSource=op.GetP_RegisterInfo(Pre_CustID.Text).Tables["Table"];
else
Odg.DataSource=op.GetT_RegisterInfo(Pre_TID.Text).Tables["Table"];
}
private void CancelOrder_Click(object sender, System.EventArgs e)
{
Operate op=new Operate();
bool result=op.CancelOrder(Convert.ToInt32(Session.Text));
if(result==true)
{
MessageBox.Show("取消预定成功!");
}
else
{
MessageBox.Show("取消预定失败!");
}
}
private void Odg_DoubleClick(object sender, System.EventArgs e)
{
Session.Text=Odg[Odg.CurrentRowIndex,0].ToString();
}
private void Process_Click(object sender, System.EventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -