using System; using System.IO; using System.Linq; using _0_Framework.Domain; using CompanyManagment.App.Contracts.AdminMonthlyOverview; using Microsoft.AspNetCore.JsonPatch.Operations; namespace Company.Domain.AdminMonthlyOverviewAgg; public class AdminMonthlyOverview:EntityBase { public AdminMonthlyOverview(long workshopId, int month, int year, AdminMonthlyOverviewStatus status) { WorkshopId = workshopId; Month = month; Year = year; Status = status; } public long WorkshopId { get; set; } public int Month { get; set; } public int Year { get; set; } public AdminMonthlyOverviewStatus Status { get; set; } public void Next() { var maxValue = Enum.GetValues(typeof(AdminMonthlyOverviewStatus)) .Cast() .Max(); if (Status >= maxValue) { throw new InvalidDataException("تغییر وضعیت وارد شده نامعتبر است"); } Status += 1; } public void Back() { var minValue = Enum.GetValues(typeof(AdminMonthlyOverviewStatus)) .Cast() .Min(); if (Status <= minValue) { throw new InvalidDataException("تغییر وضعیت وارد شده نامعتبر است"); } Status -= 1; } public void SetStatus(AdminMonthlyOverviewStatus status) { Status = status; } }