Example #1
0
        public static IList <YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO> getListadoVotacionPropuestaEstado()
        {
            IList <YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO> IVotacionPropuestaEstado = new List <YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.DAL.VotacionPropuestaEstadoDAL.getListadoVotacionPropuestaEstado(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO VotacionPropuestaEstado = new YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO();

                    VotacionPropuestaEstado.IdVotacionPropuestaEstado     = decimal.Parse(wobjDataRow["IdVotacionPropuestaEstado"].ToString());
                    VotacionPropuestaEstado.NombreVotacionPropuestaEstado = wobjDataRow["nombreVotacionPropuestaEstado"].ToString();

                    VotacionPropuestaEstado.UsuarioIngreso      = wobjDataRow["usuario_ingreso"].ToString();
                    VotacionPropuestaEstado.FechaIngreso        = wobjDataRow["fecha_ingreso"].ToString();
                    VotacionPropuestaEstado.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString();
                    VotacionPropuestaEstado.FechaModificacion   = wobjDataRow["fecha_modificacion"].ToString();

                    VotacionPropuestaEstado.Estado = wobjDataRow["estado"].ToString();

                    IVotacionPropuestaEstado.Add(VotacionPropuestaEstado);
                }
            }

            return(IVotacionPropuestaEstado);
        }
        public static bool ValidaEliminacionVotacionPropuestaEstado(YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO theVotacionPropuestaEstadoDTO, ref DataTable pobjDatatable)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();
            wobjSQLHelper.SetParametro("@idVotacionPropuestaEstado", SqlDbType.VarChar, 20, theVotacionPropuestaEstadoDTO.IdVotacionPropuestaEstado);

            try
            {
                //====================================================================================
                if (wobjSQLHelper.Ejecutar("validaEliminacionVotacionPropuestaEstado", "YouCom", pobjDatatable) <= 0)
                {
                    retorno = false;
                }
                else
                {
                    retorno = true;
                }
            }
            catch (Exception eobjException)
            {
                throw eobjException;
            }
            return(retorno);
        }
        public static bool ActivaVotacionPropuestaEstado(YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO theVotacionPropuestaEstadoDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theVotacionPropuestaEstadoDTO.UsuarioModificacion);
            wobjSQLHelper.SetParametro("@pIdVotacionPropuestaEstado", SqlDbType.VarChar, 20, theVotacionPropuestaEstadoDTO.IdVotacionPropuestaEstado);

            try
            {
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("Activa_VotacionPropuestaEstado", "YouCom"))
                {
                case 0:
                    throw new Exception("No se pudo grabar.");

                case -1:
                    throw new Exception("Hubo un error.");

                case -2:
                    throw new Exception("Hubo un error.");
                }
                //====================================================================================
                retorno = true;
            }
            catch (Exception eobjException)
            {
                throw eobjException;
            }
            return(retorno);
        }
        public static IList <YouCom.DTO.Propuesta.VotacionPropuestaDTO> getListadoVotacionPropuesta()
        {
            IList <YouCom.DTO.Propuesta.VotacionPropuestaDTO> IVotacionPropuesta = new List <YouCom.DTO.Propuesta.VotacionPropuestaDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.DAL.VotacionPropuestaDAL.getListadoVotacionPropuesta(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.Propuesta.VotacionPropuestaDTO votacion = new YouCom.DTO.Propuesta.VotacionPropuestaDTO();

                    votacion.IdVotacionPropuesta = decimal.Parse(wobjDataRow["idVotacionPropuesta"].ToString());

                    YouCom.DTO.Seguridad.CondominioDTO myCondominioDTO = new YouCom.DTO.Seguridad.CondominioDTO();
                    myCondominioDTO.IdCondominio = decimal.Parse(wobjDataRow["idCondominio"].ToString());
                    votacion.TheCondominioDTO    = myCondominioDTO;

                    YouCom.DTO.Seguridad.ComunidadDTO myComunidadDTO = new YouCom.DTO.Seguridad.ComunidadDTO();
                    myComunidadDTO.IdComunidad = decimal.Parse(wobjDataRow["idComunidad"].ToString());
                    votacion.TheComunidadDTO   = myComunidadDTO;

                    YouCom.DTO.Propuesta.PropuestaDTO myPropuestaDTO = new YouCom.DTO.Propuesta.PropuestaDTO();
                    myPropuestaDTO.IdPropuesta          = decimal.Parse(wobjDataRow["idPropuesta"].ToString());
                    myPropuestaDTO.NombrePropuesta      = wobjDataRow["nombrePropuesta"].ToString();
                    myPropuestaDTO.DescripcionPropuesta = wobjDataRow["descripcionPropuesta"].ToString();

                    YouCom.DTO.Propietario.FamiliaDTO myFamiliaDTO = new YouCom.DTO.Propietario.FamiliaDTO();
                    myFamiliaDTO.IdFamilia              = decimal.Parse(wobjDataRow["idFamilia"].ToString());
                    myFamiliaDTO.NombreFamilia          = wobjDataRow["nombreFamilia"].ToString();
                    myFamiliaDTO.ApellidoPaternoFamilia = wobjDataRow["apellidoPaternoFamilia"].ToString();
                    myFamiliaDTO.ApellidoMaternoFamilia = wobjDataRow["apellidoMaternoFamilia"].ToString();
                    myPropuestaDTO.TheFamiliaDTO        = myFamiliaDTO;

                    votacion.ThePropuestaDTO = myPropuestaDTO;

                    YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO myVotacionPropuestaEstadoDTO = new YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO();
                    myVotacionPropuestaEstadoDTO.IdVotacionPropuestaEstado     = decimal.Parse(wobjDataRow["idVotacionPropuestaEstado"].ToString());
                    myVotacionPropuestaEstadoDTO.NombreVotacionPropuestaEstado = wobjDataRow["nombreVotacionPropuestaEstado"].ToString();
                    votacion.TheVotacionPropuestaEstadoDTO = myVotacionPropuestaEstadoDTO;

                    votacion.FechaInicioVotacionPropuesta  = Convert.ToDateTime(wobjDataRow["fechaInicioVotacionPropuesta"].ToString());
                    votacion.FechaTerminoVotacionPropuesta = Convert.ToDateTime(wobjDataRow["fechaTerminoVotacionPropuesta"].ToString());

                    votacion.UsuarioIngreso      = wobjDataRow["usuario_ingreso"].ToString();
                    votacion.FechaIngreso        = wobjDataRow["fecha_ingreso"].ToString();
                    votacion.UsuarioModificacion = wobjDataRow["usuario_modificacion"].ToString();
                    votacion.FechaModificacion   = wobjDataRow["fecha_modificacion"].ToString();
                    votacion.Estado = wobjDataRow["estado"].ToString();

                    IVotacionPropuesta.Add(votacion);
                }
            }

            return(IVotacionPropuesta);
        }
