Free cookie consent management tool by TermsFeed Policy Generator

Changeset 15956 for branches


Ignore:
Timestamp:
06/08/18 15:34:12 (6 years ago)
Author:
jzenisek
Message:

#2839:

  • fixed project/resource selector in HiveJobManager
  • added error provider to project/resource selector
  • changed datetime pickers in HiveAdmin...
Location:
branches/2839_HiveProjectManagement
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Recurrence.Designer.cs

    r14185 r15956  
    4848      this.chbade = new System.Windows.Forms.CheckBox();
    4949      this.dtpEnd = new System.Windows.Forms.DateTimePicker();
    50       this.dtpToTime = new System.Windows.Forms.DateTimePicker();
    5150      this.label5 = new System.Windows.Forms.Label();
    5251      this.dtpStart = new System.Windows.Forms.DateTimePicker();
    53       this.dtpFromTime = new System.Windows.Forms.DateTimePicker();
    5452      this.label6 = new System.Windows.Forms.Label();
    5553      this.btSaveRecurrence = new System.Windows.Forms.Button();
     
    7472      this.gbAppointment.Controls.Add(this.chbade);
    7573      this.gbAppointment.Controls.Add(this.dtpEnd);
    76       this.gbAppointment.Controls.Add(this.dtpToTime);
    7774      this.gbAppointment.Controls.Add(this.label5);
    7875      this.gbAppointment.Controls.Add(this.dtpStart);
    79       this.gbAppointment.Controls.Add(this.dtpFromTime);
    8076      this.gbAppointment.Controls.Add(this.label6);
    8177      this.gbAppointment.Location = new System.Drawing.Point(2, 2);
     
    9894      // dtpEnd
    9995      //
    100       this.dtpEnd.Format = System.Windows.Forms.DateTimePickerFormat.Short;
     96      this.dtpEnd.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
     97      this.dtpEnd.CustomFormat = "ddd, dd.MM.yyyy, HH:mm:ss";
    10198      this.dtpEnd.Location = new System.Drawing.Point(113, 56);
    10299      this.dtpEnd.Name = "dtpEnd";
    103       this.dtpEnd.Size = new System.Drawing.Size(91, 20);
     100      this.dtpEnd.Size = new System.Drawing.Size(175, 20);
    104101      this.dtpEnd.TabIndex = 29;
    105       //
    106       // dtpToTime
    107       //
    108       this.dtpToTime.CustomFormat = "HH:mm";
    109       this.dtpToTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    110       this.dtpToTime.Location = new System.Drawing.Point(226, 56);
    111       this.dtpToTime.Name = "dtpToTime";
    112       this.dtpToTime.ShowUpDown = true;
    113       this.dtpToTime.Size = new System.Drawing.Size(73, 20);
    114       this.dtpToTime.TabIndex = 38;
    115102      //
    116103      // label5
     
    126113      //
    127114      this.dtpStart.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
     115      this.dtpStart.CustomFormat = "ddd, dd.MM.yyyy, HH:mm:ss";
    128116      this.dtpStart.Location = new System.Drawing.Point(113, 19);
    129117      this.dtpStart.Name = "dtpStart";
    130       this.dtpStart.Size = new System.Drawing.Size(89, 20);
     118      this.dtpStart.Size = new System.Drawing.Size(175, 20);
    131119      this.dtpStart.TabIndex = 28;
    132       //
    133       // dtpFromTime
    134       //
    135       this.dtpFromTime.CustomFormat = "HH:mm";
    136       this.dtpFromTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    137       this.dtpFromTime.Location = new System.Drawing.Point(226, 19);
    138       this.dtpFromTime.Name = "dtpFromTime";
    139       this.dtpFromTime.ShowUpDown = true;
    140       this.dtpFromTime.Size = new System.Drawing.Size(73, 20);
    141       this.dtpFromTime.TabIndex = 30;
    142120      //
    143121      // label6
     
    307285    private System.Windows.Forms.Button btSaveRecurrence;
    308286    private System.Windows.Forms.Button btCancelRecurrence;
    309     private System.Windows.Forms.DateTimePicker dtpFromTime;
    310     private System.Windows.Forms.DateTimePicker dtpToTime;
    311287    private System.Windows.Forms.CheckBox chbade;
    312288    private System.Windows.Forms.GroupBox gbWeekly;
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/Recurrence.cs

    r14185 r15956  
    4646      //check if valid
    4747      if (InputIsValid()) {
    48         dateFrom = DateTime.Parse(dtpStart.Text + " " + dtpFromTime.Text);
    49         dateTo = DateTime.Parse(dtpEnd.Text + " " + dtpToTime.Text);
     48        dateFrom = DateTime.Parse(dtpStart.Text);
     49        dateTo = DateTime.Parse(dtpEnd.Text);
    5050
    5151        RecurrentEvent recurrentEvent = new RecurrentEvent() {
     
    8989      DateTime dateFrom, dateTo;
    9090
    91       dateFrom = DateTime.Parse(dtpStart.Text + " " + dtpFromTime.Text);
    92       dateTo = DateTime.Parse(dtpEnd.Text + " " + dtpToTime.Text);
     91      dateFrom = DateTime.Parse(dtpStart.Text);
     92      dateTo = DateTime.Parse(dtpEnd.Text);
    9393
    9494      if (chbade.Checked && dateFrom < dateTo) {
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.Designer.cs

    r14185 r15956  
    4848      Calendar.DrawTool drawTool1 = new Calendar.DrawTool();
    4949      this.dvOnline = new Calendar.DayView();
    50       this.txttimeTo = new System.Windows.Forms.DateTimePicker();
    51       this.txttimeFrom = new System.Windows.Forms.DateTimePicker();
    5250      this.dtpTo = new System.Windows.Forms.DateTimePicker();
    5351      this.groupBox1 = new System.Windows.Forms.GroupBox();
     
    9492      this.dvOnline.OnSelectionChanged += new System.EventHandler<System.EventArgs>(this.dvOnline_OnSelectionChanged);
    9593      //
    96       // txttimeTo
    97       //
    98       this.txttimeTo.CustomFormat = "HH:mm";
    99       this.txttimeTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    100       this.txttimeTo.Location = new System.Drawing.Point(164, 45);
    101       this.txttimeTo.Name = "txttimeTo";
    102       this.txttimeTo.ShowUpDown = true;
    103       this.txttimeTo.Size = new System.Drawing.Size(73, 20);
    104       this.txttimeTo.TabIndex = 40;
    105       //
    106       // txttimeFrom
    107       //
    108       this.txttimeFrom.CustomFormat = "HH:mm";
    109       this.txttimeFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
    110       this.txttimeFrom.Location = new System.Drawing.Point(164, 12);
    111       this.txttimeFrom.Name = "txttimeFrom";
    112       this.txttimeFrom.ShowUpDown = true;
    113       this.txttimeFrom.Size = new System.Drawing.Size(73, 20);
    114       this.txttimeFrom.TabIndex = 39;
    115       //
    11694      // dtpTo
    11795      //
    11896      this.dtpTo.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
     97      this.dtpTo.CustomFormat = "ddd, dd.MM.yyyy, HH:mm:ss";
    11998      this.dtpTo.Location = new System.Drawing.Point(72, 45);
    12099      this.dtpTo.Name = "dtpTo";
    121       this.dtpTo.Size = new System.Drawing.Size(89, 20);
     100      this.dtpTo.Size = new System.Drawing.Size(175, 20);
    122101      this.dtpTo.TabIndex = 33;
    123102      //
     
    125104      //
    126105      this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
    127       this.groupBox1.Controls.Add(this.txttimeTo);
    128       this.groupBox1.Controls.Add(this.txttimeFrom);
    129106      this.groupBox1.Controls.Add(this.dtpTo);
    130107      this.groupBox1.Controls.Add(this.dtpFrom);
     
    144121      //
    145122      this.dtpFrom.Format = System.Windows.Forms.DateTimePickerFormat.Custom;
     123      this.dtpFrom.CustomFormat = "ddd, dd.MM.yyyy, HH:mm:ss";
    146124      this.dtpFrom.Location = new System.Drawing.Point(72, 12);
    147125      this.dtpFrom.Name = "dtpFrom";
    148       this.dtpFrom.Size = new System.Drawing.Size(89, 20);
     126      this.dtpFrom.Size = new System.Drawing.Size(175, 20);
    149127      this.dtpFrom.TabIndex = 32;
    150128      //
     
    157135      this.chbade.TabIndex = 31;
    158136      this.chbade.Text = "All Day Event";
     137      this.chbade.CheckedChanged += new System.EventHandler(this.chbade_CheckedChanged);
    159138      this.chbade.UseVisualStyleBackColor = true;
    160       this.chbade.CheckedChanged += new System.EventHandler(this.chbade_CheckedChanged);
    161139      //
    162140      // btnRecurrence
     
    273251    #endregion
    274252
    275     private System.Windows.Forms.DateTimePicker txttimeTo;
    276253    private Calendar.DayView dvOnline;
    277     private System.Windows.Forms.DateTimePicker txttimeFrom;
    278254    private System.Windows.Forms.DateTimePicker dtpTo;
    279255    private System.Windows.Forms.GroupBox groupBox1;
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.Administrator/3.3/Views/ScheduleView.cs

    r15813 r15956  
    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
     
    249253
    250254    private void chbade_CheckedChanged(object sender, EventArgs e) {
    251       txttimeFrom.Visible = !chbade.Checked;
    252       txttimeTo.Visible = !chbade.Checked;
     255      if(chbade.Checked) {
     256        dtpFrom.Value = new DateTime(dtpFrom.Value.Year, dtpFrom.Value.Month, dtpFrom.Value.Day);
     257        dtpTo.Value = new DateTime(dtpTo.Value.Year, dtpTo.Value.Month, dtpTo.Value.Day);
     258      }
    253259    }
    254260
    255261    private void dvOnline_OnSelectionChanged(object sender, EventArgs e) {
    256262      if (dvOnline.Selection == SelectionType.DateRange) {
    257         dtpFrom.Text = dvOnline.SelectionStart.ToShortDateString();
    258         dtpTo.Text = dvOnline.SelectionEnd.Date.ToShortDateString();
    259         txttimeFrom.Text = dvOnline.SelectionStart.ToShortTimeString();
    260         txttimeTo.Text = dvOnline.SelectionEnd.ToShortTimeString();
     263        dtpFrom.Value = dvOnline.SelectionStart;
     264        dtpTo.Value = dvOnline.SelectionEnd.Date;
    261265        btCreate.Text = "Create Downtime";
    262266      }
    263267
    264268      if (dvOnline.Selection == SelectionType.Appointment) {
    265         dtpFrom.Text = dvOnline.SelectedAppointment.StartDate.ToShortDateString();
    266         dtpTo.Text = dvOnline.SelectedAppointment.EndDate.ToShortDateString();
    267         txttimeFrom.Text = dvOnline.SelectedAppointment.StartDate.ToShortTimeString();
    268         txttimeTo.Text = dvOnline.SelectedAppointment.EndDate.ToShortTimeString();
     269        dtpFrom.Value = dvOnline.SelectedAppointment.StartDate;
     270        dtpTo.Value = dvOnline.SelectedAppointment.EndDate;
    269271
    270272        if (dvOnline.SelectedAppointment.Recurring)
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.Designer.cs

    r15920 r15956  
    248248    protected HeuristicLab.Clients.Hive.Views.TreeView.NoDoubleClickTreeView resourcesTreeView;
    249249    private System.Windows.Forms.GroupBox summaryGroupBox;
    250     private System.Windows.Forms.Label coresLabel;
    251     private System.Windows.Forms.Label memorySummaryLabel;
    252     private System.Windows.Forms.Label memoryLabel;
    253     private System.Windows.Forms.Label coresSummaryLabel;
     250    protected System.Windows.Forms.Label coresLabel;
     251    protected System.Windows.Forms.Label memorySummaryLabel;
     252    protected System.Windows.Forms.Label memoryLabel;
     253    protected System.Windows.Forms.Label coresSummaryLabel;
    254254  }
    255255}
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelector.cs

    r15922 r15956  
    148148    }
    149149
     150    public int AssignedCores {
     151      get {
     152        HashSet<Slave> newAssignedSlaves = new HashSet<Slave>(newAssignedResources.OfType<Slave>());
     153        foreach(var slaveGroup in newAssignedResources.OfType<SlaveGroup>()) {
     154          foreach(var slave in HiveClient.Instance.GetAvailableResourceDescendants(slaveGroup.Id).OfType<Slave>()) {
     155            newAssignedSlaves.Add(slave);
     156          }
     157        }
     158        return newAssignedSlaves.Sum(x => x.Cores.GetValueOrDefault());
     159      }
     160    }
     161
    150162    public IEnumerable<Resource> AssignedResources {
    151163      get { return newAssignedResources; }
     
    425437          }
    426438        }
    427       } else { // existent, unchanged jobs get all assigned resources
     439      } else if(selectedProject.Id == projectId) { // existent, unchanged jobs get all assigned resources
    428440        // update assigned resources
    429441        var assignedJobResources = GetAssignedResourcesForJob(JobId);
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.Designer.cs

    r15953 r15956  
    5050      this.refreshButton = new System.Windows.Forms.Button();
    5151      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
     52      this.errorProvider = new System.Windows.Forms.ErrorProvider(this.components);
    5253      this.hiveResourceSelector = new HeuristicLab.Clients.Hive.JobManager.Views.HiveProjectSelector();
     54      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    5355      this.SuspendLayout();
    5456      //
     
    6466      this.okButton.Text = "&OK";
    6567      this.okButton.UseVisualStyleBackColor = true;
     68      this.errorProvider.SetIconAlignment(this.okButton, System.Windows.Forms.ErrorIconAlignment.MiddleLeft);
     69      this.errorProvider.SetIconPadding(this.okButton, 2);
    6670      //
    6771      // cancelButton
     
    8791      this.refreshButton.UseVisualStyleBackColor = true;
    8892      this.refreshButton.Click += new System.EventHandler(this.refreshButton_Click);
     93      //
     94      // errorProvider
     95      //
     96      this.errorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink;
     97      this.errorProvider.ContainerControl = this;
    8998      //
    9099      // hiveResourceSelector
     
    127136      this.Text = "Select Project";
    128137      this.Load += new System.EventHandler(this.HiveResourceSelectorDialog_Load);
     138      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit();
    129139      this.ResumeLayout(false);
    130140
     
    137147    protected System.Windows.Forms.Button refreshButton;
    138148    protected System.Windows.Forms.ToolTip toolTip;
     149    protected System.Windows.Forms.ErrorProvider errorProvider;
    139150    protected HiveProjectSelector hiveResourceSelector;
    140151  }
  • branches/2839_HiveProjectManagement/HeuristicLab.Clients.Hive.JobManager/3.3/Views/HiveResourceSelectorDialog.cs

    r15933 r15956  
    134134
    135135    private void hiveResourceSelector_SelectedProjectChanged(object sender, EventArgs e) {
    136       okButton.Enabled = hiveResourceSelector.SelectedProject != null;
     136      okButton.Enabled = hiveResourceSelector.SelectedProject != null && hiveResourceSelector.AssignedResources.Any();
    137137    }
    138138
    139139    private void hiveResourceSelector_SelectedResourcesChanged(object sender, EventArgs e) {
    140140      okButton.Enabled = hiveResourceSelector.AssignedResources.Any();
     141
     142      if(!hiveResourceSelector.AssignedResources.Any()) {
     143        errorProvider.SetError(okButton, "Note: currently no resources are assigned");
     144      } else if(hiveResourceSelector.AssignedCores == 0) {
     145        errorProvider.SetError(okButton, "Note: currently no resources with cores are assigned");
     146      } else {
     147        errorProvider.SetError(okButton, string.Empty);
     148      }
    141149    }
    142150
Note: See TracChangeset for help on using the changeset viewer.