Esempio n. 1
0
        public override void ValoresPorDefecto(BaseNegocio origen)
        {
            if (origen is PresupuestoVersion)
            {
                this["IDPresupuestoVersion"] = origen["IDPresupuestoVersion"];
            }
            if (origen is PresupuestoYTarifa)
            {
                this["IDPyT"] = origen["IDPyT"];

                // Buscamos Unidades de presupuesto de una versión anterior.
                int versionActual = (int)ObjetoAsociado("PresupuestoVersion")["Version"];

                foreach (BaseNegocio b in ObjetoAsociado("PresupuestoVersion").ObjetoAsociado("Presupuesto").Coleccion("ColPresupuestoVersion"))
                {
                    if ((int)b["Version"] < versionActual)
                    {
                        foreach (BaseNegocio d in b.Coleccion("ColPresupuestoVersionDetalle"))
                        {
                            if ((int)d["IDTarifa"] == (int)this["IDTarifa"])
                            {
                                this["Unidades"]        = d["Unidades"];
                                this["DivisorUnidades"] = d["DivisorUnidades"];
                            }
                        }
                    }
                }

                if (this.Nuevo && !MetodoPermitido("ModificarLineas"))
                {
                    this["Precio"] = 0;
                }
            }

            base.ValoresPorDefecto(origen);
        }
Esempio n. 2
0
 public ColPresupuestoColaboradorNaM(BaseNegocio Padre, string CampoRelacionPadre, string Sql)
     : base(Padre, CampoRelacionPadre, Sql)
 {
 }
 public ColPresupuestoPrecioCompetencia(BaseNegocio Padre, string CampoRelacionPadre, string Sql)
     : base(Padre, CampoRelacionPadre, Sql)
 {
 }
Esempio n. 4
0
 public ColPresupuestoNota(BaseNegocio Padre, string CampoRelacionPadre, string Sql)
     : base(Padre, CampoRelacionPadre, Sql)
 {
 }
Esempio n. 5
0
 public ColPresupuestoMision(BaseNegocio Padre, string CampoRelacionPadre, string Sql)
     : base(Padre, CampoRelacionPadre, Sql)
 {
     campoRelacionHijo      = "IDPresupuesto";
     siempreNecesitaGuardar = false;
 }
Esempio n. 6
0
        //public PresupuestoYTarifa BuscarPorCodigo(int CodigoTarifa)
        //{
        //    PresupuestoYTarifa pyt = null;

        //    foreach (BaseNegocio p in this)
        //    {
        //        if ((int) p["Codigo"] == CodigoTarifa)
        //        {
        //            pyt = (PresupuestoYTarifa)p;
        //            break;
        //        }
        //    }

        //    return pyt;
        //}

        public PresupuestoYTarifa BuscarCrear(int IDTarifa)
        {
            PresupuestoYTarifa pyt = null;

            if (padre != null && padre is BasePresupuesto)
            {
                string sql = "SELECT TOP 1 PresupuestoYTarifa.IDPyT"
                             + " FROM PresupuestoYTarifa INNER JOIN"
                             + " PresupuestoVersionDetalle ON PresupuestoYTarifa.IDPyT = PresupuestoVersionDetalle.IDPyT INNER JOIN"
                             + " PresupuestoVersion ON PresupuestoVersionDetalle.IDPresupuestoVersion = PresupuestoVersion.IDPresupuestoVersion"
                             + " WHERE PresupuestoYTarifa.IDPresupuesto = " + padre.IDActual[0].ToString()
                             + " AND PresupuestoYTarifa.IDTarifa = " + IDTarifa.ToString();
                int IDPyT;

                if (((Presupuesto)padre).AceptadoAhora)
                {
                    sql += " AND (PresupuestoVersionDetalle.Aceptada = 1)"
                           + " AND (PresupuestoVersion.Aceptado = 1)";
                }
                sql += " ORDER BY PresupuestoYTarifa.FechaAplicacion DESC";

                IDPyT = Datos.Instancia().DameExpresionInt(sql);

                if (IDPyT > 0)
                {
                    foreach (BaseNegocio b in this)
                    {
                        if (Lib.NoIntNulo(b["IDPyT"]) == IDPyT)
                        {
                            pyt = (PresupuestoYTarifa)b;
                            break;
                        }
                    }
                }
            }

            if (pyt == null)
            {
                foreach (BaseNegocio b in this)
                {
                    if (Lib.NoIntNulo(b["IDTarifa"]) == IDTarifa)
                    {
                        pyt = (PresupuestoYTarifa)b;
                        break;
                    }
                }
            }

            if (pyt == null)
            {
                Tarifa      t = new Tarifa();
                BaseNegocio b = CrearEnBlanco();

                t.IDActual[0] = IDTarifa;

                t.Leer();
                b.ValoresPorDefecto(t);

                AnexarObjetoActivo();

                pyt = (PresupuestoYTarifa)this.ObjetoActivo;

                // Necesario.
                pyt.Guardar();
            }

            return(pyt);
        }
Esempio n. 7
0
 public ColPresupuestoVersionDetalle(BaseNegocio Padre, string CampoRelacionPadre, string Sql)
     : base(Padre, CampoRelacionPadre, Sql)
 {
 }