?? frmdesk.cs
字號(hào):
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace bggl.fm
{
/// <summary>
/// frmdesk 的摘要說(shuō)明。
/// </summary>
public class frmdesk : System.Windows.Forms.Form
{
DataSet objset=new DataSet();
cs.Class1 typeload=new bggl.cs.Class1();
ListView lv;
string chi;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label3;
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public frmdesk(ListView zz,string cc)
{
lv=zz;
chi=cc;
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.comboBox1);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Location = new System.Drawing.Point(0, 0);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(168, 168);
this.groupBox1.TabIndex = 0;
this.groupBox1.TabStop = false;
//
// comboBox1
//
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Location = new System.Drawing.Point(72, 104);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(80, 20);
this.comboBox1.TabIndex = 3;
//
// label2
//
this.label2.Location = new System.Drawing.Point(8, 104);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 2;
this.label2.Text = "所屬餐廳:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(72, 64);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(80, 21);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
this.textBox1.Leave += new System.EventHandler(this.textBox1_Leave);
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 72);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 24);
this.label1.TabIndex = 0;
this.label1.Text = "餐桌號(hào):";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button3);
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Location = new System.Drawing.Point(168, 0);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(96, 168);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
//
// button3
//
this.button3.Location = new System.Drawing.Point(8, 112);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(80, 24);
this.button3.TabIndex = 2;
this.button3.Text = "退出";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(8, 72);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 24);
this.button2.TabIndex = 1;
this.button2.Text = "刪除";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(8, 40);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 24);
this.button1.TabIndex = 0;
this.button1.Text = "添加";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(136, 23);
this.label3.TabIndex = 4;
this.label3.Text = "注意:餐桌好不能重復(fù)";
//
// frmdesk
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(272, 173);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "frmdesk";
this.Text = "餐桌管理";
this.Load += new System.EventHandler(this.frmdesk_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void frmdesk_Load(object sender, System.EventArgs e) //傳值
{
objset=typeload.settype();
foreach(DataRow br in objset.Tables[0].Rows)
{
this.comboBox1.Items.Add(br[0].ToString());
}
}
private void button1_Click(object sender, System.EventArgs e) //添加餐桌
{
if(this.textBox1.Text.Trim()!="" && this.comboBox1.Text.Trim()!="")
{
typeload.addcanzhuo(this.textBox1.Text,this.comboBox1.Text);
MessageBox.Show("餐桌添加已成功!");
objset=typeload.selectlistview();
this.lv.Items.Clear();
foreach(DataRow dr in objset.Tables[0].Rows)
{
if(dr["carea"].ToString().Trim()==chi.Trim())
{
ListViewItem lst=new ListViewItem();
lst.SubItems.Clear();
lst.SubItems[0].Text=dr[0].ToString();
lst.SubItems.Add(dr[1].ToString());
lst.SubItems.Add(dr[2].ToString());
lst.SubItems.Add(dr[3].ToString());
lst.SubItems.Add(dr[4].ToString());
lst.SubItems.Add(dr[5].ToString());
lst.SubItems.Add(dr[6].ToString());
lst.SubItems.Add(dr[7].ToString());
lst.SubItems.Add(dr[8].ToString());
lst.SubItems.Add(dr[9].ToString());
lv.Items.Add(lst);
}
}
}
else
{
MessageBox.Show("操作失敗,輸入不能為空,餐桌添加不成功!");
}
}
private void button2_Click(object sender, System.EventArgs e) //刪除餐桌
{
if(this.textBox1.Text.Trim()!="" && this.comboBox1.Text.Trim()!="")
{
typeload.delcanzhuo(this.textBox1.Text,this.comboBox1.Text);
MessageBox.Show("餐桌刪除已成功");
objset=typeload.selectlistview();
this.lv.Items.Clear();
foreach(DataRow dr in objset.Tables[0].Rows)
{
if(dr["carea"].ToString().Trim()==chi.Trim())
{
ListViewItem lst=new ListViewItem();
lst.SubItems.Clear();
lst.SubItems[0].Text=dr[0].ToString();
lst.SubItems.Add(dr[1].ToString());
lst.SubItems.Add(dr[2].ToString());
lst.SubItems.Add(dr[3].ToString());
lst.SubItems.Add(dr[4].ToString());
lst.SubItems.Add(dr[5].ToString());
lst.SubItems.Add(dr[6].ToString());
lst.SubItems.Add(dr[7].ToString());
lst.SubItems.Add(dr[8].ToString());
lst.SubItems.Add(dr[9].ToString());
lv.Items.Add(lst);
}
}
}
else
{
MessageBox.Show("操作失敗,輸入不能為空,餐桌添加不成功!");
}
}
private void button3_Click(object sender, System.EventArgs e) //退出
{
this.Close();
}
private void textBox1_Leave(object sender, System.EventArgs e) //對(duì)textBox1的判斷
{
bggl.gong.zhipd pd=new bggl.gong.zhipd();
if(pd.intjc(this.textBox1.Text.Trim())!=true)
{
MessageBox.Show("餐桌號(hào)只能為數(shù)字!");
this.textBox1.Text="";
}
}
}
}
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -