Organizasyon Tablosu Eklendi.

This commit is contained in:
2025-08-15 00:08:26 +03:00
parent 663784484e
commit 3805d07494
6 changed files with 542 additions and 8 deletions

View File

@@ -9,19 +9,14 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Bunifu.UI.WinForms" Version="9.0.0" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.7" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.8">
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.7">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" /> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.4" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Update="FrmAddKullanici.cs"> <Compile Update="FrmAddKullanici.cs">
<SubType>Form</SubType> <SubType>Form</SubType>

View File

@@ -0,0 +1,319 @@
// <auto-generated />
using System;
using DugunSalonu.Models;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DugunSalonu.Migrations
{
[DbContext(typeof(dugunsalonuContext))]
[Migration("20250814210347_mig12")]
partial class mig12
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
modelBuilder.Entity("DugunSalonu.Models.Il", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<string>("adi")
.IsRequired()
.HasColumnType("text");
b.HasKey("id");
b.ToTable("il");
});
modelBuilder.Entity("DugunSalonu.Models.Ilce", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<int>("ILid")
.HasColumnType("integer")
.HasColumnName("ilid");
b.Property<string>("adi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("id");
b.HasIndex("ILid");
b.ToTable("ilce");
});
modelBuilder.Entity("DugunSalonu.Models.Kullanici", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<string>("adi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<bool>("admin")
.HasColumnType("boolean");
b.Property<bool>("aktif")
.HasColumnType("boolean");
b.Property<string>("ceptel")
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("eposta")
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("kullaniciadi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<string>("parola")
.IsRequired()
.HasColumnType("text");
b.Property<string>("soyadi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasKey("id");
b.ToTable("kullanici");
});
modelBuilder.Entity("DugunSalonu.Models.Organizasyon", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<string>("aciklama")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("character varying(400)");
b.Property<string>("adi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<int>("ceptel")
.HasMaxLength(10)
.HasColumnType("integer");
b.Property<int?>("ceptel2")
.HasMaxLength(10)
.HasColumnType("integer");
b.Property<string>("damatyore")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal>("fiyat")
.HasColumnType("numeric(18,2)");
b.Property<string>("gelinyore")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<int?>("iptal")
.HasColumnType("integer");
b.Property<string>("iptalaciklama")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<int?>("iptalkk")
.HasColumnType("integer");
b.Property<DateTime?>("iptalkts")
.HasColumnType("timestamp with time zone");
b.Property<int>("kk")
.HasColumnType("integer");
b.Property<DateTime>("kts")
.HasColumnType("timestamp with time zone");
b.Property<string>("organizasyondurum")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("organizasyonsaati")
.IsRequired()
.HasColumnType("text");
b.Property<DateOnly>("organizasyontarihi")
.HasColumnType("date");
b.Property<DateOnly>("rezervasyontarihi")
.HasColumnType("date");
b.Property<string>("soyadi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<byte[]>("sozlesme")
.HasColumnType("bytea");
b.Property<DateOnly>("sozlesmetarihi")
.HasColumnType("date");
b.HasKey("id");
b.ToTable("organizasyon");
});
modelBuilder.Entity("DugunSalonu.Models.Referans", b =>
{
b.Property<string>("adi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<bool>("aktif")
.HasColumnType("boolean");
b.Property<int>("id")
.HasColumnType("integer");
b.Property<int>("kk")
.HasColumnType("integer");
b.Property<string>("kodu")
.IsRequired()
.HasMaxLength(20)
.HasColumnType("character varying(20)");
b.Property<DateTime>("kts")
.HasColumnType("timestamp with time zone");
b.Property<string>("turu")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.HasIndex("turu", "kodu")
.IsUnique();
b.ToTable("referans");
});
modelBuilder.Entity("DugunSalonu.Models.Salon", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<string>("CepTel")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("adi")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("character varying(150)");
b.Property<string>("adres")
.HasMaxLength(250)
.HasColumnType("character varying(250)");
b.Property<string>("eposta")
.IsRequired()
.HasColumnType("text");
b.Property<int?>("ilceid")
.HasColumnType("integer");
b.Property<int?>("ilid")
.HasColumnType("integer");
b.Property<string>("telefon")
.HasColumnType("text");
b.Property<string>("vergidairesi")
.HasColumnType("text");
b.Property<string>("verginumarasi")
.HasColumnType("text");
b.Property<string>("webadres")
.HasColumnType("text");
b.HasKey("id");
b.HasIndex("ilid");
b.ToTable("salon");
});
modelBuilder.Entity("DugunSalonu.Models.Ilce", b =>
{
b.HasOne("DugunSalonu.Models.Il", "Il")
.WithMany("ilceler")
.HasForeignKey("ILid")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Il");
});
modelBuilder.Entity("DugunSalonu.Models.Salon", b =>
{
b.HasOne("DugunSalonu.Models.Il", "il")
.WithMany("salons")
.HasForeignKey("ilid");
b.Navigation("il");
});
modelBuilder.Entity("DugunSalonu.Models.Il", b =>
{
b.Navigation("ilceler");
b.Navigation("salons");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
#nullable disable
namespace DugunSalonu.Migrations
{
/// <inheritdoc />
public partial class mig12 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "organizasyon",
columns: table => new
{
id = table.Column<int>(type: "integer", nullable: false)
.Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
rezervasyontarihi = table.Column<DateOnly>(type: "date", nullable: false),
sozlesmetarihi = table.Column<DateOnly>(type: "date", nullable: false),
organizasyontarihi = table.Column<DateOnly>(type: "date", nullable: false),
organizasyonsaati = table.Column<string>(type: "text", nullable: false),
adi = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
soyadi = table.Column<string>(type: "character varying(50)", maxLength: 50, nullable: false),
ceptel = table.Column<int>(type: "integer", maxLength: 10, nullable: false),
ceptel2 = table.Column<int>(type: "integer", maxLength: 10, nullable: true),
gelinyore = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
damatyore = table.Column<string>(type: "character varying(30)", maxLength: 30, nullable: false),
aciklama = table.Column<string>(type: "character varying(400)", maxLength: 400, nullable: false),
organizasyondurum = table.Column<string>(type: "character varying(10)", maxLength: 10, nullable: false),
fiyat = table.Column<decimal>(type: "numeric(18,2)", nullable: false),
kts = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
kk = table.Column<int>(type: "integer", nullable: false),
sozlesme = table.Column<byte[]>(type: "bytea", nullable: true),
iptal = table.Column<int>(type: "integer", nullable: true),
iptalkk = table.Column<int>(type: "integer", nullable: true),
iptalkts = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
iptalaciklama = table.Column<string>(type: "character varying(200)", maxLength: 200, nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_organizasyon", x => x.id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "organizasyon");
}
}
}

View File

@@ -17,7 +17,7 @@ namespace DugunSalonu.Migrations
{ {
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder modelBuilder
.HasAnnotation("ProductVersion", "9.0.7") .HasAnnotation("ProductVersion", "9.0.8")
.HasAnnotation("Relational:MaxIdentifierLength", 63); .HasAnnotation("Relational:MaxIdentifierLength", 63);
NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder);
@@ -109,6 +109,95 @@ namespace DugunSalonu.Migrations
b.ToTable("kullanici"); b.ToTable("kullanici");
}); });
modelBuilder.Entity("DugunSalonu.Models.Organizasyon", b =>
{
b.Property<int>("id")
.ValueGeneratedOnAdd()
.HasColumnType("integer");
NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property<int>("id"));
b.Property<string>("aciklama")
.IsRequired()
.HasMaxLength(400)
.HasColumnType("character varying(400)");
b.Property<string>("adi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<int>("ceptel")
.HasMaxLength(10)
.HasColumnType("integer");
b.Property<int?>("ceptel2")
.HasMaxLength(10)
.HasColumnType("integer");
b.Property<string>("damatyore")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<decimal>("fiyat")
.HasColumnType("numeric(18,2)");
b.Property<string>("gelinyore")
.IsRequired()
.HasMaxLength(30)
.HasColumnType("character varying(30)");
b.Property<int?>("iptal")
.HasColumnType("integer");
b.Property<string>("iptalaciklama")
.HasMaxLength(200)
.HasColumnType("character varying(200)");
b.Property<int?>("iptalkk")
.HasColumnType("integer");
b.Property<DateTime?>("iptalkts")
.HasColumnType("timestamp with time zone");
b.Property<int>("kk")
.HasColumnType("integer");
b.Property<DateTime>("kts")
.HasColumnType("timestamp with time zone");
b.Property<string>("organizasyondurum")
.IsRequired()
.HasMaxLength(10)
.HasColumnType("character varying(10)");
b.Property<string>("organizasyonsaati")
.IsRequired()
.HasColumnType("text");
b.Property<DateOnly>("organizasyontarihi")
.HasColumnType("date");
b.Property<DateOnly>("rezervasyontarihi")
.HasColumnType("date");
b.Property<string>("soyadi")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("character varying(50)");
b.Property<byte[]>("sozlesme")
.HasColumnType("bytea");
b.Property<DateOnly>("sozlesmetarihi")
.HasColumnType("date");
b.HasKey("id");
b.ToTable("organizasyon");
});
modelBuilder.Entity("DugunSalonu.Models.Referans", b => modelBuilder.Entity("DugunSalonu.Models.Referans", b =>
{ {
b.Property<string>("adi") b.Property<string>("adi")

68
Models/Organizasyon.cs Normal file
View File

@@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.Design.Serialization;
using System.Data.SqlTypes;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DugunSalonu.Models
{
public class Organizasyon
{
[Key]
public int id { get; set; }
[Required]
public required DateOnly rezervasyontarihi { get; set; } = DateOnly.FromDateTime(DateTime.Now);
[Required]
public required DateOnly sozlesmetarihi { get; set; }
[Required]
public required DateOnly organizasyontarihi { get; set; }
[Required]
public required string organizasyonsaati { get; set; } //referans tablosundan alınacak.
[Required]
[MaxLength(50)]
public required string adi { get; set; }
[Required]
[MaxLength(50)]
public required string soyadi { get; set; }
public string adisoyadi { get { return $"{adi} {soyadi}"; } }
[Required]
[MaxLength(10)]
[MinLength(10)]
public required int ceptel { get; set; }
[MaxLength(10)]
[MinLength(10)]
public int? ceptel2 { get; set; }
[Required]
[MaxLength(30)]
public required string gelinyore { get; set; }
[Required]
[MaxLength(30)]
public required string damatyore { get; set; }
[Required]
[MaxLength(400)]
public required string aciklama { get; set; }
[Required]
[MaxLength(10)]
public required string organizasyondurum { get; set; } // referans tablosundan alınacak.
[Required]
public required Decimal fiyat { get; set; }
[Required]
public required DateTime kts { get; set; } = DateTime.UtcNow;
[Required]
public required int kk { get; set; }
public byte[]? sozlesme { get; set; }
public int? iptal { get; set; }
public int? iptalkk { get; set; }
public DateTime? iptalkts { get; set; }
[MaxLength(200)]
public string? iptalaciklama { get; set; }
}
}

View File

@@ -19,6 +19,7 @@ namespace DugunSalonu.Models
public DbSet<Referans> referans { get; set; } public DbSet<Referans> referans { get; set; }
public DbSet<Organizasyon> organizasyon { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
@@ -29,6 +30,13 @@ namespace DugunSalonu.Models
modelBuilder.Entity<Referans>().HasNoKey(); modelBuilder.Entity<Referans>().HasNoKey();
modelBuilder.Entity<Il>().HasMany<Ilce>(i => i.ilceler); modelBuilder.Entity<Il>().HasMany<Ilce>(i => i.ilceler);
modelBuilder.Entity<Ilce>().HasOne<Il>(i => i.Il); modelBuilder.Entity<Ilce>().HasOne<Il>(i => i.Il);
//fiyat için oluşturulan alanın tipini belirtmek için yapıldı.
modelBuilder.Entity<Organizasyon>(entity =>
{
entity.Property(e => e.fiyat)
.HasColumnType("numeric(18,2)"); // 18 basamak, 2 ondalık
});
/* /*
// kts alanı için default değer // kts alanı için default değer
modelBuilder.Entity<Referans>() modelBuilder.Entity<Referans>()