فهرست منبع

добарление базы, новых страниц, изменение навигации

Liza Smerdova 7 ماه پیش
والد
کامیت
fbc977b445
38فایلهای تغییر یافته به همراه2901 افزوده شده و 65 حذف شده
  1. 21 4
      PDK_Concert/App.config
  2. 6 0
      PDK_Concert/App.xaml
  3. 1 0
      PDK_Concert/Classes/DataBaseClass.cs
  4. 1 0
      PDK_Concert/Classes/FrameClass.cs
  5. 31 0
      PDK_Concert/Concert.cs
  6. 24 0
      PDK_Concert/ConcertProgram.cs
  7. 23 0
      PDK_Concert/Logined.cs
  8. 2 1
      PDK_Concert/MainWindow.xaml
  9. 1 0
      PDK_Concert/MainWindow.xaml.cs
  10. 38 0
      PDK_Concert/ModelBD.Context.cs
  11. 636 0
      PDK_Concert/ModelBD.Context.tt
  12. 10 0
      PDK_Concert/ModelBD.Designer.cs
  13. 9 0
      PDK_Concert/ModelBD.cs
  14. 591 0
      PDK_Concert/ModelBD.edmx
  15. 28 0
      PDK_Concert/ModelBD.edmx.diagram
  16. 733 0
      PDK_Concert/ModelBD.tt
  17. 31 0
      PDK_Concert/Numbers.cs
  18. 1 1
      PDK_Concert/Pages/AuthorizationPage.xaml
  19. 11 1
      PDK_Concert/Pages/AuthorizationPage.xaml.cs
  20. 37 0
      PDK_Concert/Pages/ConcertPage.xaml
  21. 46 0
      PDK_Concert/Pages/ConcertPage.xaml.cs
  22. 18 44
      PDK_Concert/Pages/MainPage.xaml
  23. 13 13
      PDK_Concert/Pages/MainPage.xaml.cs
  24. 30 0
      PDK_Concert/Pages/NumberPage.xaml
  25. 41 0
      PDK_Concert/Pages/NumberPage.xaml.cs
  26. 36 0
      PDK_Concert/Pages/ProfilePage.xaml
  27. 50 0
      PDK_Concert/Pages/ProfilePage.xaml.cs
  28. 30 0
      PDK_Concert/Pages/RehearsalSchedulePage.xaml
  29. 46 0
      PDK_Concert/Pages/RehearsalSchedulePage.xaml.cs
  30. 29 0
      PDK_Concert/Pages/UpdatePasswordPage.xaml
  31. 62 0
      PDK_Concert/Pages/UpdatePasswordPage.xaml.cs
  32. 29 0
      PDK_Concert/Post.cs
  33. 29 0
      PDK_Concert/Power.cs
  34. 109 1
      PDK_Concert/RDK_Concert.csproj
  35. 29 0
      PDK_Concert/RehearsalDate.cs
  36. 24 0
      PDK_Concert/RehearsalSchedule.cs
  37. 40 0
      PDK_Concert/Users.cs
  38. 5 0
      PDK_Concert/packages.config

+ 21 - 4
PDK_Concert/App.config

@@ -1,6 +1,23 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8"?>
 <configuration>
-    <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
-    </startup>
+  <configSections>
+    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
+    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+  </configSections>
+  <startup>
+    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
+  </startup>
+  <connectionStrings>
+    <add name="sm_RDKEntities" connectionString="metadata=res://*/ModelBD.csdl|res://*/ModelBD.ssdl|res://*/ModelBD.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=sql.ngknn.local;initial catalog=sm_RDK;persist security info=True;user id=21P;password=12357;MultipleActiveResultSets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
+  </connectionStrings>
+  <entityFramework>
+    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
+      <parameters>
+        <parameter value="mssqllocaldb" />
+      </parameters>
+    </defaultConnectionFactory>
+    <providers>
+      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
+    </providers>
+  </entityFramework>
 </configuration>

+ 6 - 0
PDK_Concert/App.xaml

@@ -34,5 +34,11 @@
             <Setter Property="Background" Value="White"/>
             <Setter Property="Margin" Value="20"/>
         </Style>
+
+        <Style x:Key="Menu" TargetType="TextBlock">
+            <Setter Property="FontSize" Value="20"/>
+            <Setter Property="Foreground" Value="White"/>
+            <Setter Property="FontWeight" Value="Bold"/>
+        </Style>
     </Application.Resources>
 </Application>

+ 1 - 0
PDK_Concert/Classes/DataBaseClass.cs

@@ -8,5 +8,6 @@ namespace PDK_Concert.Classes
 {
     public class DataBaseClass
     {
+        public static sm_RDKEntities connect;
     }
 }

+ 1 - 0
PDK_Concert/Classes/FrameClass.cs

@@ -10,5 +10,6 @@ namespace PDK_Concert.Classes
     public class FrameClass
     {
         public static Frame frame;
+        public static Frame menuFrame;
     }
 }

+ 31 - 0
PDK_Concert/Concert.cs

@@ -0,0 +1,31 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Concert
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Concert()
+        {
+            this.ConcertProgram = new HashSet<ConcertProgram>();
+        }
+    
+        public int IDConcert { get; set; }
+        public System.DateTime ConcertDate { get; set; }
+        public string Titlee { get; set; }
+        public int NumderOfRooms { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<ConcertProgram> ConcertProgram { get; set; }
+    }
+}

+ 24 - 0
PDK_Concert/ConcertProgram.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class ConcertProgram
+    {
+        public int IDConcert { get; set; }
+        public int IDNumber { get; set; }
+        public int IndexNumber { get; set; }
+    
+        public virtual Concert Concert { get; set; }
+        public virtual Numbers Numbers { get; set; }
+    }
+}

+ 23 - 0
PDK_Concert/Logined.cs

@@ -0,0 +1,23 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Logined
+    {
+        public int ID { get; set; }
+        public string Login { get; set; }
+        public int Password { get; set; }
+    
+        public virtual Users Users { get; set; }
+    }
+}

+ 2 - 1
PDK_Concert/MainWindow.xaml

@@ -6,7 +6,8 @@
         xmlns:local="clr-namespace:PDK_Concert"
         mc:Ignorable="d"
         Background="#284590"
-        Title="RDK" Height="600" Width="800">
+        Title="RDK" 
+        WindowState="Maximized">
     <Grid>
         <Frame Name="frame" NavigationUIVisibility="Hidden"/>
     </Grid>

+ 1 - 0
PDK_Concert/MainWindow.xaml.cs

@@ -26,6 +26,7 @@ namespace PDK_Concert
         {
             InitializeComponent();
             FrameClass.frame = frame;
+            DataBaseClass.connect = new sm_RDKEntities();
             FrameClass.frame.Navigate(new AuthorizationPage());
         }
     }

+ 38 - 0
PDK_Concert/ModelBD.Context.cs

@@ -0,0 +1,38 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Data.Entity;
+    using System.Data.Entity.Infrastructure;
+    
+    public partial class sm_RDKEntities : DbContext
+    {
+        public sm_RDKEntities()
+            : base("name=sm_RDKEntities")
+        {
+        }
+    
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            throw new UnintentionalCodeFirstException();
+        }
+    
+        public virtual DbSet<Concert> Concert { get; set; }
+        public virtual DbSet<Logined> Logined { get; set; }
+        public virtual DbSet<Numbers> Numbers { get; set; }
+        public virtual DbSet<Post> Post { get; set; }
+        public virtual DbSet<Power> Power { get; set; }
+        public virtual DbSet<RehearsalDate> RehearsalDate { get; set; }
+        public virtual DbSet<Users> Users { get; set; }
+        public virtual DbSet<ConcertProgram> ConcertProgram { get; set; }
+        public virtual DbSet<RehearsalSchedule> RehearsalSchedule { get; set; }
+    }
+}

+ 636 - 0
PDK_Concert/ModelBD.Context.tt

