Changeset 16311 for branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
- Timestamp:
- 11/20/18 15:26:57 (5 years ago)
- Location:
- branches/2845_EnhancedProgress
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2845_EnhancedProgress
- Property svn:mergeinfo changed
-
branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
/branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator merged eligible /stable/HeuristicLab.Clients.Hive.Administrator merged eligible /trunk/HeuristicLab.Clients.Hive.Administrator merged eligible /branches/1721-RandomForestPersistence/HeuristicLab.Clients.Hive.Administrator 10321-10322 /branches/Algorithms.GradientDescent/HeuristicLab.Clients.Hive.Administrator 5516-5520 /branches/Async/HeuristicLab.Clients.Hive.Administrator 13329-15286 /branches/Benchmarking/sources/HeuristicLab.Clients.Hive.Administrator 6917-7005 /branches/CloningRefactoring/HeuristicLab.Clients.Hive.Administrator 4656-4721 /branches/CodeEditor/HeuristicLab.Clients.Hive.Administrator 11700-11806 /branches/DataAnalysis Refactoring/HeuristicLab.Clients.Hive.Administrator 5471-5808 /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Clients.Hive.Administrator 5815-6180 /branches/DataAnalysis/HeuristicLab.Clients.Hive.Administrator 4458-4459,4462,4464 /branches/DataPreprocessing/HeuristicLab.Clients.Hive.Administrator 10085-11101 /branches/GP.Grammar.Editor/HeuristicLab.Clients.Hive.Administrator 6284-6795 /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Clients.Hive.Administrator 5060 /branches/HLScript/HeuristicLab.Clients.Hive.Administrator 10331-10358 /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Clients.Hive.Administrator 11570-12508 /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Clients.Hive.Administrator 6123-9799 /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Clients.Hive.Administrator 11130-12721 /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator 15377-15760 /branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.Administrator 12440-12877 /branches/LogResidualEvaluator/HeuristicLab.Clients.Hive.Administrator 10202-10483 /branches/NET40/sources/HeuristicLab.Clients.Hive.Administrator 5138-5162 /branches/NSGA-II Changes/HeuristicLab.Clients.Hive.Administrator 12033-12122 /branches/ParallelEngine/HeuristicLab.Clients.Hive.Administrator 5175-5192 /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Clients.Hive.Administrator 7568-7810 /branches/QAPAlgorithms/HeuristicLab.Clients.Hive.Administrator 6350-6627 /branches/Restructure trunk solution/HeuristicLab.Clients.Hive.Administrator 6828 /branches/RuntimeOptimizer/HeuristicLab.Clients.Hive.Administrator 8943-9078 /branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator 7787-8333 /branches/SlaveShutdown/HeuristicLab.Clients.Hive.Administrator 8944-8956 /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Clients.Hive.Administrator 10204-10479 /branches/SuccessProgressAnalysis/HeuristicLab.Clients.Hive.Administrator 5370-5682 /branches/Trunk/HeuristicLab.Clients.Hive.Administrator 6829-6865 /branches/UnloadJobs/HeuristicLab.Clients.Hive.Administrator 9168-9215 /branches/VNS/HeuristicLab.Clients.Hive.Administrator 5594-5752 /branches/crossvalidation-2434/HeuristicLab.Clients.Hive.Administrator 12948-12950 /branches/histogram/HeuristicLab.Clients.Hive.Administrator 5959-6341 /branches/symbreg-factors-2650/HeuristicLab.Clients.Hive.Administrator 14232-14825
-
Property
svn:mergeinfo
set to
(toggle deleted branches)
-
branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs
r16308 r16311 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 6Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 92 92 93 93 if (!string.IsNullOrEmpty(dtpFrom.Text) && !string.IsNullOrEmpty(dtpTo.Text)) { 94 if ( chbade.Checked) {94 if (DateTime.TryParse(dtpFrom.Text, out from) && DateTime.TryParse(dtpTo.Text, out to) && from <= to) { 95 95 //whole day appointment, only dates are visible 96 if (DateTime.TryParse(dtpFrom.Text, out from) && DateTime.TryParse(dtpTo.Text, out to) && from <= to) 97 offlineTimes.Add(CreateDowntime(from, to.AddDays(1), true, dtType)); 98 else 99 MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 100 } else if (!string.IsNullOrEmpty(txttimeFrom.Text) && !string.IsNullOrEmpty(txttimeTo.Text)) { 101 //Timeframe appointment 102 if (DateTime.TryParse(dtpFrom.Text + " " + txttimeFrom.Text, out from) && DateTime.TryParse(dtpTo.Text + " " + txttimeTo.Text, out to) && from < to) { 96 if (chbade.Checked) { 97 offlineTimes.Add(CreateDowntime(new DateTime(from.Year, from.Month, from.Day), (new DateTime(to.Year, to.Month, to.Day)).AddDays(1), true, dtType)); 98 } else { 99 //Timeframe appointment 103 100 if (from.Date == to.Date) 104 101 offlineTimes.Add(CreateDowntime(from, to, false, dtType)); … … 111 108 offlineTimes.Add(CreateDowntime(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false, dtType)); 112 109 } 113 } else 114 MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 115 } 110 } 111 112 } else { 113 MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 114 } 115 116 116 117 dvOnline.Invalidate(); 117 118 return true; … … 156 157 157 158 private void ChangeRecurrenceDowntime(Guid recurringId) { 158 int hourfrom = int.Parse(txttimeFrom.Text.Substring(0, txttimeFrom.Text.IndexOf(':'))); 159 int hourTo = int.Parse(txttimeTo.Text.Substring(0, txttimeTo.Text.IndexOf(':'))); 160 List<HiveDowntime> recurringDowntimes = offlineTimes.Where(appointment => ((HiveDowntime)appointment).RecurringId == recurringId).ToList(); 161 recurringDowntimes.ForEach(appointment => appointment.StartDate = new DateTime(appointment.StartDate.Year, appointment.StartDate.Month, appointment.StartDate.Day, hourfrom, 0, 0)); 162 recurringDowntimes.ForEach(appointment => appointment.EndDate = new DateTime(appointment.EndDate.Year, appointment.EndDate.Month, appointment.EndDate.Day, hourTo, 0, 0)); 159 DateTime from, to; 160 if (DateTime.TryParse(dtpFrom.Text, out from) && DateTime.TryParse(dtpTo.Text, out to) && from <= to) { 161 List<HiveDowntime> recurringDowntimes = offlineTimes.Where(appointment => ((HiveDowntime)appointment).RecurringId == recurringId).ToList(); 162 recurringDowntimes.ForEach(appointment => appointment.StartDate = new DateTime(appointment.StartDate.Year, appointment.StartDate.Month, appointment.StartDate.Day, from.Hour, 0, 0)); 163 recurringDowntimes.ForEach(appointment => appointment.EndDate = new DateTime(appointment.EndDate.Year, appointment.EndDate.Month, appointment.EndDate.Day, to.Hour, 0, 0)); 164 } else { 165 MessageBox.Show("Incorrect date format", "Schedule Error", MessageBoxButtons.OK, MessageBoxIcon.Error); 166 } 163 167 } 164 168 … … 222 226 protected override void SetEnabledStateOfControls() { 223 227 base.SetEnabledStateOfControls(); 224 } 225 226 public virtual void SetEnabledStateOfSchedule(bool state) { 227 if (InvokeRequired) { 228 Invoke(new Action(() => SetEnabledStateOfSchedule(state))); 229 } else { 230 if (Content == null) state = false; 231 groupBox1.Enabled = state; 232 btnClearCal.Enabled = state; 233 btnSaveCal.Enabled = state; 234 } 235 } 228 bool enabled = Content != null && !Locked; 229 dtpFrom.Enabled = enabled; 230 dtpTo.Enabled = enabled; 231 chbade.Enabled = enabled; 232 btCreate.Enabled = enabled; 233 btbDelete.Enabled = enabled; 234 btnRecurrence.Enabled = enabled; 235 btnClearCal.Enabled = enabled; 236 btnSaveCal.Enabled = enabled; 237 } 238 239 //public virtual void SetEnabledStateOfSchedule(bool state) { 240 // if (InvokeRequired) { 241 // Invoke(new Action(() => SetEnabledStateOfSchedule(state))); 242 // } else { 243 // if (Content == null || Locked || ReadOnly) state = false; 244 // //groupBox1.Enabled = state; 245 // btnClearCal.Enabled = state; 246 // btnSaveCal.Enabled = state; 247 // } 248 //} 236 249 237 250 private void btnClearCal_Click(object sender, System.EventArgs e) { … … 243 256 244 257 private void chbade_CheckedChanged(object sender, EventArgs e) { 245 txttimeFrom.Visible = !chbade.Checked; 246 txttimeTo.Visible = !chbade.Checked; 258 if(chbade.Checked) { 259 dtpFrom.Value = new DateTime(dtpFrom.Value.Year, dtpFrom.Value.Month, dtpFrom.Value.Day); 260 dtpTo.Value = new DateTime(dtpTo.Value.Year, dtpTo.Value.Month, dtpTo.Value.Day); 261 } 247 262 } 248 263 249 264 private void dvOnline_OnSelectionChanged(object sender, EventArgs e) { 250 265 if (dvOnline.Selection == SelectionType.DateRange) { 251 dtpFrom.Text = dvOnline.SelectionStart.ToShortDateString(); 252 dtpTo.Text = dvOnline.SelectionEnd.Date.ToShortDateString(); 253 txttimeFrom.Text = dvOnline.SelectionStart.ToShortTimeString(); 254 txttimeTo.Text = dvOnline.SelectionEnd.ToShortTimeString(); 266 dtpFrom.Value = dvOnline.SelectionStart; 267 dtpTo.Value = dvOnline.SelectionEnd.Date; 255 268 btCreate.Text = "Create Downtime"; 256 269 } 257 270 258 271 if (dvOnline.Selection == SelectionType.Appointment) { 259 dtpFrom.Text = dvOnline.SelectedAppointment.StartDate.ToShortDateString(); 260 dtpTo.Text = dvOnline.SelectedAppointment.EndDate.ToShortDateString(); 261 txttimeFrom.Text = dvOnline.SelectedAppointment.StartDate.ToShortTimeString(); 262 txttimeTo.Text = dvOnline.SelectedAppointment.EndDate.ToShortTimeString(); 272 dtpFrom.Value = dvOnline.SelectedAppointment.StartDate; 273 dtpTo.Value = dvOnline.SelectedAppointment.EndDate; 263 274 264 275 if (dvOnline.SelectedAppointment.Recurring)
Note: See TracChangeset
for help on using the changeset viewer.