📄 frmcaidan.cs
字号:
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(288, 24);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(112, 21);
this.textBox3.TabIndex = 3;
this.textBox3.Text = "";
//
// label4
//
this.label4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label4.Location = new System.Drawing.Point(232, 24);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 24);
this.label4.TabIndex = 2;
this.label4.Text = "菜名:";
//
// label3
//
this.label3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label3.Location = new System.Drawing.Point(40, 24);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 24);
this.label3.TabIndex = 0;
this.label3.Text = "菜型:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(8, 16);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(88, 24);
this.button1.TabIndex = 2;
this.button1.Text = "查询";
this.button1.Click += new System.EventHandler(this.button1_Click_1);
//
// button2
//
this.button2.Location = new System.Drawing.Point(8, 48);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(88, 24);
this.button2.TabIndex = 3;
this.button2.Text = "退出";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// groupBox1
//
this.groupBox1.Location = new System.Drawing.Point(-432, 112);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(568, 160);
this.groupBox1.TabIndex = 5;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "groupBox1";
this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter);
//
// button3
//
this.button3.Location = new System.Drawing.Point(8, 80);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(88, 24);
this.button3.TabIndex = 4;
this.button3.Text = "添加";
this.button3.Click += new System.EventHandler(this.button3_Click_1);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.button1);
this.groupBox3.Controls.Add(this.button2);
this.groupBox3.Controls.Add(this.groupBox1);
this.groupBox3.Controls.Add(this.button3);
this.groupBox3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.groupBox3.Location = new System.Drawing.Point(432, 120);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(104, 112);
this.groupBox3.TabIndex = 4;
this.groupBox3.TabStop = false;
//
// frmcaidan
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(584, 341);
this.Controls.Add(this.groupBox4);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.dataGrid1);
this.Name = "frmcaidan";
this.Text = "菜单管理";
this.Load += new System.EventHandler(this.frmcaidan_Load);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.groupBox4.ResumeLayout(false);
this.groupBox3.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void button3_Click(object sender, System.EventArgs e)
{
}
private void frmcaidan_Load(object sender, System.EventArgs e)
{
DataSet objset=caidan.seltype(); //对餐厅的第一个下拉框,模糊查
foreach(DataRow br in objset.Tables[0].Rows)
{
this.comboBox1.Items.Add(br[0].ToString());
}
objset=cx.cttype(); //菜型下拉框
foreach(DataRow br in objset.Tables[0].Rows)
{
this.comboBox2.Items.Add(br[0].ToString());
}
}
private void button2_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void button1_Click_1(object sender, System.EventArgs e) //查询或者条件查询
{
try
{
DataSet objset1=caidan.selmenu(this.comboBox1.Text,this.textBox1.Text);
this.dataGrid1.DataSource=objset1.Tables["BG_Menu"].DefaultView;
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void dataGrid1_DoubleClick(object sender, System.EventArgs e)//获取数据框的值
{
int mm=this.dataGrid1.CurrentRowIndex;
int wz=Convert.ToInt16(this.dataGrid1[mm,0].ToString());
frmcaidanadd yy=new frmcaidanadd(wz,this.dataGrid1,this.comboBox1);
yy.Show();
}
private void dataGrid1_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
{
}
private void label1_Click(object sender, System.EventArgs e)
{
}
private void groupBox2_Enter(object sender, System.EventArgs e)
{
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
}
private void groupBox1_Enter(object sender, System.EventArgs e)
{
}
private void button3_Click_1(object sender, System.EventArgs e) //添加菜单
{
if(this.comboBox2.Text.Trim()!="" && this.textBox3.Text.Trim()!="" && this.textBox4.Text.Trim()!="" && this.textBox5.Text.Trim()!="")
{
ii.addcaidan(this.comboBox2.Text,this.textBox3.Text,this.textBox4.Text,this.textBox5.Text);
cs.selectmenu fork=new bggl.cs.selectmenu();
DataSet objset=fork.selmenu("","");
this.dataGrid1.DataSource=objset.Tables[0].DefaultView;
setlv();
MessageBox.Show("保存成功!");
}
else
{
MessageBox.Show("操作不正确,输入不能为空,保存失败!");
}
this.textBox3.Text="";
this.textBox4.Text="";
this.textBox5.Text="";
}
private void setlv() //餐厅类型
{
DataSet sbobjset=new DataSet();
cs.selectmenu sbsql=new bggl.cs.selectmenu();
sbobjset=caidan.seltype();
this.comboBox1.Items.Clear();
foreach(DataRow dr in sbobjset.Tables[0].Rows)
{
this.comboBox1.Items.Add(dr["mtype"].ToString());
}
this.comboBox1.SelectedIndex=0;
}
private void textBox2_Leave(object sender, System.EventArgs e)
{
}
private void textBox4_Leave(object sender, System.EventArgs e) //条件判断textBox4
{
bggl.gong.zhipd pd=new bggl.gong.zhipd();
if(pd.intjc(this.textBox4.Text.Trim())!=true)
{
MessageBox.Show("菜单编号只能为数字!");
this.textBox4.Text="";
}
}
private void textBox5_Leave(object sender, System.EventArgs e) //条件判断textBox5
{
bggl.gong.zhipd pd=new bggl.gong.zhipd();
if(pd.zhi(this.textBox5.Text.Trim())!=true)
{
MessageBox.Show("价格只能输入数字!");
this.textBox5.Text="";
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -