private void btn_RoomTypeEdit_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection r = dgv_RoomType.SelectedRows; if (r.Count == 1) { if ((bool)r[0].Cells["RoTyActiveflag"].Value == true) { Form_Detail_Room_Type f = new Form_Detail_Room_Type(int.Parse(r[0].Cells["IdRoomType"].Value.ToString()), true); this.Hide(); f.myDel = new Form_Detail_Room_Type.MyDel(LoadRoomTypeList); f.ShowDialog(); this.Show(); } else { MessageBox.Show("Can't update inactive roomtype!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (r.Count == 0) { MessageBox.Show("Bạn chưa chọn loại phòng để cập nhật!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Chỉ có thể chọn một loại phòng trong một lần cập nhật!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btn_RoomTypeAdd_Click(object sender, EventArgs e) { Form_Detail_Room_Type f = new Form_Detail_Room_Type(0, true); this.Hide(); f.myDel = new Form_Detail_Room_Type.MyDel(LoadRoomTypeList); f.ShowDialog(); this.Show(); //Reload data }
//----- RoomType Events -----// private void btn_RoomTypeView_Click(object sender, EventArgs e) { DataGridViewSelectedRowCollection r = dgv_RoomType.SelectedRows; if (r.Count == 1) { Form_Detail_Room_Type f = new Form_Detail_Room_Type(int.Parse(r[0].Cells["IdRoomtype"].Value.ToString()), false); this.Hide(); f.myDel = new Form_Detail_Room_Type.MyDel(LoadRoomTypeList); f.ShowDialog(); this.Show(); //Reload Data } else if (r.Count == 0) { MessageBox.Show("Bạn chưa chọn loại phòng để xem!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Chỉ có thể chọn một loại phòng trong một lần xem!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Error); } }