protected int ConfigureLab(LabCreate newLabData, int Lab_ID) { ApplicationDbContext db = new ApplicationDbContext(); LabConfiguration newLabConfig = new LabConfiguration(); LabConfiguration config = db.LabConfiguration.Where(c => c.LabID == Lab_ID).FirstOrDefault(); if (config != null) { newLabConfig = config; } else { newLabConfig.LabID = Lab_ID; } newLabConfig.Networked = newLabData.Networked; newLabConfig.OS = newLabData.OS; newLabConfig.VM_Count = newLabData.VM_Count; newLabConfig.Machine_Size = newLabData.Machine_Size; // newLabConfig.Hard_Disk = newLabData.; if (config == null) { db.LabConfiguration.Add(newLabConfig); } db.SaveChanges(); return(0); }
/// <summary> /// Reloads the current configuration. /// </summary> /// <returns></returns> public async Task ReadConfigurationAsync() { try { // Read and parse configuration var labConfigData = await File.ReadAllTextAsync(_options.CurrentValue.LabConfigurationFile); CurrentConfiguration = JsonConvert.DeserializeObject <LabConfiguration>(labConfigData); } catch (Exception ex) { throw new Exception("Could not load lab configuration", ex); } }
protected string AddToDB() { try { DataClassesDataContext db = new DataClassesDataContext(); //LabConfiguration v = dx.LabConfigurations.Where(s => s.LabConfigurationID > 34).First(); //v.LabDescription = "wefwedf"; //dx.SubmitChanges(); LabConfiguration lc = new LabConfiguration(); lc.applicationCallName = appCallNameBx.Text.Trim(); lc.LabName = TxBLabName.Text.Trim(); lc.LabDescription = LabDescpt.Trim(); lc.ExperimentGroupName = ExptGrpN.Trim(); lc.ServiceBrokerGUID = sbGuid.Trim(); lc.ServiceBrokerURL = sbURL.Trim(); lc.ClientName = ClientNm.Trim(); lc.ClientGuid = ClientGUID.Trim(); lc.MaximumLabDuration = MaxDuratn; lc.LabServerName = LsName.Trim(); lc.LabServerGuid = LsGuid.Trim(); lc.DateCreated = DateTime.UtcNow; db.LabConfigurations.InsertOnSubmit(lc); db.SubmitChanges(); return "Instant Scheduling configuration for Client " + ClientName.Text + "has been succesfully saved."; } catch { return "Failed to connect to database"; } }
//---------------------------------------------------------------------------------------// public DriverModuleGeneric(LabConfiguration labConfiguration, CancelExperiment cancelExperiment) { this.labConfiguration = labConfiguration; this.cancelExperiment = cancelExperiment; }
//---------------------------------------------------------------------------------------// public DriverModuleGeneric(LabConfiguration labConfiguration) : this(labConfiguration, null) { }
//-------------------------------------------------------------------------------------------------// public DriverEquipmentGeneric(EquipmentService equipmentServiceProxy, LabConfiguration labConfiguration, CancelExperiment cancelExperiment) { this.equipmentServiceProxy = equipmentServiceProxy; this.labConfiguration = labConfiguration; this.cancelExperiment = cancelExperiment; }
//---------------------------------------------------------------------------------------// public DriverEquipmentGeneric(EquipmentService equipmentServiceProxy, LabConfiguration labConfiguration) : this(equipmentServiceProxy, labConfiguration, null) { }
//-------------------------------------------------------------------------------------------------// public DriverEquipmentGeneric(EquipmentService equipmentServiceProxy, LabConfiguration labConfiguration, CancelExperiment cancelExperiment) { this.equipmentServiceProxy = equipmentServiceProxy; this.labConfiguration = labConfiguration; this.cancelExperiment = cancelExperiment; }
//---------------------------------------------------------------------------------------// public DriverEquipmentGeneric(EquipmentService equipmentServiceProxy, LabConfiguration labConfiguration) : this(equipmentServiceProxy, labConfiguration, null) { }
//---------------------------------------------------------------------------------------// public DriverModuleGeneric(LabConfiguration labConfiguration, CancelExperiment cancelExperiment) { this.labConfiguration = labConfiguration; this.cancelExperiment = cancelExperiment; }
//---------------------------------------------------------------------------------------// public DriverModuleGeneric(LabConfiguration labConfiguration) : this(labConfiguration, null) { }
partial void DeleteLabConfiguration(LabConfiguration instance);
partial void UpdateLabConfiguration(LabConfiguration instance);
partial void InsertLabConfiguration(LabConfiguration instance);