mr.solder5 5 years ago
parent
commit
501bc6b467

+ 6 - 0
CopyCenter.sln

@@ -5,6 +5,8 @@ VisualStudioVersion = 16.0.29503.13
 MinimumVisualStudioVersion = 10.0.40219.1
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CopyCenter", "CopyCenter\CopyCenter.csproj", "{04616998-307A-4A63-8664-563D90797C95}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CopyCenterTests", "CopyCenterTests\CopyCenterTests.csproj", "{F7DF5BBE-DD93-41C4-9030-1C1E7563C789}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -15,6 +17,10 @@ Global
 		{04616998-307A-4A63-8664-563D90797C95}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{04616998-307A-4A63-8664-563D90797C95}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{04616998-307A-4A63-8664-563D90797C95}.Release|Any CPU.Build.0 = Release|Any CPU
+		{F7DF5BBE-DD93-41C4-9030-1C1E7563C789}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{F7DF5BBE-DD93-41C4-9030-1C1E7563C789}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{F7DF5BBE-DD93-41C4-9030-1C1E7563C789}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{F7DF5BBE-DD93-41C4-9030-1C1E7563C789}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 39 - 15
CopyCenter/AuthorizationWindow.xaml.cs

@@ -29,36 +29,60 @@ namespace CopyCenter
 
         private void AuthorizationClick(object sender, RoutedEventArgs e)
         {
+            Auth(login.Text, password.Password);
            
-            if (login.Text == "" || password.Password == "")
+            //if (login.Text == "" || password.Password == "")
+            //{
+            //    MessageBox.Show("Введено неправильное значение");
+            //    return;
+            //}
+            //if (db.Users.Select(item => item.Login + " " + item.Password).Contains(login.Text + " " + password.Password))
+            //{
+            //    MessageBox.Show("Добро пожаловать, вы авторизированы!");
+            //    MenuWindow mw = new MenuWindow();
+            //    mw.Show();
+            //    this.Close();
+            //}
+            //else
+            //{
+            //    MessageBox.Show("Введён неправильный логин/пароль");
+            //}
+        }
+
+        private void Registration_Click(object sender, RoutedEventArgs e)
+        {
+            RegistrationWindow rw = new RegistrationWindow();
+            Auth(login.Text, password.Password);
+            rw.Show();
+            this.Close();
+        }
+
+        private void Exit_Click(object sender, RoutedEventArgs e)
+        {
+            Application.Current.Shutdown();
+        }
+
+        private bool Auth(string login, string password)
+        {
+            if (login == "" || password == "")
             {
                 MessageBox.Show("Введено неправильное значение");
-                return;
+                return false;
             }
-            if (db.Users.Select(item => item.Login + " " + item.Password).Contains(login.Text + " " + password.Password))
+            if (db.Users.Select(item => item.Login + " " + item.Password).Contains(login + " " + password))
             {
                 MessageBox.Show("Добро пожаловать, вы авторизированы!");
                 MenuWindow mw = new MenuWindow();
                 mw.Show();
                 this.Close();
+                return true;
             }
             else
             {
                 MessageBox.Show("Введён неправильный логин/пароль");
+                return false;
             }
         }
 
-        private void Registration_Click(object sender, RoutedEventArgs e)
-        {
-            RegistrationWindow rw = new RegistrationWindow();
-            rw.Show();
-            this.Close();
-        }
-
-        private void Exit_Click(object sender, RoutedEventArgs e)
-        {
-            Application.Current.Shutdown();
-        }
-
     }
 }

+ 108 - 107
CopyCenter/DataBase.edmx

@@ -4,7 +4,7 @@
   <edmx:Runtime>
     <!-- SSDL content -->
     <edmx:StorageModels>
-    <Schema Namespace="gr672_liiModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
+      <Schema Namespace="gr672_liiModel.Store" Provider="System.Data.SqlClient" ProviderManifestToken="2012" Alias="Self" xmlns:store="http://schemas.microsoft.com/ado/2007/12/edm/EntityStoreSchemaGenerator" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm/ssdl">
         <EntityType Name="Card">
           <Key>
             <PropertyRef Name="idCard" />
