?? frmttype.cs
字號:
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>
/// frmTtype 的摘要說明。
/// </summary>
public class frmTtype : System.Windows.Forms.Form
{
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button4;
cs.frmTtype type=new bggl.cs.frmTtype();
DataSet objset=new DataSet();
TreeView tv;
cs.Class1 zw=new bggl.cs.Class1();
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox1;
private System.ComponentModel.IContainer components;
public frmTtype(TreeView tree)
{
tv=tree;
//
// Windows 窗體設計器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調用后添加任何構造函數代碼
//
}
/// <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()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmTtype));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button3 = new System.Windows.Forms.Button();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.textBox3 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button4 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.button3);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Location = new System.Drawing.Point(8, 8);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(224, 240);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
//
// button3
//
this.button3.ImageIndex = 0;
this.button3.ImageList = this.imageList1;
this.button3.Location = new System.Drawing.Point(192, 112);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(24, 24);
this.button3.TabIndex = 6;
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// imageList1
//
this.imageList1.ImageSize = new System.Drawing.Size(25, 25);
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(80, 152);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(104, 21);
this.textBox3.TabIndex = 5;
this.textBox3.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 160);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(48, 16);
this.label1.TabIndex = 4;
this.label1.Text = "菜型:";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(80, 112);
this.textBox2.Name = "textBox2";
this.textBox2.TabIndex = 3;
this.textBox2.Text = "";
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
this.textBox2.DoubleClick += new System.EventHandler(this.textBox2_DoubleClick_1);
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 120);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(80, 24);
this.label2.TabIndex = 2;
this.label2.Text = "餐廳類型:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button5);
this.groupBox2.Controls.Add(this.button4);
this.groupBox2.Controls.Add(this.button2);
this.groupBox2.Controls.Add(this.button1);
this.groupBox2.Location = new System.Drawing.Point(232, 8);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(104, 240);
this.groupBox2.TabIndex = 2;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "操作";
//
// button4
//
this.button4.Location = new System.Drawing.Point(8, 160);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(80, 32);
this.button4.TabIndex = 3;
this.button4.Text = "退出";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(8, 80);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 32);
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, 32);
this.button1.TabIndex = 0;
this.button1.Text = "添加";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(8, 120);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(80, 32);
this.button5.TabIndex = 4;
this.button5.Text = "修改";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 80);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 16);
this.label3.TabIndex = 7;
this.label3.Text = "餐廳編號:";
//
// textBox1
//
this.textBox1.Enabled = false;
this.textBox1.Location = new System.Drawing.Point(80, 72);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 8;
this.textBox1.Text = "";
//
// frmTtype
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(344, 253);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "frmTtype";
this.Text = "餐廳管理";
this.Load += new System.EventHandler(this.frmTtype_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void textBox2_TextChanged(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e) //添加餐廳
{
if(this.textBox2.Text.Trim()!="" && this.textBox3.Text.Trim()!="")
{
type.addtype(this.textBox2.Text,this.textBox3.Text);
MessageBox.Show("添加已成功!");
this.textBox1.Text="";
this.textBox2.Text="";
this.textBox3.Text="";
gettree();
}
else
{
MessageBox.Show(" 數據輸入不完整,請重新輸入數據!");
}
}
private void frmTtype_Load(object sender, System.EventArgs e)
{
}
private void textBox2_DoubleClick(object sender, System.EventArgs e)
{
}
private void button2_Click(object sender, System.EventArgs e) //刪除餐廳
{
if(this.textBox2.Text.Trim()!="" && this.textBox3.Text.Trim()!="")
{
type.deltype(this.textBox2.Text);
MessageBox.Show("刪除已成功!");
this.textBox2.Text="";
this.textBox3.Text="";
gettree();
}
else
{
MessageBox.Show(" 數據輸入不完整,請重新輸入數據!");
}
}
private void gettree() //樹的方法
{
this.tv.Nodes.Clear();
TreeNode node=new TreeNode();
node.Text="全部顯示";
node.Tag=1;
this.tv.Nodes.Add(node);
this.tv.SelectedNode=node;
DataSet objsetfjlx=new DataSet();
objsetfjlx=zw.selecttree();
foreach(DataRow dr in objsetfjlx.Tables[0].Rows)
{
TreeNode nodec=new TreeNode();
nodec.Text=dr["CTqy"].ToString();
nodec.Tag=1;
this.tv.SelectedNode.Nodes.Add(nodec);
this.tv.SelectedNode=nodec;
tv.SelectedNode=nodec.Parent;
}
}
private void textBox2_DoubleClick_1(object sender, System.EventArgs e)
{
}
// private void button5_Click(object sender, System.EventArgs e)
// {
// frmtype zz=new frmtype(this.textBox2);
// zz.Show();
// }
private void button4_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void button3_Click(object sender, System.EventArgs e) //
{
frmtype zz=new frmtype(this.textBox1,this.textBox2,this.textBox3);
zz.ShowDialog();
}
private void button5_Click(object sender, System.EventArgs e) //修改餐廳
{
if(this.textBox2.Text.Trim()!="" && this.textBox3.Text.Trim()!="")
{
type.uptype(Convert.ToInt16(this.textBox1.Text.Trim()),this.textBox2.Text.Trim(),this.textBox3.Text.Trim());
MessageBox.Show("修改已成功!");
this.textBox1.Text="";
this.textBox2.Text="";
this.textBox3.Text="";
gettree();
}
else
{
MessageBox.Show(" 數據輸入不完整,請重新輸入數據!");
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -