public static Room DTOToRoom(RoomDTO room) { return(new Room() { Id = room.Id, ClassId = room.ClassId, Floor = room.Floor, Number = room.Number, UseFor = room.UseFor }); }
private void MetroButton_addItem_Click(object sender, EventArgs e) { try { DTO.RoomDTO room = listViewItem.Tag as DTO.RoomDTO; //lay ra table hien tai int idBill = BUS.bill_BUS.GetBillNotPaymentByIdRoom(room.IdRoom); int idMenu = idItem; //testing int count = (int)numericUpDown_Count.Value; if (count > amoutItem) { MessageBox.Show("Not enough to add!"); return; } if (count == 0) { MessageBox.Show("Please input number of " + nameItem.ToString() + " do you want to add"); return; } if (idBill == -1) //chuaco bill nao het { BUS.bill_BUS.AddBill(room.IdRoom); BUS.billInfo_BUS.AddBillInfo(BUS.bill_BUS.getMaxIdBill(), idMenu, count); } else { BUS.billInfo_BUS.AddBillInfo(idBill, idMenu, count); } if (count > 0) { MessageBox.Show(nameItem.ToString() + " was added to " + room.Name.ToString() + "!"); } else { MessageBox.Show(count.ToString() + " " + nameItem.ToString() + " in " + room.Name.ToString() + " successfully!"); } LoadItemOfRoom(room.IdRoom); Load_Room(); } catch { } }
private void metroTile_Edit_Click(object sender, EventArgs e) { if (metroTextBox_name.Text == "") { MessageBox.Show("Please input room's name !"); return; } DTO.RoomDTO r = new DTO.RoomDTO(); r.IdRoom = int.Parse(metroTextBox_id.Text); r.Name = metroTextBox_name.Text; if (metroRadioButton_Available.Checked == true) { r.Status = 0; } else if (metroRadioButton_NotAvailable.Checked == true) { r.Status = 1; } else { r.Status = 2; } if (metroRadioButton_roomNormal.Checked == true) { r.Kind_Of_Room = 0; } else { r.Kind_Of_Room = 1; } r.Price = int.Parse(metroTextBox_price.Text); if (RoomBUS.EditRoom(r) == true) { MessageBox.Show("Room was updated !"); Load_Room(); } else { MessageBox.Show("Can't update this room !"); } }