Ejemplo n.º 1
0
        private void allocateButton_Click(object sender, EventArgs e)
        {
            int deptId = (int)deptComboBox.SelectedValue;
            int courseId = (int) courseComboBox.SelectedValue;
            int roomId = (int)roomComboBox.SelectedValue;
            string day = dayComboBox.Text;
            DateTime fromTime = fromDateTimePicker.Value;
            DateTime toTime = toDateTimePicker.Value;
            RoomAllocation roomAllocation=new RoomAllocation(deptId,courseId,roomId,day,fromTime,toTime);
            RoomAllocationManager manager=new RoomAllocationManager();
            try
            {
                if (manager.IsRoomAvailable(roomId, day, fromTime, toTime))
                {

                    if (manager.Save(roomAllocation))
                    {
                        MessageBox.Show("Room Allocated");

                    }
                    else
                    {
                        MessageBox.Show("Room Allocation Failed");
                    }
                }
            }
            catch (Exception exception)
            {

                MessageBox.Show(exception.Message);
            }
        }
Ejemplo n.º 2
0
 private void LoadRoomCombobox()
 {
     RoomAllocationManager roomAllocationManager = new RoomAllocationManager();
     roomComboBox.DataSource = null;
     roomComboBox.DataSource = roomAllocationManager.GetAllRoom();
     roomComboBox.DisplayMember = "Name";
     roomComboBox.ValueMember = "Id";
 }