📄 frmreserve.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.Odbc;
namespace HotelApp
{
/// <summary>
/// frmReserve 的摘要说明。
/// </summary>
public class frmReserve : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtPrice;
private System.Windows.Forms.Button btnAdd;
private System.Windows.Forms.Button btnReturn;
private System.Windows.Forms.Button btnReset;
private System.Windows.Forms.RadioButton radioNo;
private System.Windows.Forms.RadioButton radioYes;
private System.Windows.Forms.ComboBox comRoomNum;
//Main form
private frmRoomQuery frmMain;
private String id=null;
private int i_number=0;
private System.Windows.Forms.Button btnSave;
private int roomid;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public frmReserve(frmRoomQuery Main)
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
this.frmMain=Main;
this.initForm();
}
private void initForm()
{
this.roomid=this.frmMain.roomID;
if(this.id==null)
{
this.btnSave.Visible=false;
this.btnAdd.Visible=true;
this.btnReset.Visible=true;
}
else
{
this.btnSave.Visible=true;
this.btnAdd.Visible=false;
this.btnReset.Visible=false;
String selSQL="select * from roomavailable where id='"+id+"'";
DBService_2 dbs=new DBService_2();
DataSet ds_s=dbs.executeBySQL(selSQL);
if(ds_s.Tables[0].Rows.Count==0)
{
this.id=null;
this.initForm();
}
else
{
this.txtPrice.Text=ds_s.Tables[0].Rows[0][5].ToString();
i_number=Convert.ToInt32(ds_s.Tables[0].Rows[0][2].ToString());
this.comRoomNum.Text=ds_s.Tables[0].Rows[0][2].ToString();
this.dateTimePicker1.Value=Convert.ToDateTime(ds_s.Tables[0].Rows[0][3].ToString());
this.dateTimePicker2.Value=Convert.ToDateTime(ds_s.Tables[0].Rows[0][4].ToString());
if(ds_s.Tables[0].Rows[0][7].Equals("1"))
{
this.radioYes.Checked=true;
}
else
{
this.radioNo.Checked=true;
}
}
}
}
public frmReserve(frmRoomQuery Main,String id)
{
InitializeComponent();
this.frmMain=Main;
this.id=id;
this.initForm();
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmReserve));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.btnSave = new System.Windows.Forms.Button();
this.btnReturn = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button();
this.btnAdd = new System.Windows.Forms.Button();
this.radioNo = new System.Windows.Forms.RadioButton();
this.radioYes = new System.Windows.Forms.RadioButton();
this.label5 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.comRoomNum = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.txtPrice = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.btnSave);
this.groupBox1.Controls.Add(this.btnReturn);
this.groupBox1.Controls.Add(this.btnReset);
this.groupBox1.Controls.Add(this.btnAdd);
this.groupBox1.Controls.Add(this.radioNo);
this.groupBox1.Controls.Add(this.radioYes);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.comRoomNum);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.dateTimePicker2);
this.groupBox1.Controls.Add(this.dateTimePicker1);
this.groupBox1.Controls.Add(this.txtPrice);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(520, 240);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
//
// btnSave
//
this.btnSave.Location = new System.Drawing.Point(80, 176);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(75, 32);
this.btnSave.TabIndex = 14;
this.btnSave.Text = "保存(&S)";
this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
//
// btnReturn
//
this.btnReturn.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnReturn.Location = new System.Drawing.Point(352, 176);
this.btnReturn.Name = "btnReturn";
this.btnReturn.Size = new System.Drawing.Size(88, 32);
this.btnReturn.TabIndex = 13;
this.btnReturn.Text = "返回(&X)";
this.btnReturn.Click += new System.EventHandler(this.btnReturn_Click);
//
// btnReset
//
this.btnReset.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnReset.Location = new System.Drawing.Point(256, 176);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(88, 32);
this.btnReset.TabIndex = 12;
this.btnReset.Text = "重置(&R)";
this.btnReset.Click += new System.EventHandler(this.button2_Click);
//
// btnAdd
//
this.btnAdd.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.btnAdd.Location = new System.Drawing.Point(160, 176);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(88, 32);
this.btnAdd.TabIndex = 11;
this.btnAdd.Text = "增加(&A)";
this.btnAdd.Click += new System.EventHandler(this.button1_Click_1);
//
// radioNo
//
this.radioNo.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.radioNo.Location = new System.Drawing.Point(168, 112);
this.radioNo.Name = "radioNo";
this.radioNo.Size = new System.Drawing.Size(56, 24);
this.radioNo.TabIndex = 10;
this.radioNo.Text = "否";
//
// radioYes
//
this.radioYes.Checked = true;
this.radioYes.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.radioYes.Location = new System.Drawing.Point(104, 112);
this.radioYes.Name = "radioYes";
this.radioYes.Size = new System.Drawing.Size(56, 24);
this.radioYes.TabIndex = 9;
this.radioYes.TabStop = true;
this.radioYes.Text = "是";
//
// label5
//
this.label5.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label5.Location = new System.Drawing.Point(16, 112);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -