using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Data.Common; using AyAEL.IGP; using AyADAL; namespace AyABL.IGP { public class CentroGestorBL : AyABL { #region Constructores public CentroGestorBL() { objCentroGestorEL = new CentroGestorEL(); this.NombreTabla = Modulos.t_igp_.ToString() + Tablas.centrogestor.ToString(); this.NombreConeccionBD = BASESDEDATOS.FOPI.ToString(); } #endregion #region Atributos public CentroGestorEL objCentroGestorEL { get; set; } #endregion #region Metodos /// /// Inluye los datos del CentroGestor /// /// public bool insertarCentroGestor() { bool blnEjecutado = false; this.CamposTabla = t_agp_centrogestor.PREINVERSION.ToString() + Tablas.centrogestor.ToString().ToUpper() + ", " + t_agp_centrogestor.EJECUCION.ToString() + Tablas.centrogestor.ToString().ToUpper() + ", " + Constraints.FK.ToString() + Tablas.procedenciacentrogestor.ToString().ToUpper() + ", " + Constraints.FK.ToString() + Tablas.proyecto.ToString().ToUpper(); this.ValoresCampos = new object[]{objCentroGestorEL.Preinversion, objCentroGestorEL.Ejecucion, objCentroGestorEL.Procedencia, objCentroGestorEL.Proyecto }; baseDAL.Insertar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, null); blnEjecutado = true; return blnEjecutado; } /// /// Actualiza el dato del CentroGestor /// public bool actualizarCentroGestor() { ArrayList arlCondiciones = new ArrayList(); bool blnEjecutado = false; if (objCentroGestorEL.PK != 0) { arlCondiciones.Add(this.buscarPorPK(objCentroGestorEL.PK, Tablas.centrogestor, operadorLogico.AND)); } this.CamposTabla = t_agp_centrogestor.PREINVERSION.ToString() + Tablas.centrogestor.ToString().ToUpper() + ", " + t_agp_centrogestor.EJECUCION.ToString() + Tablas.centrogestor.ToString().ToUpper() + ", " + Constraints.FK.ToString() + Tablas.procedenciacentrogestor.ToString().ToUpper() + ", " + Constraints.FK.ToString() + Tablas.proyecto.ToString().ToUpper(); this.ValoresCampos = new object[]{objCentroGestorEL.Preinversion, objCentroGestorEL.Ejecucion, objCentroGestorEL.Procedencia, objCentroGestorEL.Proyecto }; baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones); blnEjecutado = true; return blnEjecutado; } /// /// Actualiza el estado del CentroGestor /// public bool actualizaEstadoCentroGestor() { ArrayList arlCondiciones = new ArrayList(); bool blnEjecutado = false; if (objCentroGestorEL.PK != 0) { arlCondiciones.Add(this.buscarPorPK(objCentroGestorEL.PK, Tablas.centrogestor, operadorLogico.AND)); } this.CamposTabla = Concepto.ASTATE.ToString() + Tablas.centrogestor.ToString(); this.ValoresCampos = new object[] { objCentroGestorEL.ASTATE }; baseDAL.Actualizar(this.NombreTabla, this.CamposTabla, this.ValoresCampos, this.NombreConeccionBD, arlCondiciones); blnEjecutado = true; return blnEjecutado; } /// /// Lista los CentroGestores /// /// public DataSet getCentroGestor() { ArrayList arlCondiciones = new ArrayList(); if (objCentroGestorEL.PK != 0) arlCondiciones.Add(buscarPorPK(objCentroGestorEL.PK, Tablas.centrogestor, operadorLogico.NONE)); if (objCentroGestorEL.Proyecto != 0) arlCondiciones.Add(buscarPorFK(objCentroGestorEL.Proyecto, Tablas.proyecto, operadorLogico.NONE)); NombreTabla = Vistas.v_centrogestor.ToString(); DataSet dsCentroGestor = baseDAL.EjecutarConsulta(this.NombreTabla, this.CamposTabla, this.NombreConeccionBD, arlCondiciones, null, " ORDER BY PKPROCEDENCIACENTROGESTOR ASC "); return dsCentroGestor; } #endregion #region Condiciones de Busqueda #endregion } }