private void FrmRoomManager_Load_1(object sender, EventArgs e) { CmpSetDgv(); cboReserWay.SelectedIndex = 0; dgvBou.DataSource = ReserService.SelectReserAll(); Type.DataSource = RoomTypeManager.SelectRoomTypesAll(); Type.DisplayMember = "RoomName"; //显示的列名 Type.ValueMember = "Roomtype"; //绑定的值 }
private void picDeleteReser_Click(object sender, EventArgs e) { string sql = "delete from RESER where ReserId='" + txtReserNo.Text + "'"; SqlConnection con = DBHelper.GetConnection(); int n = DBHelper.ExecuteNonQuery(sql); MessageBox.Show("删除预约信息成功", "删除提示"); txtReserNo.Text = ""; dgvBou.DataSource = ReserService.SelectReserAll(); }
private void picUpdate_Click(object sender, EventArgs e) { if (txtReserNo.Text == "") { MessageBox.Show("还没选择预约客户信息,无法进行修改!"); } else { int n = 0; string sql = "update RESER set CustoName='" + txtCustoName.Text + "',CustoTel='" + txtCustoTel.Text + "',ReserWay='" + cboReserWay.Text + "',ReserRoom='" + Type.SelectedIndex + "',ReserCash='" + ReserCash.Text + "',ReserDate='" + dtpBouDate.Value.ToShortDateString() + "',ReserPerson='" + txtReserNum.Text + "',ReserRemark='" + txtMessage.Text + "' where ReserId='" + txtReserNo.Text + "'"; SqlConnection con = DBHelper.GetConnection(); n = DBHelper.ExecuteNonQuery(sql); MessageBox.Show("修改预约信息成功"); dgvBou.DataSource = ReserService.SelectReserAll(); } }
private void picAddReserInfo_Click(object sender, EventArgs e) { if (txtReserNo.Text == "") { MessageBox.Show("预约编号不能为空!", "TS提醒"); } else { int n = 0; string sql = "insert RESER values('" + txtReserNo.Text + "','" + txtCustoName.Text + "','" + txtCustoTel.Text + "','" + cboReserWay.Text + "','" + Type.SelectedIndex + "','" + ReserCash.Text + "','" + dtpBouDate.Value + "','" + txtReserNum.Text + "','" + txtMessage.Text + "')"; SqlConnection con = DBHelper.GetConnection(); n = DBHelper.ExecuteNonQuery(sql); MessageBox.Show("添加预约信息成功"); dgvBou.DataSource = ReserService.SelectReserAll(); txtCustoName.Text = ""; txtCustoTel.Text = ""; cboReserWay.Text = ""; Type.Text = ""; ReserCash.Text = ""; dtpBouDate.Text = ""; txtReserNum.Text = ""; txtMessage.Text = ""; } }
public static List <Reser> SelectReserAll() { return(ReserService.SelectReserAll()); }