Fix Logging Confirm, Add, FindDuplicate

This commit is contained in:
Francesco 2020-07-26 16:04:13 +02:00
parent b8549bb60a
commit 54c3beaad2
4 changed files with 72 additions and 78 deletions

View File

@ -9,9 +9,9 @@
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<!--<Control.DataContext>
<Control.DataContext>
<viewModel:LocationViewModel/>
</Control.DataContext>-->
</Control.DataContext>
<Grid Height="450" Width="800" Background="#FF89A9B2" >
<TextBlock Height="32" HorizontalAlignment="Left" Margin="10,18,0,0" Name="TextBlockHeading" Text="Locations" VerticalAlignment="Top" Width="310" FontSize="20" FontStretch="Normal"/>
@ -59,30 +59,30 @@
<TextBox HorizontalAlignment="Left" Height="23" Margin="248,22,0,0" TextWrapping="Wrap" Text="{Binding TxtConnectionString}" Name="TxtConnectionString" VerticalAlignment="Top" Width="525" />
<TextBox HorizontalAlignment="Left" Height="25" Margin="10,366,0,0" TextWrapping="Wrap" x:Name="LocationId" VerticalAlignment="Top" Width="80" >
<Binding Path="NewLocationModelEntry.AddressId" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding.ValidationRules>
<validators:IntRangeValidationRule
MinimumLength="1" MaximumLength="10000"/>
</Binding.ValidationRules>-->
</Binding.ValidationRules>
</Binding>
</TextBox>
<TextBox HorizontalAlignment="Left" Height="25" Margin="95,366,0,0" TextWrapping="Wrap" Name="EnterParentId" VerticalAlignment="Top" Width="80">
<TextBox.Text>
<Binding Path="NewLocationModelEntry.ParentId" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding.ValidationRules>
<validators:IntRangeValidationRule
validators:MinimumLength="1" validators:MaximumLength="10000"/>
</Binding.ValidationRules>-->
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox HorizontalAlignment="Left" Height="25" Margin="180,366,0,0" TextWrapping="Wrap" Name="EnterDesignation" VerticalAlignment="Top" Width="80">
<TextBox.Text>
<Binding Path="NewLocationModelEntry.Designation" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding.ValidationRules>
<validators:StringRangeValidationRule
validators:MinimumLength="1" validators:MaximumLength="45"
ErrorMessage="Designation must contain at least 1 characters up to 45" />
</Binding.ValidationRules>-->
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
@ -90,20 +90,20 @@
<TextBox HorizontalAlignment="Left" Height="25" Margin="265,366,0,0" TextWrapping="Wrap" Name="EnterBuildingNr" VerticalAlignment="Top" Width="80">
<TextBox.Text>
<Binding Path="NewLocationModelEntry.BuildingNr" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding.ValidationRules>
<validators:IntRangeValidationRule
validators:MinimumLength="1" validators:MaximumLength="10000"/>
</Binding.ValidationRules>-->
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox HorizontalAlignment="Left" Height="25" Margin="350,366,0,0" TextWrapping="Wrap" Name="EnterRoomNr" VerticalAlignment="Top" Width="80" >
<TextBox.Text>
<Binding Path="NewLocationModelEntry.RoomNr" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding.ValidationRules>
<validators:IntRangeValidationRule
validators:MinimumLength="1" validators:MaximumLength="10000"/>
</Binding.ValidationRules>-->
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
@ -118,4 +118,4 @@
<Label Content="RoomNr" HorizontalAlignment="Left" Margin="350,340,0,0" VerticalAlignment="Top" Width="80" FontSize="12"/>
</Grid>
</Grid>
</UserControl>
</UserControl>

View File

