2 Achegas 232a2287c7 ... a59a2628e6

Autor SHA1 Mensaxe Data
  AngelikaSuhareva a59a2628e6 Merge branch 'master' of http://gogs.ngknn.ru:3000/Acosta/Frontend hai 4 meses
  AngelikaSuhareva 93c0cb71b2 add db hai 4 meses

+ 9 - 0
Acosta.csproj

@@ -25,5 +25,14 @@
     <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
     <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.10" />
     <PackageReference Include="Avalonia.ReactiveUI" Version="11.0.10" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.14">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
   </ItemGroup>
 </Project>

+ 13 - 0
Models/Acceptance.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class Acceptance
+{
+    public int Acceptanceid { get; set; }
+
+    public string Title { get; set; } = null!;
+
+    public virtual ICollection<Visit> Visits { get; set; } = new List<Visit>();
+}

+ 25 - 0
Models/Employee.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class Employee
+{
+    public int Employeesid { get; set; }
+
+    public string Surname { get; set; } = null!;
+
+    public string Name { get; set; } = null!;
+
+    public string Patronymic { get; set; } = null!;
+
+    public string Phonenumber { get; set; } = null!;
+
+    public string Email { get; set; } = null!;
+
+    public int Role { get; set; }
+
+    public string Password { get; set; } = null!;
+
+    public virtual Role RoleNavigation { get; set; } = null!;
+}

+ 19 - 0
Models/Outlet.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class Outlet
+{
+    public int Outletid { get; set; }
+
+    public string Address { get; set; } = null!;
+
+    public string Location { get; set; } = null!;
+
+    public int TradeNetworks { get; set; }
+
+    public virtual TradeNetwork TradeNetworksNavigation { get; set; } = null!;
+
+    public virtual ICollection<Visit> Visits { get; set; } = new List<Visit>();
+}

+ 17 - 0
Models/Product.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class Product
+{
+    public int Productid { get; set; }
+
+    public string Title { get; set; } = null!;
+
+    public int Project { get; set; }
+
+    public virtual ICollection<ProductReport> ProductReports { get; set; } = new List<ProductReport>();
+
+    public virtual Project ProjectNavigation { get; set; } = null!;
+}

+ 25 - 0
Models/ProductReport.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class ProductReport
+{
+    public int Productreportid { get; set; }
+
+    public int Product { get; set; }
+
+    public int Price { get; set; }
+
+    public int Pricetothecard { get; set; }
+
+    public int Actualbalance { get; set; }
+
+    public int Virtualbalance { get; set; }
+
+    public int Visit { get; set; }
+
+    public virtual Product ProductNavigation { get; set; } = null!;
+
+    public virtual Visit VisitNavigation { get; set; } = null!;
+}

+ 17 - 0
Models/Project.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class Project
+{
+    public int Projectid { get; set; }
+
+    public string Title { get; set; } = null!;
+
+    public int Numofvisitsperweek { get; set; }
+
+    public virtual ICollection<Product> Products { get; set; } = new List<Product>();
+
+    public virtual ICollection<Visit> Visits { get; set; } = new List<Visit>();
+}

+ 15 - 0
Models/ProjectsAndEmployee.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class ProjectsAndEmployee
+{
+    public int Employeeid { get; set; }
+
+    public int Projectid { get; set; }
+
+    public virtual Employee Employee { get; set; } = null!;
+
+    public virtual Project Project { get; set; } = null!;
+}

+ 15 - 0
Models/ProjectsAndOutlet.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class ProjectsAndOutlet
+{
+    public int Projectid { get; set; }
+
+    public int Outletid { get; set; }
+
+    public virtual Outlet Outlet { get; set; } = null!;
+
+    public virtual Project Project { get; set; } = null!;
+}

+ 13 - 0
Models/Role.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class Role
+{
+    public int Roleid { get; set; }
+
+    public string Title { get; set; } = null!;
+
+    public virtual ICollection<Employee> Employees { get; set; } = new List<Employee>();
+}

+ 274 - 0
Models/SuharevaContext.cs

