Example #1
0
        public void CopiarTarifas(PresupuestoVersion origenPV)
        {
            ColPresupuestoVersionDetalle cpv       = (ColPresupuestoVersionDetalle)this.Coleccion("ColPresupuestoVersionDetalle");
            ColPresupuestoVersionDetalle cpvOrigen = (ColPresupuestoVersionDetalle)origenPV.Coleccion("ColPresupuestoVersionDetalle");

            foreach (BaseNegocio orig in cpvOrigen)
            {
                bool encontrado = false;
                foreach (BaseNegocio existente in cpv)
                {
                    if ((int)orig["IDPyT"] == (int)existente["IDPyT"])
                    {
                        encontrado = true;
                        break;
                    }
                }

                if (!encontrado)
                {
                    cpv.CrearEnBlanco();

                    cpv.ObjetoActivo["IDPyT"] = orig["IDPyT"];

                    cpv.AnexarObjetoActivo();
                }
            }
        }
Example #2
0
        public override void Metodo(System.Web.UI.Page pag, string Nombre, int[] Param)
        {
            if (Nombre == "Nuevas")
            {
                //if (AceptadoAhoraVersion)
                //{
                //    ErrorMensaje = "La versión del presupuesto está aceptada. No se pueden añadir tarifas.";
                //}
                //else
                //{
                int posicion = 0;

                foreach (int idTarifa in Param)
                {
                    if (idTarifa > 0)
                    {
                        ColPresupuestoVersionDetalle col = (ColPresupuestoVersionDetalle)Coleccion("ColPresupuestoVersionDetalle");

                        col.CrearLinea(idTarifa, ref posicion);
                    }
                }
                //}

                string script = "";

                script += "if (window.opener != null) {window.opener." + pag.ClientScript.GetPostBackEventReference(pag, "noguardar") + "}";
                script += "window.close();";

                ((PROT.ControlesEspeciales.RaizPage)pag).RegistraStartupScript("selec", script, true);
            }

            base.Metodo(pag, Nombre, Param);
        }
Example #3
0
        public override void ValoresPorDefecto(BaseNegocio origen)
        {
            if (origen is Presupuesto)
            {
                bool existePrincipalAceptada = false;
                ColPresupuestoVersion col    = (ColPresupuestoVersion)ObjetoAsociado("Presupuesto").Coleccion("ColPresupuestoVersion");

                this["IDPresupuesto"] = origen["IDPresupuesto"];

                foreach (BaseNegocio b in col)
                {
                    if ((int)this["Version"] <= (int)b["Version"])
                    {
                        this["Version"] = (int)b["Version"] + 1;
                    }
                    if ((bool)b["Principal"] && (bool)b["Aceptado"])
                    {
                        existePrincipalAceptada = true;
                    }
                }

                // Si no hay presupuestos pues lo dejamos como está.

                if (col.Count > 0)
                {
                    this["Principal"] = false;
                    if (existePrincipalAceptada)
                    {
                        this["Ampliacion"] = true;
                    }
                    else
                    {
                        // Copiar las unidades y tarifas de la última versión.

                        int posicion = 0;
                        ColPresupuestoVersionDetalle colPDT = (ColPresupuestoVersionDetalle)Coleccion("ColPresupuestoVersionDetalle");

                        foreach (BaseNegocio bdt in col[col.Count - 1].Coleccion("ColPresupuestoVersionDetalle"))
                        {
                            colPDT.CrearLinea((int)bdt["IDTarifa"], ref posicion);
                        }
                    }
                }
            }

            base.ValoresPorDefecto(origen);
        }