@ -1,17 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls;
namespace LoggingClient.Views
{

View File

@ -1,38 +1,34 @@
<UserControl x:Class="LoggingClient.Views.LogView"
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:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:LoggingClient.Views"
xmlns:validators="clr-namespace:LoggingClient.Validators"
mc:Ignorable="d"
d:DesignHeight="425" d:DesignWidth="800">
xmlns:viewModel="clr-namespace:LoggingClient.ViewModel"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<Control.DataContext>
<viewModel:LogViewModel/>
</Control.DataContext>
<Grid Width="800" Background="#FF89A9B2" >
<TextBlock Height="32" HorizontalAlignment="Left" Margin="10,18,0,0" Name="TextBlockHeading"
Text="LogReader" VerticalAlignment="Top" Width="310" FontSize="20" FontStretch="Normal"/>
<Grid HorizontalAlignment="Left" Height="425" VerticalAlignment="Top" Width="773">
<DataGrid AutoGenerateColumns="False" HorizontalAlignment="Left" SelectedItem="{Binding MySelectedItem, Mode=TwoWay}" Margin="10,55,0,97" Name="DataGridCustomers" Width="780" ItemsSource="{Binding Path=Logs}"
CanUserResizeRows="False">
<Grid Height="450" Width="800" Background="#FF89A9B2" >
<TextBlock Height="32" HorizontalAlignment="Left" Margin="10,18,0,0" Name="TextBlockHeading" Text="Log Reader" VerticalAlignment="Top" Width="310" FontSize="20" FontStretch="Normal"/>
<Grid HorizontalAlignment="Left" Height="416" VerticalAlignment="Top" Width="773">
<DataGrid CanUserAddRows="False" AutoGenerateColumns="False" HorizontalAlignment="Left" SelectedItem="{Binding MySelectedItem, Mode=TwoWay}" Margin="10,55,0,97" Name="DataGridLogs" Width="780" ItemsSource="{Binding Path=Logs}" CanUserResizeRows="False">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=Id}" Header="ID" Width="70" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Pod}" Header="POD" Width="70" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Location}" Header="Location" Width="111" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Hostname}" Header="Hostname" Width="111" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Severity}" Header="Severity" Width="70" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Timestamp}" Header="Timestamp" Width="130" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Message}" Header="Message" Width="215" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Id}" Header="id" Width="70" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Pod}" Header="pod" Width="70" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Location}" Header="location" Width="111" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Hostname}" Header="hostname" Width="111" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Severity}" Header="severity" Width="70" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Timestamp}" Header="timestamp" Width="130" IsReadOnly="True" />
<DataGridTextColumn Binding="{Binding Path=Message}" Header="message" Width="215" IsReadOnly="True" />
</DataGrid.Columns>
</DataGrid>
<Label Content="Database Connection" HorizontalAlignment="Left" Margin="118,22,0,0" VerticalAlignment="Top" Height="23" Width="125" Background="{x:Null}" RenderTransformOrigin="0.366,0.725"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="248,22,0,0" TextWrapping="Wrap" Text="{Binding TxtConnectionString}" Name="TxtConnectionString" VerticalAlignment="Top" Width="525" />
<Button Content="Find duplicate" Height="25" HorizontalAlignment="Left" Margin="545,380,0,0" x:Name="BtnFindDuplicate" VerticalAlignment="Top" Width="78" Command="{Binding BtnFindDuplicateClick}" />
<Button Content="Load Data" Height="25" HorizontalAlignment="Left" Margin="628,380,0,0" Name="Btnloaddata" VerticalAlignment="Top" Width="70" Command="{Binding BtnLoadDataClick}" />
<Button Content="Confirm" Height="25" HorizontalAlignment="Left" Margin="703,380,0,0" Name="BtnConfirm" VerticalAlignment="Top" Width="70" Command="{Binding BtnConfirmDataClick}"/>
<Button Content="Add" Height="25" HorizontalAlignment="Left" Margin="470,380,0,0" Name="BtnAdd" VerticalAlignment="Top" Width="70" Command="{Binding BtnAddDataClick}">
<Button Content="Add" Height="25" HorizontalAlignment="Left" Margin="418,355,0,0" Name="BtnAdd" VerticalAlignment="Top" Width="85" Command="{Binding BtnAddDataClick}">
<Button.Style>
<Style TargetType="{x:Type Button}">
<Style.Triggers>
@ -52,50 +48,62 @@ CanUserResizeRows="False">
</Style>
</Button.Style>
</Button>
<TextBox HorizontalAlignment="Left" Height="25" Margin="10,350,0,0" TextWrapping="Wrap" Name="EnterPod" VerticalAlignment="Top" Width="110">
<Button Content="Find Duplicates" Height="25" HorizontalAlignment="Left" Margin="508,355,0,0" Name="BtnFindDuplicates" VerticalAlignment="Top" Width="85" Command="{Binding BtnFindDuplicatesClick}" />
<Button Content="Load Data" Height="25" HorizontalAlignment="Left" Margin="598,355,0,0" Name="BtnLoadData" VerticalAlignment="Top" Width="85" Command="{Binding BtnLoadDataClick}" />
<Button Content="Confirm" Height="25" HorizontalAlignment="Left" Margin="688,355,0,0" Name="BtnConfirm" VerticalAlignment="Top" Width="85" Command="{Binding BtnConfirmDataClick}"/>
<TextBox HorizontalAlignment="Left" Height="23" Margin="248,22,0,0" TextWrapping="Wrap" Text="{Binding TxtConnectionString}" Name="TxtConnectionString" VerticalAlignment="Top" Width="525" />
<TextBox HorizontalAlignment="Left" Height="25" Margin="10,355,0,0" TextWrapping="Wrap" Name="EnterPod" VerticalAlignment="Top" Width="95">
<TextBox.Text>
<Binding Path="EnterPod" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding Path="NewLogModelEntry.Pod" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validators:StringRangeValidationRule
ErrorMessage="Pod must contain atleast 3 characters up to 255" />
</Binding.ValidationRules>-->
validators:MinimumLength="3" validators:MaximumLength="255"
ErrorMessage="Pod must contain at least 3 characters up to 255" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox HorizontalAlignment="Left" Height="25" Margin="125,350,0,0" TextWrapping="Wrap" Name="EnterHostname" VerticalAlignment="Top" Width="110">
<TextBox HorizontalAlignment="Left" Height="25" Margin="110,355,0,0" TextWrapping="Wrap" Name="EnterHostname" VerticalAlignment="Top" Width="95">
<TextBox.Text>
<Binding Path="EnterHostname" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding Path="NewLogModelEntry.Hostname" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validators:StringRangeValidationRule
ErrorMessage="Hostname must contain atleast 3 characters up to 255" />
</Binding.ValidationRules>-->
validators:MinimumLength="3" validators:MaximumLength="255"
ErrorMessage="Hostname must contain at least 3 characters up to 255" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox HorizontalAlignment="Left" Height="25" Margin="240,350,0,0" TextWrapping="Wrap" Name="EnterSeverity" VerticalAlignment="Top" Width="110" >
<TextBox HorizontalAlignment="Left" Height="25" Margin="210,355,0,0" TextWrapping="Wrap" Name="EnterSeverity" VerticalAlignment="Top" Width="95" >
<TextBox.Text>
<Binding Path="EnterSeverity" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<validators:IntRangeValidationRule/>
</Binding.ValidationRules>-->
<Binding Path="NewLogModelEntry.Severity" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validators:IntRangeValidationRule
validators:MinimumLength="1" validators:MaximumLength="3"/>
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<TextBox HorizontalAlignment="Left" Height="25" Margin="355,350,0,0" TextWrapping="Wrap" Name="EnterMessage" VerticalAlignment="Top" Width="418" RenderTransformOrigin="0.5,0.5">
<TextBox HorizontalAlignment="Left" Height="50" Margin="310,355,0,0" TextWrapping="Wrap" Name="EnterMessage" VerticalAlignment="Top" Width="95">
<TextBox.Text>
<Binding Path="EnterMessage" UpdateSourceTrigger="PropertyChanged">
<!--<Binding.ValidationRules>
<Binding Path="NewLogModelEntry.Message" UpdateSourceTrigger="PropertyChanged">
<Binding.ValidationRules>
<validators:StringRangeValidationRule
ErrorMessage="Message must contain atleast 3 characters up to 255" />
</Binding.ValidationRules>-->
validators:MinimumLength="3" validators:MaximumLength="255"
ErrorMessage="Message must contain at least 3 characters up to 255" />
</Binding.ValidationRules>
</Binding>
</TextBox.Text>
</TextBox>
<Label Content="Enter Pod" HorizontalAlignment="Left" Margin="10,324,0,0" VerticalAlignment="Top" Width="110"/>
<Label Content="Enter Hostname" HorizontalAlignment="Left" Margin="125,324,0,0" VerticalAlignment="Top" Width="110"/>
<Label Content="Enter Severity" HorizontalAlignment="Left" Margin="240,324,0,0" VerticalAlignment="Top" Width="110"/>
<Label Content="Enter Message" HorizontalAlignment="Left" Margin="355,324,0,0" VerticalAlignment="Top" Width="110"/>
<!--<ComboBox x:Name="SeverityCombobox" DisplayMemberPath="Severity" SelectedValuePath="id" ItemsSource="{Binding SeverityComboBox}" SelectedValue="{Binding Path=Severity , Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Margin="240,359,470,66" Width="90" Height="25"/>-->
<Label Content="Database Connection" HorizontalAlignment="Left" Margin="118,22,0,0" VerticalAlignment="Top" Height="23" Width="125" Background="{x:Null}" RenderTransformOrigin="0.366,0.725"/>
<Label Content="Pod" HorizontalAlignment="Left" Margin="10,324,0,0" VerticalAlignment="Top" Width="110"/>
<Label Content="Hostname" HorizontalAlignment="Left" Margin="110,324,0,0" VerticalAlignment="Top" Width="110"/>
<Label Content="Severity" HorizontalAlignment="Left" Margin="210,324,0,0" VerticalAlignment="Top" Width="110"/>
<Label Content="Message" HorizontalAlignment="Left" Margin="310,324,0,0" VerticalAlignment="Top" Width="110"/>
</Grid>
</Grid>
</UserControl>
</UserControl>

1
LoggingClient/LoggingClient/Views/LogView.xaml.cs Normal file → Executable file
View File

@ -8,7 +8,6 @@ namespace LoggingClient.Views
public LogView()
{
InitializeComponent();
DataContext = new LogViewModel();
}
}
}