@@ -0,0 +1,636 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF6.Utility.CS.ttinclude"#><#@
+ output extension=".cs"#><#
+
+const string inputFile = @"ModelBD.edmx";
+var textTransform = DynamicTextTransformation.Create(this);
+var code = new CodeGenerationTools(this);
+var ef = new MetadataTools(this);
+var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
+var loader = new EdmMetadataLoader(textTransform.Host, textTransform.Errors);
+var itemCollection = loader.CreateEdmItemCollection(inputFile);
+var modelNamespace = loader.GetModelNamespace(inputFile);
+var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
+
+var container = itemCollection.OfType<EntityContainer>().FirstOrDefault();
+if (container == null)
+{
+    return string.Empty;
+}
+#>
+//------------------------------------------------------------------------------
+// <auto-generated>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
+//
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+<#
+
+var codeNamespace = code.VsNamespaceSuggestion();
+if (!String.IsNullOrEmpty(codeNamespace))
+{
+#>
+namespace <#=code.EscapeNamespace(codeNamespace)#>
+{
+<#
+    PushIndent("    ");
+}
+
+#>
+using System;
+using System.Data.Entity;
+using System.Data.Entity.Infrastructure;
+<#
+if (container.FunctionImports.Any())
+{
+#>
+using System.Data.Entity.Core.Objects;
+using System.Linq;
+<#
+}
+#>
+
+<#=Accessibility.ForType(container)#> partial class <#=code.Escape(container)#> : DbContext
+{
+    public <#=code.Escape(container)#>()
+        : base("name=<#=container.Name#>")
+    {
+<#
+if (!loader.IsLazyLoadingEnabled(container))
+{
+#>
+        this.Configuration.LazyLoadingEnabled = false;
+<#
+}
+
+foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
+{
+    // Note: the DbSet members are defined below such that the getter and
+    // setter always have the same accessibility as the DbSet definition
+    if (Accessibility.ForReadOnlyProperty(entitySet) != "public")
+    {
+#>
+        <#=codeStringGenerator.DbSetInitializer(entitySet)#>
+<#
+    }
+}
+#>
+    }
+
+    protected override void OnModelCreating(DbModelBuilder modelBuilder)
+    {
+        throw new UnintentionalCodeFirstException();
+    }
+
+<#
+    foreach (var entitySet in container.BaseEntitySets.OfType<EntitySet>())
+    {
+#>
+    <#=codeStringGenerator.DbSet(entitySet)#>
+<#
+    }
+
+    foreach (var edmFunction in container.FunctionImports)
+    {
+        WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: false);
+    }
+#>
+}
+<#
+
+if (!String.IsNullOrEmpty(codeNamespace))
+{
+    PopIndent();
+#>
+}
+<#
+}
+#>
+<#+
+
+private void WriteFunctionImport(TypeMapper typeMapper, CodeStringGenerator codeStringGenerator, EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+{
+    if (typeMapper.IsComposable(edmFunction))
+    {
+#>
+
+    [DbFunction("<#=edmFunction.NamespaceName#>", "<#=edmFunction.Name#>")]
+    <#=codeStringGenerator.ComposableFunctionMethod(edmFunction, modelNamespace)#>
+    {
+<#+
+        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
+#>
+        <#=codeStringGenerator.ComposableCreateQuery(edmFunction, modelNamespace)#>
+    }
+<#+
+    }
+    else
+    {
+#>
+
+    <#=codeStringGenerator.FunctionMethod(edmFunction, modelNamespace, includeMergeOption)#>
+    {
+<#+
+        codeStringGenerator.WriteFunctionParameters(edmFunction, WriteFunctionParameter);
+#>
+        <#=codeStringGenerator.ExecuteFunction(edmFunction, modelNamespace, includeMergeOption)#>
+    }
+<#+
+        if (typeMapper.GenerateMergeOptionFunction(edmFunction, includeMergeOption))
+        {
+            WriteFunctionImport(typeMapper, codeStringGenerator, edmFunction, modelNamespace, includeMergeOption: true);
+        }
+    }
+}
+
+public void WriteFunctionParameter(string name, string isNotNull, string notNullInit, string nullInit)
+{
+#>
+        var <#=name#> = <#=isNotNull#> ?
+            <#=notNullInit#> :
+            <#=nullInit#>;
+
+<#+
+}
+
+public const string TemplateId = "CSharp_DbContext_Context_EF6";
+
+public class CodeStringGenerator
+{
+    private readonly CodeGenerationTools _code;
+    private readonly TypeMapper _typeMapper;
+    private readonly MetadataTools _ef;
+
+    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(typeMapper, "typeMapper");
+        ArgumentNotNull(ef, "ef");
+
+        _code = code;
+        _typeMapper = typeMapper;
+        _ef = ef;
+    }
+
+    public string Property(EdmProperty edmProperty)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            Accessibility.ForProperty(edmProperty),
+            _typeMapper.GetTypeName(edmProperty.TypeUsage),
+            _code.Escape(edmProperty),
+            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
+            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
+    }
+
+    public string NavigationProperty(NavigationProperty navProp)
+    {
+        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
+            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
+            _code.Escape(navProp),
+            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
+            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
+    }
+    
+    public string AccessibilityAndVirtual(string accessibility)
+    {
+        return accessibility + (accessibility != "private" ? " virtual" : "");
+    }
+    
+    public string EntityClassOpening(EntityType entity)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1}partial class {2}{3}",
+            Accessibility.ForType(entity),
+            _code.SpaceAfter(_code.AbstractOption(entity)),
+            _code.Escape(entity),
+            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
+    }
+    
+    public string EnumOpening(SimpleType enumType)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} enum {1} : {2}",
+            Accessibility.ForType(enumType),
+            _code.Escape(enumType),
+            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
+        }
+    
+    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
+    {
+        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
+        {
+            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
+            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
+            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
+            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
+        }
+    }
+    
+    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} IQueryable<{1}> {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            _code.Escape(edmFunction),
+            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
+    }
+    
+    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            edmFunction.NamespaceName,
+            edmFunction.Name,
+            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
+            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
+    }
+    
+    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
+        if (includeMergeOption)
+        {
+            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
+        }
+
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            _code.Escape(edmFunction),
+            paramList);
+    }
+    
+    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
+        if (includeMergeOption)
+        {
+            callParams = ", mergeOption" + callParams;
+        }
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
+            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            edmFunction.Name,
+            callParams);
+    }
+    
+    public string DbSet(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
+            Accessibility.ForReadOnlyProperty(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType),
+            _code.Escape(entitySet));
+    }
+
+    public string DbSetInitializer(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} = Set<{1}>();",
+            _code.Escape(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType));
+    }
+
+    public string UsingDirectives(bool inHeader, bool includeCollections = true)
+    {
+        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
+            ? string.Format(
+                CultureInfo.InvariantCulture,
+                "{0}using System;{1}" +
+                "{2}",
+                inHeader ? Environment.NewLine : "",
+                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
+                inHeader ? "" : Environment.NewLine)
+            : "";
+    }
+}
+
+public class TypeMapper
+{
+    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
+
+    private readonly System.Collections.IList _errors;
+    private readonly CodeGenerationTools _code;
+    private readonly MetadataTools _ef;
+
+    public static string FixNamespaces(string typeName)
+    {
+        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
+    }
+
+    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(ef, "ef");
+        ArgumentNotNull(errors, "errors");
+
+        _code = code;
+        _ef = ef;
+        _errors = errors;
+    }
+
+    public string GetTypeName(TypeUsage typeUsage)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
+    }
+
+    public string GetTypeName(EdmType edmType)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
+    }
+
+    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, string modelNamespace)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
+    {
+        if (edmType == null)
+        {
+            return null;
+        }
+
+        var collectionType = edmType as CollectionType;
+        if (collectionType != null)
+        {
+            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
+        }
+
+        var typeName = _code.Escape(edmType.MetadataProperties
+                                .Where(p => p.Name == ExternalTypeNameAttributeName)
+                                .Select(p => (string)p.Value)
+                                .FirstOrDefault())
+            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
+                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
+                _code.Escape(edmType));
+
+        if (edmType is StructuralType)
+        {
+            return typeName;
+        }
+
+        if (edmType is SimpleType)
+        {
+            var clrType = UnderlyingClrType(edmType);
+            if (!IsEnumType(edmType))
+            {
+                typeName = _code.Escape(clrType);
+            }
+
+            typeName = FixNamespaces(typeName);
+
+            return clrType.IsValueType && isNullable == true ?
+                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
+                typeName;
+        }
+
+        throw new ArgumentException("edmType");
+    }
+    
+    public Type UnderlyingClrType(EdmType edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        var primitiveType = edmType as PrimitiveType;
+        if (primitiveType != null)
+        {
+            return primitiveType.ClrEquivalentType;
+        }
+
+        if (IsEnumType(edmType))
+        {
+            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
+        }
+
+        return typeof(object);
+    }
+    
+    public object GetEnumMemberValue(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var valueProperty = enumMember.GetType().GetProperty("Value");
+        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
+    }
+    
+    public string GetEnumMemberName(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var nameProperty = enumMember.GetType().GetProperty("Name");
+        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
+    }
+
+    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        var membersProperty = enumType.GetType().GetProperty("Members");
+        return membersProperty != null 
+            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
+            : Enumerable.Empty<MetadataItem>();
+    }
+    
+    public bool EnumIsFlags(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+        
+        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
+        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
+    }
+
+    public bool IsEnumType(GlobalItem edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        return edmType.GetType().Name == "EnumType";
+    }
+
+    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
+    }
+
+    public string CreateLiteral(object value)
+    {
+        if (value == null || value.GetType() != typeof(TimeSpan))
+        {
+            return _code.CreateLiteral(value);
+        }
+
+        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
+    }
+    
+    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
+    {
+        ArgumentNotNull(types, "types");
+        ArgumentNotNull(sourceFile, "sourceFile");
+        
+        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+        if (types.Any(item => !hash.Add(item)))
+        {
+            _errors.Add(
+                new CompilerError(sourceFile, -1, -1, "6023",
+                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
+            return false;
+        }
+        return true;
+    }
+    
+    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
+    {
+        return GetItemsToGenerate<SimpleType>(itemCollection)
+            .Where(e => IsEnumType(e));
+    }
+    
+    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
+    {
+        return itemCollection
+            .OfType<T>()
+            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
+            .OrderBy(i => i.Name);
+    }
+
+    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
+    {
+        return itemCollection
+            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
+            .Select(g => GetGlobalItemName(g));
+    }
+
+    public string GetGlobalItemName(GlobalItem item)
+    {
+        if (item is EdmType)
+        {
+            return ((EdmType)item).Name;
+        }
+        else
+        {
+            return ((EntityContainer)item).Name;
+        }
+    }
+
+    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+    
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+
+    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type);
+    }
+    
+    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
+    }
+    
+    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
+        return returnParamsProperty == null
+            ? edmFunction.ReturnParameter
+            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
+    }
+
+    public bool IsComposable(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
+        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
+    }
+
+    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
+    {
+        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+    }
+
+    public TypeUsage GetReturnType(EdmFunction edmFunction)
+    {
+        var returnParam = GetReturnParameter(edmFunction);
+        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
+    }
+    
+    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
+    {
+        var returnType = GetReturnType(edmFunction);
+        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
+    }
+}
+
+public static void ArgumentNotNull<T>(T arg, string name) where T : class
+{
+    if (arg == null)
+    {
+        throw new ArgumentNullException(name);
+    }
+}
+#>

+ 10 - 0
PDK_Concert/ModelBD.Designer.cs

@@ -0,0 +1,10 @@
+// Создание кода T4 для модели "C:\Users\смердоваев\Source\Repos\RDK_Concert\PDK_Concert\ModelBD.edmx" включено. 
+// Чтобы включить формирование кода прежних версий, измените значение свойства "Стратегия создания кода" конструктора
+// на "Legacy ObjectContext". Это свойство доступно в окне "Свойства", если модель
+// открыта в конструкторе.
+
+// Если не сформированы контекст и классы сущности, возможная причина в том, что вы создали пустую модель, но
+// еще не выбрали версию Entity Framework для использования. Чтобы сформировать класс контекста и классы сущностей
+// для своей модели, откройте модель в конструкторе, щелкните правой кнопкой область конструктора и
+// выберите "Обновить модель из базы данных", "Сформировать базу данных из модели" или "Добавить элемент формирования
+// кода...".

+ 9 - 0
PDK_Concert/ModelBD.cs

@@ -0,0 +1,9 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+

+ 591 - 0
PDK_Concert/ModelBD.edmx

