add publicId to financialStatement
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
10065
CompanyManagment.EFCore/Migrations/20250721101031_add public id to financialstatement.Designer.cs
generated
Normal file
10065
CompanyManagment.EFCore/Migrations/20250721101031_add public id to financialstatement.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user