public static int AddYd(YDMDL y) { string sql = "insert into YuDing values(@YDID,@KName,@KPhone,@RTID,@TBID,@YTime,@YJ,@Price,@bz,@daoda)"; SqlParameter[] sp = { new SqlParameter("@YDID", y.YDID), new SqlParameter("@KName", y.KName), new SqlParameter("@KPhone", y.KPhone), new SqlParameter("@RTID", y.RTID), new SqlParameter("@TBID", y.TBID), new SqlParameter("@YTime", y.YTime), new SqlParameter("@YJ", y.YJ), new SqlParameter("@Price", y.Price), new SqlParameter("@bz", y.bz), new SqlParameter("@daoda", y.daoda), }; return(DBhelper.MyExecuteNonQuery(sql, sp)); }
private void button3_Click(object sender, EventArgs e) { //验证数据 if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "") { new Warning("信息填写不完整", 图标.Erro).Show(); return; } //遍历listview1,插入数据 //判断白道是已经有这个桌子 int c = 0; foreach (ListViewItem item in listView1.Items) { //@YDID,@KName,@KPhone,@PTID,@TBID,@YTime,@YJ,@Price,@bz YDMDL y = new YDMDL(); y.YDID = label9.Text; y.KName = textBox1.Text; y.KPhone = textBox2.Text; y.RTID = item.Name; y.TBID = item.Tag.ToString(); y.YTime = dateTimePicker1.Value.ToString("yyyy-MM-dd"); y.YJ = textBox3.Text; y.bz = textBox5.Text; y.Price = "0"; y.daoda = "0"; c = YDBLL.AddYd(y); TablesBLL.UpdateTables(Convert.ToInt32(item.Tag), (int)餐台状态.预订); } if (c > 0) { new Warning("预约成功", 图标.Yes).Show(); this.Close(); } //MessageBox.Show("房间:"+listView1.SelectedItems[0].Name+"\n\r"+"桌子:"+listView1.SelectedItems[0].Tag); }
public static int AddYd(YDMDL y) { return(YdDAL.AddYd(y)); }