@@ -0,0 +1,591 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+  <!-- EF Runtime content -->
+  <edmx:Runtime>
+    <!-- SSDL content -->
+    <edmx:StorageModels>
+      <Schema Namespace="Хранилище sm_RDKModel" 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="Concert">
+          <Key>
+            <PropertyRef Name="IDConcert" />
+          </Key>
+          <Property Name="IDConcert" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="ConcertDate" Type="date" Nullable="false" />
+          <Property Name="Titlee" Type="nvarchar(max)" Nullable="false" />
+          <Property Name="NumderOfRooms" Type="int" Nullable="false" />
+        </EntityType>
+        <!--Ошибки, обнаруженные при создании:
+предупреждение 6002: В таблице или представлении "sm_RDK.dbo.ConcertProgram" не определен первичный ключ. Ключ был выведен, а определение таблицы или представления было создано в режиме только для чтения.-->
+        <EntityType Name="ConcertProgram">
+          <Key>
+            <PropertyRef Name="IDConcert" />
+            <PropertyRef Name="IDNumber" />
+            <PropertyRef Name="IndexNumber" />
+          </Key>
+          <Property Name="IDConcert" Type="int" Nullable="false" />
+          <Property Name="IDNumber" Type="int" Nullable="false" />
+          <Property Name="IndexNumber" Type="int" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Logined">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Login" Type="nvarchar(max)" Nullable="false" />
+          <Property Name="Password" Type="int" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Numbers">
+          <Key>
+            <PropertyRef Name="IDNumber" />
+          </Key>
+          <Property Name="IDNumber" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="IDUser" Type="int" Nullable="false" />
+          <Property Name="Title" Type="nvarchar(max)" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Post">
+          <Key>
+            <PropertyRef Name="IDPost" />
+          </Key>
+          <Property Name="IDPost" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Title" Type="nvarchar(max)" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Power">
+          <Key>
+            <PropertyRef Name="IDPower" />
+          </Key>
+          <Property Name="IDPower" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="Title" Type="nchar" MaxLength="10" Nullable="false" />
+        </EntityType>
+        <EntityType Name="RehearsalDate">
+          <Key>
+            <PropertyRef Name="IDData" />
+          </Key>
+          <Property Name="IDData" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
+          <Property Name="RehearsalDate" Type="date" Nullable="false" />
+        </EntityType>
+        <!--Ошибки, обнаруженные при создании:
+предупреждение 6002: В таблице или представлении "sm_RDK.dbo.RehearsalSchedule" не определен первичный ключ. Ключ был выведен, а определение таблицы или представления было создано в режиме только для чтения.-->
+        <EntityType Name="RehearsalSchedule">
+          <Key>
+            <PropertyRef Name="IDSchedule" />
+            <PropertyRef Name="IDUser" />
+            <PropertyRef Name="RehearsalTime" />
+          </Key>
+          <Property Name="IDSchedule" Type="int" Nullable="false" />
+          <Property Name="IDUser" Type="int" Nullable="false" />
+          <Property Name="RehearsalTime" Type="nvarchar" MaxLength="5" Nullable="false" />
+        </EntityType>
+        <EntityType Name="Users">
+          <Key>
+            <PropertyRef Name="IDUser" />
+          </Key>
+          <Property Name="IDUser" Type="int" Nullable="false" />
+          <Property Name="Name" Type="nvarchar(max)" Nullable="false" />
+          <Property Name="Surname" Type="nvarchar(max)" Nullable="false" />
+          <Property Name="Patronymic" Type="nvarchar(max)" />
+          <Property Name="Number" Type="nvarchar" MaxLength="11" />
+          <Property Name="IDPower" Type="int" Nullable="false" />
+          <Property Name="IDPost" Type="int" Nullable="false" />
+        </EntityType>
+        <Association Name="FK_ConcertProgram_Concert">
+          <End Role="Concert" Type="Self.Concert" Multiplicity="1" />
+          <End Role="ConcertProgram" Type="Self.ConcertProgram" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Concert">
+              <PropertyRef Name="IDConcert" />
+            </Principal>
+            <Dependent Role="ConcertProgram">
+              <PropertyRef Name="IDConcert" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_ConcertProgram_Numbers">
+          <End Role="Numbers" Type="Self.Numbers" Multiplicity="1" />
+          <End Role="ConcertProgram" Type="Self.ConcertProgram" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Numbers">
+              <PropertyRef Name="IDNumber" />
+            </Principal>
+            <Dependent Role="ConcertProgram">
+              <PropertyRef Name="IDNumber" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Numbers_Users">
+          <End Role="Users" Type="Self.Users" Multiplicity="1" />
+          <End Role="Numbers" Type="Self.Numbers" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Users">
+              <PropertyRef Name="IDUser" />
+            </Principal>
+            <Dependent Role="Numbers">
+              <PropertyRef Name="IDUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_RehearsalSchedule_RehearsalDate">
+          <End Role="RehearsalDate" Type="Self.RehearsalDate" Multiplicity="1" />
+          <End Role="RehearsalSchedule" Type="Self.RehearsalSchedule" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="RehearsalDate">
+              <PropertyRef Name="IDData" />
+            </Principal>
+            <Dependent Role="RehearsalSchedule">
+              <PropertyRef Name="IDSchedule" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_RehearsalSchedule_Users">
+          <End Role="Users" Type="Self.Users" Multiplicity="1" />
+          <End Role="RehearsalSchedule" Type="Self.RehearsalSchedule" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Users">
+              <PropertyRef Name="IDUser" />
+            </Principal>
+            <Dependent Role="RehearsalSchedule">
+              <PropertyRef Name="IDUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Users_Logined">
+          <End Role="Logined" Type="Self.Logined" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="0..1" />
+          <ReferentialConstraint>
+            <Principal Role="Logined">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Users">
+              <PropertyRef Name="IDUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Users_Post">
+          <End Role="Post" Type="Self.Post" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Post">
+              <PropertyRef Name="IDPost" />
+            </Principal>
+            <Dependent Role="Users">
+              <PropertyRef Name="IDPost" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Users_Power">
+          <End Role="Power" Type="Self.Power" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Power">
+              <PropertyRef Name="IDPower" />
+            </Principal>
+            <Dependent Role="Users">
+              <PropertyRef Name="IDPower" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <EntityContainer Name="Хранилище sm_RDKModelContainer">
+          <EntitySet Name="Concert" EntityType="Self.Concert" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Logined" EntityType="Self.Logined" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Numbers" EntityType="Self.Numbers" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Post" EntityType="Self.Post" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Power" EntityType="Self.Power" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="RehearsalDate" EntityType="Self.RehearsalDate" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="Users" EntityType="Self.Users" Schema="dbo" store:Type="Tables" />
+          <EntitySet Name="ConcertProgram" EntityType="Self.ConcertProgram" store:Type="Tables" store:Schema="dbo">
+            <DefiningQuery>SELECT 
+    [ConcertProgram].[IDConcert] AS [IDConcert], 
+    [ConcertProgram].[IDNumber] AS [IDNumber], 
+    [ConcertProgram].[IndexNumber] AS [IndexNumber]
+    FROM [dbo].[ConcertProgram] AS [ConcertProgram]</DefiningQuery>
+          </EntitySet>
+          <EntitySet Name="RehearsalSchedule" EntityType="Self.RehearsalSchedule" store:Type="Tables" store:Schema="dbo">
+            <DefiningQuery>SELECT 
+    [RehearsalSchedule].[IDSchedule] AS [IDSchedule], 
+    [RehearsalSchedule].[IDUser] AS [IDUser], 
+    [RehearsalSchedule].[RehearsalTime] AS [RehearsalTime]
+    FROM [dbo].[RehearsalSchedule] AS [RehearsalSchedule]</DefiningQuery>
+          </EntitySet>
+          <AssociationSet Name="FK_ConcertProgram_Concert" Association="Self.FK_ConcertProgram_Concert">
+            <End Role="Concert" EntitySet="Concert" />
+            <End Role="ConcertProgram" EntitySet="ConcertProgram" />
+          </AssociationSet>
+          <AssociationSet Name="FK_ConcertProgram_Numbers" Association="Self.FK_ConcertProgram_Numbers">
+            <End Role="Numbers" EntitySet="Numbers" />
+            <End Role="ConcertProgram" EntitySet="ConcertProgram" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Numbers_Users" Association="Self.FK_Numbers_Users">
+            <End Role="Users" EntitySet="Users" />
+            <End Role="Numbers" EntitySet="Numbers" />
+          </AssociationSet>
+          <AssociationSet Name="FK_RehearsalSchedule_RehearsalDate" Association="Self.FK_RehearsalSchedule_RehearsalDate">
+            <End Role="RehearsalDate" EntitySet="RehearsalDate" />
+            <End Role="RehearsalSchedule" EntitySet="RehearsalSchedule" />
+          </AssociationSet>
+          <AssociationSet Name="FK_RehearsalSchedule_Users" Association="Self.FK_RehearsalSchedule_Users">
+            <End Role="Users" EntitySet="Users" />
+            <End Role="RehearsalSchedule" EntitySet="RehearsalSchedule" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Users_Logined" Association="Self.FK_Users_Logined">
+            <End Role="Logined" EntitySet="Logined" />
+            <End Role="Users" EntitySet="Users" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Users_Post" Association="Self.FK_Users_Post">
+            <End Role="Post" EntitySet="Post" />
+            <End Role="Users" EntitySet="Users" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Users_Power" Association="Self.FK_Users_Power">
+            <End Role="Power" EntitySet="Power" />
+            <End Role="Users" EntitySet="Users" />
+          </AssociationSet>
+        </EntityContainer>
+      </Schema>
+    </edmx:StorageModels>
+    <!-- CSDL content -->
+    <edmx:ConceptualModels>
+      <Schema Namespace="sm_RDKModel" 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">
+        <EntityType Name="Concert">
+          <Key>
+            <PropertyRef Name="IDConcert" />
+          </Key>
+          <Property Name="IDConcert" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="ConcertDate" Type="DateTime" Nullable="false" Precision="0" />
+          <Property Name="Titlee" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="NumderOfRooms" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="ConcertProgram" Relationship="Self.FK_ConcertProgram_Concert" FromRole="Concert" ToRole="ConcertProgram" />
+        </EntityType>
+        <EntityType Name="Logined">
+          <Key>
+            <PropertyRef Name="ID" />
+          </Key>
+          <Property Name="ID" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Login" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Password" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Users" Relationship="Self.FK_Users_Logined" FromRole="Logined" ToRole="Users" />
+        </EntityType>
+        <EntityType Name="Numbers">
+          <Key>
+            <PropertyRef Name="IDNumber" />
+          </Key>
+          <Property Name="IDNumber" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="IDUser" Type="Int32" Nullable="false" />
+          <Property Name="Title" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="ConcertProgram" Relationship="Self.FK_ConcertProgram_Numbers" FromRole="Numbers" ToRole="ConcertProgram" />
+          <NavigationProperty Name="Users" Relationship="Self.FK_Numbers_Users" FromRole="Numbers" ToRole="Users" />
+        </EntityType>
+        <EntityType Name="Post">
+          <Key>
+            <PropertyRef Name="IDPost" />
+          </Key>
+          <Property Name="IDPost" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Title" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Users" Relationship="Self.FK_Users_Post" FromRole="Post" ToRole="Users" />
+        </EntityType>
+        <EntityType Name="Power">
+          <Key>
+            <PropertyRef Name="IDPower" />
+          </Key>
+          <Property Name="IDPower" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="Title" Type="String" MaxLength="10" FixedLength="true" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="Users" Relationship="Self.FK_Users_Power" FromRole="Power" ToRole="Users" />
+        </EntityType>
+        <EntityType Name="RehearsalDate">
+          <Key>
+            <PropertyRef Name="IDData" />
+          </Key>
+          <Property Name="IDData" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
+          <Property Name="RehearsalDate1" Type="DateTime" Nullable="false" Precision="0" />
+          <NavigationProperty Name="RehearsalSchedule" Relationship="Self.FK_RehearsalSchedule_RehearsalDate" FromRole="RehearsalDate" ToRole="RehearsalSchedule" />
+        </EntityType>
+        <EntityType Name="Users">
+          <Key>
+            <PropertyRef Name="IDUser" />
+          </Key>
+          <Property Name="IDUser" Type="Int32" Nullable="false" />
+          <Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Surname" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
+          <Property Name="Patronymic" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" />
+          <Property Name="Number" Type="String" MaxLength="11" FixedLength="false" Unicode="true" />
+          <Property Name="IDPower" Type="Int32" Nullable="false" />
+          <Property Name="IDPost" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Logined" Relationship="Self.FK_Users_Logined" FromRole="Users" ToRole="Logined" />
+          <NavigationProperty Name="Numbers" Relationship="Self.FK_Numbers_Users" FromRole="Users" ToRole="Numbers" />
+          <NavigationProperty Name="Post" Relationship="Self.FK_Users_Post" FromRole="Users" ToRole="Post" />
+          <NavigationProperty Name="Power" Relationship="Self.FK_Users_Power" FromRole="Users" ToRole="Power" />
+          <NavigationProperty Name="RehearsalSchedule" Relationship="Self.FK_RehearsalSchedule_Users" FromRole="Users" ToRole="RehearsalSchedule" />
+        </EntityType>
+        <EntityType Name="ConcertProgram">
+          <Key>
+            <PropertyRef Name="IDConcert" />
+            <PropertyRef Name="IDNumber" />
+            <PropertyRef Name="IndexNumber" />
+          </Key>
+          <Property Name="IDConcert" Type="Int32" Nullable="false" />
+          <Property Name="IDNumber" Type="Int32" Nullable="false" />
+          <Property Name="IndexNumber" Type="Int32" Nullable="false" />
+          <NavigationProperty Name="Concert" Relationship="Self.FK_ConcertProgram_Concert" FromRole="ConcertProgram" ToRole="Concert" />
+          <NavigationProperty Name="Numbers" Relationship="Self.FK_ConcertProgram_Numbers" FromRole="ConcertProgram" ToRole="Numbers" />
+        </EntityType>
+        <EntityType Name="RehearsalSchedule">
+          <Key>
+            <PropertyRef Name="IDSchedule" />
+            <PropertyRef Name="IDUser" />
+            <PropertyRef Name="RehearsalTime" />
+          </Key>
+          <Property Name="IDSchedule" Type="Int32" Nullable="false" />
+          <Property Name="IDUser" Type="Int32" Nullable="false" />
+          <Property Name="RehearsalTime" Type="String" MaxLength="5" FixedLength="false" Unicode="true" Nullable="false" />
+          <NavigationProperty Name="RehearsalDate" Relationship="Self.FK_RehearsalSchedule_RehearsalDate" FromRole="RehearsalSchedule" ToRole="RehearsalDate" />
+          <NavigationProperty Name="Users" Relationship="Self.FK_RehearsalSchedule_Users" FromRole="RehearsalSchedule" ToRole="Users" />
+        </EntityType>
+        <Association Name="FK_ConcertProgram_Concert">
+          <End Role="Concert" Type="Self.Concert" Multiplicity="1" />
+          <End Role="ConcertProgram" Type="Self.ConcertProgram" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Concert">
+              <PropertyRef Name="IDConcert" />
+            </Principal>
+            <Dependent Role="ConcertProgram">
+              <PropertyRef Name="IDConcert" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Users_Logined">
+          <End Role="Logined" Type="Self.Logined" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="0..1" />
+          <ReferentialConstraint>
+            <Principal Role="Logined">
+              <PropertyRef Name="ID" />
+            </Principal>
+            <Dependent Role="Users">
+              <PropertyRef Name="IDUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_ConcertProgram_Numbers">
+          <End Role="Numbers" Type="Self.Numbers" Multiplicity="1" />
+          <End Role="ConcertProgram" Type="Self.ConcertProgram" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Numbers">
+              <PropertyRef Name="IDNumber" />
+            </Principal>
+            <Dependent Role="ConcertProgram">
+              <PropertyRef Name="IDNumber" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Numbers_Users">
+          <End Role="Users" Type="Self.Users" Multiplicity="1" />
+          <End Role="Numbers" Type="Self.Numbers" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Users">
+              <PropertyRef Name="IDUser" />
+            </Principal>
+            <Dependent Role="Numbers">
+              <PropertyRef Name="IDUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Users_Post">
+          <End Role="Post" Type="Self.Post" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Post">
+              <PropertyRef Name="IDPost" />
+            </Principal>
+            <Dependent Role="Users">
+              <PropertyRef Name="IDPost" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_Users_Power">
+          <End Role="Power" Type="Self.Power" Multiplicity="1" />
+          <End Role="Users" Type="Self.Users" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Power">
+              <PropertyRef Name="IDPower" />
+            </Principal>
+            <Dependent Role="Users">
+              <PropertyRef Name="IDPower" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_RehearsalSchedule_RehearsalDate">
+          <End Role="RehearsalDate" Type="Self.RehearsalDate" Multiplicity="1" />
+          <End Role="RehearsalSchedule" Type="Self.RehearsalSchedule" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="RehearsalDate">
+              <PropertyRef Name="IDData" />
+            </Principal>
+            <Dependent Role="RehearsalSchedule">
+              <PropertyRef Name="IDSchedule" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <Association Name="FK_RehearsalSchedule_Users">
+          <End Role="Users" Type="Self.Users" Multiplicity="1" />
+          <End Role="RehearsalSchedule" Type="Self.RehearsalSchedule" Multiplicity="*" />
+          <ReferentialConstraint>
+            <Principal Role="Users">
+              <PropertyRef Name="IDUser" />
+            </Principal>
+            <Dependent Role="RehearsalSchedule">
+              <PropertyRef Name="IDUser" />
+            </Dependent>
+          </ReferentialConstraint>
+        </Association>
+        <EntityContainer Name="sm_RDKEntities" annotation:LazyLoadingEnabled="true">
+          <EntitySet Name="Concert" EntityType="Self.Concert" />
+          <EntitySet Name="Logined" EntityType="Self.Logined" />
+          <EntitySet Name="Numbers" EntityType="Self.Numbers" />
+          <EntitySet Name="Post" EntityType="Self.Post" />
+          <EntitySet Name="Power" EntityType="Self.Power" />
+          <EntitySet Name="RehearsalDate" EntityType="Self.RehearsalDate" />
+          <EntitySet Name="Users" EntityType="Self.Users" />
+          <EntitySet Name="ConcertProgram" EntityType="Self.ConcertProgram" />
+          <EntitySet Name="RehearsalSchedule" EntityType="Self.RehearsalSchedule" />
+          <AssociationSet Name="FK_ConcertProgram_Concert" Association="Self.FK_ConcertProgram_Concert">
+            <End Role="Concert" EntitySet="Concert" />
+            <End Role="ConcertProgram" EntitySet="ConcertProgram" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Users_Logined" Association="Self.FK_Users_Logined">
+            <End Role="Logined" EntitySet="Logined" />
+            <End Role="Users" EntitySet="Users" />
+          </AssociationSet>
+          <AssociationSet Name="FK_ConcertProgram_Numbers" Association="Self.FK_ConcertProgram_Numbers">
+            <End Role="Numbers" EntitySet="Numbers" />
+            <End Role="ConcertProgram" EntitySet="ConcertProgram" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Numbers_Users" Association="Self.FK_Numbers_Users">
+            <End Role="Users" EntitySet="Users" />
+            <End Role="Numbers" EntitySet="Numbers" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Users_Post" Association="Self.FK_Users_Post">
+            <End Role="Post" EntitySet="Post" />
+            <End Role="Users" EntitySet="Users" />
+          </AssociationSet>
+          <AssociationSet Name="FK_Users_Power" Association="Self.FK_Users_Power">
+            <End Role="Power" EntitySet="Power" />
+            <End Role="Users" EntitySet="Users" />
+          </AssociationSet>
+          <AssociationSet Name="FK_RehearsalSchedule_RehearsalDate" Association="Self.FK_RehearsalSchedule_RehearsalDate">
+            <End Role="RehearsalDate" EntitySet="RehearsalDate" />
+            <End Role="RehearsalSchedule" EntitySet="RehearsalSchedule" />
+          </AssociationSet>
+          <AssociationSet Name="FK_RehearsalSchedule_Users" Association="Self.FK_RehearsalSchedule_Users">
+            <End Role="Users" EntitySet="Users" />
+            <End Role="RehearsalSchedule" EntitySet="RehearsalSchedule" />
+          </AssociationSet>
+        </EntityContainer>
+      </Schema>
+    </edmx:ConceptualModels>
+    <!-- C-S mapping content -->
+    <edmx:Mappings>
+      <Mapping Space="C-S" xmlns="http://schemas.microsoft.com/ado/2009/11/mapping/cs">
+        <EntityContainerMapping StorageEntityContainer="Хранилище sm_RDKModelContainer" CdmEntityContainer="sm_RDKEntities">
+          <EntitySetMapping Name="Concert">
+            <EntityTypeMapping TypeName="sm_RDKModel.Concert">
+              <MappingFragment StoreEntitySet="Concert">
+                <ScalarProperty Name="IDConcert" ColumnName="IDConcert" />
+                <ScalarProperty Name="ConcertDate" ColumnName="ConcertDate" />
+                <ScalarProperty Name="Titlee" ColumnName="Titlee" />
+                <ScalarProperty Name="NumderOfRooms" ColumnName="NumderOfRooms" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Logined">
+            <EntityTypeMapping TypeName="sm_RDKModel.Logined">
+              <MappingFragment StoreEntitySet="Logined">
+                <ScalarProperty Name="ID" ColumnName="ID" />
+                <ScalarProperty Name="Login" ColumnName="Login" />
+                <ScalarProperty Name="Password" ColumnName="Password" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Numbers">
+            <EntityTypeMapping TypeName="sm_RDKModel.Numbers">
+              <MappingFragment StoreEntitySet="Numbers">
+                <ScalarProperty Name="IDNumber" ColumnName="IDNumber" />
+                <ScalarProperty Name="IDUser" ColumnName="IDUser" />
+                <ScalarProperty Name="Title" ColumnName="Title" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Post">
+            <EntityTypeMapping TypeName="sm_RDKModel.Post">
+              <MappingFragment StoreEntitySet="Post">
+                <ScalarProperty Name="IDPost" ColumnName="IDPost" />
+                <ScalarProperty Name="Title" ColumnName="Title" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Power">
+            <EntityTypeMapping TypeName="sm_RDKModel.Power">
+              <MappingFragment StoreEntitySet="Power">
+                <ScalarProperty Name="IDPower" ColumnName="IDPower" />
+                <ScalarProperty Name="Title" ColumnName="Title" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="RehearsalDate">
+            <EntityTypeMapping TypeName="sm_RDKModel.RehearsalDate">
+              <MappingFragment StoreEntitySet="RehearsalDate">
+                <ScalarProperty Name="IDData" ColumnName="IDData" />
+                <ScalarProperty Name="RehearsalDate1" ColumnName="RehearsalDate" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="Users">
+            <EntityTypeMapping TypeName="sm_RDKModel.Users">
+              <MappingFragment StoreEntitySet="Users">
+                <ScalarProperty Name="IDUser" ColumnName="IDUser" />
+                <ScalarProperty Name="Name" ColumnName="Name" />
+                <ScalarProperty Name="Surname" ColumnName="Surname" />
+                <ScalarProperty Name="Patronymic" ColumnName="Patronymic" />
+                <ScalarProperty Name="Number" ColumnName="Number" />
+                <ScalarProperty Name="IDPower" ColumnName="IDPower" />
+                <ScalarProperty Name="IDPost" ColumnName="IDPost" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="ConcertProgram">
+            <EntityTypeMapping TypeName="sm_RDKModel.ConcertProgram">
+              <MappingFragment StoreEntitySet="ConcertProgram">
+                <ScalarProperty Name="IDConcert" ColumnName="IDConcert" />
+                <ScalarProperty Name="IDNumber" ColumnName="IDNumber" />
+                <ScalarProperty Name="IndexNumber" ColumnName="IndexNumber" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+          <EntitySetMapping Name="RehearsalSchedule">
+            <EntityTypeMapping TypeName="sm_RDKModel.RehearsalSchedule">
+              <MappingFragment StoreEntitySet="RehearsalSchedule">
+                <ScalarProperty Name="IDSchedule" ColumnName="IDSchedule" />
+                <ScalarProperty Name="IDUser" ColumnName="IDUser" />
+                <ScalarProperty Name="RehearsalTime" ColumnName="RehearsalTime" />
+              </MappingFragment>
+            </EntityTypeMapping>
+          </EntitySetMapping>
+        </EntityContainerMapping>
+      </Mapping>
+    </edmx:Mappings>
+  </edmx:Runtime>
+  <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <Connection>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="MetadataArtifactProcessing" Value="EmbedInOutputAssembly" />
+      </DesignerInfoPropertySet>
+    </Connection>
+    <Options>
+      <DesignerInfoPropertySet>
+        <DesignerProperty Name="ValidateOnBuild" Value="true" />
+        <DesignerProperty Name="EnablePluralization" Value="false" />
+        <DesignerProperty Name="IncludeForeignKeysInModel" Value="true" />
+        <DesignerProperty Name="UseLegacyProvider" Value="false" />
+        <DesignerProperty Name="CodeGenerationStrategy" Value="Нет" />
+      </DesignerInfoPropertySet>
+    </Options>
+    <!-- Diagram content (shape and connector positions) -->
+    <Diagrams></Diagrams>
+  </Designer>
+</edmx:Edmx>

