/// <summary> /// @author : khoaht /// @createDate:28/05/2008 /// @description : Save all /// </summary> private void AddAllScheduleWorkstation() { BSchedule schedule = new BSchedule(); if (listWorkstationAdded.Items.Count > 0) { scheduleWorkstation = new ScheduleWorkstation[listWorkstationAdded.Items.Count]; InitScheduleWorkstation(); // Remove older if (update) { if (_dsWorksationNeed.Tables[0].Rows.Count > 0) { ScheduleWorkstation[] olderRemove = new ScheduleWorkstation[_dsWorksationNeed.Tables[0].Rows.Count]; int index = 0; foreach (DataRow row in _dsWorksationNeed.Tables[0].Rows) olderRemove[index++] = new ScheduleWorkstation(this.scheduleId, (int)row["WORKSTATION_ID"]); schedule.Delete(olderRemove); } } schedule.AddGroupd(scheduleWorkstation); } else if (update) { // Remove older if (_dsWorksationNeed.Tables[0].Rows.Count > 0) { ScheduleWorkstation[] olderRemove = new ScheduleWorkstation[_dsWorksationNeed.Tables[0].Rows.Count]; int index = 0; foreach (DataRow row in _dsWorksationNeed.Tables[0].Rows) olderRemove[index++] = new ScheduleWorkstation(this.scheduleId, (int)row["WORKSTATION_ID"]); schedule.Delete(olderRemove); } } }
/// <summary> /// @author : khoaht /// @createDate:28/04/2008 /// @modifiedDate:28/04/2008 /// @description : Save schedule workstation /// </summary> private void SaveScheduleWorkstations(BSchedule bsch,Schedule sch) { bool RemoveAll=true; if(scheduleWorkstation!=null) { for (int i = 0; i < scheduleWorkstation.Length; i++) if(scheduleWorkstation[i]!=null) { scheduleWorkstation[i].ScheduleId = sch.ScheduleId; RemoveAll=false; } bsch.AddGroupd(scheduleWorkstation); } if(RemoveAll)// Must sure the schedule of all workstations are removed { bsch.DeleteScheduleFromWorkstatoins(sch); } }