falta interfaz venta
This commit is contained in:
@@ -14,7 +14,7 @@ public class RepositorioContratos: RepositorioBase<RepositorioContratos> {
|
||||
}
|
||||
}
|
||||
|
||||
public bool CargaPrecontrato(Contrato? c = null, Notificacione? n = null) {
|
||||
public bool CargaPrecontrato( Contrato? c = null, Notificacione? n = null) {
|
||||
if (c == null || c.Habilitado == 1) return false;
|
||||
if (n == null) return false;
|
||||
var con = Context;
|
||||
@@ -201,4 +201,39 @@ public class RepositorioContratos: RepositorioBase<RepositorioContratos> {
|
||||
var con = Context;
|
||||
return con.Contratos.Where(x=>x.Fechainicio.Year == year).Any();
|
||||
}
|
||||
|
||||
public bool SetOpcionVenta(Venta v, long idcontrato) {
|
||||
var con = Context;
|
||||
var cont = con.Contratos.Include(x=>x.IdventaNavigation).FirstOrDefault(x=>x.Id == idcontrato);
|
||||
if (cont != null) return false;
|
||||
|
||||
v.Id = (con.Ventas.Any()?con.Ventas.Count():0)+1;
|
||||
|
||||
cont.IdventaNavigation = v;
|
||||
con.Ventas.Add(v);
|
||||
return Guardar(con);
|
||||
}
|
||||
|
||||
public bool CargaPrecontratoOpcionVenta(Contrato c, Notificacione n, Venta v) {
|
||||
if (c == null || c.Habilitado == 1) return false;
|
||||
if (n == null) return false;
|
||||
var con = Context;
|
||||
|
||||
var prop = con.Propiedades.FirstOrDefault(x=>x.Id==c.Idpropiedad);
|
||||
if (prop == null) return false;
|
||||
prop.Idestado = 2;
|
||||
|
||||
c.Iddivisa = prop.Iddivisa;
|
||||
c.Id = (con.Contratos.Any() ? con.Contratos.Max(x => x.Id) : 0) + 1;
|
||||
c.Monto = prop.Monto;
|
||||
|
||||
v.Id = (con.Ventas.Any()?con.Ventas.Count():0)+1;
|
||||
c.Idventa = v.Id;
|
||||
|
||||
con.Ventas.Add(v);
|
||||
con.Contratos.Add(c);
|
||||
con.Notificaciones.Add(n);
|
||||
|
||||
return Guardar(con);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user