+ 28 - 0
PDK_Concert/ModelBD.edmx.diagram

@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<edmx:Edmx Version="3.0" xmlns:edmx="http://schemas.microsoft.com/ado/2009/11/edmx">
+ <!-- EF Designer content (DO NOT EDIT MANUALLY BELOW HERE) -->
+  <edmx:Designer xmlns="http://schemas.microsoft.com/ado/2009/11/edmx">
+    <!-- Diagram content (shape and connector positions) -->
+    <edmx:Diagrams>
+      <Diagram DiagramId="7cff3210b2dc40c680f2c4fd473a00ee" Name="Diagram1">
+        <EntityTypeShape EntityType="sm_RDKModel.Concert" Width="1.5" PointX="5.25" PointY="6.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.Logined" Width="1.5" PointX="0.75" PointY="3.875" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.Numbers" Width="1.5" PointX="5.25" PointY="3.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.Post" Width="1.5" PointX="0.75" PointY="0.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.Power" Width="1.5" PointX="0.75" PointY="7.125" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.RehearsalDate" Width="1.5" PointX="3" PointY="9.125" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.Users" Width="1.5" PointX="3" PointY="3.125" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.ConcertProgram" Width="1.5" PointX="7.5" PointY="3.75" IsExpanded="true" />
+        <EntityTypeShape EntityType="sm_RDKModel.RehearsalSchedule" Width="1.5" PointX="5.25" PointY="0.75" IsExpanded="true" />
+        <AssociationConnector Association="sm_RDKModel.FK_ConcertProgram_Concert" ManuallyRouted="false" />
+        <AssociationConnector Association="sm_RDKModel.FK_Users_Logined" ManuallyRouted="false" />
+        <AssociationConnector Association="sm_RDKModel.FK_ConcertProgram_Numbers" ManuallyRouted="false" />
+        <AssociationConnector Association="sm_RDKModel.FK_Numbers_Users" ManuallyRouted="false" />
+        <AssociationConnector Association="sm_RDKModel.FK_Users_Post" ManuallyRouted="false" />
+        <AssociationConnector Association="sm_RDKModel.FK_Users_Power" ManuallyRouted="false" />
+        <AssociationConnector Association="sm_RDKModel.FK_RehearsalSchedule_RehearsalDate" ManuallyRouted="false" />
+        <AssociationConnector Association="sm_RDKModel.FK_RehearsalSchedule_Users" ManuallyRouted="false" />
+      </Diagram>
+    </edmx:Diagrams>
+  </edmx:Designer>
+</edmx:Edmx>