Example #5
0
        public static bool ValidaEliminacionVotacionPropuestaEstado(YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO theVotacionPropuestaEstadoDTO)
        {
            DataTable pobjDataTable = new DataTable();
            bool      retorno       = false;

            if (YouCom.DAL.VotacionPropuestaEstadoDAL.ValidaEliminacionVotacionPropuestaEstado(theVotacionPropuestaEstadoDTO, ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    retorno = true;
                }
            }

            return(retorno);
        }
        public static bool Update(YouCom.DTO.Propuesta.VotacionPropuestaEstadoDTO myVotacionPropuestaEstadoDTO)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();

            try
            {
                //Seteo ParĂ¡metros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdVotacionPropuestaEstado", SqlDbType.Decimal, -1, myVotacionPropuestaEstadoDTO.IdVotacionPropuestaEstado);
                wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.VarChar, -1, myVotacionPropuestaEstadoDTO.TheCondominioDTO.IdCondominio);
                wobjSQLHelper.SetParametro("@pNombreVotacionPropuestaEstado", SqlDbType.VarChar, 200, myVotacionPropuestaEstadoDTO.NombreVotacionPropuestaEstado);
                wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myVotacionPropuestaEstadoDTO.UsuarioModificacion);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("UPD_VotacionPropuestaEstado", "YouCom"))
                {
                case 0:
                    throw new Exception("No se pudo grabar.");

                case -1:
                    throw new Exception("Hubo un error.");

                case -2:
                    throw new Exception("Hubo un error.");
                }
                //====================================================================================

                retorno = true;
            }

            #region Catch

            catch (Exception eobjException)
            {
                throw eobjException;
            }
            #endregion

            return(retorno);
        }