@@ -211,75 +211,38 @@
             <End Role="Service" EntitySet="Service" />
           </AssociationSet>
         </EntityContainer>
-      </Schema></edmx:StorageModels>
+      </Schema>
+    </edmx:StorageModels>
     <!-- CSDL content -->
     <edmx:ConceptualModels>
       <Schema Namespace="gr672_liiModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
-        <EntityContainer Name="gr672_liiEntities" annotation:LazyLoadingEnabled="true">
-          <EntitySet Name="Cards" EntityType="gr672_liiModel.Card" />
-          <EntitySet Name="CategoryServices" EntityType="gr672_liiModel.CategoryService" />
-          <EntitySet Name="Clients" EntityType="gr672_liiModel.Client" />
-          <EntitySet Name="Discounts" EntityType="gr672_liiModel.Discount" />
-          <EntitySet Name="Orders" EntityType="gr672_liiModel.Order" />
-          <EntitySet Name="Payments" EntityType="gr672_liiModel.Payment" />
-          <EntitySet Name="Services" EntityType="gr672_liiModel.Service" />
-          <EntitySet Name="Users" EntityType="gr672_liiModel.User" />
-          <AssociationSet Name="FK_Card_Client" Association="gr672_liiModel.FK_Card_Client">
-            <End Role="Client" EntitySet="Clients" />
-            <End Role="Card" EntitySet="Cards" />
-          </AssociationSet>
-          <AssociationSet Name="FK_Service_CategoryService" Association="gr672_liiModel.FK_Service_CategoryService">
-            <End Role="CategoryService" EntitySet="CategoryServices" />
-            <End Role="Service" EntitySet="Services" />
-          </AssociationSet>
-          <AssociationSet Name="FK_Order_Client" Association="gr672_liiModel.FK_Order_Client">
-            <End Role="Client" EntitySet="Clients" />
-            <End Role="Order" EntitySet="Orders" />
-          </AssociationSet>
-          <AssociationSet Name="FK_Discount_Order" Association="gr672_liiModel.FK_Discount_Order">
-            <End Role="Order" EntitySet="Orders" />
-            <End Role="Discount" EntitySet="Discounts" />
-          </AssociationSet>
-          <AssociationSet Name="FK_Order_Payment" Association="gr672_liiModel.FK_Order_Payment">
-            <End Role="Payment" EntitySet="Payments" />
-            <End Role="Order" EntitySet="Orders" />
-          </AssociationSet>
-          <AssociationSet Name="FK_Order_Service" Association="gr672_liiModel.FK_Order_Service">
-            <End Role="Service" EntitySet="Services" />
-            <End Role="Order" EntitySet="Orders" />
-          </AssociationSet>
-          <AssociationSet Name="FK_Order_User" Association="gr672_liiModel.FK_Order_User">
-            <End Role="User" EntitySet="Users" />
-            <End Role="Order" EntitySet="Orders" />
-          </AssociationSet>
-        </EntityContainer>
         <EntityType Name="Card">
           <Key>
             <PropertyRef Name="idCard" />
           </Key>
           <Property Name="idCard" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="NumberCard" Type="Int32" Nullable="false" />
-          <Property Name="TypeCard" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="TypeCard" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <Property Name="idClient" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="Client" Relationship="gr672_liiModel.FK_Card_Client" FromRole="Card" ToRole="Client" />
+          <NavigationProperty Name="Client" Relationship="Self.FK_Card_Client" FromRole="Card" ToRole="Client" />
         </EntityType>
         <EntityType Name="CategoryService">
           <Key>
             <PropertyRef Name="idCategory" />
           </Key>
           <Property Name="idCategory" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="NameCategory" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <NavigationProperty Name="Services" Relationship="gr672_liiModel.FK_Service_CategoryService" FromRole="CategoryService" ToRole="Service" />
+          <Property Name="NameCategory" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Services" Relationship="Self.FK_Service_CategoryService" FromRole="CategoryService" ToRole="Service" />
         </EntityType>
         <EntityType Name="Client">
           <Key>
             <PropertyRef Name="idClient" />
           </Key>
           <Property Name="idClient" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="NameClient" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="TypeClient" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <NavigationProperty Name="Cards" Relationship="gr672_liiModel.FK_Card_Client" FromRole="Client" ToRole="Card" />
