您好,欢迎光临本网站![请登录][注册会员]  
文件名称: 小型餐饮管理(适用于初学学生参考)
  所属分类: C/C++
  开发工具:
  文件大小: 902byte
  下载次数: 0
  上传时间: 2011-06-22
  提 供 者: coolha******
 详细说明: 功能介绍:增;减;修;查;用户权限 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace MRCY { public partial class frmUser : Form { public frmUser() { InitializeComponent(); } private void BindData() { SqlConnection conn = BaseClass.DBConn.CyCon(); SqlDataAdapter sda = new SqlDataAdapter(" select WaiterName,CardNum,WaiterNum,Sex,Age,Tel,ID from tb_Waiter order by ID desc", conn); DataSet ds = new DataSet(); sda.Fill(ds); dataGridView1.DataSource = ds.Tables[0]; } private void button7_Click(object sender, EventArgs e) { this.Close(); BindData(); } private void frmUser_Load(object sender, EventArgs e) { comboBox1.SelectedIndex = 0; } private void button5_Click(object sender, EventArgs e) { BindData(); } private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { txtname.Text = dataGridView1.SelectedCells[0].Value.ToString(); txtjc.Text = dataGridView1.SelectedCells[1].Value.ToString(); txtbjf.Text = dataGridView1.SelectedCells[2].Value.ToString(); comboBox1.SelectedItem = dataGridView1.SelectedCells[3].Value.ToString().Trim(); txtlx.Text = dataGridView1.SelectedCells[4].Value.ToString(); txtbz.Text = dataGridView1.SelectedCells[5].Value.ToString(); button2.Enabled = true; button6.Enabled = true; } private void button1_Click(object sender, EventArgs e) { txtname.Text = ""; txtlx.Text = ""; txtjc.Text = ""; txtbz.Text = ""; txtbjf.Text = ""; txtname.Enabled = true; txtjc.Enabled = true; txtbjf.Enabled = true; comboBox1.Enabled = true; txtlx.Enabled = true; txtbz.Enabled = true; button3.Enabled = true; button4.Enabled = true; button2.Enabled = false; } private void button2_Click(object sender, EventArgs e) { button1.Enabled = false; button3.Enabled = true; button4.Enabled = true; txtname.Enabled = false; txtjc.Enabled = true; txtbjf.Enabled = true; this.comboBox1.Enabled = true; txtlx.Enabled = true; txtbz.Enabled = true; } private void button3_Click(object sender, EventArgs e) { SqlConnection conn = BaseClass.DBConn.CyCon(); conn.Open(); SqlCommand cmd = new SqlCommand("select count(*) from tb_Waiter where WaiterName='" + txtname.Text + "'", conn); int i = Convert.ToInt32(cmd.ExecuteScalar()); if (i > 0) { cmd = new SqlCommand("update tb_Waiter set WaiterName='" + txtname.Text + "',CardNum='" + txtjc.Text + "',WaiterNum='" + txtbjf.Text + "',Sex='" + comboBox1.SelectedItem.ToString() + "',Age='" + txtlx.Text + "',Tel='" + txtbz.Text + "' where ID='" + dataGridView1.SelectedCells[6].Value.ToString() + "'", conn); cmd.ExecuteNonQuery(); conn.Close(); BindData(); button1.Enabled = true; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; button5.Enabled = true; button6.Enabled = false; button7.Enabled = true; txtname.Enabled = false; } else { cmd = new SqlCommand("insert into tb_Waiter(WaiterName,CardNum,WaiterNum,Sex,Age,Tel) values('" + txtname.Text + "','" + txtjc.Text + "','" + txtbjf.Text + "','" + comboBox1.SelectedItem.ToString() + "','" + txtlx.Text + "','" + txtbz.Text + "')", conn); cmd.ExecuteNonQuery(); conn.Close(); BindData(); button1.Enabled = true; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; button5.Enabled = true; button6.Enabled = false; button7.Enabled = true; txtname.Enabled = false; } } private void button4_Click(object sender, EventArgs e) { button1.Enabled = true; button2.Enabled = false; button3.Enabled = false; button4.Enabled = false; button6.Enabled = false; txtname.Enabled = false; txtjc.Enabled = false; txtbjf.Enabled = false; this.comboBox1.Enabled = false; txtlx.Enabled = false; txtbz.Enabled = false; } private void button6_Click(object sender, EventArgs e) { SqlConnection conn = BaseClass.DBConn.CyCon(); conn.Open(); SqlCommand cmd = new SqlCommand("delete from tb_Waiter where ID='" + dataGridView1.SelectedCells[6].Value.ToString() + "'", conn); cmd.ExecuteNonQuery(); conn.Close(); BindData(); } } } ...展开收缩
(系统自动生成,下载前可以参看下载内容)

下载文件列表

相关说明

  • 本站资源为会员上传分享交流与学习,如有侵犯您的权益,请联系我们删除.
  • 本站是交换下载平台,提供交流渠道,下载内容来自于网络,除下载问题外,其它问题请自行百度
  • 本站已设置防盗链,请勿用迅雷、QQ旋风等多线程下载软件下载资源,下载后用WinRAR最新版进行解压.
  • 如果您发现内容无法下载,请稍后再次尝试;或者到消费记录里找到下载记录反馈给我们.
  • 下载后发现下载的内容跟说明不相乎,请到消费记录里找到下载记录反馈给我们,经确认后退回积分.
  • 如下载前有疑问,可以通过点击"提供者"的名字,查看对方的联系方式,联系对方咨询.
 相关搜索: 餐饮管理
 输入关键字,在本站1000多万海量源码库中尽情搜索: