Changeset 4426
- Timestamp:
- 09/18/10 04:03:28 (14 years ago)
- Files:
-
- 20 added
- 12 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OKB/HeuristicLab.Clients.OKB-3.3/AdministrationMenuItem.cs
r4388 r4426 22 22 using System.Collections.Generic; 23 23 using System.Windows.Forms; 24 using HeuristicLab.MainForm; 24 25 using HeuristicLab.Optimizer; 25 26 26 27 namespace HeuristicLab.Clients.OKB { 27 28 internal class AdministrationMenuItem : HeuristicLab.MainForm.WindowsForms.MenuItem, IOptimizerUserInterfaceItemProvider { 29 private Administrator administrator; 30 28 31 private ToolStripMenuItem menuItem; 29 32 … … 39 42 40 43 public override void Execute() { 41 AdministrationView view = new AdministrationView();42 view.Show();44 if (administrator == null) administrator = new Administrator(); 45 MainFormManager.MainForm.ShowContent(administrator); 43 46 } 44 47 } -
branches/OKB/HeuristicLab.Clients.OKB-3.3/HeuristicLab.Clients.OKB-3.3.csproj
r4422 r4426 71 71 </ItemGroup> 72 72 <ItemGroup> 73 <Compile Include="Administrator.cs"> 74 <SubType>Code</SubType> 75 </Compile> 73 76 <Compile Include="AdministrationMenuItem.cs" /> 74 <Compile Include="AlgorithmCollectionView.cs"> 77 <Compile Include="HeuristicLabClientsOKBPlugin.cs" /> 78 <Compile Include="Properties\AssemblyInfo.cs" /> 79 <Compile Include="ServiceClients\AlgorithmClass.cs" /> 80 <Compile Include="ServiceClients\IOKBItem.cs" /> 81 <Compile Include="ServiceClients\INamedOKBItem.cs" /> 82 <Compile Include="ServiceClients\OKBItem.cs" /> 83 <Compile Include="ServiceClients\ServiceClients.cs" /> 84 <Compile Include="ServiceClients\Algorithm.cs" /> 85 <Compile Include="Views\AdministratorView.cs"> 75 86 <SubType>UserControl</SubType> 76 87 </Compile> 77 <Compile Include="AlgorithmCollectionView.Designer.cs"> 88 <Compile Include="Views\AdministratorView.Designer.cs"> 89 <DependentUpon>AdministratorView.cs</DependentUpon> 90 </Compile> 91 <Compile Include="Views\AlgorithmClassCollectionView.cs"> 92 <SubType>UserControl</SubType> 93 </Compile> 94 <Compile Include="Views\AlgorithmClassCollectionView.Designer.cs"> 95 <DependentUpon>AlgorithmClassCollectionView.cs</DependentUpon> 96 </Compile> 97 <Compile Include="Views\AlgorithmCollectionView.cs"> 98 <SubType>UserControl</SubType> 99 </Compile> 100 <Compile Include="Views\AlgorithmCollectionView.Designer.cs"> 78 101 <DependentUpon>AlgorithmCollectionView.cs</DependentUpon> 79 102 </Compile> 80 <Compile Include="Extensions.cs" /> 81 <Compile Include="HeuristicLabClientsOKBPlugin.cs" /> 82 <Compile Include="AdministrationView.cs"> 103 <Compile Include="Views\OKBItemView.cs"> 83 104 <SubType>UserControl</SubType> 84 105 </Compile> 85 <Compile Include=" AdministrationView.Designer.cs">86 <DependentUpon> AdministrationView.cs</DependentUpon>106 <Compile Include="Views\OKBItemView.Designer.cs"> 107 <DependentUpon>OKBItemView.cs</DependentUpon> 87 108 </Compile> 88 <Compile Include="OKBItem.cs" /> 89 <Compile Include="NamedEntityView.cs"> 109 <Compile Include="Views\NamedOKBItemView.cs"> 90 110 <SubType>UserControl</SubType> 91 111 </Compile> 92 <Compile Include=" NamedEntityView.Designer.cs">93 <DependentUpon>Named EntityView.cs</DependentUpon>112 <Compile Include="Views\NamedOKBItemView.Designer.cs"> 113 <DependentUpon>NamedOKBItemView.cs</DependentUpon> 94 114 </Compile> 95 <Compile Include="AlgorithmClassCollectionView.cs">96 <SubType>UserControl</SubType>97 </Compile>98 <Compile Include="AlgorithmClassCollectionView.Designer.cs">99 <DependentUpon>AlgorithmClassCollectionView.cs</DependentUpon>100 </Compile>101 <Compile Include="Properties\AssemblyInfo.cs" />102 <Compile Include="ServiceClients.cs" />103 115 <None Include="app.config" /> 104 <None Include="GenerateServiceClients.cmd" />105 116 <None Include="Properties\AssemblyInfo.frame" /> 117 <None Include="ServiceClients\GenerateServiceClients.cmd" /> 106 118 <None Include="UpdateLocalInstallation.cmd" /> 107 119 </ItemGroup> -
trunk/sources/HeuristicLab.Services.OKB/3.3/AdminService.cs
r4407 r4426 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Data.Linq; 23 24 using System.Linq; … … 31 32 [ServiceBehavior(IncludeExceptionDetailInFaults = true)] 32 33 public class AdminService : IAdminService { 33 public void AddAlgorithmClass(AlgorithmClass algorithmClass) { 34 using (OKBDataContext okb = new OKBDataContext()) { 35 okb.AlgorithmClasses.InsertOnSubmit(new AlgorithmClass() { 36 Name = algorithmClass.Name, 37 Description = algorithmClass.Description 38 }); 39 okb.SubmitChanges(); 40 } 41 } 42 public AlgorithmClass[] GetAlgorithmClasses() { 34 public AlgorithmClass GetAlgorithmClass(long algorithmClassId) { 35 using (OKBDataContext okb = new OKBDataContext()) { 36 return okb.AlgorithmClasses.FirstOrDefault(a => a.Id == algorithmClassId); 37 } 38 } 39 public IEnumerable<AlgorithmClass> GetAlgorithmClasses() { 43 40 using (OKBDataContext okb = new OKBDataContext()) { 44 41 return okb.AlgorithmClasses.ToArray(); 45 42 } 46 43 } 47 public void UpdateAlgorithmClass(AlgorithmClass algorithmClass) { 48 using (OKBDataContext okb = new OKBDataContext()) { 49 AlgorithmClass original = okb.AlgorithmClasses.First(a => a.Id == algorithmClass.Id); 50 original.Name = algorithmClass.Name; 51 original.Description = algorithmClass.Description; 44 public void StoreAlgorithmClass(AlgorithmClass algorithmClass) { 45 using (OKBDataContext okb = new OKBDataContext()) { 46 AlgorithmClass original = okb.AlgorithmClasses.FirstOrDefault(a => a.Id == algorithmClass.Id); 47 if (original == null) { 48 okb.AlgorithmClasses.InsertOnSubmit(new AlgorithmClass() { 49 Name = algorithmClass.Name, 50 Description = algorithmClass.Description 51 }); 52 } else { 53 original.Name = algorithmClass.Name; 54 original.Description = algorithmClass.Description; 55 } 52 56 okb.SubmitChanges(); 53 57 } … … 60 64 } 61 65 62 public void AddAlgorithm(Algorithm algorithm) { 63 using (OKBDataContext okb = new OKBDataContext()) { 64 okb.Algorithms.InsertOnSubmit(new Algorithm() { 65 AlgorithmClassId = algorithm.AlgorithmClassId, 66 PlatformId = algorithm.PlatformId, 67 Name = algorithm.Name, 68 Description = algorithm.Description 69 }); 70 okb.SubmitChanges(); 71 } 72 } 73 public Algorithm[] GetAlgorithms() { 66 public Algorithm GetAlgorithm(long algorithmId) { 67 using (OKBDataContext okb = new OKBDataContext()) { 68 return okb.Algorithms.FirstOrDefault(a => a.Id == algorithmId); 69 } 70 } 71 public IEnumerable<Algorithm> GetAlgorithms() { 74 72 using (OKBDataContext okb = new OKBDataContext()) { 75 73 return okb.Algorithms.ToArray(); 76 74 } 77 75 } 78 public void UpdateAlgorithm(Algorithm algorithm) { 79 using (OKBDataContext okb = new OKBDataContext()) { 80 Algorithm original = okb.Algorithms.First(a => a.Id == algorithm.Id); 81 original.AlgorithmClassId = algorithm.AlgorithmClassId; 82 original.PlatformId = algorithm.PlatformId; 83 original.Name = algorithm.Name; 84 original.Description = algorithm.Description; 76 public void StoreAlgorithm(Algorithm algorithm) { 77 using (OKBDataContext okb = new OKBDataContext()) { 78 Algorithm original = okb.Algorithms.FirstOrDefault(a => a.Id == algorithm.Id); 79 if (original == null) { 80 okb.Algorithms.InsertOnSubmit(new Algorithm() { 81 Name = algorithm.Name, 82 Description = algorithm.Description 83 }); 84 } else { 85 original.Name = algorithm.Name; 86 original.Description = algorithm.Description; 87 } 85 88 okb.SubmitChanges(); 86 89 } -
trunk/sources/HeuristicLab.Services.OKB/3.3/Interfaces/IAdminService.cs
r4407 r4426 20 20 #endregion 21 21 22 using System.Collections.Generic; 22 23 using System.Net.Security; 23 24 using System.ServiceModel; … … 31 32 public interface IAdminService { 32 33 [OperationContract] 33 void AddAlgorithmClass(AlgorithmClass algorithmClass);34 AlgorithmClass GetAlgorithmClass(long algorithmClassId); 34 35 [OperationContract] 35 AlgorithmClass[]GetAlgorithmClasses();36 IEnumerable<AlgorithmClass> GetAlgorithmClasses(); 36 37 [OperationContract] 37 void UpdateAlgorithmClass(AlgorithmClass algorithmClass);38 void StoreAlgorithmClass(AlgorithmClass algorithmClass); 38 39 [OperationContract] 39 40 void DeleteAlgorithmClass(long algorithmClassId); 40 41 41 42 [OperationContract] 42 void AddAlgorithm(Algorithm algorithm);43 Algorithm GetAlgorithm(long algorithmId); 43 44 [OperationContract] 44 Algorithm[]GetAlgorithms();45 IEnumerable<Algorithm> GetAlgorithms(); 45 46 [OperationContract] 46 void UpdateAlgorithm(Algorithm algorithm);47 void StoreAlgorithm(Algorithm algorithm); 47 48 [OperationContract] 48 49 void DeleteAlgorithm(long algorithmId);
Note: See TracChangeset
for help on using the changeset viewer.