-          <NavigationProperty Name="Orders" Relationship="gr672_liiModel.FK_Order_Client" FromRole="Client" ToRole="Order" />
+          <Property Name="NameClient" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="TypeClient" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Cards" Relationship="Self.FK_Card_Client" FromRole="Client" ToRole="Card" />
+          <NavigationProperty Name="Orders" Relationship="Self.FK_Order_Client" FromRole="Client" ToRole="Order" />
         </EntityType>
         <EntityType Name="Discount">
           <Key>
@@ -288,7 +251,7 @@
           <Property Name="idDiscount" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="Procent" Type="Int32" Nullable="false" />
           <Property Name="idOrder" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="Order" Relationship="gr672_liiModel.FK_Discount_Order" FromRole="Discount" ToRole="Order" />
+          <NavigationProperty Name="Order" Relationship="Self.FK_Discount_Order" FromRole="Discount" ToRole="Order" />
         </EntityType>
         <EntityType Name="Order">
           <Key>
@@ -296,18 +259,18 @@
           </Key>
           <Property Name="idOrder" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="NumberOrder" Type="Int32" Nullable="false" />
-          <Property Name="ViewOrder" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="ViewOrder" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <Property Name="OrderDate" Type="DateTime" Nullable="false" Precision="0" />
           <Property Name="CostOrder" Type="Int32" Nullable="false" />
           <Property Name="idClient" Type="Int32" Nullable="false" />
           <Property Name="idService" Type="Int32" Nullable="false" />
           <Property Name="idUser" Type="Int32" Nullable="false" />
           <Property Name="idPayment" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="Client" Relationship="gr672_liiModel.FK_Order_Client" FromRole="Order" ToRole="Client" />
-          <NavigationProperty Name="Discounts" Relationship="gr672_liiModel.FK_Discount_Order" FromRole="Order" ToRole="Discount" />
-          <NavigationProperty Name="Payment" Relationship="gr672_liiModel.FK_Order_Payment" FromRole="Order" ToRole="Payment" />
-          <NavigationProperty Name="Service" Relationship="gr672_liiModel.FK_Order_Service" FromRole="Order" ToRole="Service" />
-          <NavigationProperty Name="User" Relationship="gr672_liiModel.FK_Order_User" FromRole="Order" ToRole="User" />
+          <NavigationProperty Name="Client" Relationship="Self.FK_Order_Client" FromRole="Order" ToRole="Client" />
+          <NavigationProperty Name="Discounts" Relationship="Self.FK_Discount_Order" FromRole="Order" ToRole="Discount" />
+          <NavigationProperty Name="Payment" Relationship="Self.FK_Order_Payment" FromRole="Order" ToRole="Payment" />
+          <NavigationProperty Name="Service" Relationship="Self.FK_Order_Service" FromRole="Order" ToRole="Service" />
+          <NavigationProperty Name="User" Relationship="Self.FK_Order_User" FromRole="Order" ToRole="User" />
         </EntityType>
         <EntityType Name="Payment">
           <Key>
@@ -316,36 +279,36 @@
           <Property Name="idPayment" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
           <Property Name="NumberPayment" Type="Int32" Nullable="false" />
           <Property Name="DatePayment" Type="DateTime" Nullable="false" Precision="0" />
-          <NavigationProperty Name="Orders" Relationship="gr672_liiModel.FK_Order_Payment" FromRole="Payment" ToRole="Order" />
+          <NavigationProperty Name="Orders" Relationship="Self.FK_Order_Payment" FromRole="Payment" ToRole="Order" />
         </EntityType>
         <EntityType Name="Service">
           <Key>
             <PropertyRef Name="idService" />
           </Key>
           <Property Name="idService" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="NameService" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="NameService" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <Property Name="PriceService" Type="Int32" Nullable="false" />