+ 733 - 0
PDK_Concert/ModelBD.tt

@@ -0,0 +1,733 @@
+<#@ template language="C#" debug="false" hostspecific="true"#>
+<#@ include file="EF6.Utility.CS.ttinclude"#><#@ 
+ output extension=".cs"#><#
+
+const string inputFile = @"ModelBD.edmx";
+var textTransform = DynamicTextTransformation.Create(this);
+var code = new CodeGenerationTools(this);
+var ef = new MetadataTools(this);
+var typeMapper = new TypeMapper(code, ef, textTransform.Errors);
+var	fileManager = EntityFrameworkTemplateFileManager.Create(this);
+var itemCollection = new EdmMetadataLoader(textTransform.Host, textTransform.Errors).CreateEdmItemCollection(inputFile);
+var codeStringGenerator = new CodeStringGenerator(code, typeMapper, ef);
+
+if (!typeMapper.VerifyCaseInsensitiveTypeUniqueness(typeMapper.GetAllGlobalItems(itemCollection), inputFile))
+{
+    return string.Empty;
+}
+
+WriteHeader(codeStringGenerator, fileManager);
+
+foreach (var entity in typeMapper.GetItemsToGenerate<EntityType>(itemCollection))
+{
+    fileManager.StartNewFile(entity.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false)#>
+<#=codeStringGenerator.EntityClassOpening(entity)#>
+{
+<#
+    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(entity);
+    var collectionNavigationProperties = typeMapper.GetCollectionNavigationProperties(entity);
+    var complexProperties = typeMapper.GetComplexProperties(entity);
+
+    if (propertiesWithDefaultValues.Any() || collectionNavigationProperties.Any() || complexProperties.Any())
+    {
+#>
+    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+    public <#=code.Escape(entity)#>()
+    {
+<#
+        foreach (var edmProperty in propertiesWithDefaultValues)
+        {
+#>
+        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
+<#
+        }
+
+        foreach (var navigationProperty in collectionNavigationProperties)
+        {
+#>
+        this.<#=code.Escape(navigationProperty)#> = new HashSet<<#=typeMapper.GetTypeName(navigationProperty.ToEndMember.GetEntityType())#>>();
+<#
+        }
+
+        foreach (var complexProperty in complexProperties)
+        {
+#>
+        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
+<#
+        }
+#>
+    }
+
+<#
+    }
+
+    var simpleProperties = typeMapper.GetSimpleProperties(entity);
+    if (simpleProperties.Any())
+    {
+        foreach (var edmProperty in simpleProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+
+    if (complexProperties.Any())
+    {
+#>
+
+<#
+        foreach(var complexProperty in complexProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(complexProperty)#>
+<#
+        }
+    }
+
+    var navigationProperties = typeMapper.GetNavigationProperties(entity);
+    if (navigationProperties.Any())
+    {
+#>
+
+<#
+        foreach (var navigationProperty in navigationProperties)
+        {
+            if (navigationProperty.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many)
+            {
+#>
+    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+<#
+            }
+#>
+    <#=codeStringGenerator.NavigationProperty(navigationProperty)#>
+<#
+        }
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+foreach (var complex in typeMapper.GetItemsToGenerate<ComplexType>(itemCollection))
+{
+    fileManager.StartNewFile(complex.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
+<#=Accessibility.ForType(complex)#> partial class <#=code.Escape(complex)#>
+{
+<#
+    var complexProperties = typeMapper.GetComplexProperties(complex);
+    var propertiesWithDefaultValues = typeMapper.GetPropertiesWithDefaultValues(complex);
+
+    if (propertiesWithDefaultValues.Any() || complexProperties.Any())
+    {
+#>
+    public <#=code.Escape(complex)#>()
+    {
+<#
+        foreach (var edmProperty in propertiesWithDefaultValues)
+        {
+#>
+        this.<#=code.Escape(edmProperty)#> = <#=typeMapper.CreateLiteral(edmProperty.DefaultValue)#>;
+<#
+        }
+
+        foreach (var complexProperty in complexProperties)
+        {
+#>
+        this.<#=code.Escape(complexProperty)#> = new <#=typeMapper.GetTypeName(complexProperty.TypeUsage)#>();
+<#
+        }
+#>
+    }
+
+<#
+    }
+
+    var simpleProperties = typeMapper.GetSimpleProperties(complex);
+    if (simpleProperties.Any())
+    {
+        foreach(var edmProperty in simpleProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+
+    if (complexProperties.Any())
+    {
+#>
+
+<#
+        foreach(var edmProperty in complexProperties)
+        {
+#>
+    <#=codeStringGenerator.Property(edmProperty)#>
+<#
+        }
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+foreach (var enumType in typeMapper.GetEnumItemsToGenerate(itemCollection))
+{
+    fileManager.StartNewFile(enumType.Name + ".cs");
+    BeginNamespace(code);
+#>
+<#=codeStringGenerator.UsingDirectives(inHeader: false, includeCollections: false)#>
+<#
+    if (typeMapper.EnumIsFlags(enumType))
+    {
+#>
+[Flags]
+<#
+    }
+#>
+<#=codeStringGenerator.EnumOpening(enumType)#>
+{
+<#
+    var foundOne = false;
+    
+    foreach (MetadataItem member in typeMapper.GetEnumMembers(enumType))
+    {
+        foundOne = true;
+#>
+    <#=code.Escape(typeMapper.GetEnumMemberName(member))#> = <#=typeMapper.GetEnumMemberValue(member)#>,
+<#
+    }
+
+    if (foundOne)
+    {
+        this.GenerationEnvironment.Remove(this.GenerationEnvironment.Length - 3, 1);
+    }
+#>
+}
+<#
+    EndNamespace(code);
+}
+
+fileManager.Process();
+
+#>
+<#+
+
+public void WriteHeader(CodeStringGenerator codeStringGenerator, EntityFrameworkTemplateFileManager fileManager)
+{
+    fileManager.StartHeader();
+#>
+//------------------------------------------------------------------------------
+// <auto-generated>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine1")#>
+//
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine2")#>
+// <#=CodeGenerationTools.GetResourceString("Template_GeneratedCodeCommentLine3")#>
+// </auto-generated>
+//------------------------------------------------------------------------------
+<#=codeStringGenerator.UsingDirectives(inHeader: true)#>
+<#+
+    fileManager.EndBlock();
+}
+
+public void BeginNamespace(CodeGenerationTools code)
+{
+    var codeNamespace = code.VsNamespaceSuggestion();
+    if (!String.IsNullOrEmpty(codeNamespace))
+    {
+#>
+namespace <#=code.EscapeNamespace(codeNamespace)#>
+{
+<#+
+        PushIndent("    ");
+    }
+}
+
+public void EndNamespace(CodeGenerationTools code)
+{
+    if (!String.IsNullOrEmpty(code.VsNamespaceSuggestion()))
+    {
+        PopIndent();
+#>
+}
+<#+
+    }
+}
+
+public const string TemplateId = "CSharp_DbContext_Types_EF6";
+
+public class CodeStringGenerator
+{
+    private readonly CodeGenerationTools _code;
+    private readonly TypeMapper _typeMapper;
+    private readonly MetadataTools _ef;
+
+    public CodeStringGenerator(CodeGenerationTools code, TypeMapper typeMapper, MetadataTools ef)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(typeMapper, "typeMapper");
+        ArgumentNotNull(ef, "ef");
+
+        _code = code;
+        _typeMapper = typeMapper;
+        _ef = ef;
+    }
+
+    public string Property(EdmProperty edmProperty)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            Accessibility.ForProperty(edmProperty),
+            _typeMapper.GetTypeName(edmProperty.TypeUsage),
+            _code.Escape(edmProperty),
+            _code.SpaceAfter(Accessibility.ForGetter(edmProperty)),
+            _code.SpaceAfter(Accessibility.ForSetter(edmProperty)));
+    }
+
+    public string NavigationProperty(NavigationProperty navProp)
+    {
+        var endType = _typeMapper.GetTypeName(navProp.ToEndMember.GetEntityType());
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2} {{ {3}get; {4}set; }}",
+            AccessibilityAndVirtual(Accessibility.ForNavigationProperty(navProp)),
+            navProp.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many ? ("ICollection<" + endType + ">") : endType,
+            _code.Escape(navProp),
+            _code.SpaceAfter(Accessibility.ForGetter(navProp)),
+            _code.SpaceAfter(Accessibility.ForSetter(navProp)));
+    }
+    
+    public string AccessibilityAndVirtual(string accessibility)
+    {
+        return accessibility + (accessibility != "private" ? " virtual" : "");
+    }
+    
+    public string EntityClassOpening(EntityType entity)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1}partial class {2}{3}",
+            Accessibility.ForType(entity),
+            _code.SpaceAfter(_code.AbstractOption(entity)),
+            _code.Escape(entity),
+            _code.StringBefore(" : ", _typeMapper.GetTypeName(entity.BaseType)));
+    }
+    
+    public string EnumOpening(SimpleType enumType)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} enum {1} : {2}",
+            Accessibility.ForType(enumType),
+            _code.Escape(enumType),
+            _code.Escape(_typeMapper.UnderlyingClrType(enumType)));
+        }
+    
+    public void WriteFunctionParameters(EdmFunction edmFunction, Action<string, string, string, string> writeParameter)
+    {
+        var parameters = FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+        foreach (var parameter in parameters.Where(p => p.NeedsLocalVariable))
+        {
+            var isNotNull = parameter.IsNullableOfT ? parameter.FunctionParameterName + ".HasValue" : parameter.FunctionParameterName + " != null";
+            var notNullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", " + parameter.FunctionParameterName + ")";
+            var nullInit = "new ObjectParameter(\"" + parameter.EsqlParameterName + "\", typeof(" + TypeMapper.FixNamespaces(parameter.RawClrTypeName) + "))";
+            writeParameter(parameter.LocalVariableName, isNotNull, notNullInit, nullInit);
+        }
+    }
+    
+    public string ComposableFunctionMethod(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} IQueryable<{1}> {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            _code.Escape(edmFunction),
+            string.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray()));
+    }
+    
+    public string ComposableCreateQuery(EdmFunction edmFunction, string modelNamespace)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.CreateQuery<{0}>(\"[{1}].[{2}]({3})\"{4});",
+            _typeMapper.GetTypeName(_typeMapper.GetReturnType(edmFunction), modelNamespace),
+            edmFunction.NamespaceName,
+            edmFunction.Name,
+            string.Join(", ", parameters.Select(p => "@" + p.EsqlParameterName).ToArray()),
+            _code.StringBefore(", ", string.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray())));
+    }
+    
+    public string FunctionMethod(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var paramList = String.Join(", ", parameters.Select(p => TypeMapper.FixNamespaces(p.FunctionParameterType) + " " + p.FunctionParameterName).ToArray());
+        if (includeMergeOption)
+        {
+            paramList = _code.StringAfter(paramList, ", ") + "MergeOption mergeOption";
+        }
+
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} {1} {2}({3})",
+            AccessibilityAndVirtual(Accessibility.ForMethod(edmFunction)),
+            returnType == null ? "int" : "ObjectResult<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            _code.Escape(edmFunction),
+            paramList);
+    }
+    
+    public string ExecuteFunction(EdmFunction edmFunction, string modelNamespace, bool includeMergeOption)
+    {
+        var parameters = _typeMapper.GetParameters(edmFunction);
+        var returnType = _typeMapper.GetReturnType(edmFunction);
+
+        var callParams = _code.StringBefore(", ", String.Join(", ", parameters.Select(p => p.ExecuteParameterName).ToArray()));
+        if (includeMergeOption)
+        {
+            callParams = ", mergeOption" + callParams;
+        }
+        
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "return ((IObjectContextAdapter)this).ObjectContext.ExecuteFunction{0}(\"{1}\"{2});",
+            returnType == null ? "" : "<" + _typeMapper.GetTypeName(returnType, modelNamespace) + ">",
+            edmFunction.Name,
+            callParams);
+    }
+    
+    public string DbSet(EntitySet entitySet)
+    {
+        return string.Format(
+            CultureInfo.InvariantCulture,
+            "{0} virtual DbSet<{1}> {2} {{ get; set; }}",
+            Accessibility.ForReadOnlyProperty(entitySet),
+            _typeMapper.GetTypeName(entitySet.ElementType),
+            _code.Escape(entitySet));
+    }
+
+    public string UsingDirectives(bool inHeader, bool includeCollections = true)
+    {
+        return inHeader == string.IsNullOrEmpty(_code.VsNamespaceSuggestion())
+            ? string.Format(
+                CultureInfo.InvariantCulture,
+                "{0}using System;{1}" +
+                "{2}",
+                inHeader ? Environment.NewLine : "",
+                includeCollections ? (Environment.NewLine + "using System.Collections.Generic;") : "",
+                inHeader ? "" : Environment.NewLine)
+            : "";
+    }
+}
+
+public class TypeMapper
+{
+    private const string ExternalTypeNameAttributeName = @"http://schemas.microsoft.com/ado/2006/04/codegeneration:ExternalTypeName";
+
+    private readonly System.Collections.IList _errors;
+    private readonly CodeGenerationTools _code;
+    private readonly MetadataTools _ef;
+
+    public TypeMapper(CodeGenerationTools code, MetadataTools ef, System.Collections.IList errors)
+    {
+        ArgumentNotNull(code, "code");
+        ArgumentNotNull(ef, "ef");
+        ArgumentNotNull(errors, "errors");
+
+        _code = code;
+        _ef = ef;
+        _errors = errors;
+    }
+
+    public static string FixNamespaces(string typeName)
+    {
+        return typeName.Replace("System.Data.Spatial.", "System.Data.Entity.Spatial.");
+    }
+
+    public string GetTypeName(TypeUsage typeUsage)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace: null);
+    }
+
+    public string GetTypeName(EdmType edmType)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: null);
+    }
+
+    public string GetTypeName(TypeUsage typeUsage, string modelNamespace)
+    {
+        return typeUsage == null ? null : GetTypeName(typeUsage.EdmType, _ef.IsNullable(typeUsage), modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, string modelNamespace)
+    {
+        return GetTypeName(edmType, isNullable: null, modelNamespace: modelNamespace);
+    }
+
+    public string GetTypeName(EdmType edmType, bool? isNullable, string modelNamespace)
+    {
+        if (edmType == null)
+        {
+            return null;
+        }
+
+        var collectionType = edmType as CollectionType;
+        if (collectionType != null)
+        {
+            return String.Format(CultureInfo.InvariantCulture, "ICollection<{0}>", GetTypeName(collectionType.TypeUsage, modelNamespace));
+        }
+
+        var typeName = _code.Escape(edmType.MetadataProperties
+                                .Where(p => p.Name == ExternalTypeNameAttributeName)
+                                .Select(p => (string)p.Value)
+                                .FirstOrDefault())
+            ?? (modelNamespace != null && edmType.NamespaceName != modelNamespace ?
+                _code.CreateFullName(_code.EscapeNamespace(edmType.NamespaceName), _code.Escape(edmType)) :
+                _code.Escape(edmType));
+
+        if (edmType is StructuralType)
+        {
+            return typeName;
+        }
+
+        if (edmType is SimpleType)
+        {
+            var clrType = UnderlyingClrType(edmType);
+            if (!IsEnumType(edmType))
+            {
+                typeName = _code.Escape(clrType);
+            }
+
+            typeName = FixNamespaces(typeName);
+
+            return clrType.IsValueType && isNullable == true ?
+                String.Format(CultureInfo.InvariantCulture, "Nullable<{0}>", typeName) :
+                typeName;
+        }
+
+        throw new ArgumentException("edmType");
+    }
+    
+    public Type UnderlyingClrType(EdmType edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        var primitiveType = edmType as PrimitiveType;
+        if (primitiveType != null)
+        {
+            return primitiveType.ClrEquivalentType;
+        }
+
+        if (IsEnumType(edmType))
+        {
+            return GetEnumUnderlyingType(edmType).ClrEquivalentType;
+        }
+
+        return typeof(object);
+    }
+    
+    public object GetEnumMemberValue(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var valueProperty = enumMember.GetType().GetProperty("Value");
+        return valueProperty == null ? null : valueProperty.GetValue(enumMember, null);
+    }
+    
+    public string GetEnumMemberName(MetadataItem enumMember)
+    {
+        ArgumentNotNull(enumMember, "enumMember");
+        
+        var nameProperty = enumMember.GetType().GetProperty("Name");
+        return nameProperty == null ? null : (string)nameProperty.GetValue(enumMember, null);
+    }
+
+    public System.Collections.IEnumerable GetEnumMembers(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        var membersProperty = enumType.GetType().GetProperty("Members");
+        return membersProperty != null 
+            ? (System.Collections.IEnumerable)membersProperty.GetValue(enumType, null)
+            : Enumerable.Empty<MetadataItem>();
+    }
+    
+    public bool EnumIsFlags(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+        
+        var isFlagsProperty = enumType.GetType().GetProperty("IsFlags");
+        return isFlagsProperty != null && (bool)isFlagsProperty.GetValue(enumType, null);
+    }
+
+    public bool IsEnumType(GlobalItem edmType)
+    {
+        ArgumentNotNull(edmType, "edmType");
+
+        return edmType.GetType().Name == "EnumType";
+    }
+
+    public PrimitiveType GetEnumUnderlyingType(EdmType enumType)
+    {
+        ArgumentNotNull(enumType, "enumType");
+
+        return (PrimitiveType)enumType.GetType().GetProperty("UnderlyingType").GetValue(enumType, null);
+    }
+
+    public string CreateLiteral(object value)
+    {
+        if (value == null || value.GetType() != typeof(TimeSpan))
+        {
+            return _code.CreateLiteral(value);
+        }
+
+        return string.Format(CultureInfo.InvariantCulture, "new TimeSpan({0})", ((TimeSpan)value).Ticks);
+    }
+    
+    public bool VerifyCaseInsensitiveTypeUniqueness(IEnumerable<string> types, string sourceFile)
+    {
+        ArgumentNotNull(types, "types");
+        ArgumentNotNull(sourceFile, "sourceFile");
+        
+        var hash = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
+        if (types.Any(item => !hash.Add(item)))
+        {
+            _errors.Add(
+                new CompilerError(sourceFile, -1, -1, "6023",
+                    String.Format(CultureInfo.CurrentCulture, CodeGenerationTools.GetResourceString("Template_CaseInsensitiveTypeConflict"))));
+            return false;
+        }
+        return true;
+    }
+    
+    public IEnumerable<SimpleType> GetEnumItemsToGenerate(IEnumerable<GlobalItem> itemCollection)
+    {
+        return GetItemsToGenerate<SimpleType>(itemCollection)
+            .Where(e => IsEnumType(e));
+    }
+    
+    public IEnumerable<T> GetItemsToGenerate<T>(IEnumerable<GlobalItem> itemCollection) where T: EdmType
+    {
+        return itemCollection
+            .OfType<T>()
+            .Where(i => !i.MetadataProperties.Any(p => p.Name == ExternalTypeNameAttributeName))
+            .OrderBy(i => i.Name);
+    }
+
+    public IEnumerable<string> GetAllGlobalItems(IEnumerable<GlobalItem> itemCollection)
+    {
+        return itemCollection
+            .Where(i => i is EntityType || i is ComplexType || i is EntityContainer || IsEnumType(i))
+            .Select(g => GetGlobalItemName(g));
+    }
+
+    public string GetGlobalItemName(GlobalItem item)
+    {
+        if (item is EdmType)
+        {
+            return ((EdmType)item).Name;
+        }
+        else
+        {
+            return ((EntityContainer)item).Name;
+        }
+    }
+
+    public IEnumerable<EdmProperty> GetSimpleProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetSimpleProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+    
+    public IEnumerable<EdmProperty> GetComplexProperties(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is ComplexType && p.DeclaringType == type);
+    }
+
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(EntityType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+    
+    public IEnumerable<EdmProperty> GetPropertiesWithDefaultValues(ComplexType type)
+    {
+        return type.Properties.Where(p => p.TypeUsage.EdmType is SimpleType && p.DeclaringType == type && p.DefaultValue != null);
+    }
+
+    public IEnumerable<NavigationProperty> GetNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type);
+    }
+    
+    public IEnumerable<NavigationProperty> GetCollectionNavigationProperties(EntityType type)
+    {
+        return type.NavigationProperties.Where(np => np.DeclaringType == type && np.ToEndMember.RelationshipMultiplicity == RelationshipMultiplicity.Many);
+    }
+    
+    public FunctionParameter GetReturnParameter(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var returnParamsProperty = edmFunction.GetType().GetProperty("ReturnParameters");
+        return returnParamsProperty == null
+            ? edmFunction.ReturnParameter
+            : ((IEnumerable<FunctionParameter>)returnParamsProperty.GetValue(edmFunction, null)).FirstOrDefault();
+    }
+
+    public bool IsComposable(EdmFunction edmFunction)
+    {
+        ArgumentNotNull(edmFunction, "edmFunction");
+
+        var isComposableProperty = edmFunction.GetType().GetProperty("IsComposableAttribute");
+        return isComposableProperty != null && (bool)isComposableProperty.GetValue(edmFunction, null);
+    }
+
+    public IEnumerable<FunctionImportParameter> GetParameters(EdmFunction edmFunction)
+    {
+        return FunctionImportParameter.Create(edmFunction.Parameters, _code, _ef);
+    }
+
+    public TypeUsage GetReturnType(EdmFunction edmFunction)
+    {
+        var returnParam = GetReturnParameter(edmFunction);
+        return returnParam == null ? null : _ef.GetElementType(returnParam.TypeUsage);
+    }
+    
+    public bool GenerateMergeOptionFunction(EdmFunction edmFunction, bool includeMergeOption)
+    {
+        var returnType = GetReturnType(edmFunction);
+        return !includeMergeOption && returnType != null && returnType.EdmType.BuiltInTypeKind == BuiltInTypeKind.EntityType;
+    }
+}
+
+public static void ArgumentNotNull<T>(T arg, string name) where T : class
+{
+    if (arg == null)
+    {
+        throw new ArgumentNullException(name);
+    }
+}
+#>

