public static bool ValidaEliminacionGastoComun(YouCom.DTO.GastosComunes.GastoComunDTO theGastosComunesDTO, ref DataTable pobjDatatable)
        {
            bool retorno = false;

            YouCom.Service.BD.SQLHelper wobjSQLHelper = new YouCom.Service.BD.SQLHelper();
            wobjSQLHelper.SetParametro("@idGastoComun", SqlDbType.VarChar, 20, theGastosComunesDTO.IdGastoComun);

            try
            {
                //====================================================================================
                if (wobjSQLHelper.Ejecutar("validaEliminacionGastoComun", "YouCom", pobjDatatable) <= 0)
                {
                    retorno = false;
                }
                else
                {
                    retorno = true;
                }
            }
            catch (Exception eobjException)
            {
                throw eobjException;
            }
            return(retorno);
        }
        public static bool ActivaGastoComun(YouCom.DTO.GastosComunes.GastoComunDTO theGastosComunesDTO)
        {
            bool retorno = false;

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

            wobjSQLHelper.SetParametro("@usuarioIngreso", SqlDbType.VarChar, 50, theGastosComunesDTO.UsuarioModificacion);
            wobjSQLHelper.SetParametro("@pIdGasto", SqlDbType.VarChar, 20, theGastosComunesDTO.IdGastoComun);

            try
            {
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("Activa_GastoComun", "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);
        }
Exemple #3
0
        public static IList <YouCom.DTO.GastosComunes.GastoComunDTO> getListadoGastosComunes()
        {
            IList <YouCom.DTO.GastosComunes.GastoComunDTO> IGastosComunes = new List <YouCom.DTO.GastosComunes.GastoComunDTO>();

            DataTable pobjDataTable = new DataTable();

            if (YouCom.DAL.GastosComunes.GastoComunDAL.getListadoGastosComunes(ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    YouCom.DTO.GastosComunes.GastoComunDTO gastos = new YouCom.DTO.GastosComunes.GastoComunDTO();

                    gastos.IdGastoComun = decimal.Parse(wobjDataRow["idGasto"].ToString());

                    YouCom.DTO.Propietario.CasaDTO myCasaDTO = new YouCom.DTO.Propietario.CasaDTO();
                    myCasaDTO.IdCasa  = decimal.Parse(wobjDataRow["idCasa"].ToString());
                    gastos.TheCasaDTO = myCasaDTO;

                    YouCom.DTO.GastosComunes.GastoComunEstadoDTO myGastoComunEstadoDTO = new YouCom.DTO.GastosComunes.GastoComunEstadoDTO();
                    myGastoComunEstadoDTO.IdGastoComunEstado     = decimal.Parse(wobjDataRow["idGastoComunEstado"].ToString());
                    myGastoComunEstadoDTO.NombreGastoComunEstado = wobjDataRow["nombreGastoComunEstado"].ToString();
                    gastos.TheGastoComunEstadoDTO = myGastoComunEstadoDTO;

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

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

                    gastos.DescripcionGasto = wobjDataRow["descripcionGasto"].ToString();
                    gastos.MontoGasto       = decimal.Parse(wobjDataRow["montoGasto"].ToString());
                    gastos.FechaGasto       = Convert.ToDateTime(wobjDataRow["fechaGasto"].ToString());
                    gastos.FechaVencimiento = Convert.ToDateTime(wobjDataRow["fechaVencimiento"].ToString());
                    gastos.ArchivoGasto     = wobjDataRow["archivoGasto"].ToString();
                    gastos.FechaPagoGasto   = Convert.ToDateTime(wobjDataRow["fechaPagoGasto"].ToString());
                    gastos.ComentarioGasto  = wobjDataRow["comentarioGasto"].ToString();

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

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

                    IGastosComunes.Add(gastos);
                }
            }

            return(IGastosComunes);
        }
        public static bool Update(YouCom.DTO.GastosComunes.GastoComunDTO myGastosComunesDTO)
        {
            bool retorno = false;

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

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdGasto", SqlDbType.Decimal, -1, myGastosComunesDTO.IdGastoComun);
                wobjSQLHelper.SetParametro("@pIdCasa", SqlDbType.Decimal, -1, myGastosComunesDTO.TheCasaDTO.IdCasa);
                wobjSQLHelper.SetParametro("@pIdCondominio", SqlDbType.Decimal, -1, myGastosComunesDTO.TheCondominioDTO.IdCondominio);
                wobjSQLHelper.SetParametro("@pDescripcionGasto", SqlDbType.VarChar, 500, myGastosComunesDTO.DescripcionGasto);
                wobjSQLHelper.SetParametro("@pMontoGasto", SqlDbType.VarChar, 200, myGastosComunesDTO.MontoGasto);
                wobjSQLHelper.SetParametro("@pFechaGasto", SqlDbType.DateTime, -1, myGastosComunesDTO.FechaGasto);
                wobjSQLHelper.SetParametro("@pFechaVencimiento", SqlDbType.DateTime, -1, myGastosComunesDTO.FechaVencimiento);
                wobjSQLHelper.SetParametro("@pArchivoGasto", SqlDbType.VarChar, 200, !string.IsNullOrEmpty(myGastosComunesDTO.ArchivoGasto) ? myGastosComunesDTO.ArchivoGasto : System.Data.SqlTypes.SqlString.Null);
                wobjSQLHelper.SetParametro("@pIdGastoComunEstado", SqlDbType.VarChar, 10, myGastosComunesDTO.TheGastoComunEstadoDTO.IdGastoComunEstado);
                wobjSQLHelper.SetParametro("@pFechaPagoGasto", SqlDbType.DateTime, -1, myGastosComunesDTO.FechaPagoGasto);
                wobjSQLHelper.SetParametro("@pComentarioGasto", SqlDbType.VarChar, 500, !string.IsNullOrEmpty(myGastosComunesDTO.ComentarioGasto) ? myGastosComunesDTO.ComentarioGasto : System.Data.SqlTypes.SqlString.Null);
                wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myGastosComunesDTO.UsuarioModificacion);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("UPD_GastoComun", "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);
        }
Exemple #5
0
        public static bool ValidaEliminacionGastoComun(YouCom.DTO.GastosComunes.GastoComunDTO theGastosComunesDTO)
        {
            DataTable pobjDataTable = new DataTable();
            bool      retorno       = false;

            if (YouCom.DAL.GastosComunes.GastoComunDAL.ValidaEliminacionGastoComun(theGastosComunesDTO, ref pobjDataTable))
            {
                foreach (DataRow wobjDataRow in pobjDataTable.Rows)
                {
                    retorno = true;
                }
            }

            return(retorno);
        }
        public static bool Delete(YouCom.DTO.GastosComunes.GastoComunDTO myGastosComunesDTO)
        {
            bool retorno = false;

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

            try
            {
                //Seteo Parámetros.
                //====================================================================================
                wobjSQLHelper.SetParametro("@pIdGasto", SqlDbType.Decimal, -1, myGastosComunesDTO.IdGastoComun);
                wobjSQLHelper.SetParametro("@pUsuarioModificacion", SqlDbType.VarChar, 20, myGastosComunesDTO.UsuarioModificacion);
                //====================================================================================

                //Ejecuto SP.
                //====================================================================================
                switch (wobjSQLHelper.EjecutarNQ("DEL_GastoComun", "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);
        }