-          <Property Name="DescriptionService" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="DescriptionService" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <Property Name="idCategory" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="CategoryService" Relationship="gr672_liiModel.FK_Service_CategoryService" FromRole="Service" ToRole="CategoryService" />
-          <NavigationProperty Name="Orders" Relationship="gr672_liiModel.FK_Order_Service" FromRole="Service" ToRole="Order" />
+          <NavigationProperty Name="CategoryService" Relationship="Self.FK_Service_CategoryService" FromRole="Service" ToRole="CategoryService" />
+          <NavigationProperty Name="Orders" Relationship="Self.FK_Order_Service" FromRole="Service" ToRole="Order" />
         </EntityType>
         <EntityType Name="User">
           <Key>
             <PropertyRef Name="idUser" />
           </Key>
           <Property Name="idUser" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
-          <Property Name="Login" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="Password" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="LastName" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
-          <Property Name="FirstName" Type="String" Nullable="false" MaxLength="50" FixedLength="false" Unicode="true" />
+          <Property Name="Login" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Password" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="LastName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="FirstName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" Nullable="false" />
           <Property Name="MiddleName" Type="String" MaxLength="50" FixedLength="false" Unicode="true" />
           <Property Name="ContactNumber" Type="Int32" Nullable="false" />
-          <NavigationProperty Name="Orders" Relationship="gr672_liiModel.FK_Order_User" FromRole="User" ToRole="Order" />
+          <NavigationProperty Name="Orders" Relationship="Self.FK_Order_User" FromRole="User" ToRole="Order" />
         </EntityType>
         <Association Name="FK_Card_Client">
-          <End Type="gr672_liiModel.Client" Role="Client" Multiplicity="1" />
-          <End Type="gr672_liiModel.Card" Role="Card" Multiplicity="*" />
+          <End Role="Client" Type="Self.Client" Multiplicity="1" />
+          <End Role="Card" Type="Self.Card" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Client">
               <PropertyRef Name="idClient" />
@@ -356,10 +319,10 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_Service_CategoryService">
-          <End Type="gr672_liiModel.CategoryService" Role="CategoryService" Multiplicity="1">
+          <End Role="CategoryService" Type="Self.CategoryService" Multiplicity="1">
             <OnDelete Action="Cascade" />
           </End>
-          <End Type="gr672_liiModel.Service" Role="Service" Multiplicity="*" />
+          <End Role="Service" Type="Self.Service" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="CategoryService">
               <PropertyRef Name="idCategory" />
@@ -370,8 +333,8 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_Order_Client">
-          <End Type="gr672_liiModel.Client" Role="Client" Multiplicity="1" />
-          <End Type="gr672_liiModel.Order" Role="Order" Multiplicity="*" />
+          <End Role="Client" Type="Self.Client" Multiplicity="1" />
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Client">
               <PropertyRef Name="idClient" />
@@ -382,10 +345,10 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_Discount_Order">
-          <End Type="gr672_liiModel.Order" Role="Order" Multiplicity="1">
+          <End Role="Order" Type="Self.Order" Multiplicity="1">
             <OnDelete Action="Cascade" />
           </End>
-          <End Type="gr672_liiModel.Discount" Role="Discount" Multiplicity="*" />
+          <End Role="Discount" Type="Self.Discount" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Order">
               <PropertyRef Name="idOrder" />
@@ -396,10 +359,10 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_Order_Payment">
-          <End Type="gr672_liiModel.Payment" Role="Payment" Multiplicity="1">
+          <End Role="Payment" Type="Self.Payment" Multiplicity="1">
             <OnDelete Action="Cascade" />
           </End>
-          <End Type="gr672_liiModel.Order" Role="Order" Multiplicity="*" />
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Payment">
               <PropertyRef Name="idPayment" />
@@ -410,10 +373,10 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_Order_Service">
-          <End Type="gr672_liiModel.Service" Role="Service" Multiplicity="1">
+          <End Role="Service" Type="Self.Service" Multiplicity="1">
             <OnDelete Action="Cascade" />
           </End>
-          <End Type="gr672_liiModel.Order" Role="Order" Multiplicity="*" />
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="Service">
               <PropertyRef Name="idService" />