@@ -0,0 +1,274 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore;
+
+namespace Acosta.Models;
+
+public partial class SuharevaContext : DbContext
+{
+    public SuharevaContext()
+    {
+    }
+
+    public SuharevaContext(DbContextOptions<SuharevaContext> options)
+        : base(options)
+    {
+    }
+
+    public virtual DbSet<Acceptance> Acceptances { get; set; }
+
+    public virtual DbSet<Employee> Employees { get; set; }
+
+    public virtual DbSet<Outlet> Outlets { get; set; }
+
+    public virtual DbSet<Product> Products { get; set; }
+
+    public virtual DbSet<ProductReport> ProductReports { get; set; }
+
+    public virtual DbSet<Project> Projects { get; set; }
+
+    public virtual DbSet<ProjectsAndEmployee> ProjectsAndEmployees { get; set; }
+
+    public virtual DbSet<ProjectsAndOutlet> ProjectsAndOutlets { get; set; }
+
+    public virtual DbSet<Role> Roles { get; set; }
+
+    public virtual DbSet<TradeNetwork> TradeNetworks { get; set; }
+
+    public virtual DbSet<Visit> Visits { get; set; }
+
+    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
+        => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.ru;Port=5442;Database=Suhareva;Username=33P;Password=12345");
+
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        modelBuilder.Entity<Acceptance>(entity =>
+        {
+            entity.HasKey(e => e.Acceptanceid).HasName("Acceptance_pkey");
+
+            entity.ToTable("Acceptance");
+
+            entity.Property(e => e.Acceptanceid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("acceptanceid");
+            entity.Property(e => e.Title)
+                .HasMaxLength(30)
+                .HasColumnName("title");
+        });
+
+        modelBuilder.Entity<Employee>(entity =>
+        {
+            entity.HasKey(e => e.Employeesid).HasName("Employees_pkey");
+
+            entity.Property(e => e.Employeesid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("employeesid");
+            entity.Property(e => e.Email)
+                .HasMaxLength(30)
+                .HasColumnName("email");
+            entity.Property(e => e.Name)
+                .HasMaxLength(30)
+                .HasColumnName("name");
+            entity.Property(e => e.Password)
+                .HasMaxLength(30)
+                .HasColumnName("password");
+            entity.Property(e => e.Patronymic)
+                .HasMaxLength(30)
+                .HasColumnName("patronymic");
+            entity.Property(e => e.Phonenumber)
+                .HasMaxLength(30)
+                .HasColumnName("phonenumber");
+            entity.Property(e => e.Role).HasColumnName("role");
+            entity.Property(e => e.Surname)
+                .HasMaxLength(30)
+                .HasColumnName("surname");
+
+            entity.HasOne(d => d.RoleNavigation).WithMany(p => p.Employees)
+                .HasForeignKey(d => d.Role)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Employees_role_fkey");
+        });
+
+        modelBuilder.Entity<Outlet>(entity =>
+        {
+            entity.HasKey(e => e.Outletid).HasName("Outlets_pkey");
+
+            entity.Property(e => e.Outletid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("outletid");
+            entity.Property(e => e.Address)
+                .HasMaxLength(100)
+                .HasColumnName("address");
+            entity.Property(e => e.Location)
+                .HasMaxLength(100)
+                .HasColumnName("location");
+            entity.Property(e => e.TradeNetworks).HasColumnName("Trade networks");
+
+            entity.HasOne(d => d.TradeNetworksNavigation).WithMany(p => p.Outlets)
+                .HasForeignKey(d => d.TradeNetworks)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Outlets_Trade networks_fkey");
+        });
+
+        modelBuilder.Entity<Product>(entity =>
+        {
+            entity.HasKey(e => e.Productid).HasName("Products_pkey");
+
+            entity.Property(e => e.Productid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("productid");
+            entity.Property(e => e.Project).HasColumnName("project");
+            entity.Property(e => e.Title)
+                .HasMaxLength(100)
+                .HasColumnName("title");
+
+            entity.HasOne(d => d.ProjectNavigation).WithMany(p => p.Products)
+                .HasForeignKey(d => d.Project)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Products_project_fkey");
+        });
+
+        modelBuilder.Entity<ProductReport>(entity =>
+        {
+            entity.HasKey(e => e.Productreportid).HasName("Product reports_pkey");
+
+            entity.ToTable("Product reports");
+
+            entity.Property(e => e.Productreportid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("productreportid");
+            entity.Property(e => e.Actualbalance).HasColumnName("actualbalance");
+            entity.Property(e => e.Price).HasColumnName("price");
+            entity.Property(e => e.Pricetothecard).HasColumnName("pricetothecard");
+            entity.Property(e => e.Product).HasColumnName("product");
+            entity.Property(e => e.Virtualbalance).HasColumnName("virtualbalance");
+            entity.Property(e => e.Visit).HasColumnName("visit");
+
+            entity.HasOne(d => d.ProductNavigation).WithMany(p => p.ProductReports)
+                .HasForeignKey(d => d.Product)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Product reports_product_fkey");
+
+            entity.HasOne(d => d.VisitNavigation).WithMany(p => p.ProductReports)
+                .HasForeignKey(d => d.Visit)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Product reports_visit_fkey");
+        });
+
+        modelBuilder.Entity<Project>(entity =>
+        {
+            entity.HasKey(e => e.Projectid).HasName("Projects_pkey");
+
+            entity.Property(e => e.Projectid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("projectid");
+            entity.Property(e => e.Numofvisitsperweek).HasColumnName("numofvisitsperweek");
+            entity.Property(e => e.Title)
+                .HasMaxLength(30)
+                .HasColumnName("title");
+        });
+
+        modelBuilder.Entity<ProjectsAndEmployee>(entity =>
+        {
+            entity
+                .HasNoKey()
+                .ToTable("Projects and employees");
+
+            entity.Property(e => e.Employeeid).HasColumnName("employeeid");
+            entity.Property(e => e.Projectid).HasColumnName("projectid");
+
+            entity.HasOne(d => d.Employee).WithMany()
+                .HasForeignKey(d => d.Employeeid)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Projects and employees_employeeid_fkey");
+
+            entity.HasOne(d => d.Project).WithMany()
+                .HasForeignKey(d => d.Projectid)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Projects and employees_projectid_fkey");
+        });
+
+        modelBuilder.Entity<ProjectsAndOutlet>(entity =>
+        {
+            entity
+                .HasNoKey()
+                .ToTable("Projects and outlets");
+
+            entity.Property(e => e.Outletid).HasColumnName("outletid");
+            entity.Property(e => e.Projectid).HasColumnName("projectid");
+
+            entity.HasOne(d => d.Outlet).WithMany()
+                .HasForeignKey(d => d.Outletid)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Projects and outlets_outletid_fkey");
+
+            entity.HasOne(d => d.Project).WithMany()
+                .HasForeignKey(d => d.Projectid)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Projects and outlets_projectid_fkey");
+        });
+
+        modelBuilder.Entity<Role>(entity =>
+        {
+            entity.HasKey(e => e.Roleid).HasName("Roles_pkey");
+
+            entity.Property(e => e.Roleid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("roleid");
+            entity.Property(e => e.Title)
+                .HasMaxLength(30)
+                .HasColumnName("title");
+        });
+
+        modelBuilder.Entity<TradeNetwork>(entity =>
+        {
+            entity.HasKey(e => e.Tradeid).HasName("Trade networks_pkey");
+
+            entity.ToTable("Trade networks");
+
+            entity.Property(e => e.Tradeid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("tradeid");
+            entity.Property(e => e.Title)
+                .HasMaxLength(30)
+                .HasColumnName("title");
+        });
+
+        modelBuilder.Entity<Visit>(entity =>
+        {
+            entity.HasKey(e => e.Visitid).HasName("Visits_pkey");
+
+            entity.Property(e => e.Visitid)
+                .UseIdentityAlwaysColumn()
+                .HasColumnName("visitid");
+            entity.Property(e => e.Accepted).HasColumnName("accepted");
+            entity.Property(e => e.Merchcomment)
+                .HasMaxLength(200)
+                .HasColumnName("merchcomment");
+            entity.Property(e => e.Outlet).HasColumnName("outlet");
+            entity.Property(e => e.Project).HasColumnName("project");
+            entity.Property(e => e.Visitdate).HasColumnName("visitdate");
+            entity.Property(e => e.Visittime).HasColumnName("visittime");
+
+            entity.HasOne(d => d.AcceptedNavigation).WithMany(p => p.Visits)
+                .HasForeignKey(d => d.Accepted)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Visits_accepted_fkey");
+
+            entity.HasOne(d => d.OutletNavigation).WithMany(p => p.Visits)
+                .HasForeignKey(d => d.Outlet)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Visits_outlet_fkey");
+
+            entity.HasOne(d => d.ProjectNavigation).WithMany(p => p.Visits)
+                .HasForeignKey(d => d.Project)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("Visits_project_fkey");
+        });
+
+        OnModelCreatingPartial(modelBuilder);
+    }
+
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 13 - 0
Models/TradeNetwork.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class TradeNetwork
+{
+    public int Tradeid { get; set; }
+
+    public string Title { get; set; } = null!;
+
+    public virtual ICollection<Outlet> Outlets { get; set; } = new List<Outlet>();
+}

+ 29 - 0
Models/Visit.cs

@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+
+namespace Acosta.Models;
+
+public partial class Visit
+{
+    public int Visitid { get; set; }
+
+    public int Outlet { get; set; }
+
+    public int Project { get; set; }
+
+    public DateOnly Visitdate { get; set; }
+
+    public TimeOnly Visittime { get; set; }
+
+    public int Accepted { get; set; }
+
+    public string Merchcomment { get; set; } = null!;
+
+    public virtual Acceptance AcceptedNavigation { get; set; } = null!;
+
+    public virtual Outlet OutletNavigation { get; set; } = null!;
+
+    public virtual ICollection<ProductReport> ProductReports { get; set; } = new List<ProductReport>();
+
+    public virtual Project ProjectNavigation { get; set; } = null!;
+}