lizka.flex@outlook.com 2 năm trước cách đây
mục cha
commit
690b3b9dff
4 tập tin đã thay đổi với 19 bổ sung10 xóa
  1. 1 1
      Muzzle/Pages/Main.xaml
  2. 1 2
      Muzzle/Pages/Main.xaml.cs
  3. 6 6
      Muzzle/Update.xaml
  4. 11 1
      Muzzle/Update.xaml.cs

+ 1 - 1
Muzzle/Pages/Main.xaml

@@ -33,7 +33,7 @@
                             <TextBlock Text="{Binding Material.Title}" Loaded="TextBlock_Loaded" Tag="{Binding ID}"/>
                         </StackPanel>
                         <StackPanel Orientation="Horizontal">
-                            <Button x:Name="btnRed" Content="Редактировать" Width="100" Height="20" Margin="0,5,0,0" Click="btnIzmena_CLick" Background="White" BorderBrush="#FFFDBD40"></Button>
+                            <Button x:Name="btnRed" Content="Редактировать" Width="100" Height="20" Margin="0,5,0,0" Click="btnIzmena_CLick" Background="White" BorderBrush="#FFFDBD40" Tag="{Binding ID}"></Button>
                         </StackPanel>
                     </StackPanel>
                     <TextBlock Text="{Binding Material.Cost}" Loaded="TextBlock_Loaded_1" Tag="{Binding ID}" VerticalAlignment="Center"/>

+ 1 - 2
Muzzle/Pages/Main.xaml.cs

@@ -11,7 +11,6 @@ namespace Muzzle
     /// </summary>
     public partial class Main : Page
     {
-        int idProduct = 0;
         public static class Products
         {
             public static Frame frm;
@@ -136,7 +135,7 @@ namespace Muzzle
 
         private void btnIzmena_CLick(object sender, RoutedEventArgs e)
         {
-            Update update = new Update(idProduct);
+            Update update = new Update((int)textBlock.Tag);
             update.ShowDialog();
         }
     }       

+ 6 - 6
Muzzle/Update.xaml

@@ -14,11 +14,11 @@
             </StackPanel>
             <StackPanel Orientation = "Horizontal" >
                 <Label Content="Наименование"/>
-                <TextBox  x:Name="Title" Width = "100" Height="15"/>
+                <TextBox  x:Name="Title" Width = "150" Height="15"/>
             </StackPanel>
             <StackPanel Orientation = "Horizontal" >
                 <Label Content="Тип продукта"/>
-                <ComboBox Width = "150" Height="15" >
+                <ComboBox x:Name="TipeProduct" Width = "150" Height="25" >
                     <ComboBox.Background>
                         <LinearGradientBrush EndPoint="0,1" StartPoint="0,0">
                             <GradientStop Color="#FFF0F0F0" Offset="0"/>
@@ -33,19 +33,19 @@
             </StackPanel>
             <StackPanel Orientation = "Horizontal" >
                 <Label Content="Количество человек для производства"/>
-                <TextBox Width = "100" Height="15"/>
+                <TextBox x:Name="Kol" Width = "100" Height="15"/>
             </StackPanel>
             <StackPanel Orientation = "Horizontal" >
                 <Label Content="Номер производственого цеха"/>
-                <TextBox Width = "100" Height="15"/>
+                <TextBox x:Name="Number" Width = "100" Height="15"/>
             </StackPanel>
             <StackPanel Orientation = "Horizontal" >
                 <Label Content="Минимальная стоимость для агента"/>
-                <TextBox Width = "100" Height="15"/>
+                <TextBox x:Name="CostMin" Width = "100" Height="15"/>
             </StackPanel>
             <StackPanel Orientation = "Horizontal" >
                 <Label Content="Описание"/>
-                <TextBox Width = "300" Height="100"/>
+                <TextBox x:Name="Opis" Width = "300" Height="100"/>
             </StackPanel>
             <StackPanel Orientation="Vertical">
                 <Button x:Name="btnDob" Content="Готово" Width="100" Height="20" HorizontalAlignment="Left" Margin="10,10,0,10" Background="White" BorderBrush="#FFFDBD40"/>

+ 11 - 1
Muzzle/Update.xaml.cs

@@ -19,9 +19,19 @@ namespace Muzzle
         {
             InitializeComponent();
             Product products = BaseConnect.baseConnect.Product.FirstOrDefault(x => x.ID == idProduct); //Изменили Where на FirstOrDefault для того, чтобы выбирать не все записи из таблицы, а конкретный продукт
+            List<ProductType> productsType = BaseConnect.baseConnect.ProductType.ToList();
             Art.Text = products.ArticleNumber; //Считывание пОля из таблицы (вывод данных в поле в макете) 
             Title.Text = products.Title;
-         
+            TipeProduct.ItemsSource = BaseConnect.baseConnect.ProductType.ToList();//создали лист с типами продуктов
+
+            TipeProduct.DisplayMemberPath = "Title";// 
+            TipeProduct.SelectedValuePath = "ID";
+            TipeProduct.SelectedValue = products.ProductTypeID;//вывод на ComboBox название типа продукта который выбран
+
+            Kol.Text = products.ProductionPersonCount.ToString();
+            Number.Text = products.ProductionWorkshopNumber.ToString();
+            CostMin.Text = products.MinCostForAgent.ToString();
+            Opis.Text = products.Description;
         }
         private void btnNaz_Click(object sender, RoutedEventArgs e)
         {