+ 31 - 0
PDK_Concert/Numbers.cs

@@ -0,0 +1,31 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Numbers
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Numbers()
+        {
+            this.ConcertProgram = new HashSet<ConcertProgram>();
+        }
+    
+        public int IDNumber { get; set; }
+        public int IDUser { get; set; }
+        public string Title { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<ConcertProgram> ConcertProgram { get; set; }
+        public virtual Users Users { get; set; }
+    }
+}

+ 1 - 1
PDK_Concert/Pages/AuthorizationPage.xaml

@@ -12,7 +12,7 @@
         <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
             <TextBlock Text="Авторизация" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
             <GroupBox Header="Логин">
-                <TextBox  Name="tbName"/>
+                <TextBox  Name="tbLogin"/>
             </GroupBox>
             <GroupBox Header="Пароль">
                 <PasswordBox Name="psPassword"/>

+ 11 - 1
PDK_Concert/Pages/AuthorizationPage.xaml.cs

@@ -29,7 +29,17 @@ namespace PDK_Concert.Pages
 
         private void go_Click(object sender, RoutedEventArgs e)
         {
-            FrameClass.frame.Navigate(new MainPage());
+            int passwordHash = psPassword.Password.GetHashCode();
+            Logined logined = DataBaseClass.connect.Logined.FirstOrDefault(x => x.Login == tbLogin.Text && x.Password == passwordHash);
+            if (logined != null)
+            {
+                MessageBox.Show("Успешный вход", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                FrameClass.frame.Navigate(new MainPage(logined));
+            }
+            else
+            {
+                MessageBox.Show("Такого пользователя не существует", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
         }
     }
 }

+ 37 - 0
PDK_Concert/Pages/ConcertPage.xaml

@@ -0,0 +1,37 @@
+<Page x:Class="PDK_Concert.Pages.CocertPage"
+      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:PDK_Concert.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="CocertPage">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="60"/>
+            <RowDefinition Height="1*"/>
+            <RowDefinition Height="50"/>
+        </Grid.RowDefinitions>
+        <TextBlock Grid.Column="1" Text="Актуальные концерты" Margin="10" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
+        <ListView SelectionChanged="listConcent_SelectionChanged" Grid.Row="1" Grid.Column="1" HorizontalContentAlignment="Stretch" Name="listConcent">
+            <ListView.ItemTemplate>
+                <DataTemplate>
+                    <StackPanel>
+                        <TextBlock TextWrapping="Wrap" Style="{StaticResource List}">
+                                    <Run Text="Дата:" FontWeight="Bold"/>
+                                    <Run Text="{Binding Date, StringFormat={}dd.MM.yyyy}"/>
+                        </TextBlock>
+                        <TextBlock TextWrapping="Wrap" Style="{StaticResource List}">
+                                    <Run Text="Название: " FontWeight="Bold"/>
+                                    <Run Text="{Binding Title}"/>
+                        </TextBlock>
+                    </StackPanel>
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+        <TextBlock Name="not" Text="Актуальных концертов нет" Grid.Row="1" Style="{StaticResource Title}" TextWrapping="Wrap" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed"/>
+        <Button Grid.Column="1" Click="btConcert_Click" Margin="0" Content="Прошлые концерты" Grid.Row="2" Name="btConcert"/>
+    </Grid>
+</Page>

+ 46 - 0
PDK_Concert/Pages/ConcertPage.xaml.cs

@@ -0,0 +1,46 @@
+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 PDK_Concert.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для CocertPage.xaml
+    /// </summary>
+    public partial class CocertPage : Page
+    {
+        Logined logined;
+        public CocertPage(Logined logined)
+        {
+            InitializeComponent();
+            this.logined = logined;
+            listConcent.ItemsSource = Classes.DataBaseClass.connect.Concert.ToList();
+            if (listConcent == null)
+            {
+                not.Visibility = Visibility.Visible;
+                listConcent.Visibility = Visibility.Collapsed;
+            }
+        }
+
+        private void listConcent_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+        }
+
+        private void btConcert_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+    }
+}

