Files
SanchoToro/bdGrupoSanchoToro/extensiones/detallepresupuesto.cs
2026-02-17 13:47:52 +01:00

99 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data;
using System.Linq;
using System.Runtime.CompilerServices;
namespace bdGrupoSanchoToro.db
{
public partial class detallepresupuesto:INotifyPropertyChanged
{
[NotMapped]
public productos? productos
{
get
{
return this.idProductoNavigation;
}
}
[NotMapped]
public virtual string DescripcionEspecial
{
get
{
string Des = this.idProductoNavigation.Descripcion ;
if (Des.Contains("("))
{
Des = Des.Split('(')[0];
}
return Des;
}
}
[NotMapped]
public virtual ICollection<detallepresupuesto>? detallepresupuesto1
{
get
{
return this.InverseidDetallePresupuestoPadreNavigation;
}
}
public double Importe
{
get
{
// If EsVenta Then
return Math.Round(this.Cantidad * this.Precio, 2, MidpointRounding.AwayFromZero);
// Else
// Return Math.Round(Cantidad * Precio * presupuestos.DiasAlquiler, 2, MidpointRounding.AwayFromZero)
// End If
}
}
[NotMapped]
public bool ContieneHijos
{
get
{
return this.detallepresupuesto1 is not null && this.detallepresupuesto1.Count > 0;
}
}
[NotMapped]
public virtual List<detallepresupuesto> DesgloseServicios
{
get
{
return this.detallepresupuesto1.Where(x => x.productos.Tipo == (int)productos.TipoProductoEnum.SERVICIO).ToList();
}
}
[NotMapped]
public virtual List<detallepresupuesto> DesgloseMaterial
{
get
{
return this.detallepresupuesto1.Where(x => x.productos.Tipo < (int)productos.TipoProductoEnum.SERVICIO).ToList();
}
}
public event PropertyChangedEventHandler? PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string name = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
}
public void RefrescaCamposTemporales()
{
this.OnPropertyChanged("Importe");
this.OnPropertyChanged("ImporteGastos");
// OnPropertyChanged("NumeroAsientosTotal")
this.OnPropertyChanged("DesgloseServicios");
this.OnPropertyChanged("DesgloseMaterial");
}
}
}