private void btnSaveSche_Click(object sender, EventArgs e) { if (TEMP == 1) { if (this.staff.Type == 2) { scheduleBus.InsertBus(txtScheduleId.Text, txtWork.Text, rtxDetailSche.Text, txtPlace.Text, dtpBeginDate.Value, dtpEndDate.Value, scheduleBus.getFacultyId(this.staff.ID), "NULL"); schedule.ID = txtScheduleId.Text.ToString(); schedule.Work = txtWork.Text.ToString(); schedule.Detail = rtxDetailSche.Text.ToString(); schedule.Place = txtPlace.Text.ToString(); schedule.BeginDate = dtpBeginDate.Value; schedule.EndDate = dtpEndDate.Value; STATUS_BUTTON = 1; } else { scheduleBus.InsertBus(txtScheduleId.Text, txtWork.Text, rtxDetailSche.Text, txtPlace.Text, dtpBeginDate.Value, dtpEndDate.Value, "NULL", scheduleBus.getSubjectId(this.staff.ID)); schedule.ID = txtScheduleId.Text.ToString(); schedule.Work = txtWork.Text.ToString(); schedule.Detail = rtxDetailSche.Text.ToString(); schedule.Place = txtPlace.Text.ToString(); schedule.BeginDate = dtpBeginDate.Value; schedule.EndDate = dtpEndDate.Value; STATUS_BUTTON = 1; } if (frmSelectStaff == null) { frmSelectStaff = new FrmSelectStaff(staff, schedule, STATUS_BUTTON); frmSelectStaff.Show(); } LoadData(); TEMP = 0; } else { if (this.staff.Type == 2) { scheduleBus.UpdateBus(txtScheduleId.Text, txtWork.Text, rtxDetailSche.Text, txtPlace.Text, dtpBeginDate.Value, dtpEndDate.Value, scheduleBus.getFacultyId(this.staff.ID), "NULL"); schedule.ID = txtScheduleId.Text.ToString(); schedule.Work = txtWork.Text.ToString(); schedule.Detail = rtxDetailSche.Text.ToString(); schedule.Place = txtPlace.Text.ToString(); schedule.BeginDate = dtpBeginDate.Value; schedule.EndDate = dtpEndDate.Value; STATUS_BUTTON = 2; } else { scheduleBus.UpdateBus(txtScheduleId.Text, txtWork.Text, rtxDetailSche.Text, txtPlace.Text, dtpBeginDate.Value, dtpEndDate.Value, "NULL", scheduleBus.getSubjectId(this.staff.ID)); schedule.ID = txtScheduleId.Text.ToString(); schedule.Work = txtWork.Text.ToString(); schedule.Detail = rtxDetailSche.Text.ToString(); schedule.Place = txtPlace.Text.ToString(); schedule.BeginDate = dtpBeginDate.Value; schedule.EndDate = dtpEndDate.Value; STATUS_BUTTON = 2; } if (frmSelectStaff == null) { frmSelectStaff = new FrmSelectStaff(staff, schedule, STATUS_BUTTON); frmSelectStaff.Show(); } LoadData(); TEMP = 0; } }