+ 18 - 44
PDK_Concert/Pages/MainPage.xaml

@@ -13,53 +13,27 @@
             <RowDefinition Height="50"/>
             <RowDefinition Height="*"/>
         </Grid.RowDefinitions>
+        <Grid.ColumnDefinitions>
+            <ColumnDefinition Width="250"/>
+            <ColumnDefinition Width="*"/>
+        </Grid.ColumnDefinitions>
         <Button Click="btProfile_Click" Content="Личный кабинет" Margin="10 0 0 0" Name="btProfile" HorizontalAlignment="Left" Width="200"/>
-        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
-            <TextBlock Name="fio" FontSize="20" Style="{StaticResource Title}" Margin="0 0 10 0"/>
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="1">
+            <TextBlock VerticalAlignment="Center" Name="fio" FontSize="20" Style="{StaticResource Title}" Margin="0 0 10 0"/>
             <Button Click="Button_Click" Content="Выход" Margin="0 0 10 0" Width="200"/>
         </StackPanel>
-        <StackPanel Grid.Row="1">
-            <Grid>
-                <Grid.ColumnDefinitions>
-                    <ColumnDefinition Width="1*"/>
-                    <ColumnDefinition Width="1*"/>
-                </Grid.ColumnDefinitions>
-                <Grid.RowDefinitions>
-                    <RowDefinition Height="50"/>
-                    <RowDefinition Height="1*"/>
-                    <RowDefinition Height="50"/>
-                </Grid.RowDefinitions>
-                <TextBlock Text="График репетиций" FontSize="20" Margin="10" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
-                <ListView SelectionChanged="listRehearsal_SelectionChanged" Grid.Row="1" HorizontalContentAlignment="Stretch" Name="listRehearsal">
-                        <ListView.ItemTemplate>
-                            <DataTemplate>
-                                <StackPanel>
-                                    <TextBlock Text="{Binding data, StringFormat={}dd.MM.yyyy}" Style="{StaticResource List}"/>
-                                </StackPanel>
-                            </DataTemplate>
-                        </ListView.ItemTemplate>
-                    </ListView>
-                <Button Click="btNewDay_Click" Margin="0" Content="Новый день репетиций" Grid.Row="2" Name="btNewDay"/>
-
-                <TextBlock Grid.Column="1" Text="Актуальные концерты" FontSize="20" Margin="10" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
-                <ListView SelectionChanged="listConcent_SelectionChanged" Grid.Row="1" Grid.Column="1" HorizontalContentAlignment="Stretch" Name="listConcent">
-                    <ListView.ItemTemplate>
-                        <DataTemplate>
-                            <StackPanel>
-                                <TextBlock TextWrapping="Wrap" Style="{StaticResource List}">
-                                    <Run Text="Дата:" FontWeight="Bold"/>
-                                    <Run Text="{Binding Date, StringFormat={}dd.MM.yyyy}"/>
-                                </TextBlock>
-                                <TextBlock TextWrapping="Wrap" Style="{StaticResource List}">
-                                    <Run Text="Название: " FontWeight="Bold"/>
-                                    <Run Text="{Binding Title}"/>
-                                </TextBlock>
-                            </StackPanel>
-                        </DataTemplate>
-                    </ListView.ItemTemplate>
-                </ListView>
-                <Button Grid.Column="1" Click="btConcert_Click" Margin="0" Content="Прошлые концерты" Grid.Row="2" Name="btConcert"/>
-            </Grid>
+        <StackPanel Grid.Row="1" Grid.Column="1">
+            <Frame Name="menuFrame" NavigationUIVisibility="Hidden"/>
+        </StackPanel>
+        <StackPanel Grid.Row="1" Width="240" VerticalAlignment="Center">
+            <Border BorderBrush="White" BorderThickness="2">
+                <StackPanel >
+                    <TextBlock Text="Меню" Style="{StaticResource Title}" HorizontalAlignment="Center" Margin="0 0 0 50"/>
+                    <TextBlock MouseDown="RehearsalSchedule_MouseDown" Margin="5 0 0 10" Text="График репетиций" Name="RehearsalSchedule" Style="{StaticResource Menu}"/>
+                    <TextBlock MouseDown="Concert_MouseDown" Margin="5 0 0 10" Text="Актуальные концерты" Name="Concert" Style="{StaticResource Menu}"/>
+                    <TextBlock MouseDown="Numbers_MouseDown" Margin="5 0 0 10" Text="Мои номера" Name="Numbers" Style="{StaticResource Menu}"/>
+                </StackPanel>
+            </Border>
         </StackPanel>
     </Grid>
 </Page>

+ 13 - 13
PDK_Concert/Pages/MainPage.xaml.cs

@@ -22,14 +22,19 @@ namespace PDK_Concert.Pages
     /// </summary>
     public partial class MainPage : Page
     {
-        public MainPage()
+        Logined logined;
+        public MainPage(Logined logined)
         {
             InitializeComponent();
+            Classes.FrameClass.menuFrame = menuFrame;
+            this.logined = logined;
+            Users users = DataBaseClass.connect.Users.FirstOrDefault(x => x.IDUser == logined.ID);
+            fio.Text=users.Surname+" "+users.Name+" "+users.Patronymic+", "+users.Post.Title;
         }
 
         private void btProfile_Click(object sender, RoutedEventArgs e)
         {
-
+            FrameClass.frame.Navigate(new ProfilePage(this,logined));
         }
 
         private void Button_Click(object sender, RoutedEventArgs e)
@@ -37,24 +42,19 @@ namespace PDK_Concert.Pages
             FrameClass.frame.Navigate(new AuthorizationPage());
         }
 
-        private void listRehearsal_SelectionChanged(object sender, SelectionChangedEventArgs e)
-        {
-
-        }
-
-        private void btNewDay_Click(object sender, RoutedEventArgs e)
+        private void RehearsalSchedule_MouseDown(object sender, MouseButtonEventArgs e)
         {
-
+            Classes.FrameClass.menuFrame.Navigate(new RehearsalSchedulePage(logined));
         }
 
-        private void listConcent_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        private void Concert_MouseDown(object sender, MouseButtonEventArgs e)
         {
-
+            FrameClass.menuFrame.Navigate(new CocertPage(logined));
         }
 
-        private void btConcert_Click(object sender, RoutedEventArgs e)
+        private void Numbers_MouseDown(object sender, MouseButtonEventArgs e)
         {
-
+            FrameClass.menuFrame.Navigate(new NumberPage(logined));
         }
     }
 }

+ 30 - 0
PDK_Concert/Pages/NumberPage.xaml

@@ -0,0 +1,30 @@
+<Page x:Class="PDK_Concert.Pages.NumberPage"
+      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:PDK_Concert.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="NumberPage">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="60"/>
+            <RowDefinition Height="*"/>
+            <RowDefinition Height="50"/>
+        </Grid.RowDefinitions>
+        <TextBlock Text="Мои номера" Margin="10" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
+        <ListView Grid.Row="1" HorizontalContentAlignment="Stretch" Name="listNumbers">
+            <ListView.ItemTemplate>
+                <DataTemplate>
+                    <StackPanel>
+                        <TextBlock Text="{Binding Title, StringFormat={}dd.MM.yyyy}" Style="{StaticResource List}"/>
+                    </StackPanel>
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+        <TextBlock Text="Номеров нет" TextWrapping="Wrap" Name="not" Grid.Row="1" Style="{StaticResource Title}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed"/>
+        <Button Click="btNewNumber_Click" Margin="0" Content="Добавить новый номер" Grid.Row="2" Name="btNewNumber"/>
+    </Grid>
+</Page>

+ 41 - 0
PDK_Concert/Pages/NumberPage.xaml.cs

@@ -0,0 +1,41 @@
+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 PDK_Concert.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для NumberPage.xaml
+    /// </summary>
+    public partial class NumberPage : Page
+    {
+        Logined logined;
+        public NumberPage(Logined logined)
+        {
+            InitializeComponent();
+            this.logined = logined;
+            listNumbers.ItemsSource = Classes.DataBaseClass.connect.Numbers.Where(x => x.IDUser == logined.ID).ToList();
+            if(listNumbers==null)
+            {
+                not.Visibility = Visibility.Visible;
+                listNumbers.Visibility = Visibility.Collapsed;
+            }
+        }
+
+        private void btNewNumber_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+    }
+}

+ 36 - 0
PDK_Concert/Pages/ProfilePage.xaml

@@ -0,0 +1,36 @@
+<Page x:Class="PDK_Concert.Pages.ProfilePage"
+      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:PDK_Concert.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="ProfilePage">
+
+    <Grid>
+        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
+            <TextBlock Text="Личный кабинет" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
+            <GroupBox Header="Имя">
+                <TextBox Text="{Binding Users.Name}"/>
+            </GroupBox>
+            <GroupBox Header="Отчество">
+                <TextBox Text="{Binding Users.Patronymic}"/>
+            </GroupBox>
+            <GroupBox Header="Фамилия">
+                <TextBox Text="{Binding Users.Surname}"/>
+            </GroupBox>
+            <GroupBox Header="Номер телефона">
+                <TextBox Text="{Binding Users.Number}"/>
+            </GroupBox>
+            <GroupBox Header="Должность">
+                <TextBlock Padding="2" Foreground="Black" Background="White" Text="{Binding Users.Post.Title}"/>
+            </GroupBox>
+            <StackPanel Orientation="Horizontal">
+                <Button Click="save_Click" Content="Сохранить" Name="save"/>
+                <Button Click="back_Click" Content="Назад" Name="back"/>
+            </StackPanel>
+            <Button Click="updatePassword_Click" Content="Изменить пароль" Name="updatePassword"/>
+        </StackPanel>
+    </Grid>
+</Page>

