/// <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/05/2008 /// @description : Save a schedule for workstation instance /// </summary> /// <param name="workstationId"></param> private void SaveOneScheduleWorkstation(int workstationId) { ScheduleWorkstation swNew = new ScheduleWorkstation(scheduleId, workstationId); Pattern pattern = new Pattern(); pattern.StartTime = txtStartTime.Text; pattern.EndTime = txtEndTime.Text; pattern.Weekly = GetWeeklyValue(); pattern.Daily = GetDailyValue(); pattern.Monthly = GetMonthlyValue(); swNew.PatternItem = pattern; bschedule.Add(swNew); }
/// <summary> /// @author : khoaht /// @createDate:28/05/2008 /// @description : Save advance schedule /// </summary> private void SaveAdvanceSchedulePerAWorkstation() { // Save advance per workstation // Advance schedule if (listWorkstationAdded.Items.Count <= 0) return; // get workstation id int workstationId = (int)listWorkstationAdded.SelectedValue; ScheduleWorkstation swUpdate = new ScheduleWorkstation(scheduleId, workstationId); Pattern pattern = new Pattern(); swUpdate.Sequence = byte.Parse(txtFreq.Text.Trim()); swUpdate.Status = 1; swUpdate.Priority = Byte.Parse(txtPriority.Text);// Default pattern.StartTime = txtStartTime.Text; pattern.EndTime = txtEndTime.Text; pattern.Weekly = GetWeeklyValue(); pattern.Daily = GetDailyValue(); pattern.Monthly = GetMonthlyValue(); swUpdate.PatternItem = pattern; bschedule.Update(swUpdate); // end advance schedule }
private void InitScheduleWorkstationData() { // backup scheduleAdvance list //_dsWorksationNeed = scheduleWorkstation; for (int i = 0; i < listWorkstationAdded.Items.Count; i++) { ScheduleWorkstation data = new ScheduleWorkstation(); data.Priority = txtPriority.Text.Trim()==""?(byte)1:byte.Parse(txtPriority.Text.Trim()); data.Sequence = txtFreq.Text.Trim()==""?(byte)1:byte.Parse(txtFreq.Text.Trim()); data.Status= (byte)1; data.WorkstationId = int.Parse(((System.Data.DataRowView)(listWorkstationAdded.Items[i])).Row.ItemArray[0].ToString()); data.PatternItem = new Pattern(txtStartTime.Text.Trim(),txtEndTime.Text.Trim(),GetDailyValue(),GetWeeklyValue(),GetMonthlyValue()); scheduleWorkstation[i] = data; } }
/// <summary> /// @author : khoaht /// @createDate:28/04/2008 /// @description : Init scheduleWorstation data /// </summary> private void InitScheduleWorkstation() { int index = 0; if(!ValidateFreq(txtFreq.Text.Trim())) txtFreq.Text="1"; //end advance schedule foreach (DataRow rowSW in dsWorksationNeed.Tables[0].Rows) { int workstatinId = Int32.Parse(rowSW["WORKSTATION_ID"].ToString()); scheduleWorkstation[index] = new ScheduleWorkstation(); scheduleWorkstation[index].ScheduleId = this.scheduleId; scheduleWorkstation[index].WorkstationId = workstatinId; scheduleWorkstation[index].Sequence = byte.Parse(txtFreq.Text.Trim()); scheduleWorkstation[index].Status = 1; scheduleWorkstation[index].Priority = Byte.Parse(txtPriority.Text) ;// Default index++; } }
/// <summary> /// @author : khoaht /// @createDate:28/04/2008 /// @modified:08/2008 /// @description : Save schedule workstation /// </summary> private void SaveScheduleWorkstations() { int index = 0; scheduleWorkstation = new ScheduleWorkstation[tblWorkstation.Rows.Count]; Pattern prt = new Pattern(txtStartTime.Text, txtEndTime.Text, GetDailyValue(), GetWeeklyValue(), GetMonthlyValue()); foreach (DataRow dr in tblWorkstation.Rows) { if ((bool)dr[STR_TICK]) { scheduleWorkstation[index] = new ScheduleWorkstation(); scheduleWorkstation[index].WorkstationId = (int)dr["WORKSTATION_ID"]; scheduleWorkstation[index].ScheduleId = this.scheduleId; scheduleWorkstation[index].Sequence = byte.Parse(txtFreq.Text.Trim()); scheduleWorkstation[index].Length = GetClipLength(); scheduleWorkstation[index].Status = 1;// Default scheduleWorkstation[index].Priority = Byte.Parse(txtPriority.Text); //Default scheduleWorkstation[index].PatternItem = prt; index++; } } bschedule.AddGroupd(scheduleWorkstation); }