@@ -424,8 +387,8 @@
           </ReferentialConstraint>
         </Association>
         <Association Name="FK_Order_User">
-          <End Type="gr672_liiModel.User" Role="User" Multiplicity="1" />
-          <End Type="gr672_liiModel.Order" Role="Order" Multiplicity="*" />
+          <End Role="User" Type="Self.User" Multiplicity="1" />
+          <End Role="Order" Type="Self.Order" Multiplicity="*" />
           <ReferentialConstraint>
             <Principal Role="User">
               <PropertyRef Name="idUser" />
@@ -435,6 +398,44 @@
             </Dependent>
           </ReferentialConstraint>
         </Association>
+        <EntityContainer Name="gr672_liiEntities" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Cards" EntityType="Self.Card" />
+          <EntitySet Name="CategoryServices" EntityType="Self.CategoryService" />
+          <EntitySet Name="Clients" EntityType="Self.Client" />
+          <EntitySet Name="Discounts" EntityType="Self.Discount" />
+          <EntitySet Name="Orders" EntityType="Self.Order" />
+          <EntitySet Name="Payments" EntityType="Self.Payment" />
+          <EntitySet Name="Services" EntityType="Self.Service" />
+          <EntitySet Name="Users" EntityType="Self.User" />
+          <AssociationSet Name="FK_Card_Client" Association="Self.FK_Card_Client">
+            <End Role="Client" EntitySet="Clients" />
+            <End Role="Card" EntitySet="Cards" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Service_CategoryService" Association="Self.FK_Service_CategoryService">
+            <End Role="CategoryService" EntitySet="CategoryServices" />
+            <End Role="Service" EntitySet="Services" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Order_Client" Association="Self.FK_Order_Client">
+            <End Role="Client" EntitySet="Clients" />
+            <End Role="Order" EntitySet="Orders" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Discount_Order" Association="Self.FK_Discount_Order">
+            <End Role="Order" EntitySet="Orders" />
+            <End Role="Discount" EntitySet="Discounts" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Order_Payment" Association="Self.FK_Order_Payment">
+            <End Role="Payment" EntitySet="Payments" />
+            <End Role="Order" EntitySet="Orders" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Order_Service" Association="Self.FK_Order_Service">
+            <End Role="Service" EntitySet="Services" />
+            <End Role="Order" EntitySet="Orders" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Order_User" Association="Self.FK_Order_User">
+            <End Role="User" EntitySet="Users" />
+            <End Role="Order" EntitySet="Orders" />
+          </AssociationSet>
+        </EntityContainer>
       </Schema>
     </edmx:ConceptualModels>
     <!-- C-S mapping content -->
@@ -444,84 +445,84 @@
           <EntitySetMapping Name="Cards">
             <EntityTypeMapping TypeName="gr672_liiModel.Card">
               <MappingFragment StoreEntitySet="Card">
-                <ScalarProperty Name="idClient" ColumnName="idClient" />
-                <ScalarProperty Name="TypeCard" ColumnName="TypeCard" />
-                <ScalarProperty Name="NumberCard" ColumnName="NumberCard" />
                 <ScalarProperty Name="idCard" ColumnName="idCard" />
+                <ScalarProperty Name="NumberCard" ColumnName="NumberCard" />
+                <ScalarProperty Name="TypeCard" ColumnName="TypeCard" />
+                <ScalarProperty Name="idClient" ColumnName="idClient" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="CategoryServices">
             <EntityTypeMapping TypeName="gr672_liiModel.CategoryService">
               <MappingFragment StoreEntitySet="CategoryService">
-                <ScalarProperty Name="NameCategory" ColumnName="NameCategory" />
                 <ScalarProperty Name="idCategory" ColumnName="idCategory" />
+                <ScalarProperty Name="NameCategory" ColumnName="NameCategory" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Clients">
             <EntityTypeMapping TypeName="gr672_liiModel.Client">
               <MappingFragment StoreEntitySet="Client">
-                <ScalarProperty Name="TypeClient" ColumnName="TypeClient" />
-                <ScalarProperty Name="NameClient" ColumnName="NameClient" />
                 <ScalarProperty Name="idClient" ColumnName="idClient" />
