using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.Common; using AyAEL.CVP; using AyADAL; namespace AyABL.CVP { public class CicloVidaBL : AyABL { #region Constructores public CicloVidaBL() { objCicloVidaEL = new CicloVidaEL(); this.NombreTabla = Modulos.t_cvp_.ToString() + Tablas.ciclovida.ToString(); this.NombreConeccionBD = BASESDEDATOS.FOPI.ToString(); } #endregion #region Atributos public CicloVidaEL objCicloVidaEL { get; set; } #endregion #region Metodos /// /// Inluye los datos del CicloVida /// /// public int insertarCicloVida() { int intEjecutado = 0; this.CamposTabla = t_cvp_ciclovida.PORCENTAJE.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + t_cvp_ciclovida.MONTO.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + //t_cvp_ciclovida.FECHAETAPAANTERIOR.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + //t_cvp_ciclovida.FECHAAPROBACION.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + Constraints.FK.ToString() + t_cvp_ciclovida.ETAPAACTUAL.ToString().ToUpper() + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.ETAPAANTERIOR.ToString().ToUpper() + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.FASEEJECUCION.ToString().ToUpper() + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.ESTUDIOFACTIBILIDAD.ToString().ToUpper() + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.EJECUTAPROYECTO.ToString().ToUpper() + ", " + Constraints.FK.ToString() + Tablas.proyecto.ToString().ToUpper(); this.ValoresCampos = new object[]{objCicloVidaEL.Porcentaje, objCicloVidaEL.Monto, //objCicloVidaEL.FechaEtapaAnterior, //objCicloVidaEL.FechaAprobacion, objCicloVidaEL.EtapaActual, //objCicloVidaEL.EtapaAnterior, //objCicloVidaEL.FaseEjecucion, //objCicloVidaEL.EstudioFactibilidad, //objCicloVidaEL.EjecutaProyecto, objCicloVidaEL.Proyecto }; intEjecutado = baseDAL.Insertar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD); return intEjecutado; } /// /// Actualiza el dato del CicloVida /// public bool actualizarCicloVida() { ArrayList arlCondiciones = new ArrayList(); bool blnEjecutado = false; if (objCicloVidaEL.PK != 0) { arlCondiciones.Add(this.buscarPorPK(objCicloVidaEL.PK, Tablas.ciclovida, operadorLogico.AND)); } this.CamposTabla = t_cvp_ciclovida.PORCENTAJE.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + t_cvp_ciclovida.MONTO.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + //t_cvp_ciclovida.FECHAETAPAANTERIOR.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + //t_cvp_ciclovida.FECHAAPROBACION.ToString() + Tablas.ciclovida.ToString().ToUpper() + ", " + Constraints.FK.ToString() + t_cvp_ciclovida.ETAPAACTUAL.ToString().ToUpper(); // + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.ETAPAANTERIOR.ToString().ToUpper() + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.FASEEJECUCION.ToString().ToUpper() + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.ESTUDIOFACTIBILIDAD.ToString().ToUpper() + ", " + //Constraints.FK.ToString() + t_cvp_ciclovida.EJECUTAPROYECTO.ToString().ToUpper(); this.ValoresCampos = new object[]{ objCicloVidaEL.Porcentaje, objCicloVidaEL.Monto, //objCicloVidaEL.FechaEtapaAnterior, //objCicloVidaEL.FechaAprobacion, objCicloVidaEL.EtapaActual //objCicloVidaEL.EtapaAnterior, //objCicloVidaEL.FaseEjecucion, //objCicloVidaEL.EstudioFactibilidad, //objCicloVidaEL.EjecutaProyecto }; baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones); blnEjecutado = true; return blnEjecutado; } /// /// Actualiza el estado del CicloVida /// public bool actualizaEstadoCicloVida() { ArrayList arlCondiciones = new ArrayList(); bool blnEjecutado = false; arlCondiciones.Add(this.buscarPorFK(objCicloVidaEL.Proyecto, Tablas.proyecto, operadorLogico.NONE)); this.CamposTabla = Concepto.ASTATE.ToString() + Tablas.ciclovida.ToString(); this.ValoresCampos = new object[] { objCicloVidaEL.ASTATE = false }; baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones); blnEjecutado = true; return blnEjecutado; } /// /// Lista los CicloVidaes /// /// public DataSet getCicloVida() { ArrayList arlCondiciones = new ArrayList(); if (this.objCicloVidaEL.Proyecto != 0) { arlCondiciones.Add(buscarPorFK(objCicloVidaEL.Proyecto, Tablas.proyecto, operadorLogico.AND)); } arlCondiciones.Add(buscarPorAstate(true, Tablas.ciclovida, operadorLogico.NONE)); DataSet dsCicloVida = baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arlCondiciones, null, " ORDER BY PKCicloVida ASC "); return dsCicloVida; } public DataSet getFichaCicloVida() { ArrayList arlCondiciones = new ArrayList(); arlCondiciones.Add(buscarPorFK(objCicloVidaEL.Proyecto, Tablas.proyecto, operadorLogico.NONE)); NombreTabla = Vistas.v_fichaciclovida.ToString(); DataSet dsCicloVida = baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arlCondiciones, null, " ORDER BY PKCicloVida ASC "); return dsCicloVida; } #endregion #region Condiciones de Busqueda #endregion } }