61 lines
2.4 KiB
C#
61 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using AyCode.Core.Consts;
|
|
|
|
namespace FruitBank.Common.Server
|
|
{
|
|
public class FruitBankConst : AcConst
|
|
{
|
|
public static string ProjectIdString = "aad53443-2ee2-4650-8a99-97e907265e4e";
|
|
|
|
public static string MeasuringRoleSystemName = "Measuring";
|
|
public static string MeasuringRevisorRoleSystemName = "MeasuringRevisor";
|
|
public static string IsMeasureableAttributeName = "IsMeasurable";
|
|
|
|
/// <summary>
|
|
/// DateTime generic attribute on Product.
|
|
/// The start of the window during which this product is visible for preordering.
|
|
/// </summary>
|
|
public const string PreOrderWindowStart = "PreOrderWindowStart";
|
|
|
|
/// <summary>
|
|
/// DateTime generic attribute on Product.
|
|
/// The end of the window during which this product is visible for preordering.
|
|
/// </summary>
|
|
public const string PreOrderWindowEnd = "PreOrderWindowEnd";
|
|
|
|
// ── Environment flag → AcEnv.IsProdDb (AyCode.Core framework, 2026-07) ──
|
|
// Egy-forrás keret-állapot (ugyanaz, amit a kliens tükröz). A method-only felület szándékosan megmarad:
|
|
// nincs property, amit véletlenül bind-olni/szerializálni lehetne. A set-once őr (a szerver DB-je nem
|
|
// változhat futásidőben) itt marad — az AcEnv-írás előtt.
|
|
|
|
/// <summary>
|
|
/// Set once by the plugin startup after DB-catalog classification.
|
|
/// A second call with a different value throws — the flag cannot flip at runtime.
|
|
/// </summary>
|
|
public static void SetIsProd(bool isProd)
|
|
{
|
|
if (AcEnv.IsProdDbHydrated && AcEnv.IsProdDb != isProd)
|
|
throw new InvalidOperationException(
|
|
$"IsProd is already set to {AcEnv.IsProdDb}; refusing to change it to {isProd}.");
|
|
|
|
AcEnv.SetIsProdDb(isProd);
|
|
}
|
|
|
|
/// <summary>
|
|
/// True = PROD database. Throws until SetIsProd ran — an uninitialized read must never return a default.
|
|
/// </summary>
|
|
public static bool IsProd() => AcEnv.IsProdDb;
|
|
|
|
static FruitBankConst()
|
|
{
|
|
ProjectId = Guid.Parse(ProjectIdString);
|
|
ProjectSalt = GenerateProjectSalt(ProjectId.ToString("N"));
|
|
}
|
|
}
|
|
|
|
}
|