Compare commits
No commits in common. "master" and "master" have entirely different histories.
@ -13,8 +13,8 @@ Global
|
|||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.ActiveCfg = Debug|Any CPU
|
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.Build.0 = Debug|Any CPU
|
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -3,7 +3,4 @@
|
|||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
</startup>
|
</startup>
|
||||||
<appSettings>
|
|
||||||
<add key="serverUrl" value="https://sysmag.herokuapp.com/api/"/>
|
|
||||||
</appSettings>
|
|
||||||
</configuration>
|
</configuration>
|
@ -8,8 +8,8 @@
|
|||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Teal.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Cyan.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
@ -5,7 +5,6 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
|
|
||||||
namespace Magazyn
|
namespace Magazyn
|
||||||
{
|
{
|
||||||
@ -14,7 +13,5 @@ namespace Magazyn
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
using Magazyn.Tools;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
|
|
||||||
namespace Magazyn.DataModels
|
namespace Magazyn.DataModels
|
||||||
{
|
{
|
||||||
@ -14,13 +11,9 @@ namespace Magazyn.DataModels
|
|||||||
int id;
|
int id;
|
||||||
string name;
|
string name;
|
||||||
int quantity;
|
int quantity;
|
||||||
int quantityMax;
|
|
||||||
float price;
|
float price;
|
||||||
string imageLink;
|
string imageLink;
|
||||||
|
|
||||||
BitmapImage imageSource;
|
|
||||||
|
|
||||||
|
|
||||||
public int Id
|
public int Id
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -45,15 +38,6 @@ namespace Magazyn.DataModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int QuantityMax
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return quantityMax;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public float Price
|
public float Price
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -70,26 +54,13 @@ namespace Magazyn.DataModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BitmapImage ImageSource
|
public Fruit(int id, string name, int quantity, float price, string imageLink)
|
||||||
{
|
{
|
||||||
get
|
|
||||||
{
|
|
||||||
return imageSource;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public Fruit(int id, string name, int quantity, int quantityMax, float price, string imageLink)
|
|
||||||
{
|
|
||||||
|
|
||||||
this.id = id;
|
this.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
this.quantityMax = quantityMax;
|
|
||||||
this.price = price;
|
this.price = price;
|
||||||
this.imageLink = imageLink;
|
this.imageLink = imageLink;
|
||||||
|
|
||||||
imageSource = CacheImage.GetImageSource(new Uri(imageLink));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||||
<NuGetPackageImportStamp>
|
|
||||||
</NuGetPackageImportStamp>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||||
@ -46,7 +44,6 @@
|
|||||||
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Configuration" />
|
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
@ -68,22 +65,12 @@
|
|||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Compile Include="DataModels\Fruit.cs" />
|
<Compile Include="DataModels\Fruit.cs" />
|
||||||
<Compile Include="DataModels\WarehousePrice.cs" />
|
<Compile Include="DataModels\WarehousePrice.cs" />
|
||||||
<Compile Include="Tools\CacheImage.cs" />
|
|
||||||
<Compile Include="Views\FruitView.xaml.cs">
|
<Compile Include="Views\FruitView.xaml.cs">
|
||||||
<DependentUpon>FruitView.xaml</DependentUpon>
|
<DependentUpon>FruitView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<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\InfoWindow.xaml.cs">
|
|
||||||
<DependentUpon>InfoWindow.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>
|
||||||
@ -104,18 +91,6 @@
|
|||||||
<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\InfoWindow.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">
|
||||||
@ -142,9 +117,7 @@
|
|||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config">
|
<None Include="App.config" />
|
||||||
<SubType>Designer</SubType>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Images\add.png" />
|
<Resource Include="Images\add.png" />
|
||||||
|
@ -1,42 +1,22 @@
|
|||||||
<Window x:Class="Magazyn.MainWindow"
|
<Window x:Class="Magazyn.MainWindow"
|
||||||
|
|
||||||
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.FontSize="13"
|
|
||||||
TextOptions.TextFormattingMode="Ideal"
|
|
||||||
TextOptions.TextRenderingMode="Auto"
|
|
||||||
Background="{DynamicResource MaterialDesignPaper}"
|
|
||||||
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"
|
xmlns:local="clr-namespace:Magazyn"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Magazyn Owoców" MinHeight="259" Height="500" MaxWidth="590" MinWidth="590" Width="590" >
|
Title="Fruit Warehouse" Height="400" Width="520">
|
||||||
<Grid>
|
<Grid>
|
||||||
|
<ListBox x:Name="fruitList" Margin="10,35,10,0" Height="239" VerticalAlignment="Top"/>
|
||||||
|
|
||||||
<ListBox MouseDoubleClick="fruitListMouseDoubleClick" x:Name="fruitList" Margin="10,51,10,87"/>
|
<Button Name="sum" Content="Suma" HorizontalAlignment="Left" Margin="414,0,0,46" VerticalAlignment="Bottom" Width="74" Height="35" Background="Teal" Click="Button_Click_1"/>
|
||||||
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Value_Click" HorizontalAlignment="Right" Width="163"/>
|
<TextBox Name="payment" HorizontalAlignment="Left" Margin="404,322,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="84"/>
|
||||||
|
<Label Content="Do zapłaty:" FontWeight="Bold" HorizontalAlignment="Left" Margin="328,325,0,0" VerticalAlignment="Top" Width="76"/>
|
||||||
|
<ProgressBar Name="loadingContent" HorizontalAlignment="Left" Height="10" Margin="304,294,0,0" VerticalAlignment="Top" Width="100"/>
|
||||||
<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"/>
|
||||||
<Label Content="Nazwa owocu:" FontWeight="Bold" HorizontalAlignment="Left" Margin="91,25,0,0" VerticalAlignment="Top" Width="100"/>
|
|
||||||
|
|
||||||
<Label Content="Ilość:" FontWeight="Bold" HorizontalAlignment="Left" Margin="283,25,0,0" VerticalAlignment="Top" Width="46"/>
|
|
||||||
|
|
||||||
<Label Content="Cena 1szt:" FontWeight="Bold" HorizontalAlignment="Left" Margin="360,25,0,0" VerticalAlignment="Top" Width="73"/>
|
|
||||||
<Label Content="Wartość:" FontWeight="Bold" HorizontalAlignment="Left" Margin="438,25,0,0" VerticalAlignment="Top" Width="65"/>
|
|
||||||
|
|
||||||
<Button x:Name="prevButton" Content="Poprzednia" HorizontalAlignment="Left" Margin="10,0,0,50" VerticalAlignment="Bottom" Width="105" Click="prevButton_Click"/>
|
|
||||||
<Button x:Name="nextButton" Content="Następna" HorizontalAlignment="Right" Margin="0,0,10,50" VerticalAlignment="Bottom" Width="105" Click="nextButton_Click"/>
|
|
||||||
<TextBlock x:Name="pageBlock" FontSize="16" Margin="271,0,276,10" TextWrapping="Wrap" Text="NaN" Height="19" VerticalAlignment="Bottom"/>
|
|
||||||
<Label Content="Status:" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom" RenderTransformOrigin="0.75,0.423" />
|
|
||||||
<TextBlock Name="netStatus" HorizontalAlignment="Left" Margin="63,0,0,14" TextWrapping="Wrap" Text="error" VerticalAlignment="Bottom"/>
|
|
||||||
<TextBox x:Name="searchBox" TextWrapping="Wrap" Text="" HorizontalAlignment="Right" Width="120" Height="23" VerticalAlignment="Top" TextChanged="TextBox_TextChanged" />
|
|
||||||
<materialDesign:PackIcon Kind="Search" Height="23" Width="23" Margin="0,0,121,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|
||||||
|
@ -16,118 +16,54 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
|
||||||
|
|
||||||
using System.Net;
|
|
||||||
using Magazyn.Windows;
|
|
||||||
using Magazyn.Tools;
|
|
||||||
using System.Net.NetworkInformation;
|
|
||||||
using System.Configuration;
|
|
||||||
|
|
||||||
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;
|
|
||||||
bool netConn;
|
|
||||||
|
|
||||||
HttpClient client;
|
HttpClient client;
|
||||||
|
|
||||||
Size windowSize;
|
|
||||||
|
|
||||||
string serverUrl;
|
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
loadingContent.IsIndeterminate = true;
|
||||||
serverUrl = ConfigurationManager.AppSettings.Get("serverUrl");
|
|
||||||
|
|
||||||
client = new HttpClient();
|
client = new HttpClient();
|
||||||
this.Loaded += MainWindowLoaded;
|
RefreshListOfFruits();
|
||||||
netConn = checkInternetConnection();
|
|
||||||
if (netConn)
|
|
||||||
netStatus.Text = "Połączony";
|
|
||||||
else
|
|
||||||
netStatus.Text = "Rozłączony";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindowLoaded(object sender, EventArgs e)
|
private void Button_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
RefreshListOfFruits();
|
RefreshListOfFruits();
|
||||||
windowSize = new Size(this.Width, this.Height);
|
|
||||||
this.SizeChanged += Window_SizeChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FruitViewSaveChangingAmountOfFruits(int amountChanged, Fruit fruit)
|
private void FruitViewSaveChangingAmountOfFruits(int amountChanged, Fruit fruit)
|
||||||
{
|
{
|
||||||
string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
|
string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
|
||||||
|
|
||||||
Task<HttpResponseMessage> response = client.PostAsync(serverUrl+"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) ;
|
||||||
|
|
||||||
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();
|
RefreshListOfFruits();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RefreshListOfFruits()
|
private void RefreshListOfFruits()
|
||||||
{
|
{
|
||||||
if (netConn)
|
loadingContent.Visibility = Visibility.Visible;
|
||||||
|
loadingContent.IsIndeterminate = true;
|
||||||
|
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all");
|
||||||
|
while (response.IsCompleted != true)
|
||||||
{
|
{
|
||||||
pageBlock.Text = (page+1).ToString();
|
loadingContent.IsIndeterminate = false;
|
||||||
|
loadingContent.Visibility = Visibility.Hidden;
|
||||||
Task<HttpResponseMessage> response = client.GetAsync(serverUrl+"get-all?page=" + page.ToString() + "&size=" + size.ToString() + "&search=" + ((string.IsNullOrEmpty(searchBox.Text) || string.IsNullOrWhiteSpace(searchBox.Text)) ? "none" : searchBox.Text) );
|
|
||||||
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();
|
|
||||||
|
|
||||||
page = 0;
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string responseString = response.Result.Content.ReadAsStringAsync().Result;
|
Fruit[] fruits = JsonConvert.DeserializeObject<Fruit[]>(response.Result.Content.ReadAsStringAsync().Result.ToString());
|
||||||
|
|
||||||
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());
|
|
||||||
|
|
||||||
UpdateListOfFruits(fruits);
|
UpdateListOfFruits(fruits);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateListOfFruits(Fruit[] list)
|
private void UpdateListOfFruits(Fruit[] list)
|
||||||
{
|
{
|
||||||
@ -143,7 +79,7 @@ namespace Magazyn
|
|||||||
|
|
||||||
private WarehousePrice GetWarehousePrice()
|
private WarehousePrice GetWarehousePrice()
|
||||||
{
|
{
|
||||||
Task<HttpResponseMessage> response = client.GetAsync(serverUrl+"get-price-of-all");
|
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-price-of-all");
|
||||||
while (response.IsCompleted != true) ;
|
while (response.IsCompleted != true) ;
|
||||||
|
|
||||||
WarehousePrice price = JsonConvert.DeserializeObject<WarehousePrice>(response.Result.Content.ReadAsStringAsync().Result.ToString());
|
WarehousePrice price = JsonConvert.DeserializeObject<WarehousePrice>(response.Result.Content.ReadAsStringAsync().Result.ToString());
|
||||||
@ -151,64 +87,13 @@ namespace Magazyn
|
|||||||
return price;
|
return price;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Value_Click(object sender, RoutedEventArgs e)
|
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
ValueWindow window = new ValueWindow(GetWarehousePrice().Price);
|
payment.Text = GetWarehousePrice().Price.ToString();
|
||||||
window.Owner = this;
|
//MessageBox.Show("Value of warehouse: " + GetWarehousePrice().Price.ToString() );
|
||||||
window.ShowDialog();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
if( Math.Abs(windowSize.Height - size.Height) >= 64 )
|
|
||||||
{
|
|
||||||
this.size = Convert.ToInt32(fruitList.ActualHeight) / 80;
|
|
||||||
page = 0;
|
|
||||||
windowSize = size;
|
|
||||||
RefreshListOfFruits();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fruitListMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
if (fruitList.SelectedItem != null)
|
|
||||||
{
|
|
||||||
InfoWindow window = new InfoWindow((fruitList.SelectedItem as FruitView).fruit);
|
|
||||||
window.Owner = this;
|
|
||||||
window.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Boolean checkInternetConnection()
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
return new Ping().Send("www.google.com").Status == IPStatus.Success;
|
|
||||||
} catch
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
|
||||||
{
|
|
||||||
page = 0;
|
|
||||||
RefreshListOfFruits();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Media.Imaging;
|
|
||||||
|
|
||||||
namespace Magazyn.Tools
|
|
||||||
{
|
|
||||||
class CacheImage
|
|
||||||
{
|
|
||||||
static Dictionary<Uri, BitmapImage> dic = new Dictionary<Uri, BitmapImage>();
|
|
||||||
|
|
||||||
static public BitmapImage GetImageSource( Uri url )
|
|
||||||
{
|
|
||||||
if (dic.Keys.Contains<Uri>(url)) return dic[url];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
BitmapImage imageSource = new BitmapImage();
|
|
||||||
imageSource.BeginInit();
|
|
||||||
imageSource.UriSource = url;
|
|
||||||
imageSource.CacheOption = BitmapCacheOption.OnLoad;
|
|
||||||
imageSource.EndInit();
|
|
||||||
dic.Add(url, imageSource);
|
|
||||||
return imageSource;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -9,14 +9,14 @@
|
|||||||
mc:Ignorable="d" Height="64" Width="520">
|
mc:Ignorable="d" Height="64" Width="520">
|
||||||
|
|
||||||
|
|
||||||
<materialDesign:Card Background="{DynamicResource SecondaryAccentBrush}">
|
<materialDesign:Card Height="64" Background="Teal">
|
||||||
<Grid>
|
<Grid Height="64">
|
||||||
<Image x:Name="fruitImage" HorizontalAlignment="Left" Margin="10,10,0,7" Width="50"/>
|
<Image Name="fruitImage" HorizontalAlignment="Left" Margin="10,10,0,7" Width="50"/>
|
||||||
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="80,26,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="116"/>
|
<TextBlock Name="fruitName" HorizontalAlignment="Left" Margin="80,26,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="116"/>
|
||||||
<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="minusImage" HorizontalAlignment="Left" Height="24" Margin="238,25,0,0" VerticalAlignment="Top" Width="24" Source="/Images/minus.png" MouseDown="subButton_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"/>
|
<Image Name="plusImage" HorizontalAlignment="Left" Height="24" Margin="306,26,0,0" VerticalAlignment="Top" Width="24" Source="/Magazyn;component/Images/plus.png" RenderTransformOrigin="0.208,0.521" MouseDown="addButton_Click"/>
|
||||||
<TextBlock x:Name="fruitAmount" HorizontalAlignment="Left" Margin="267,29,0,19" Width="34" TextAlignment="Center" RenderTransformOrigin="0.489,-0.623"/>
|
<TextBox Name="fruitAmount" HorizontalAlignment="Left" Height="35" Margin="267,14,0,0" VerticalAlignment="Top" Width="34" TextAlignment="Center"/>
|
||||||
<TextBlock x:Name="fruitPrice" Margin="362,26,106,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" IsEnabled="False"/>
|
<TextBlock 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>
|
||||||
|
@ -24,7 +24,7 @@ namespace Magazyn.Views
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FruitView : UserControl
|
public partial class FruitView : UserControl
|
||||||
{
|
{
|
||||||
public Fruit fruit;
|
Fruit fruit;
|
||||||
|
|
||||||
public delegate void ChangingAmountOfFruits(int amountChanged, Fruit fruit);
|
public delegate void ChangingAmountOfFruits(int amountChanged, Fruit fruit);
|
||||||
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
||||||
@ -37,26 +37,31 @@ namespace Magazyn.Views
|
|||||||
|
|
||||||
fruitName.Text = fruit.Name;
|
fruitName.Text = fruit.Name;
|
||||||
fruitAmount.Text = fruit.Quantity.ToString();
|
fruitAmount.Text = fruit.Quantity.ToString();
|
||||||
fruitPrice.Text = fruit.Price.ToString() + "zł";
|
fruitPrice.Text = fruit.Price.ToString();
|
||||||
allPrice.Text = (fruit.Quantity * fruit.Price).ToString() + "zł";
|
allPrice.Text = (fruit.Quantity * fruit.Price).ToString();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fruitImage.Source = fruit.ImageSource;
|
fruitImage.Source = new BitmapImage(new Uri(fruit.ImageLink));
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void subaddButton_Click(object sender, RoutedEventArgs e)
|
private void subButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
AmountWindow window = new AmountWindow(fruit, ((sender as Image).Name == "minusImage")?-1:1, fruit.Quantity);
|
AmountWindow window = new AmountWindow(fruit, -1);
|
||||||
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
||||||
window.Owner = Application.Current.MainWindow;
|
window.Show();
|
||||||
window.ShowDialog();
|
}
|
||||||
|
|
||||||
|
private void addButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
AmountWindow window = new AmountWindow(fruit, 1);
|
||||||
|
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
||||||
|
window.Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowSaveChangingAmountOfFruits(int amountChanged)
|
private void WindowSaveChangingAmountOfFruits(int amountChanged)
|
||||||
|
@ -1,29 +1,15 @@
|
|||||||
<Window x:Class="Magazyn.Windows.AmountWindow"
|
<Window x:Class="Magazyn.Windows.AmountWindow"
|
||||||
|
|
||||||
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="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="" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
|
Title="Change Quantity" Height="100" Width="280">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,87,0,0" TextWrapping="Wrap" Text="fruitName" Width="76" Height="16" VerticalAlignment="Top" TextAlignment="Center"/>
|
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" Text="fruitName" VerticalAlignment="Top" Width="64"/>
|
||||||
<TextBlock x:Name="messageBox" HorizontalAlignment="Left" Margin="84,10,0,0" TextWrapping="Wrap" Text="messageBox" VerticalAlignment="Top" Width="121" Height="64"/>
|
<TextBox x:Name="amountToChange" HorizontalAlignment="Left" Margin="74,0,0,10" TextWrapping="Wrap" Text="0" Width="64" Height="32" VerticalAlignment="Bottom" RenderTransformOrigin="1.456,0.316"/>
|
||||||
<TextBox x:Name="amountToChange" Margin="0,71,9,0" TextWrapping="Wrap" Text="" RenderTransformOrigin="1.456,0.316" Height="32" VerticalAlignment="Top" HorizontalAlignment="Right" Width="64"/>
|
<Button x:Name="saveButton" Content="Save" Margin="175,0,10,10" VerticalAlignment="Bottom" Click="saveButton_Click" />
|
||||||
<Button x:Name="saveButton" Content="Zastosuj" Margin="0,0,9,10" VerticalAlignment="Bottom" Click="saveButton_Click" Width="90" HorizontalAlignment="Right"/>
|
|
||||||
<Button x:Name="cancelButton" Content="Anuluj" Margin="10,0,0,10" VerticalAlignment="Bottom" Click="cancelButton_Click" Width="90" HorizontalAlignment="Left" />
|
|
||||||
<Image x:Name="fruitImage" HorizontalAlignment="Left" Height="64" Margin="15,10,0,0" VerticalAlignment="Top" Width="64"/>
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
@ -18,104 +18,36 @@ 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;
|
|
||||||
|
|
||||||
public delegate void ChangingAmountOfFruits(int amountChanged);
|
public delegate void ChangingAmountOfFruits(int amountChanged);
|
||||||
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
||||||
|
|
||||||
bool focusLock = false;
|
public AmountWindow(Fruit fruit, int type)
|
||||||
|
|
||||||
public AmountWindow(Fruit fruit, int type, int quantity)
|
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.fruit = fruit;
|
this.fruit = fruit;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
||||||
this.quantity = quantity;
|
|
||||||
|
|
||||||
if (type == -1)
|
|
||||||
this.Title = "Zmniejsz ilość: " + fruit.Name;
|
|
||||||
else
|
|
||||||
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ąć");
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fruitImage.Source = fruit.ImageSource;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.Loaded += AmountWindowLoaded;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private void AmountWindowLoaded(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
amountToChange.Focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SendNewQuantity()
|
|
||||||
{
|
|
||||||
int amount;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
amount = int.Parse(amountToChange.Text);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
ErrorWindow window = new ErrorWindow("Podana wartość jest nieprawidłowa, proszę podać liczbę dodatnią.");
|
|
||||||
window.Owner = Application.Current.MainWindow;
|
|
||||||
window.ShowDialog();
|
|
||||||
amountToChange.Text = "0";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if (amount < 0)
|
|
||||||
{
|
|
||||||
ErrorWindow window = new ErrorWindow("Podana wartość jest nieprawidłowa, proszę podać wartość dodatnią.");
|
|
||||||
window.Owner = Application.Current.MainWindow;
|
|
||||||
window.ShowDialog();
|
|
||||||
amountToChange.Text = "0";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException(ex.Message);
|
|
||||||
}
|
|
||||||
|
|
||||||
SaveChangingAmountOfFruits.Invoke((type > 0) ? amount : -amount);
|
|
||||||
this.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveButton_Click(object sender, RoutedEventArgs e)
|
private void saveButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
SendNewQuantity();
|
int amount = 0;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
amount = int.Parse(amountToChange.Text);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
throw new NotImplementedException(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelButton_Click(object sender, RoutedEventArgs e)
|
SaveChangingAmountOfFruits.Invoke((type>0)?amount:-amount);
|
||||||
{
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Return) SendNewQuantity();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
<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" Keyboard.KeyDown="Window_KeyDown">
|
|
||||||
<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>
|
|
@ -1,38 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Return) this.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
<Window x:Class="Magazyn.Windows.InfoWindow"
|
|
||||||
|
|
||||||
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="Informacje o: " WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
|
|
||||||
<Grid>
|
|
||||||
<TextBlock x:Name="fruitName" Margin="79,10,9,0" TextWrapping="Wrap" Text="fruitName" Height="16" VerticalAlignment="Top"/>
|
|
||||||
<TextBlock x:Name="fruitPrice" Margin="79,31,10,0" TextWrapping="Wrap" Text="fruitPrice" Height="16" VerticalAlignment="Top"/>
|
|
||||||
<TextBlock x:Name="fruitQuantity" Margin="79,52,10,0" TextWrapping="Wrap" Text="fruitQuantity" Height="16" VerticalAlignment="Top"/>
|
|
||||||
<TextBlock x:Name="fruitQuantityMax" Margin="79,73,10,0" TextWrapping="Wrap" Text="fruitQuantityMax" Height="16" VerticalAlignment="Top"/>
|
|
||||||
<TextBlock x:Name="fruitValue" Margin="79,94,10,0" TextWrapping="Wrap" Text="fruitValue" Height="16" VerticalAlignment="Top"/>
|
|
||||||
<Button x:Name="okButton" Content="Ok" Margin="0,0,9,10" VerticalAlignment="Bottom" Click="okButton_Click" Width="75" HorizontalAlignment="Right"/>
|
|
||||||
<Image x:Name="fruitImage" HorizontalAlignment="Left" Height="64" Margin="10,10,0,0" VerticalAlignment="Top" Width="64"/>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
@ -1,58 +0,0 @@
|
|||||||
using Magazyn.DataModels;
|
|
||||||
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 InfoWindow.xaml
|
|
||||||
/// </summary>
|
|
||||||
public partial class InfoWindow : Window
|
|
||||||
{
|
|
||||||
Fruit fruit;
|
|
||||||
public InfoWindow(Fruit fruit)
|
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
this.fruit = fruit;
|
|
||||||
|
|
||||||
fruitName.Text = "Owoc: " + fruit.Name;
|
|
||||||
this.Title = this.Title + fruit.Name;
|
|
||||||
|
|
||||||
fruitPrice.Text = "Cena: " + fruit.Price.ToString() + "zł";
|
|
||||||
fruitQuantity.Text = "Ilość: " + fruit.Quantity.ToString();
|
|
||||||
fruitQuantityMax.Text = "Ilość maks: " + fruit.QuantityMax.ToString();
|
|
||||||
|
|
||||||
fruitValue.Text = "Wartość: " + (fruit.Price * fruit.Quantity).ToString() + "zł";
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
fruitImage.Source = fruit.ImageSource;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
MessageBox.Show(ex.Message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void okButton_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
this.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Return) this.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
<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" Keyboard.KeyDown="Window_KeyDown">
|
|
||||||
<Grid>
|
|
||||||
<Button x:Name="okButton" Content="Ok" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Click="okButton_Click"/>
|
|
||||||
<TextBlock Margin="10,28,10,0" TextWrapping="Wrap" Text="Wartość magazynu to:" VerticalAlignment="Top" TextAlignment="Center" RenderTransformOrigin="0.495,1.734" />
|
|
||||||
<TextBlock x:Name="valueBlock" Margin="67,49,69,0" TextWrapping="Wrap" Text="NaN zł" VerticalAlignment="Top" TextAlignment="Center" RenderTransformOrigin="2.405,0.629"/>
|
|
||||||
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
@ -1,38 +0,0 @@
|
|||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Window_KeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Return) this.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
118
README.md
Normal file
118
README.md
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
# DINO_SCRUM
|
||||||
|
|
||||||
|
DINO_SCRUM
|
||||||
|
|
||||||
|
## API Endpoints
|
||||||
|
|
||||||
|
*POST* **/api/product/change-quantity**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": Int,
|
||||||
|
"change": Int
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": Int,
|
||||||
|
"name": String,
|
||||||
|
"price": Float,
|
||||||
|
"quantity": Int,
|
||||||
|
"imageLink": String
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This endpoint return editet product.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*GET* **/api/get-all**
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"id": Int,
|
||||||
|
"name": String,
|
||||||
|
"price": Float,
|
||||||
|
"quantity": Int,
|
||||||
|
"imageLink": String
|
||||||
|
},
|
||||||
|
{...}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*GET* **/api/get-price-of-all**
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"price-of-all": Float
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*POST* **/api/product/add**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"name": String,
|
||||||
|
"price": Float,
|
||||||
|
"quantity": Int,
|
||||||
|
"imageLing": String
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": Int,
|
||||||
|
"name": String,
|
||||||
|
"price": Float,
|
||||||
|
"quantity": Int,
|
||||||
|
"imageLink": String
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This endpoint return a newly created product.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*DELETE* **/api/delete-product**
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": Int
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This endpoint doesn't return any data.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
*GET* **/api/product/get-by-id**
|
||||||
|
|
||||||
|
Return:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"id": Int,
|
||||||
|
"name": String,
|
||||||
|
"price": Float,
|
||||||
|
"quantity": Int,
|
||||||
|
"imageLink": String
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
----
|
Loading…
Reference in New Issue
Block a user