Forráskód Böngészése

Страницы создание и редактирвоание данных

y.buzueva2002 2 éve
szülő
commit
bb2f2c53ec

+ 1 - 1
BuzuevaDemo/App.xaml

@@ -10,8 +10,8 @@
         </Style>
         <Style TargetType="Button">
             <Setter Property="FontFamily" Value="Monotype Corsiva"/>
+            <Setter Property="Background" Value="#46B29D"/>
         </Style>
-
         <Style TargetType="ComboBox">
             <Setter Property="FontFamily" Value="Monotype Corsiva"/>
         </Style>

+ 21 - 0
BuzuevaDemo/BuzuevaDemo.csproj

@@ -64,6 +64,10 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Page Include="CreateChange.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -82,6 +86,9 @@
     <Compile Include="Classes\ChangePage.cs" />
     <Compile Include="Classes\DataBase.cs" />
     <Compile Include="Classes\ViewModel.cs" />
+    <Compile Include="CreateChange.xaml.cs">
+      <DependentUpon>CreateChange.xaml</DependentUpon>
+    </Compile>
     <Compile Include="MainWindow.xaml.cs">
       <DependentUpon>MainWindow.xaml</DependentUpon>
       <SubType>Code</SubType>
@@ -90,6 +97,14 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\ChangeData.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Pages\CreateData.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Model1.Context.cs">
@@ -110,6 +125,12 @@
     <Compile Include="Pages\Agents.xaml.cs">
       <DependentUpon>Agents.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Pages\ChangeData.xaml.cs">
+      <DependentUpon>ChangeData.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\CreateData.xaml.cs">
+      <DependentUpon>CreateData.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Product.cs">
       <DependentUpon>Model1.tt</DependentUpon>
     </Compile>

+ 22 - 0
BuzuevaDemo/CreateChange.xaml

@@ -0,0 +1,22 @@
+<Window x:Class="BuzuevaDemo.CreateChange"
+        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:BuzuevaDemo"
+        mc:Ignorable="d"
+        Title="Добавление/редактирование данных" Height="730" Width="410" Icon="/Img/Приятный шелест.ico">
+    <Grid>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="100"/>
+            <ColumnDefinition Width="*"/>
+        </Grid.ColumnDefinitions>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="100"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+        <Image Source="/Img/Приятный шелест.png" Grid.Row="0" Grid.Column="0"/>
+        <TextBlock Text="Приятный шелест" Grid.Row="0" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40" FontFamily="Monotype Corsiva"/>
+        <Frame Grid.Row="1" Grid.ColumnSpan ="2" Name="PageChange" NavigationUIVisibility="Hidden"/>
+    </Grid>
+</Window>

+ 39 - 0
BuzuevaDemo/CreateChange.xaml.cs

@@ -0,0 +1,39 @@
+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;
+using BuzuevaDemo.Classes;
+using BuzuevaDemo.Pages;
+
+namespace BuzuevaDemo
+{
+    /// <summary>
+    /// Логика взаимодействия для CreateChange.xaml
+    /// </summary>
+    public partial class CreateChange : Window
+    {
+        public CreateChange(Agent idagent, int a)
+        {
+            InitializeComponent();
+            if (a == 0)
+            {
+                PageChange.Navigate(new ChangeData());
+                ChangePage.swithpages = PageChange;
+            }
+            if (a == 1)
+            {
+                PageChange.Navigate(new ChangeData());
+                ChangePage.swithpages = PageChange;
+            }
+        }
+    }
+}

+ 1 - 1
BuzuevaDemo/MainWindow.xaml

@@ -5,7 +5,7 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:BuzuevaDemo"
         mc:Ignorable="d"
-        Title="Приятный шелест" Height="450" Width="800" Icon="/Img/Приятный шелест.ico">
+        Title="Приятный шелест" Height="450" Width="850" Icon="/Img/Приятный шелест.ico" MinHeight="450" MinWidth="850">
     <Grid>
         <Grid.ColumnDefinitions>
             <ColumnDefinition Width="100"/>

+ 3 - 3
BuzuevaDemo/Pages/Agents.xaml

@@ -5,12 +5,12 @@
       xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
       xmlns:local="clr-namespace:BuzuevaDemo.Pages"
       mc:Ignorable="d" 
