public bool addRoomBook(RoomBook roomBook) { try { int param = 7; string[] name = new string[param]; object[] value = new object[param]; name[0] = "@begindate"; value[0] = roomBook.Begindate; name[1] = "@enddate"; value[1] = roomBook.Enddate; name[2] = "@roomid"; value[2] = roomBook.Roomid; name[3] = "@customeid"; value[3] = roomBook.Customerid; name[4] = "@roombookStatusId"; value[4] = roomBook.RoomBookStatusid; name[5] = "@note"; value[5] = roomBook.Note; name[6] = "@deposit"; value[6] = roomBook.Deposit; int result = this.Update("RoomBook_Insert", name, value, param); if (result != 0) { return true; } } catch (System.Exception ex) { Console.WriteLine("Message = {1}", ex.Message); } return false; }
private void btAdd_Click(object sender, EventArgs e) { RoomBook newRoomBook = new RoomBook(); this.Hide(); RoomBookEdit editform = new RoomBookEdit(newRoomBook, 2); editform.Show(); }
public RoomBookEdit(RoomBook roomBooks, int type) { InitializeComponent(); this.roomBook = roomBooks; this.typeHandle = type; this.tbID.Enabled = false; roomBookBLT = new RoomBookBLT(); }
public DataTable searchRoomBook(RoomBook roomBook, string customerName="") { try { DataTable table = roomBookDAT.SearchRoomBook(roomBook, customerName); return table; } catch (System.Exception ex) { Console.WriteLine("Message= {1}", ex.Message); } return null; }
private void btEdit_Click(object sender, EventArgs e) { //KO cho edit Cai da het han // // // if (gridRoomBook.Rows.Count > 1) { rowIndex = this.gridRoomBook.CurrentCell.RowIndex; if ((rowIndex < gridRoomBook.RowCount - 1) && (rowIndex >= 0)) { RoomBook editRoomBook = new RoomBook(); editRoomBook.Id = gridRoomBook.Rows[rowIndex].Cells[0].Value.ToString(); editRoomBook.Begindate = gridRoomBook.Rows[rowIndex].Cells[1].Value.ToString(); editRoomBook.Enddate = gridRoomBook.Rows[rowIndex].Cells[2].Value.ToString(); editRoomBook.Roomid = gridRoomBook.Rows[rowIndex].Cells[3].Value.ToString(); editRoomBook.Customerid = gridRoomBook.Rows[rowIndex].Cells[4].Value.ToString(); editRoomBook.RoomBookStatusid = gridRoomBook.Rows[rowIndex].Cells[5].Value.ToString(); if (editRoomBook.RoomBookStatusid == "Da het han") { //ko cho edit ......... } editRoomBook.Note = gridRoomBook.Rows[rowIndex].Cells[6].Value.ToString(); editRoomBook.Deposit = Convert.ToDecimal(gridRoomBook.Rows[rowIndex].Cells[7].Value); this.Hide(); RoomBookEdit editform = new RoomBookEdit(editRoomBook, 1); editform.Show(); } } else { MessageBox.Show("Not Select"); } }
private void btSearch_Click(object sender, EventArgs e) { RoomBook searchRoomBook = new RoomBook(); searchRoomBook.Begindate = this.dateBegin.Value.Date.ToString("MM/dd/yyyy"); searchRoomBook.Enddate = this.dateEnd.Value.Date.ToString("MM/dd/yyyy"); searchRoomBook.Roomid = this.cbRoom.SelectedValue.ToString(); searchRoomBook.Customerid = this.cbCustomer.SelectedValue.ToString(); searchRoomBook.RoomBookStatusid = this.cbStatusRoomBook.SelectedValue.ToString(); searchRoomBook.Note = this.tbNote.Text; searchRoomBook.Deposit = Convert.ToDecimal(this.tbDeposit.Text); this.gridRoomBook.DataSource = roomBookBLT.searchRoomBook(searchRoomBook); }
public bool updateRoomBook(RoomBook roomBook) { return roomBookDAT.updateRoomBook(roomBook); //update lai trang thai phong cu -->> TRong //phong moi -->>Thue }
public bool addRoomBook(RoomBook roomBook) { return roomBookDAT.addRoomBook(roomBook); //Cap nhat lai trang thai phong -->Thue }
private void FormSearchBooked_Completed(RoomBook roomBook, string roomName, string customerName) { cmbRoom.Enabled = false; cmbCustomer.Size = new Size(cmbRoom.Size.Width, cmbCustomer.Size.Height); cmbCustomer.DropDownStyle = ComboBoxStyle.DropDownList; cmbCustomer.Enabled = false; btnAddCustomer.Visible = false; cmbRoom.DataSource = roomBLT.getListRoom(); cmbRoom.SelectedIndex = cmbRoom.FindStringExact(roomName); cmbCustomer.SelectedIndex = cmbCustomer.FindStringExact(customerName); txtBail.Text = roomBook.Deposit.ToString(); }
public bool updateRoomBook(RoomBook roomBook) { try { SqlParameter[] para = new SqlParameter[8]; para[0] = new SqlParameter("@id", roomBook.Id); para[1] = new SqlParameter("@begin", roomBook.Begindate); para[2] = new SqlParameter("@end", roomBook.Enddate); para[3] = new SqlParameter("@roomid", roomBook.Roomid); para[4] = new SqlParameter("@customerid", roomBook.Customerid); para[5] = new SqlParameter("@roombookStatusId", roomBook.RoomBookStatusid); para[6] = new SqlParameter("@note", roomBook.Note); para[7] = new SqlParameter("@deposit", roomBook.Deposit); int result = this.ExecuteNonQuery("UPDATE roombook SET begindate=@begin, enddate=@end, roomid=@roomid, customerid=@customerid, roombookstatusid= @roombookStatusId, note=@note, deposit=@deposit WHERE id = @id", para); if (result != 0) { return true; } } catch (System.Exception ex) { Console.WriteLine("Message = {1}", ex.Message); } return false; }
public DataTable SearchRoomBook(RoomBook roomBook, string customerName="") { try { SqlParameter[] para = new SqlParameter[10]; para[0] = new SqlParameter("@p_id", roomBook.Id); para[1] = new SqlParameter("@p_begindate", roomBook.Begindate); para[2] = new SqlParameter("@p_enddate", roomBook.Enddate); para[3] = new SqlParameter("@p_roomid", roomBook.Roomid); para[4] = new SqlParameter("@p_customerid", roomBook.Customerid); para[5] = new SqlParameter("@p_roombookStatusId", roomBook.RoomBookStatusid); para[6] = new SqlParameter("@p_note", roomBook.Note); para[7] = new SqlParameter("@p_deposit", roomBook.Deposit); para[8] = new SqlParameter("@p_customerName", customerName); para[9] = new SqlParameter("@p_top", 0); DataTable lstRoomBook = LoadDataTableStoreProcedure("RoomBook_Search", para); return lstRoomBook; } catch (System.Exception ex) { Console.WriteLine("Message= {1}", ex.Message); } return null; }