add publicId to financialStatement

This commit is contained in:
MahanCh
2025-07-21 14:19:51 +03:30
parent 194323004b
commit cc3b18bc99
5 changed files with 10120 additions and 3 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -15,7 +16,7 @@ public class FinancialStatment : EntityBase
{
ContractingPartyId = contractingPartyId;
ContractingPartyName = contractingPartyName;
PublicId = Guid.NewGuid();
}
public FinancialStatment()
@@ -24,9 +25,16 @@ public class FinancialStatment : EntityBase
}
public long ContractingPartyId { get; private set; }
public string ContractingPartyName { get; private set; }
public Guid PublicId { get; private set; }
[NotMapped]
public string PublicIdStr => PublicId.ToString("N");
public List<FinancialTransaction> FinancialTransactionList { get; set; }
public void SetPublicId()
{
PublicId = Guid.NewGuid();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,30 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CompanyManagment.EFCore.Migrations
{
/// <inheritdoc />
public partial class addpublicidtofinancialstatement : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<Guid>(
name: "PublicId",
table: "FinancialStatments",
type: "uniqueidentifier",
nullable: false,
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"));
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "PublicId",
table: "FinancialStatments");
}
}
}

View File

@@ -2629,6 +2629,9 @@ namespace CompanyManagment.EFCore.Migrations
b.Property<DateTime>("CreationDate")
.HasColumnType("datetime2");
b.Property<Guid>("PublicId")
.HasColumnType("uniqueidentifier");
b.HasKey("id");
b.ToTable("FinancialStatments", (string)null);

View File

@@ -97,7 +97,8 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
//Console.WriteLine("endStep 1 ============");
//SetRollCall(r1);
await ChangeFridayWorkToWeeklyDayOfWeek();
//await ChangeFridayWorkToWeeklyDayOfWeek();
//await SetPublicId();
ViewData["message"] = "تومام دو";
return Page();
}
@@ -615,6 +616,16 @@ namespace ServiceHost.Areas.AdminNew.Pages.Company.AndroidApk
await _context.SaveChangesAsync();
}
private async System.Threading.Tasks.Task SetPublicId()
{
var financialStatements = await _context.FinancialStatments.Where(x=>x.PublicId ==Guid.Empty).ToListAsync();
foreach (var financialStatement in financialStatements)
{
financialStatement.SetPublicId();
}
await _context.SaveChangesAsync();
}
}
public class IndexModel2 : PageModel
{