-      d:DesignHeight="450" d:DesignWidth="800" 
-      Title="Агенты">
+      d:DesignHeight="450" 
+      Title="Агенты" Width="918">
     <Page.Resources>
         <DataTemplate x:Key="AllAgent">
             <Border BorderThickness="1" BorderBrush="Black" Width="600">
-                <StackPanel Orientation="Horizontal">
+                <StackPanel Orientation="Horizontal" MouseLeftButtonDown="PerexodCreate">
                     <Image Source="{Binding Logo}" Width="80" Height="80"/>
                     <StackPanel Orientation="Vertical">
                         <StackPanel Orientation="Horizontal">

+ 10 - 0
BuzuevaDemo/Pages/Agents.xaml.cs

@@ -41,6 +41,16 @@ namespace BuzuevaDemo.Pages
 
             }
             AllAgent.ItemsSource = filter.ToList();
+
+            
+        }
+
+        private void PerexodCreate(object sender, MouseButtonEventArgs e)
+        {
+            StackPanel zapis = (StackPanel)sender;
+            int id = Convert.ToInt32(zapis.Uid);
+            Agent agent = DataBase.BaseModel.Agent.FirstOrDefault(x => x.ID == id);
+            new CreateChange(agent, 0).ShowDialog();
         }
     }
 }

+ 37 - 0
BuzuevaDemo/Pages/ChangeData.xaml

@@ -0,0 +1,37 @@
+<Page x:Class="BuzuevaDemo.Pages.ChangeData"
+      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:local="clr-namespace:BuzuevaDemo.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="245"
+      Title="ChangeData">
+
+    <Grid>
+        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
+            <GroupBox Header="Наименование">
+                <TextBox/>
+            </GroupBox>
+            <GroupBox Header="Тип агента">
+                <ComboBox/>
+            </GroupBox>
+            <GroupBox Header="Приоритет">
+                <TextBox/>
+            </GroupBox>
+            <GroupBox Header="Адрес">
+                <TextBox/>
+            </GroupBox>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <GroupBox  Header="ИНН">
+                    <TextBox/>
+                </GroupBox>
+                <GroupBox  Header="КПП">
+                    <TextBox/>
+                </GroupBox>
+            </StackPanel>
+            <Image Width="100" Height="100"/>
+            <Button Content="Внести изменения"/>
+        </StackPanel>
+    </Grid>
+</Page>

+ 28 - 0
BuzuevaDemo/Pages/ChangeData.xaml.cs

@@ -0,0 +1,28 @@
+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;
+
+namespace BuzuevaDemo.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для ChangeData.xaml
+    /// </summary>
+    public partial class ChangeData : Page
+    {
+        public ChangeData()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 36 - 0
BuzuevaDemo/Pages/CreateData.xaml

@@ -0,0 +1,36 @@
+<Page x:Class="BuzuevaDemo.Pages.CreateZapis"
+      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:local="clr-namespace:BuzuevaDemo.Pages"
+      mc:Ignorable="d"
+      Title="CreateZapis" Height="450" Width="245">
+
+    <Grid>
+        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
+            <GroupBox Header="Наименование">
+                <TextBox/>
+            </GroupBox>
+            <GroupBox Header="Тип агента">
+                <ComboBox/>
+            </GroupBox>
+            <GroupBox Header="Приоритет">
+                <TextBox/>
+            </GroupBox>
+            <GroupBox Header="Адрес">
+                <TextBox/>
+            </GroupBox>
+            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
+                <GroupBox  Header="ИНН">
+                    <TextBox/>
+                </GroupBox>
+                <GroupBox  Header="КПП">
+                    <TextBox/>
+                </GroupBox>
+            </StackPanel>
+            <Image Width="100" Height="100"/>
+            <Button Content="Создать"/>
+        </StackPanel>
+    </Grid>
+</Page>

+ 28 - 0
BuzuevaDemo/Pages/CreateData.xaml.cs

@@ -0,0 +1,28 @@
+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;
+
+namespace BuzuevaDemo.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для CreateZapis.xaml
+    /// </summary>
+    public partial class CreateZapis : Page
+    {
+        public CreateZapis()
+        {
+            InitializeComponent();
+        }
+    }
+}