OrdersUserControl.xaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <UserControl x:Class="OOO_WriteAndClear.MVP.Views.OrdersUserControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:OOO_WriteAndClear.MVP.Views"
  7. xmlns:db_models="clr-namespace:OOO_WriteAndClear.DBModels"
  8. mc:Ignorable="d" d:Background="White"
  9. d:DesignHeight="450" d:DesignWidth="800"
  10. FontFamily="Comic Sans MS"
  11. Loaded="OrdersUserControlLoaded">
  12. <UserControl.Resources>
  13. <Style x:Key="BackButtonStyle" TargetType="{x:Type Button}">
  14. <Setter Property="Width" Value="35"/>
  15. <Setter Property="Height" Value="35"/>
  16. <Setter Property="Margin" Value="0 0 0 10"/>
  17. <Setter Property="VerticalAlignment" Value="Top"/>
  18. <Setter Property="Template">
  19. <Setter.Value>
  20. <ControlTemplate TargetType="{x:Type Button}">
  21. <Image Height="{TemplateBinding Height}"
  22. Width="{TemplateBinding Width}"
  23. Source="/Assets/Pictures/BackButton.png"/>
  24. </ControlTemplate>
  25. </Setter.Value>
  26. </Setter>
  27. </Style>
  28. <Style x:Key="OrdersListViewStyle" TargetType="{x:Type ListView}">
  29. <Setter Property="BorderThickness" Value="0"/>
  30. <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
  31. <Setter Property="ItemTemplate">
  32. <Setter.Value>
  33. <DataTemplate DataType="db_models:Order">
  34. <Border Padding="10"
  35. Background="{Binding OrderBackGround}"
  36. BorderThickness="1" BorderBrush="Black"
  37. CornerRadius="10">
  38. <Grid HorizontalAlignment="Stretch">
  39. <Grid.ColumnDefinitions>
  40. <ColumnDefinition Width="1*"/>
  41. <ColumnDefinition Width="1*"/>
  42. </Grid.ColumnDefinitions>
  43. <Grid.RowDefinitions>
  44. <RowDefinition Height="auto"/>
  45. <RowDefinition/>
  46. <RowDefinition Height="auto"/>
  47. </Grid.RowDefinitions>
  48. <TextBlock Grid.ColumnSpan="2"
  49. HorizontalAlignment="Center" VerticalAlignment="Top"
  50. Text="{Binding OrderId, StringFormat=Номер заказа №{0}}" />
  51. <StackPanel Grid.Row="1" Grid.Column="0"
  52. Margin="0 5 0 0"
  53. Orientation="Vertical">
  54. <TextBlock Text="{Binding OrderCustomer, StringFormat=Заказчик: {0}, TargetNullValue=NA}"/>
  55. <TextBlock Text="{Binding OrderStatus.OrderStatusName, StringFormat=Статус: {0}}"/>
  56. <TextBlock Text="{Binding OrderCreateDate, StringFormat=Дата создания: {0}}"/>
  57. <TextBlock Text="{Binding OrderDeliveryDate, StringFormat=Дата готовности: {0}}"/>
  58. <TextBlock Text="{Binding OrderPickupPoint.PickupPointAdress, StringFormat=Адресс пункта выдачи: {0}}"
  59. TextWrapping="Wrap"/>
  60. <TextBlock Text="{Binding OrderCostWithoutDiscount, StringFormat=Цена без скидки {0:f2} руб.}"/>
  61. <TextBlock Text="{Binding OrderReceiveCode, StringFormat=Код получения заказа: {0}}"/>
  62. </StackPanel>
  63. <Border Grid.Column="1" Grid.Row="1"
  64. Margin="0 5 0 0">
  65. <DataGrid
  66. ItemsSource="{Binding OrderProducts}"
  67. IsReadOnly="True"
  68. AutoGenerateColumns="False"
  69. Background="White"
  70. CanUserResizeColumns="False">
  71. <DataGrid.Columns>
  72. <DataGridTextColumn Header="Количество"
  73. CanUserSort="False"
  74. Binding="{Binding ProductAmount}"/>
  75. <DataGridTextColumn Header="Артикул"
  76. CanUserSort="False"
  77. Binding="{Binding ProductArticleNumber}"/>
  78. <DataGridTextColumn Header="Продукт"
  79. CanUserSort="False"
  80. Binding="{Binding ProductArticleNumberNavigation.ProductName}"/>
  81. <DataGridTextColumn Header="Цена без скидки"
  82. CanUserSort="False"
  83. Binding="{Binding PriceWithoutDiscount, StringFormat={}{0:f2} руб.}"/>
  84. <DataGridTextColumn Header="Цена со скидкой"
  85. CanUserSort="False"
  86. Binding="{Binding Price, StringFormat={}{0:f2} руб.}"/>
  87. </DataGrid.Columns>
  88. </DataGrid>
  89. </Border>
  90. <TextBlock Grid.Row="2" Grid.ColumnSpan="2"
  91. HorizontalAlignment="Center"
  92. Margin="0 5 0 0"
  93. Text="{Binding OrderCost, StringFormat=Итог: {0:f2} руб.}"/>
  94. <TextBlock Grid.Row="2" Grid.ColumnSpan="2"
  95. HorizontalAlignment="Right"
  96. Margin="0 5 0 0"
  97. Text="{Binding OrderDiscountPercent, StringFormat=Суммарная скидка: {0:p2}}"/>
  98. </Grid>
  99. </Border>
  100. </DataTemplate>
  101. </Setter.Value>
  102. </Setter>
  103. </Style>
  104. </UserControl.Resources>
  105. <Border Padding="10">
  106. <Grid>
  107. <Grid.RowDefinitions>
  108. <RowDefinition Height="auto"/>
  109. <RowDefinition Height="auto"/>
  110. <RowDefinition/>
  111. </Grid.RowDefinitions>
  112. <Label Grid.Row="0"
  113. HorizontalAlignment="Center" VerticalAlignment="Center"
  114. Content="Заказы"
  115. FontSize="18" FontWeight="Bold"/>
  116. <Grid HorizontalAlignment="Right" VerticalAlignment="Top"
  117. Margin="0 0 10 0">
  118. <Grid.ColumnDefinitions>
  119. <ColumnDefinition Width="auto"/>
  120. <ColumnDefinition/>
  121. </Grid.ColumnDefinitions>
  122. <Grid.RowDefinitions>
  123. <RowDefinition Height="auto"/>
  124. <RowDefinition Height="auto"/>
  125. </Grid.RowDefinitions>
  126. <Image Grid.Column="0" Grid.RowSpan="2"
  127. Height="40" Width="40"
  128. VerticalAlignment="Top"
  129. Margin="0 0 10 0"
  130. Source="/Assets/Pictures/LoginFieldIcon.png"/>
  131. <TextBlock x:Name="DisplayingUserName"
  132. Grid.Column="1" Grid.Row="0"
  133. Text="Гость"
  134. Margin="0 0 0 5"/>
  135. <TextBlock x:Name="DisplayingUserRole"
  136. Grid.Column="1" Grid.Row="1"
  137. Foreground="Gray"/>
  138. </Grid>
  139. <Button Style="{DynamicResource BackButtonStyle}"
  140. HorizontalAlignment="Left" VerticalAlignment="Top"
  141. Click="Back_ButtonClick"/>
  142. <Grid Grid.Row="1" HorizontalAlignment="Stretch">
  143. <StackPanel Grid.Row="1"
  144. Margin="0 0 0 10"
  145. Orientation="Horizontal">
  146. <GroupBox Margin="0 0 10 0"
  147. Header="Фильтрация по суммарной скидке">
  148. <ComboBox x:Name="FilterComboBox"
  149. SelectionChanged="FilterChanged_SelectionChangedComboBox"/>
  150. </GroupBox>
  151. <GroupBox Header="Сортировка по цене">
  152. <ComboBox x:Name="SortComboBox"
  153. SelectionChanged="SortChanged_SelectionChangedComboBox"/>
  154. </GroupBox>
  155. </StackPanel>
  156. </Grid>
  157. <ListView x:Name="OrderListView"
  158. Grid.Row="2"
  159. HorizontalContentAlignment="Stretch"
  160. Style="{StaticResource OrdersListViewStyle}"
  161. d:ItemsSource="{d:SampleData ItemCount=5}"/>
  162. </Grid>
  163. </Border>
  164. </UserControl>