2 Commits 6186d28a0b ... bb2f2c53ec

Author SHA1 Message Date
  y.buzueva2002 bb2f2c53ec Страницы создание и редактирвоание данных 2 years ago
  y.buzueva2002 4d93353888 Поиск 2 years ago

+ 2 - 2
BuzuevaDemo/App.xaml

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

+ 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>

+ 3 - 1
BuzuevaDemo/Classes/ViewModel.cs

@@ -23,14 +23,16 @@ namespace BuzuevaDemo.Classes
             List<Product> bdproduct = DataBase.BaseModel.Product.ToList();
             foreach (Agent bda in bdagent)
             {
+                //извлечение данных тип агента
                 AgentType AT = DataBase.BaseModel.AgentType.FirstOrDefault(x => x.ID == bda.AgentTypeID);
-                bda.TitleType = AT.Title;
+                bda.TitleType = AT.Title; 
                 int skid = 0;
                 buffag = new Agent();
                 buffag.Title = bda.Title;
                 buffag.Phone = bda.Phone;
                 buffag.Priority = bda.Priority;
                 buffag.Logo = bda.Logo;
+                // картинка-загушка
                 if (bda.Logo == "")
                 {
                     bda.Logo = "/agents/picture.png";

+ 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"/>

+ 23 - 8
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">
@@ -35,16 +35,31 @@
     </Page.Resources>
     <Grid>
         <Grid.RowDefinitions>
-            <RowDefinition Height="64*"/>
+            <RowDefinition Height="64"/>
             <RowDefinition Height="363*"/>
             <RowDefinition Height="23*"/>
         </Grid.RowDefinitions>
-        <StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" Background="#C6D7FF">
+        <StackPanel Orientation="Horizontal" Grid.Row="0" HorizontalAlignment="Stretch" VerticalAlignment="Center" Background="#C6D7FF" >
             <GroupBox Header="Введите для поиска" Width="300">
-                <TextBox Height="40"/>
+                <TextBox x:Name="poisk" Height="40" TextChanged="Changeg" />
             </GroupBox>
-            <ComboBox  Width="200" Margin="10, 5" Height="40"/>
-            <ComboBox  Width="200" Margin="10, 5" Height="40"/>
+            <ComboBox x:Name="sort" Width="200" Margin="10, 5" Height="40">
+                <TextBlock>Наименование (возр.)</TextBlock>
+                <TextBlock>Наименование (убыв.)</TextBlock>
+                <TextBlock>Размер скидки (возр.)</TextBlock>
+                <TextBlock>Размер скидки (убыв.)</TextBlock>
+                <TextBlock>Приоритет агента (возр.)</TextBlock>
+                <TextBlock>Приоритет агента (убыв.)</TextBlock>
+            </ComboBox>
+            <ComboBox x:Name="filt" Width="200" Margin="10, 5" Height="40" >
+                <TextBlock>Все типы</TextBlock>
+                <TextBlock>МФО</TextBlock>
+                <TextBlock>ПАО</TextBlock>
+                <TextBlock>ООО</TextBlock>
+                <TextBlock>ЗАО</TextBlock>
+                <TextBlock>ОАО</TextBlock>
+                <TextBlock>MKK</TextBlock>
+            </ComboBox>
         </StackPanel>
         <ListBox  Grid.Row="1" x:Name="AllAgent" ItemTemplate="{StaticResource AllAgent}" />
     </Grid>

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

@@ -22,12 +22,35 @@ namespace BuzuevaDemo.Pages
     public partial class Agents : Page
     {
         ViewModel view = new ViewModel();
+        List<Agent> filter;
 
         public Agents()
         {
             InitializeComponent();
             AllAgent.ItemsSource = view.agent.ToList();
             AllAgent.Items.Refresh();
+            filter = view.agent.ToList();
+        }
+
+        private void Changeg(object sender, TextChangedEventArgs e)
+        {
+            filter = view.agent;
+            if (poisk.Text != "")
+            {
+                filter = filter.Where(x => x.Title.Contains(poisk.Text) || x.Email.Contains(poisk.Text) || x.Phone.Contains(poisk.Text)).ToList();
+
+            }
+            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();
+        }
+    }
+}