+ 50 - 0
PDK_Concert/Pages/ProfilePage.xaml.cs

@@ -0,0 +1,50 @@
+using PDK_Concert.Classes;
+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 PDK_Concert.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для ProfilePage.xaml
+    /// </summary>
+    public partial class ProfilePage : Page
+    {
+        Page page;
+        Logined logined;
+        public ProfilePage(Page page, Logined logined)
+        {
+            InitializeComponent();
+            this.page = page;
+            this.logined = logined;
+            DataContext = logined;
+        }
+
+        private void save_Click(object sender, RoutedEventArgs e)
+        {
+            MessageBox.Show("Личные данные успешно обновлены", "Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+            DataBaseClass.connect.SaveChanges();
+        }
+
+        private void back_Click(object sender, RoutedEventArgs e)
+        {
+            FrameClass.frame.Navigate(page);
+        }
+
+        private void updatePassword_Click(object sender, RoutedEventArgs e)
+        {
+            Classes.FrameClass.frame.Navigate(new UpdatePasswordPage(logined, this));
+        }
+    }
+}

+ 30 - 0
PDK_Concert/Pages/RehearsalSchedulePage.xaml

@@ -0,0 +1,30 @@
+<Page x:Class="PDK_Concert.Pages.RehearsalSchedulePage"
+      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:PDK_Concert.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="RehearsalSchedulePage">
+
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="60"/>
+            <RowDefinition Height="1*"/>
+            <RowDefinition Height="50"/>
+        </Grid.RowDefinitions>
+        <TextBlock Text="График репетиций" Margin="10" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
+        <ListView SelectionChanged="listRehearsal_SelectionChanged" Grid.Row="1" HorizontalContentAlignment="Stretch" Name="listRehearsal">
+            <ListView.ItemTemplate>
+                <DataTemplate>
+                    <StackPanel>
+                        <TextBlock Text="{Binding RehearsalDate, StringFormat={}dd.MM.yyyy}" Style="{StaticResource List}"/>
+                    </StackPanel>
+                </DataTemplate>
+            </ListView.ItemTemplate>
+        </ListView>
+        <TextBlock Text="Репетиций нет" TextWrapping="Wrap" Name="not" Grid.Row="1" Style="{StaticResource Title}" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="Collapsed"/>
+        <Button Click="btNewDay_Click" Margin="0" Content="Новый день репетиций" Grid.Row="2" Name="btNewDay"/>
+    </Grid>
+</Page>

+ 46 - 0
PDK_Concert/Pages/RehearsalSchedulePage.xaml.cs

@@ -0,0 +1,46 @@
+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 PDK_Concert.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для RehearsalSchedulePage.xaml
+    /// </summary>
+    public partial class RehearsalSchedulePage : Page
+    {
+        Logined logined;
+        public RehearsalSchedulePage(Logined logined)
+        {
+            InitializeComponent();
+            this.logined = logined;
+            listRehearsal.ItemsSource = Classes.DataBaseClass.connect.RehearsalDate.ToList();
+            if (listRehearsal == null)
+            {
+                not.Visibility = Visibility.Visible;
+                listRehearsal.Visibility = Visibility.Collapsed;
+            }
+        }
+
+        private void btNewDay_Click(object sender, RoutedEventArgs e)
+        {
+
+        }
+
+        private void listRehearsal_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        {
+
+        }
+    }
+}

+ 29 - 0
PDK_Concert/Pages/UpdatePasswordPage.xaml

@@ -0,0 +1,29 @@
+<Page x:Class="PDK_Concert.Pages.UpdatePasswordPage"
+      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:PDK_Concert.Pages"
+      mc:Ignorable="d" 
+      d:DesignHeight="450" d:DesignWidth="800"
+      Title="UpdatePasswordPage">
+
+    <Grid>
+        <StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
+            <TextBlock Text="Смена пароля" Style="{StaticResource Title}" HorizontalAlignment="Center"/>
+            <GroupBox Header="Старый пароль">
+                <PasswordBox Name="oldPassword"/>
+            </GroupBox>
+            <GroupBox Header="Новый пароль">
+                <PasswordBox Name="newPassword"/>
+            </GroupBox>
+            <GroupBox Header="Повтор нового пароля">
+                <PasswordBox Name="twoNewPassword"/>
+            </GroupBox>
+            <StackPanel Orientation="Horizontal">
+                <Button Content="Сохранить" Name="savePasswordd" Click="savePasswordd_Click"/>
+                <Button Content="Отмена" Name="back" Click="back_Click"/>
+            </StackPanel>
+        </StackPanel>
+    </Grid>
+</Page>

+ 62 - 0
PDK_Concert/Pages/UpdatePasswordPage.xaml.cs

@@ -0,0 +1,62 @@
+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 PDK_Concert.Pages
+{
+    /// <summary>
+    /// Логика взаимодействия для UpdatePasswordPage.xaml
+    /// </summary>
+    public partial class UpdatePasswordPage : Page
+    {
+        Logined logined;
+        Page page;
+        public UpdatePasswordPage(Logined logined, Page page)
+        {
+            InitializeComponent();
+            this.logined = logined;
+            this.page = page;
+        }
+
+        private void savePasswordd_Click(object sender, RoutedEventArgs e)
+        {
+            int oldPasswordHash = oldPassword.Password.GetHashCode();
+            int newPasswordHash = newPassword.Password.GetHashCode();
+            int twoNewPasswordHash = twoNewPassword.Password.GetHashCode();
+            if(oldPasswordHash==logined.Password)
+            {
+                if(newPasswordHash==twoNewPasswordHash)
+                {
+                    logined.Password = newPasswordHash;
+                    MessageBox.Show("Успешная смена пароля","Информация", MessageBoxButton.OK, MessageBoxImage.Information);
+                    Classes.DataBaseClass.connect.SaveChanges();
+                    Classes.FrameClass.frame.Navigate(new AuthorizationPage());
+                }
+                else
+                {
+                    MessageBox.Show("Новый пароль не совпадает", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+                }
+            }
+            else
+            {
+                MessageBox.Show("Старый пароль не верен", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error);
+            }
+        }
+
+        private void back_Click(object sender, RoutedEventArgs e)
+        {
+            Classes.FrameClass.frame.Navigate(page);
+        }
+    }
+}

+ 29 - 0
PDK_Concert/Post.cs

@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Post
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Post()
+        {
+            this.Users = new HashSet<Users>();
+        }
+    
+        public int IDPost { get; set; }
+        public string Title { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<Users> Users { get; set; }
+    }
+}

+ 29 - 0
PDK_Concert/Power.cs

@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Power
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Power()
+        {
+            this.Users = new HashSet<Users>();
+        }
+    
+        public int IDPower { get; set; }
+        public string Title { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<Users> Users { get; set; }
+    }
+}

+ 109 - 1
PDK_Concert/RDK_Concert.csproj

@@ -35,8 +35,17 @@
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.2.0\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
+    <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Data" />
+    <Reference Include="System.Runtime.Serialization" />
+    <Reference Include="System.Security" />
     <Reference Include="System.Xml" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Core" />
@@ -55,6 +64,53 @@
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
     </ApplicationDefinition>
+    <Compile Include="Concert.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="ConcertProgram.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Logined.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="ModelBD.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Numbers.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\ConcertPage.xaml.cs">
+      <DependentUpon>ConcertPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\NumberPage.xaml.cs">
+      <DependentUpon>NumberPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\ProfilePage.xaml.cs">
+      <DependentUpon>ProfilePage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\RehearsalSchedulePage.xaml.cs">
+      <DependentUpon>RehearsalSchedulePage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Pages\UpdatePasswordPage.xaml.cs">
+      <DependentUpon>UpdatePasswordPage.xaml</DependentUpon>
+    </Compile>
+    <Compile Include="Post.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Power.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="RehearsalDate.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="RehearsalSchedule.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
+    <Compile Include="Users.cs">
+      <DependentUpon>ModelBD.tt</DependentUpon>
+    </Compile>
     <Page Include="MainWindow.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -73,12 +129,42 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\ConcertPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Pages\MainPage.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Pages\NumberPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Pages\ProfilePage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Pages\RehearsalSchedulePage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+    <Page Include="Pages\UpdatePasswordPage.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="ModelBD.Context.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>ModelBD.Context.tt</DependentUpon>
+    </Compile>
+    <Compile Include="ModelBD.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>ModelBD.edmx</DependentUpon>
+    </Compile>
     <Compile Include="Pages\AuthorizationPage.xaml.cs">
       <DependentUpon>AuthorizationPage.xaml</DependentUpon>
     </Compile>
@@ -102,6 +188,14 @@
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <EntityDeploy Include="ModelBD.edmx">
+      <Generator>EntityModelCodeGenerator</Generator>
+      <LastGenOutput>ModelBD.Designer.cs</LastGenOutput>
+    </EntityDeploy>
+    <None Include="ModelBD.edmx.diagram">
+      <DependentUpon>ModelBD.edmx</DependentUpon>
+    </None>
+    <None Include="packages.config" />
     <None Include="Properties\Settings.settings">
       <Generator>SettingsSingleFileGenerator</Generator>
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -110,6 +204,20 @@
   <ItemGroup>
     <None Include="App.config" />
   </ItemGroup>
-  <ItemGroup />
+  <ItemGroup>
+    <Content Include="ModelBD.Context.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <LastGenOutput>ModelBD.Context.cs</LastGenOutput>
+      <DependentUpon>ModelBD.edmx</DependentUpon>
+    </Content>
+    <Content Include="ModelBD.tt">
+      <Generator>TextTemplatingFileGenerator</Generator>
+      <DependentUpon>ModelBD.edmx</DependentUpon>
+      <LastGenOutput>ModelBD.cs</LastGenOutput>
+    </Content>
+  </ItemGroup>
+  <ItemGroup>
+    <Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 </Project>

+ 29 - 0
PDK_Concert/RehearsalDate.cs

@@ -0,0 +1,29 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class RehearsalDate
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public RehearsalDate()
+        {
+            this.RehearsalSchedule = new HashSet<RehearsalSchedule>();
+        }
+    
+        public int IDData { get; set; }
+        public System.DateTime RehearsalDate1 { get; set; }
+    
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<RehearsalSchedule> RehearsalSchedule { get; set; }
+    }
+}

+ 24 - 0
PDK_Concert/RehearsalSchedule.cs

@@ -0,0 +1,24 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class RehearsalSchedule
+    {
+        public int IDSchedule { get; set; }
+        public int IDUser { get; set; }
+        public string RehearsalTime { get; set; }
+    
+        public virtual RehearsalDate RehearsalDate { get; set; }
+        public virtual Users Users { get; set; }
+    }
+}

+ 40 - 0
PDK_Concert/Users.cs

@@ -0,0 +1,40 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     Этот код создан по шаблону.
+//
+//     Изменения, вносимые в этот файл вручную, могут привести к непредвиденной работе приложения.
+//     Изменения, вносимые в этот файл вручную, будут перезаписаны при повторном создании кода.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PDK_Concert
+{
+    using System;
+    using System.Collections.Generic;
+    
+    public partial class Users
+    {
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
+        public Users()
+        {
+            this.Numbers = new HashSet<Numbers>();
+            this.RehearsalSchedule = new HashSet<RehearsalSchedule>();
+        }
+    
+        public int IDUser { get; set; }
+        public string Name { get; set; }
+        public string Surname { get; set; }
+        public string Patronymic { get; set; }
+        public string Number { get; set; }
+        public int IDPower { get; set; }
+        public int IDPost { get; set; }
+    
+        public virtual Logined Logined { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<Numbers> Numbers { get; set; }
+        public virtual Post Post { get; set; }
+        public virtual Power Power { get; set; }
+        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
+        public virtual ICollection<RehearsalSchedule> RehearsalSchedule { get; set; }
+    }
+}

+ 5 - 0
PDK_Concert/packages.config

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="EntityFramework" version="6.2.0" targetFramework="net472" />
+  <package id="EntityFramework.ru" version="6.2.0" targetFramework="net472" />
+</packages>