+                <ScalarProperty Name="NameClient" ColumnName="NameClient" />
+                <ScalarProperty Name="TypeClient" ColumnName="TypeClient" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Discounts">
             <EntityTypeMapping TypeName="gr672_liiModel.Discount">
               <MappingFragment StoreEntitySet="Discount">
-                <ScalarProperty Name="idOrder" ColumnName="idOrder" />
-                <ScalarProperty Name="Procent" ColumnName="Procent" />
                 <ScalarProperty Name="idDiscount" ColumnName="idDiscount" />
+                <ScalarProperty Name="Procent" ColumnName="Procent" />
+                <ScalarProperty Name="idOrder" ColumnName="idOrder" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Orders">
             <EntityTypeMapping TypeName="gr672_liiModel.Order">
               <MappingFragment StoreEntitySet="Order">
-                <ScalarProperty Name="idPayment" ColumnName="idPayment" />
-                <ScalarProperty Name="idUser" ColumnName="idUser" />
-                <ScalarProperty Name="idService" ColumnName="idService" />
-                <ScalarProperty Name="idClient" ColumnName="idClient" />
-                <ScalarProperty Name="CostOrder" ColumnName="CostOrder" />
-                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
-                <ScalarProperty Name="ViewOrder" ColumnName="ViewOrder" />
-                <ScalarProperty Name="NumberOrder" ColumnName="NumberOrder" />
                 <ScalarProperty Name="idOrder" ColumnName="idOrder" />
+                <ScalarProperty Name="NumberOrder" ColumnName="NumberOrder" />
+                <ScalarProperty Name="ViewOrder" ColumnName="ViewOrder" />
+                <ScalarProperty Name="OrderDate" ColumnName="OrderDate" />
+                <ScalarProperty Name="CostOrder" ColumnName="CostOrder" />
+                <ScalarProperty Name="idClient" ColumnName="idClient" />
+                <ScalarProperty Name="idService" ColumnName="idService" />
+                <ScalarProperty Name="idUser" ColumnName="idUser" />
+                <ScalarProperty Name="idPayment" ColumnName="idPayment" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Payments">
             <EntityTypeMapping TypeName="gr672_liiModel.Payment">
               <MappingFragment StoreEntitySet="Payment">
-                <ScalarProperty Name="DatePayment" ColumnName="DatePayment" />
-                <ScalarProperty Name="NumberPayment" ColumnName="NumberPayment" />
                 <ScalarProperty Name="idPayment" ColumnName="idPayment" />
+                <ScalarProperty Name="NumberPayment" ColumnName="NumberPayment" />
+                <ScalarProperty Name="DatePayment" ColumnName="DatePayment" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Services">
             <EntityTypeMapping TypeName="gr672_liiModel.Service">
               <MappingFragment StoreEntitySet="Service">
-                <ScalarProperty Name="idCategory" ColumnName="idCategory" />
-                <ScalarProperty Name="DescriptionService" ColumnName="DescriptionService" />
-                <ScalarProperty Name="PriceService" ColumnName="PriceService" />
-                <ScalarProperty Name="NameService" ColumnName="NameService" />
                 <ScalarProperty Name="idService" ColumnName="idService" />
+                <ScalarProperty Name="NameService" ColumnName="NameService" />
+                <ScalarProperty Name="PriceService" ColumnName="PriceService" />
+                <ScalarProperty Name="DescriptionService" ColumnName="DescriptionService" />
+                <ScalarProperty Name="idCategory" ColumnName="idCategory" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>
           <EntitySetMapping Name="Users">
             <EntityTypeMapping TypeName="gr672_liiModel.User">
               <MappingFragment StoreEntitySet="User">
-                <ScalarProperty Name="ContactNumber" ColumnName="ContactNumber" />
-                <ScalarProperty Name="MiddleName" ColumnName="MiddleName" />
-                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
-                <ScalarProperty Name="LastName" ColumnName="LastName" />
-                <ScalarProperty Name="Password" ColumnName="Password" />
-                <ScalarProperty Name="Login" ColumnName="Login" />
                 <ScalarProperty Name="idUser" ColumnName="idUser" />
