Merge branch 'master' of s442333/DINO_SCRUM into master
This commit is contained in:
commit
231ee392da
@ -73,6 +73,12 @@
|
|||||||
<Compile Include="Windows\AmountWindow.xaml.cs">
|
<Compile Include="Windows\AmountWindow.xaml.cs">
|
||||||
<DependentUpon>AmountWindow.xaml</DependentUpon>
|
<DependentUpon>AmountWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\ErrorWindow.xaml.cs">
|
||||||
|
<DependentUpon>ErrorWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Include="Windows\ValueWindow.xaml.cs">
|
||||||
|
<DependentUpon>ValueWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Page Include="MainWindow.xaml">
|
<Page Include="MainWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@ -93,6 +99,14 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\ErrorWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="Windows\ValueWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
@ -15,12 +15,14 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Magazyn"
|
xmlns:local="clr-namespace:Magazyn"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Magazyn Owoców" Height="400" MaxWidth="590" MinWidth="590" Width="590">
|
Title="Magazyn Owoców" Height="500" MaxWidth="590" MinWidth="590" Width="590" SizeChanged="Window_SizeChanged">
|
||||||
<Grid>
|
<Grid>
|
||||||
<ListBox x:Name="fruitList" Margin="10,35,10,50"/>
|
<ListBox x:Name="fruitList" Margin="10,35,10,89"/>
|
||||||
|
|
||||||
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Button_Click_1" HorizontalAlignment="Right" Width="163"/>
|
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Value_Click" HorizontalAlignment="Right" Width="163"/>
|
||||||
<Label Content="Lista owoców:" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" Width="100"/>
|
<Label Content="Lista owoców:" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" Width="100"/>
|
||||||
|
<Button x:Name="prevButton" Content="Poprzednia" HorizontalAlignment="Left" Margin="10,0,0,52" VerticalAlignment="Bottom" Width="105" Click="prevButton_Click"/>
|
||||||
|
<Button x:Name="nextButton" Content="Następna" HorizontalAlignment="Right" Margin="0,0,10,52" VerticalAlignment="Bottom" Width="105" Click="nextButton_Click"/>
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -18,22 +18,30 @@ using System.Windows.Shapes;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
|
using System.Net;
|
||||||
|
using Magazyn.Windows;
|
||||||
|
|
||||||
namespace Magazyn
|
namespace Magazyn
|
||||||
{
|
{
|
||||||
|
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
|
public int size = 4;
|
||||||
|
public int page = 0;
|
||||||
|
|
||||||
|
bool firstPage;
|
||||||
|
bool lastPage;
|
||||||
|
|
||||||
HttpClient client;
|
HttpClient client;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
client = new HttpClient();
|
this.Initialized += MainWindow_Initialized; ;
|
||||||
RefreshListOfFruits();
|
|
||||||
}
|
client = new HttpClient();
|
||||||
|
}
|
||||||
|
|
||||||
private void Button_Click(object sender, RoutedEventArgs e)
|
private void MainWindow_Initialized(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
RefreshListOfFruits();
|
RefreshListOfFruits();
|
||||||
}
|
}
|
||||||
@ -43,27 +51,58 @@ namespace Magazyn
|
|||||||
string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
|
string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
|
||||||
|
|
||||||
Task<HttpResponseMessage> response = client.PostAsync("https://sysmag.herokuapp.com/api/product/change-quantity", new StringContent(json, Encoding.UTF8, "application/json"));
|
Task<HttpResponseMessage> response = client.PostAsync("https://sysmag.herokuapp.com/api/product/change-quantity", new StringContent(json, Encoding.UTF8, "application/json"));
|
||||||
while (response.IsCompleted != true)
|
while (response.IsCompleted != true) ;
|
||||||
{
|
|
||||||
RefreshListOfFruits();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (response.Result.StatusCode == HttpStatusCode.BadRequest)
|
||||||
|
{
|
||||||
|
JObject data = JObject.Parse(response.Result.Content.ReadAsStringAsync().Result.ToString());
|
||||||
|
|
||||||
|
ErrorWindow window;
|
||||||
|
|
||||||
|
if (data["message"].ToString().Contains("Too low"))
|
||||||
|
{
|
||||||
|
window = new ErrorWindow("Wystąpił błąd niedomiaru. Próbujesz usunąć więcej owoców niż masz w magazynie.");
|
||||||
|
}
|
||||||
|
else if (data["message"].ToString().Contains("Over max"))
|
||||||
|
{
|
||||||
|
window = new ErrorWindow("Wystąpił błąd nadmiaru. Próbujesz dodać więcej owoców niż pomieści magazyn.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
window = new ErrorWindow("Nieznany błąd.");
|
||||||
|
}
|
||||||
|
window.Owner = this;
|
||||||
|
window.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
RefreshListOfFruits();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshListOfFruits()
|
private void RefreshListOfFruits()
|
||||||
{
|
{
|
||||||
|
|
||||||
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all");
|
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all?page=" + page.ToString() + "&size=" + size.ToString());
|
||||||
while (response.IsCompleted != true) ;
|
while (response.IsCompleted != true) ;
|
||||||
|
|
||||||
|
if (response.Result.StatusCode != HttpStatusCode.OK)
|
||||||
|
{
|
||||||
|
ErrorWindow window = new ErrorWindow("Nastąpił błąd połączenia z serwerem.");
|
||||||
|
window.Owner = this;
|
||||||
|
window.ShowDialog();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
string responseString = response.Result.Content.ReadAsStringAsync().Result;
|
string responseString = response.Result.Content.ReadAsStringAsync().Result;
|
||||||
|
|
||||||
JObject replay = JObject.Parse(responseString);
|
JObject replay = JObject.Parse(responseString);
|
||||||
|
|
||||||
|
firstPage = bool.Parse(replay["first"].ToString());
|
||||||
|
lastPage = bool.Parse(replay["last"].ToString());
|
||||||
|
|
||||||
Fruit[] fruits = JsonConvert.DeserializeObject<Fruit[]>(replay["content"].ToString());
|
Fruit[] fruits = JsonConvert.DeserializeObject<Fruit[]>(replay["content"].ToString());
|
||||||
|
|
||||||
UpdateListOfFruits(fruits);
|
UpdateListOfFruits(fruits);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateListOfFruits(Fruit[] list)
|
private void UpdateListOfFruits(Fruit[] list)
|
||||||
{
|
{
|
||||||
@ -87,16 +126,32 @@ namespace Magazyn
|
|||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
private void Value_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
ValueWindow window = new ValueWindow(GetWarehousePrice().Price);
|
||||||
|
window.Owner = this;
|
||||||
|
window.ShowDialog();
|
||||||
MessageBox.Show("Wartość magazynu to: " + GetWarehousePrice().Price.ToString() + "zł", "Wartość magazynu" );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void prevButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (firstPage != true) page--;
|
||||||
|
RefreshListOfFruits();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
private void nextButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (lastPage != true) page++;
|
||||||
|
RefreshListOfFruits();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
|
{
|
||||||
|
Size size = e.NewSize;
|
||||||
|
double height = size.Height - 124;
|
||||||
|
this.size = (int)(height / 90);
|
||||||
|
RefreshListOfFruits();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,12 +11,12 @@
|
|||||||
|
|
||||||
<materialDesign:Card Background="{DynamicResource SecondaryAccentBrush}">
|
<materialDesign:Card Background="{DynamicResource SecondaryAccentBrush}">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Image Name="fruitImage" HorizontalAlignment="Left" Margin="10,10,0,7" Width="50"/>
|
<Image x:Name="fruitImage" HorizontalAlignment="Left" Margin="10,10,0,7" Width="50"/>
|
||||||
<TextBlock Name="fruitName" HorizontalAlignment="Left" Margin="80,26,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="116"/>
|
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="80,26,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="116"/>
|
||||||
<Image Name="minusImage" HorizontalAlignment="Left" Height="24" Margin="240,25,0,0" VerticalAlignment="Top" Width="24" Source="/Images/minus.png" MouseDown="subButton_Click" />
|
<Image x:Name="minusImage" HorizontalAlignment="Left" Height="24" Margin="240,25,0,0" VerticalAlignment="Top" Width="24" Source="/Images/minus.png" MouseDown="subaddButton_Click" />
|
||||||
<Image Name="plusImage" HorizontalAlignment="Left" Height="24" Margin="304,25,0,0" VerticalAlignment="Top" Width="24" Source="/Magazyn;component/Images/plus.png" RenderTransformOrigin="0.208,0.521" MouseDown="addButton_Click"/>
|
<Image x:Name="plusImage" HorizontalAlignment="Left" Height="24" Margin="304,25,0,0" VerticalAlignment="Top" Width="24" Source="/Magazyn;component/Images/plus.png" RenderTransformOrigin="0.208,0.521" MouseDown="subaddButton_Click"/>
|
||||||
<TextBlock Name="fruitAmount" HorizontalAlignment="Left" Margin="267,29,0,19" Width="34" TextAlignment="Center" RenderTransformOrigin="0.489,-0.623"/>
|
<TextBlock x:Name="fruitAmount" HorizontalAlignment="Left" Margin="267,29,0,19" Width="34" TextAlignment="Center" RenderTransformOrigin="0.489,-0.623"/>
|
||||||
<TextBlock Name="fruitPrice" Margin="362,26,106,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" IsEnabled="False"/>
|
<TextBlock x:Name="fruitPrice" Margin="362,26,106,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" IsEnabled="False"/>
|
||||||
<TextBlock x:Name="allPrice" Margin="425,26,43,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
|
<TextBlock x:Name="allPrice" Margin="425,26,43,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -46,21 +46,14 @@ namespace Magazyn.Views
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void subButton_Click(object sender, RoutedEventArgs e)
|
private void subaddButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
AmountWindow window = new AmountWindow(fruit, -1, fruit.Quantity);
|
AmountWindow window = new AmountWindow(fruit, ((sender as Image).Name == "minusImage")?-1:1, fruit.Quantity);
|
||||||
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
|
||||||
window.Owner = Application.Current.MainWindow;
|
|
||||||
window.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
AmountWindow window = new AmountWindow(fruit, 1, fruit.Quantity);
|
|
||||||
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
||||||
window.Owner = Application.Current.MainWindow;
|
window.Owner = Application.Current.MainWindow;
|
||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<Window x:Class="Magazyn.Windows.AmountWindow"
|
<Window x:Class="Magazyn.Windows.AmountWindow"
|
||||||
|
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
TextElement.FontWeight="Regular"
|
TextElement.FontWeight="Regular"
|
||||||
@ -7,23 +7,23 @@
|
|||||||
TextOptions.TextFormattingMode="Ideal"
|
TextOptions.TextFormattingMode="Ideal"
|
||||||
TextOptions.TextRenderingMode="Auto"
|
TextOptions.TextRenderingMode="Auto"
|
||||||
Background="{DynamicResource MaterialDesignPaper}"
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
FontFamily="{DynamicResource MaterialDesignFont}"
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Magazyn.Windows"
|
xmlns:local="clr-namespace:Magazyn.Windows"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Magazyn" WindowStartupLocation="CenterOwner" Height="205" Width="220">
|
Title="Magazyn" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,82,0,0" TextWrapping="Wrap" Text="fruitName" Width="64" Height="16" VerticalAlignment="Top"/>
|
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,82,0,0" TextWrapping="Wrap" Text="fruitName" Width="64" Height="16" VerticalAlignment="Top"/>
|
||||||
<TextBlock x:Name="messageBox" HorizontalAlignment="Left" Margin="80,10,0,0" TextWrapping="Wrap" Text="messageBox" VerticalAlignment="Top" Width="125" Height="64"/>
|
<TextBlock x:Name="messageBox" HorizontalAlignment="Left" Margin="80,10,0,0" TextWrapping="Wrap" Text="messageBox" VerticalAlignment="Top" Width="125" Height="64"/>
|
||||||
<TextBox x:Name="amountToChange" Margin="0,71,9,0" TextWrapping="Wrap" Text="0" RenderTransformOrigin="1.456,0.316" Height="32" VerticalAlignment="Top" HorizontalAlignment="Right" Width="64"/>
|
<TextBox x:Name="amountToChange" Margin="0,71,9,0" TextWrapping="Wrap" Text="0" RenderTransformOrigin="1.456,0.316" Height="32" VerticalAlignment="Top" HorizontalAlignment="Right" Width="64"/>
|
||||||
<Button x:Name="saveButton" Content="Zastosuj" Margin="105,122,0,0" VerticalAlignment="Top" Click="saveButton_Click" Width="90" HorizontalAlignment="Left"/>
|
<Button x:Name="saveButton" Content="Zastosuj" Margin="105,122,0,0" VerticalAlignment="Top" Click="saveButton_Click" Width="90" HorizontalAlignment="Left"/>
|
||||||
<Button x:Name="cancelButton" Content="Anuluj" Margin="10,122,0,0" VerticalAlignment="Top" Click="cancelButton_Click" Width="90" HorizontalAlignment="Left" />
|
<Button x:Name="cancelButton" Content="Anuluj" Margin="10,122,0,0" VerticalAlignment="Top" Click="cancelButton_Click" Width="90" HorizontalAlignment="Left" />
|
||||||
<Image x:Name="fruitImage" HorizontalAlignment="Left" Height="64" Margin="10,10,0,0" VerticalAlignment="Top" Width="64"/>
|
<Image x:Name="fruitImage" HorizontalAlignment="Left" Height="64" Margin="10,10,0,0" VerticalAlignment="Top" Width="64"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -18,13 +18,13 @@ namespace Magazyn.Windows
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for AmountWindow.xaml
|
/// Interaction logic for AmountWindow.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
///
|
///
|
||||||
|
|
||||||
public partial class AmountWindow : Window
|
public partial class AmountWindow : Window
|
||||||
{
|
{
|
||||||
Fruit fruit;
|
Fruit fruit;
|
||||||
int type;
|
int type;
|
||||||
int quantity;
|
int quantity;
|
||||||
|
|
||||||
public delegate void ChangingAmountOfFruits(int amountChanged);
|
public delegate void ChangingAmountOfFruits(int amountChanged);
|
||||||
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
||||||
@ -35,16 +35,16 @@ namespace Magazyn.Windows
|
|||||||
this.fruit = fruit;
|
this.fruit = fruit;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
if (type == -1)
|
|
||||||
this.Title = "Zmniejsz ilość " + fruit.Name;
|
if (type == -1)
|
||||||
else
|
this.Title = "Zmniejsz ilość: " + fruit.Name;
|
||||||
this.Title = "Zwiększ ilość " + fruit.Name;
|
else
|
||||||
fruitName.Text = fruit.Name;
|
this.Title = "Zwiększ ilość: " + fruit.Name;
|
||||||
|
|
||||||
fruitName.Text = fruit.Name;
|
fruitName.Text = fruit.Name;
|
||||||
|
|
||||||
messageBox.Text = String.Format("Jaką ilość produktu chcesz {0} do magazynu?", (type > 0) ? "dodać":"odjąć");
|
messageBox.Text = String.Format("Jaką ilość produktu chcesz {0} do magazynu?", (type > 0) ? "dodać" : "odjąć");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -52,51 +52,48 @@ namespace Magazyn.Windows
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
MessageBox.Show(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveButton_Click(object sender, RoutedEventArgs e)
|
private void SendNewQuantity()
|
||||||
{
|
{
|
||||||
int amount = 0;
|
int amount = int.Parse(amountToChange.Text);
|
||||||
int maxAmount = 2500;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
amount = int.Parse(amountToChange.Text);
|
if (amount < 0)
|
||||||
if (amount < 0)
|
{
|
||||||
{
|
ErrorWindow window = new ErrorWindow("Podana wartość jest nieprawidłowa, proszę podać wartość dodatnią.");
|
||||||
MessageBox.Show("Podana wartość jest nieprawidłowa, proszę podać wartość dodatnią", "Nieprawidłowa wartość", MessageBoxButton.OK, MessageBoxImage.Error);
|
window.Owner = Application.Current.MainWindow;
|
||||||
amountToChange.Text = "0";
|
window.ShowDialog();
|
||||||
return;
|
amountToChange.Text = "0";
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
} catch (Exception ex) {
|
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
throw new NotImplementedException(ex.Message);
|
throw new NotImplementedException(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((quantity + amount > maxAmount) && amount >= 0 && type == 1)
|
SaveChangingAmountOfFruits.Invoke((type > 0) ? amount : -amount);
|
||||||
{
|
this.Close();
|
||||||
MessageBox.Show("Przepełnienie magazynu", "Przepełnienie, maksymalnie 2500 sztuk", MessageBoxButton.OK, MessageBoxImage.Error);
|
}
|
||||||
amountToChange.Text = "0";
|
|
||||||
return;
|
|
||||||
|
|
||||||
} else if ((quantity - amount < 0) && amount >= 0 && type == -1)
|
|
||||||
{
|
|
||||||
MessageBox.Show("Niedobór magazynu", "Ilość przedmiotów nie możę być mniejsza niz 0", MessageBoxButton.OK, MessageBoxImage.Error);
|
|
||||||
amountToChange.Text = "0";
|
|
||||||
return;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
SaveChangingAmountOfFruits.Invoke((type > 0) ? amount : -amount);
|
|
||||||
this.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private void saveButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
SendNewQuantity();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButton_Click(object sender, RoutedEventArgs e)
|
private void cancelButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Return) SendNewQuantity();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml
Normal file
23
Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<Window x:Class="Magazyn.Windows.ErrorWindow"
|
||||||
|
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
|
TextElement.FontWeight="Regular"
|
||||||
|
TextElement.FontSize="13"
|
||||||
|
TextOptions.TextFormattingMode="Ideal"
|
||||||
|
TextOptions.TextRenderingMode="Auto"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
|
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Magazyn.Windows"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Błąd" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
|
||||||
|
<Grid>
|
||||||
|
<Button x:Name="okButton" Content="Ok" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Click="okButton_Click"/>
|
||||||
|
<TextBlock x:Name="messageBlock" FontSize="16" Margin="10,10,10,0" TextWrapping="Wrap" Text="messageBlock" VerticalAlignment="Top"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
33
Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml.cs
Normal file
33
Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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.Shapes;
|
||||||
|
|
||||||
|
namespace Magazyn.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ErrorWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ErrorWindow : Window
|
||||||
|
{
|
||||||
|
public ErrorWindow(string text)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
messageBlock.Text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void okButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
Magazyn_Client/Magazyn/Windows/ValueWindow.xaml
Normal file
25
Magazyn_Client/Magazyn/Windows/ValueWindow.xaml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
<Window x:Class="Magazyn.Windows.ValueWindow"
|
||||||
|
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
|
TextElement.FontWeight="Regular"
|
||||||
|
TextElement.FontSize="13"
|
||||||
|
TextOptions.TextFormattingMode="Ideal"
|
||||||
|
TextOptions.TextRenderingMode="Auto"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
|
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Magazyn.Windows"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Wartość magazynu" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
|
||||||
|
<Grid>
|
||||||
|
<Button x:Name="okButton" Content="Ok" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Click="okButton_Click"/>
|
||||||
|
<TextBlock FontSize="16" Margin="10,10,10,0" TextWrapping="Wrap" Text="Wartość magazynu to:" VerticalAlignment="Top"/>
|
||||||
|
<TextBlock x:Name="valueBlock" FontSize="16" HorizontalAlignment="Left" Margin="10,34,0,0" TextWrapping="Wrap" Text="NaN zł" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
33
Magazyn_Client/Magazyn/Windows/ValueWindow.xaml.cs
Normal file
33
Magazyn_Client/Magazyn/Windows/ValueWindow.xaml.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
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.Shapes;
|
||||||
|
|
||||||
|
namespace Magazyn.Windows
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for ValueWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class ValueWindow : Window
|
||||||
|
{
|
||||||
|
public ValueWindow(float value)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
valueBlock.Text = value.ToString() + " zł";
|
||||||
|
}
|
||||||
|
|
||||||
|
private void okButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user