private void btnAddSchedule_Click(object sender, EventArgs e) { if (main_busDto == null) { MessageBox.Show("Please choose bus before create Schedule"); } else { ScheduleDetailOfBus form = new ScheduleDetailOfBus(main_busDto, (RouteDTO)cbbRouteID.SelectedItem); form.ShowDialog(); main_scheduleDto = bll.SearchScheduleOfBusByBusId(txtId.Text); foreach (var item in main_scheduleDto) { item.DepartureTime = item.DepartureTime.Split(' ')[1] + " " + item.DepartureTime.Split(' ')[2]; item.TimeBack = item.TimeBack.Split(' ')[1] + " " + item.TimeBack.Split(' ')[2]; } LoadListSchedule(); } }
private void dgvSchedule_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (main_busDto == null) { MessageBox.Show("Please choose bus before create Schedule"); } else { StaffBLL sBll = new StaffBLL(); int index = dgvSchedule.CurrentRow.Index; BusStationGridView schedule_dto = bll.GetDetailOfScheduleById(int.Parse(dgvSchedule.Rows[index].Cells["Id"].Value.ToString())); StaffDTO driver = sBll.SearchStaffById(schedule_dto.MSNVDRIVER); StaffDTO casher = sBll.SearchStaffById(schedule_dto.MSNVCAST); ScheduleDetailOfBus form = new ScheduleDetailOfBus(main_busDto, (RouteDTO)cbbRouteID.SelectedItem, schedule_dto, driver, casher); form.ShowDialog(); main_scheduleDto = bll.SearchScheduleOfBusByBusId(txtId.Text); foreach (var item in main_scheduleDto) { item.DepartureTime = item.DepartureTime.Split(' ')[1] + " " + item.DepartureTime.Split(' ')[2]; item.TimeBack = item.TimeBack.Split(' ')[1] + " " + item.TimeBack.Split(' ')[2]; } LoadListSchedule(); } }