+                <ScalarProperty Name="Login" ColumnName="Login" />
+                <ScalarProperty Name="Password" ColumnName="Password" />
+                <ScalarProperty Name="LastName" ColumnName="LastName" />
+                <ScalarProperty Name="FirstName" ColumnName="FirstName" />
+                <ScalarProperty Name="MiddleName" ColumnName="MiddleName" />
+                <ScalarProperty Name="ContactNumber" ColumnName="ContactNumber" />
               </MappingFragment>
             </EntityTypeMapping>
           </EntitySetMapping>

+ 16 - 17
CopyCenter/DataBase.edmx.diagram

@@ -4,23 +4,22 @@
   <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
     <!-- Diagram content (shape and connector positions) -->
     <edmx:Diagrams>
-      <Diagram DiagramId="c03ed94988164e86a985d3452b7cd042" Name="Diagram1" ZoomLevel="63">
-        <EntityTypeShape EntityType="gr672_liiModel.Card" Width="1.5" PointX="4.125" PointY="4.875" />
-        <EntityTypeShape EntityType="gr672_liiModel.CategoryService" Width="1.5" PointX="1.25" PointY="13.125" />
-        <EntityTypeShape EntityType="gr672_liiModel.Client" Width="1.5" PointX="1.875" PointY="7.875" />
-        <EntityTypeShape EntityType="gr672_liiModel.Discount" Width="1.5" PointX="13" PointY="4.75" />
-        <EntityTypeShape EntityType="gr672_liiModel.Order" Width="1.5" PointX="8.75" PointY="7" />
-        <EntityTypeShape EntityType="gr672_liiModel.Payment" Width="1.5" PointX="10.25" PointY="11.125" />
-        <EntityTypeShape EntityType="gr672_liiModel.Service" Width="1.5" PointX="4.875" PointY="12.25" />
-        <EntityTypeShape EntityType="gr672_liiModel.User" Width="1.5" PointX="14.5" PointY="12" />
-        <AssociationConnector Association="gr672_liiModel.FK_Card_Client" />
-        <AssociationConnector Association="gr672_liiModel.FK_Service_CategoryService" />
-        <AssociationConnector Association="gr672_liiModel.FK_Order_Client" />
-        <AssociationConnector Association="gr672_liiModel.FK_Discount_Order" />
-        <AssociationConnector Association="gr672_liiModel.FK_Order_Payment" ManuallyRouted="false" >
-        </AssociationConnector>
-        <AssociationConnector Association="gr672_liiModel.FK_Order_Service" />
-        <AssociationConnector Association="gr672_liiModel.FK_Order_User" />
+      <Diagram DiagramId="1cd8c16b0ac54744a8e759d1e28f6d2a" Name="Diagram1">
+        <EntityTypeShape EntityType="gr672_liiModel.Card" Width="1.5" PointX="3" PointY="3.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr672_liiModel.CategoryService" Width="1.5" PointX="1.5" PointY="9.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr672_liiModel.Client" Width="1.5" PointX="0.75" PointY="3.375" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr672_liiModel.Discount" Width="1.5" PointX="8.25" PointY="3.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr672_liiModel.Order" Width="1.5" PointX="6" PointY="2.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr672_liiModel.Payment" Width="1.5" PointX="3.75" PointY="6.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr672_liiModel.Service" Width="1.5" PointX="3.75" PointY="9.5" IsExpanded="true" />
+        <EntityTypeShape EntityType="gr672_liiModel.User" Width="1.5" PointX="3.75" PointY="12.5" IsExpanded="true" />
+        <AssociationConnector Association="gr672_liiModel.FK_Card_Client" ManuallyRouted="false" />
+        <AssociationConnector Association="gr672_liiModel.FK_Service_CategoryService" ManuallyRouted="false" />
+        <AssociationConnector Association="gr672_liiModel.FK_Order_Client" ManuallyRouted="false" />
+        <AssociationConnector Association="gr672_liiModel.FK_Discount_Order" ManuallyRouted="false" />
+        <AssociationConnector Association="gr672_liiModel.FK_Order_Payment" ManuallyRouted="false" />
+        <AssociationConnector Association="gr672_liiModel.FK_Order_Service" ManuallyRouted="false" />
+        <AssociationConnector Association="gr672_liiModel.FK_Order_User" ManuallyRouted="false" />
       </Diagram>
     </edmx:Diagrams>
   </edmx:Designer>

