diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-23 17:58:59 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-23 17:58:59 +0200 |
| commit | 8ae0f3da19c537eff30e19a1fe99cce51b3116f1 (patch) | |
| tree | 999f8c0ab670b775b4bcde5a4a0d26fb4f287fd5 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB | |
| parent | 891b5703fc8722ecc70c7883213b994f8902bb7b (diff) | |
| download | Tango-8ae0f3da19c537eff30e19a1fe99cce51b3116f1.tar.gz Tango-8ae0f3da19c537eff30e19a1fe99cce51b3116f1.zip | |
A lot of work on Developer Module and Jobs related DB tables.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB')
10 files changed, 70 insertions, 49 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj index bb3084207..54c29f7f3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj @@ -129,7 +129,7 @@ <Compile Include="ViewModels\OrganizationsViewVM.cs" /> <Compile Include="ViewModels\PermissionsViewVM.cs" /> <Compile Include="ViewModels\ProcessParametersTablesViewVM.cs" /> - <Compile Include="ViewModels\RmlsProcessParametersTablesViewVM.cs" /> + <Compile Include="ViewModels\ProcessParametersTablesGroupsViewVM.cs" /> <Compile Include="ViewModels\RmlsViewVM.cs" /> <Compile Include="ViewModels\RolesViewVM.cs" /> <Compile Include="ViewModels\UsersViewVM.cs" /> @@ -142,11 +142,11 @@ <Compile Include="Views\DBViews\ActionTypeView.xaml.cs"> <DependentUpon>ActionTypeView.xaml</DependentUpon> </Compile> - <Compile Include="Views\DBViews\RmlsProcessParametersTablesView.xaml.cs"> - <DependentUpon>RmlsProcessParametersTablesView.xaml</DependentUpon> + <Compile Include="Views\DBViews\ProcessParametersTablesGroupsView.xaml.cs"> + <DependentUpon>ProcessParametersTablesGroupsView.xaml</DependentUpon> </Compile> - <Compile Include="Views\DBViews\RmlsProcessParametersTableView.xaml.cs"> - <DependentUpon>RmlsProcessParametersTableView.xaml</DependentUpon> + <Compile Include="Views\DBViews\ProcessParametersTablesGroupView.xaml.cs"> + <DependentUpon>ProcessParametersTablesGroupView.xaml</DependentUpon> </Compile> <Compile Include="Views\DBViews\ProcessParametersTablesView.xaml.cs"> <DependentUpon>ProcessParametersTablesView.xaml</DependentUpon> @@ -378,11 +378,11 @@ <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> - <Page Include="Views\DBViews\RmlsProcessParametersTablesView.xaml"> + <Page Include="Views\DBViews\ProcessParametersTablesGroupsView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> - <Page Include="Views\DBViews\RmlsProcessParametersTableView.xaml"> + <Page Include="Views\DBViews\ProcessParametersTablesGroupView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> </Page> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs index 5fe386749..8a7afc067 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs @@ -60,7 +60,7 @@ namespace Tango.MachineStudio.DB SimpleIoc.Default.Register<CatsViewVM>(); SimpleIoc.Default.Register<ProcessParametersTablesViewVM>(); - SimpleIoc.Default.Register<RmlsProcessParametersTablesViewVM>(); + SimpleIoc.Default.Register<ProcessParametersTablesGroupsViewVM>(); } public static MainViewVM MainViewVM @@ -351,11 +351,11 @@ namespace Tango.MachineStudio.DB } } - public static RmlsProcessParametersTablesViewVM RmlsProcessParametersTablesViewVM + public static ProcessParametersTablesGroupsViewVM ProcessParametersTablesGroupsViewVM { get { - return ServiceLocator.Current.GetInstance<RmlsProcessParametersTablesViewVM>(); + return ServiceLocator.Current.GetInstance<ProcessParametersTablesGroupsViewVM>(); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ProcessParametersTablesGroupsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ProcessParametersTablesGroupsViewVM.cs new file mode 100644 index 000000000..620762a6f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/ProcessParametersTablesGroupsViewVM.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.DAL.Observables; +using Tango.MachineStudio.Common.Notifications; + +namespace Tango.MachineStudio.DB.ViewModels +{ + public class ProcessParametersTablesGroupsViewVM : DbTableViewModel<ProcessParametersTablesGroup> + { + public ProcessParametersTablesGroupsViewVM(INotificationProvider notification) : base(notification) + { + + } + + protected override void OnBeforeEntitySave(DialogOpenMode mode, ProcessParametersTablesGroup entity) + { + entity.SaveDate = DateTime.UtcNow; + + if (entity.Rml != null && entity.Active) + { + foreach (var group in entity.Rml.ProcessParametersTablesGroups.Where(x => x != entity)) + { + group.Active = false; + } + } + + base.OnBeforeEntitySave(mode, entity); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RmlsProcessParametersTablesViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RmlsProcessParametersTablesViewVM.cs deleted file mode 100644 index 4ae1f063f..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/RmlsProcessParametersTablesViewVM.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.DAL.Observables; -using Tango.MachineStudio.Common.Notifications; - -namespace Tango.MachineStudio.DB.ViewModels -{ - public class RmlsProcessParametersTablesViewVM : DbTableViewModel<RmlsProcessParametersTable> - { - public RmlsProcessParametersTablesViewVM(INotificationProvider notification) : base(notification) - { - - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml index e9b7c31af..1e3933ce0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTableView.xaml @@ -22,8 +22,12 @@ <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox> <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox> + <TextBlock Text="Group:" FontWeight="Bold"></TextBlock> + <ComboBox ItemsSource="{Binding Adapter.ProcessParametersTablesGroups}" SelectedItem="{Binding EditEntity.ProcessParametersTablesGroups,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Index:" FontWeight="Bold"></TextBlock> + <mahapps:NumericUpDown Minimum="0" Maximum="10" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.TableIndex,Mode=TwoWay}"></mahapps:NumericUpDown> <TextBlock Text="Dyeing Speed:" FontWeight="Bold"></TextBlock> <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.DyeingSpeed,Mode=TwoWay}"></mahapps:NumericUpDown> <TextBlock Text="Min Ink Uptake:" FontWeight="Bold"></TextBlock> @@ -54,10 +58,6 @@ <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.DryerAirFlow,Mode=TwoWay}"></mahapps:NumericUpDown> <TextBlock Text="Winder Tension:" FontWeight="Bold"></TextBlock> <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.WinderTension,Mode=TwoWay}"></mahapps:NumericUpDown> - <TextBlock Text="Lubrication:" FontWeight="Bold"></TextBlock> - <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding EditEntity.Lubrication}" Style="{StaticResource MaterialDesignSwitchToggleButton}" /> - <TextBlock Text="Lubrication Nanoliter Per Centimeter:" FontWeight="Bold"></TextBlock> - <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.LubricationNlPerCm,Mode=TwoWay}"></mahapps:NumericUpDown> </controls:TableGrid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTableView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupView.xaml index 767b39f29..135d66eac 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTableView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupView.xaml @@ -1,4 +1,4 @@ -<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.RmlsProcessParametersTableView" +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ProcessParametersTablesGroupView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" @@ -10,7 +10,7 @@ xmlns:converters="clr-namespace:Tango.MachineStudio.DB.Converters" xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" mc:Ignorable="d" - d:DesignHeight="300" d:DesignWidth="300" DataContext="{x:Static global:ViewModelLocator.RmlsProcessParametersTablesViewVM}"> + d:DesignHeight="300" d:DesignWidth="300" DataContext="{x:Static global:ViewModelLocator.ProcessParametersTablesGroupsViewVM}"> <Grid> <controls:TableGrid> @@ -22,10 +22,10 @@ <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True" IsEnabled="False"></TextBox> <TextBlock Text="RML:" FontWeight="Bold"></TextBlock> <ComboBox ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding EditEntity.Rml,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox> - <TextBlock Text="Process Parameters Table:" FontWeight="Bold"></TextBlock> - <ComboBox ItemsSource="{Binding Adapter.ProcessParametersTables}" SelectedItem="{Binding EditEntity.ProcessParametersTables}" DisplayMemberPath="Name"></ComboBox> - <TextBlock Text="Index:" FontWeight="Bold"></TextBlock> - <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.TableIndex,Mode=TwoWay}"></mahapps:NumericUpDown> + <TextBlock Text="Name:" FontWeight="Bold"></TextBlock> + <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox> + <TextBlock Text="Active:" FontWeight="Bold"></TextBlock> + <ToggleButton IsChecked="{Binding EditEntity.Active}" HorizontalAlignment="Right"></ToggleButton> </controls:TableGrid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTableView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupView.xaml.cs index 713a46204..490453f2a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTableView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupView.xaml.cs @@ -18,9 +18,9 @@ namespace Tango.MachineStudio.DB.Views.DBViews /// <summary> /// Interaction logic for UserView.xaml /// </summary> - public partial class RmlsProcessParametersTableView : UserControl + public partial class ProcessParametersTablesGroupView : UserControl { - public RmlsProcessParametersTableView() + public ProcessParametersTablesGroupView() { InitializeComponent(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTablesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupsView.xaml index d599c64a3..0eee2aa77 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTablesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupsView.xaml @@ -1,24 +1,30 @@ -<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.RmlsProcessParametersTablesView" +<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.ProcessParametersTablesGroupsView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls" xmlns:global="clr-namespace:Tango.MachineStudio.DB" xmlns:converters="clr-namespace:Tango.MachineStudio.DB.Converters" + xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews" mc:Ignorable="d" - d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.RmlsProcessParametersTablesViewVM}"> + d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.ProcessParametersTablesGroupsViewVM}"> + + <UserControl.Resources> + <sharedConverters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter"></sharedConverters:BooleanToYesNoConverter> + </UserControl.Resources> <Grid> <controls:DbTableView> - <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.RmlsProcessParametersTablesViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> + <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.ProcessParametersTablesGroupsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" IsReadOnly="True"> <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> <DataGridTextColumn Header="RML" Binding="{Binding Rml.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Process Parameters Table" Binding="{Binding ProcessParametersTables.Name}"></DataGridTextColumn> - <DataGridTextColumn Header="Index" Binding="{Binding TableIndex}"></DataGridTextColumn> + <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Saved Date" Binding="{Binding SaveDate}"></DataGridTextColumn> + <DataGridTextColumn Header="Active" Binding="{Binding Active,Converter={StaticResource BooleanToYesNoConverter}}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid> </controls:DbTableView> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTablesView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupsView.xaml.cs index c4ee7e66d..67072d554 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/RmlsProcessParametersTablesView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesGroupsView.xaml.cs @@ -20,9 +20,9 @@ namespace Tango.MachineStudio.DB.Views.DBViews /// Interaction logic for UsersView.xaml /// </summary> [DBView] - public partial class RmlsProcessParametersTablesView : UserControl + public partial class ProcessParametersTablesGroupsView : UserControl { - public RmlsProcessParametersTablesView() + public ProcessParametersTablesGroupsView() { InitializeComponent(); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml index 2648b78a0..d9ad83f68 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/ProcessParametersTablesView.xaml @@ -21,7 +21,9 @@ <DataGrid.Columns> <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn> <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn> + <DataGridTextColumn Header="Group" Binding="{Binding ProcessParametersTablesGroups.Name}"></DataGridTextColumn> <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn> + <DataGridTextColumn Header="Index" Binding="{Binding TableIndex}"></DataGridTextColumn> <DataGridTextColumn Header="Dyeing Speed" Binding="{Binding DyeingSpeed}"></DataGridTextColumn> <DataGridTextColumn Header="Min Ink Uptake" Binding="{Binding MinInkUptake}"></DataGridTextColumn> <DataGridTextColumn Header="Mixer Temp" Binding="{Binding MixerTemp}"></DataGridTextColumn> @@ -37,8 +39,6 @@ <DataGridTextColumn Header="Dryer Zone 3 Temp" Binding="{Binding DryerZone3Temp}"></DataGridTextColumn> <DataGridTextColumn Header="Dryer Air Flow" Binding="{Binding DryerAirFlow}"></DataGridTextColumn> <DataGridTextColumn Header="Winder Tension" Binding="{Binding WinderTension}"></DataGridTextColumn> - <DataGridTextColumn Header="Lubrication" Binding="{Binding Lubrication,Converter={StaticResource BooleanToYesNoConverter}}"></DataGridTextColumn> - <DataGridTextColumn Header="Lubrication nl/cm" Binding="{Binding LubricationNlPerCm}"></DataGridTextColumn> </DataGrid.Columns> </DataGrid> </controls:DbTableView> |
