Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/20/18 15:26:57 (5 years ago)
Author:
pfleck
Message:

#2845 Merged trunk changes into branch (15406-15681, 15683-16308)

Location:
branches/2845_EnhancedProgress
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/2845_EnhancedProgress

  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator

    • Property svn:mergeinfo set to (toggle deleted branches)
      /branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administratormergedeligible
      /stable/HeuristicLab.Clients.Hive.Administratormergedeligible
      /trunk/HeuristicLab.Clients.Hive.Administratormergedeligible
      /branches/1721-RandomForestPersistence/HeuristicLab.Clients.Hive.Administrator10321-10322
      /branches/Algorithms.GradientDescent/HeuristicLab.Clients.Hive.Administrator5516-5520
      /branches/Async/HeuristicLab.Clients.Hive.Administrator13329-15286
      /branches/Benchmarking/sources/HeuristicLab.Clients.Hive.Administrator6917-7005
      /branches/CloningRefactoring/HeuristicLab.Clients.Hive.Administrator4656-4721
      /branches/CodeEditor/HeuristicLab.Clients.Hive.Administrator11700-11806
      /branches/DataAnalysis Refactoring/HeuristicLab.Clients.Hive.Administrator5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Clients.Hive.Administrator5815-6180
      /branches/DataAnalysis/HeuristicLab.Clients.Hive.Administrator4458-4459,​4462,​4464
      /branches/DataPreprocessing/HeuristicLab.Clients.Hive.Administrator10085-11101
      /branches/GP.Grammar.Editor/HeuristicLab.Clients.Hive.Administrator6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Clients.Hive.Administrator5060
      /branches/HLScript/HeuristicLab.Clients.Hive.Administrator10331-10358
      /branches/HeuristicLab.DatasetRefactor/sources/HeuristicLab.Clients.Hive.Administrator11570-12508
      /branches/HeuristicLab.Problems.DataAnalysis.Trading/HeuristicLab.Clients.Hive.Administrator6123-9799
      /branches/HeuristicLab.Problems.Orienteering/HeuristicLab.Clients.Hive.Administrator11130-12721
      /branches/HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator15377-15760
      /branches/HiveStatistics/sources/HeuristicLab.Clients.Hive.Administrator12440-12877
      /branches/LogResidualEvaluator/HeuristicLab.Clients.Hive.Administrator10202-10483
      /branches/NET40/sources/HeuristicLab.Clients.Hive.Administrator5138-5162
      /branches/NSGA-II Changes/HeuristicLab.Clients.Hive.Administrator12033-12122
      /branches/ParallelEngine/HeuristicLab.Clients.Hive.Administrator5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Clients.Hive.Administrator7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Clients.Hive.Administrator6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Clients.Hive.Administrator6828
      /branches/RuntimeOptimizer/HeuristicLab.Clients.Hive.Administrator8943-9078
      /branches/ScatterSearch (trunk integration)/HeuristicLab.Clients.Hive.Administrator7787-8333
      /branches/SlaveShutdown/HeuristicLab.Clients.Hive.Administrator8944-8956
      /branches/SpectralKernelForGaussianProcesses/HeuristicLab.Clients.Hive.Administrator10204-10479
      /branches/SuccessProgressAnalysis/HeuristicLab.Clients.Hive.Administrator5370-5682
      /branches/Trunk/HeuristicLab.Clients.Hive.Administrator6829-6865
      /branches/UnloadJobs/HeuristicLab.Clients.Hive.Administrator9168-9215
      /branches/VNS/HeuristicLab.Clients.Hive.Administrator5594-5752
      /branches/crossvalidation-2434/HeuristicLab.Clients.Hive.Administrator12948-12950
      /branches/histogram/HeuristicLab.Clients.Hive.Administrator5959-6341
      /branches/symbreg-factors-2650/HeuristicLab.Clients.Hive.Administrator14232-14825
  • branches/2845_EnhancedProgress/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs

    r16308 r16311  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2016 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    9292
    9393      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) {
    9595          //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
    103100            if (from.Date == to.Date)
    104101              offlineTimes.Add(CreateDowntime(from, to, false, dtType));
     
    111108              offlineTimes.Add(CreateDowntime(from, new DateTime(from.Year, from.Month, from.Day, to.Hour, to.Minute, 0, 0), false, dtType));
    112109            }
    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
    116117        dvOnline.Invalidate();
    117118        return true;
     
    156157
    157158    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      }
    163167    }
    164168
     
    222226    protected override void SetEnabledStateOfControls() {
    223227      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    //}
    236249
    237250    private void btnClearCal_Click(object sender, System.EventArgs e) {
     
    243256
    244257    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      }
    247262    }
    248263
    249264    private void dvOnline_OnSelectionChanged(object sender, EventArgs e) {
    250265      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;
    255268        btCreate.Text = "Create Downtime";
    256269      }
    257270
    258271      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;
    263274
    264275        if (dvOnline.SelectedAppointment.Recurring)
Note: See TracChangeset for help on using the changeset viewer.