+ 75 - 0
CopyCenterTests/CopyCenterTests.csproj

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" />
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{F7DF5BBE-DD93-41C4-9030-1C1E7563C789}</ProjectGuid>
+    <OutputType>Library</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>CopyCenterTests</RootNamespace>
+    <AssemblyName>CopyCenterTests</AssemblyName>
+    <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
+    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+    <ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
+    <IsCodedUITest>False</IsCodedUITest>
+    <TestProjectType>UnitTest</TestProjectType>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\MSTest.TestFramework.1.3.2\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="PresentationFramework" />
+    <Reference Include="System" />
+    <Reference Include="System.Core" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="UnitTest1.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="packages.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\CopyCenter\CopyCenter.csproj">
+      <Project>{04616998-307a-4a63-8664-563d90797c95}</Project>
+      <Name>CopyCenter</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.props'))" />
+    <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets'))" />
+  </Target>
+  <Import Project="..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.3.2\build\net45\MSTest.TestAdapter.targets')" />
+</Project>

+ 20 - 0
CopyCenterTests/Properties/AssemblyInfo.cs

@@ -0,0 +1,20 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+[assembly: AssemblyTitle("CopyCenterTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("CopyCenterTests")]
+[assembly: AssemblyCopyright("Copyright ©  2019")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+[assembly: ComVisible(false)]
+
+[assembly: Guid("f7df5bbe-dd93-41c4-9030-1c1e7563c789")]
+
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 100 - 0
CopyCenterTests/UnitTest1.cs

@@ -0,0 +1,100 @@
+using System;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using CopyCenter;
+using System.Collections.Generic;
+using System.Linq;
+
+
+namespace CopyCenterTests
+{
+    [TestClass]
+    public class UnitTest1
+    {
+
+        gr672_liiEntities db = new gr672_liiEntities();
+
+        [TestMethod]
+
+        public void TestMethod1()
+        {
+            var Authorization = new AuthorizationWindow();
+            var Clients = new ClientsWindow();
+            Assert.IsFalse(Authorization.Auth("test", "123"));
+            Assert.IsTrue(Authorization.Auth("max", "123"));
+        }
+    }
+    public class Authorization
+    {
+        gr672_liiEntities db = new gr672_liiEntities();
+        public bool Auth(string login, string password)
+        {
+           
+            if (login == "" || password == "")
+            {
+                return false;
+            }
+            if (db.Users.Select(item => item.Login + " " + item.Password).Contains(login + " " + password))
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+
+        }
+    }
+
+    public class Window1
+    {
+        gr672_liiEntities db = new gr672_liiEntities();
+        public bool Insert(string login, string password, string last_name, string first_name)
+        {
+            if (db.User.Select(item => item.Login + " " + item.Password + item.LastName + item.FirstName).Contains(login + " " + password + last_name + first_name))
+            {
+                return true;
+            }
+            if (login == "" || password == "")
+            {
+                return false;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        public bool Update(string login, string password, string last_name, string first_name)
+        {
+            if (db.User.Select(item => item.Login + " " + item.Password + item.LastName + item.FirstName).Contains(login + " " + password + last_name + first_name))
+            {
+                return true;
+            }
+            if (login == "" || password == "")
+            {
+                return false;
+            }
+            else
+            {
+                return false;
+            }
+        }
+        public bool Delete(string login, string password)
+        {
+
+            if (login == "" || password == "")
+            {
+                return true;
+            }
+            if (db.User.Select(item => item.Login + " " + item.Password).Contains(login + " " + password))
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+    }
+}
+}
+

+ 5 - 0
CopyCenterTests/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="MSTest.TestAdapter" version="1.3.2" targetFramework="net472" />
+  <package id="MSTest.TestFramework" version="1.3.2" targetFramework="net472" />
+</packages>