using System; using System.ComponentModel; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Runtime.CompilerServices; namespace bdGrupoSanchoToro.db { public partial class conciliacionesbancarias { [NotMapped] public double ImporteExtractosConciliados { get { return this.movimientosbancarios.Sum(x => x.Importe); } } [NotMapped] public double ImporteApuntesConciliados { get { return this.movimientoscaja.Sum(x => x.Importe); } } private int? _Anno; [NotMapped] public int? Anno { get { if (_Anno.HasValue) { return _Anno; } else if (this.FechaInicio == DateOnly.MinValue) { return default; } else { return this.FechaInicio.Year; } } set { _Anno = value; if (_Mes.HasValue) { this.FechaInicio = new DateOnly((int)_Anno, (int)_Mes, 1); this.FechaFin = new DateOnly((int)_Anno, (int)_Mes, DateTime.DaysInMonth((int)_Anno, (int)_Mes)); } } } private int? _Mes; [NotMapped] public int? Mes { get { if (_Mes.HasValue) { return _Mes; } else if (this.FechaInicio == DateOnly.MinValue) { return default; } else { return this.FechaInicio.Month; } } set { _Mes = value; if (_Anno.HasValue) { this.FechaInicio = new DateOnly((int)_Anno, (int)_Mes, 1); this.FechaFin = new DateOnly((int)_Anno, (int)_Mes, DateTime.DaysInMonth((int)_Anno, (int)_Mes)); } } } } }