Example #1
0
 /// <summary>
 /// Permite eliminar Cuota por Id de Registro
 /// </summary>
 /// <param name="pIdCuota"></param>
 /// <returns></returns>
 public RetornaMensaje EliminarCuota(int pIdCuota)
 {
     retornaMensaje = new RetornaMensaje();
     try
     {
         cuotaDAO = new CuotaDAO();
         Cuota cuotaEliminar = new Cuota();
         cuotaEliminar = cuotaDAO.Buscar(pIdCuota);
         if (cuotaEliminar.N_IdCuota > 0)
         {
             cuotaDAO.Eliminar(pIdCuota);
             retornaMensaje.CodigoRetorno = 0;
             retornaMensaje.Mensage       = string.Format(resMensajes.msjEliminadoOK, "Cuota");
             retornaMensaje.Exito         = true;
         }
         else
         {
             retornaMensaje.CodigoRetorno = -1;
             retornaMensaje.Mensage       = string.Format(resMensajes.msjNoBuscado, "Cuota");
             retornaMensaje.Exito         = false;
         }
     }
     catch (Exception exception)
     {
         throw new FaultException <RetornaMensaje>
                   (new RetornaMensaje
         {
             Mensage     = string.Format(resMensajes.msjNoEliminado, "Cuota"),
             CodigoError = exception.GetHashCode().ToString(),
             Exito       = false
         }
                   , new FaultReason(exception.Message));
     }
     return(retornaMensaje);
 }
Example #2
0
        /// <summary>
        /// Registra Una Cuota para una vivienda del Condominio
        /// </summary>
        /// <param name="C_Periodo"></param>
        /// <param name="N_IdVivienda"></param>
        /// <param name="N_IdTipoPago"></param>
        /// <param name="N_Importe"></param>
        /// <param name="D_FecVncto"></param>
        /// <returns></returns>
        public RetornaMensaje RegistrarCuota(string C_Periodo, int N_IdVivienda, double N_Importe, string D_FecVncto)
        {
            Cuota cuotaBuscar = null;

            try
            {
                retornaMensaje = new RetornaMensaje();
                cuotaDAO       = new CuotaDAO();
                cuotaBuscar    = cuotaDAO.Buscar(C_Periodo, N_IdVivienda);
                if (cuotaBuscar == null)
                {
                    Cuota cuota = new Cuota
                    {
                        C_Periodo    = C_Periodo,
                        N_IdVivienda = N_IdVivienda,
                        N_Importe    = Convert.ToDecimal(N_Importe),
                        D_FecVncto   = Convert.ToDateTime(D_FecVncto)
                    };
                    retornaMensaje.CodigoRetorno = cuotaDAO.Registrar(cuota);
                    retornaMensaje.Mensage       = string.Format(resMensajes.msjGuardadoOK, "Cuota");
                    retornaMensaje.Exito         = true;
                }
                else
                {
                    retornaMensaje.CodigoRetorno = -1;
                    retornaMensaje.Mensage       = string.Format(resMensajes.msjYaExiste, "Cuota");
                    retornaMensaje.Exito         = false;
                }
            }
            catch (Exception exception)
            {
                throw new FaultException <RetornaMensaje>
                          (new RetornaMensaje
                {
                    Mensage     = string.Format(resMensajes.msjNoRegistrado, "Cuota"),
                    CodigoError = exception.GetHashCode().ToString(),
                    Exito       = false
                }
                          , new FaultReason(exception.Message));
            }
            return(retornaMensaje);
        }
Example #3
0
        public List <Cuota> ListarCuotaMorosas(string pPeriodo)
        {
            List <Cuota> lstCuota = new List <Cuota>();

            try
            {
                cuotaDAO = new CuotaDAO();

                /* LEER LA COLA DE MENSAJES Y GUARDAR EN BASE DE DATOS */
                string       rutaCola         = ConfigurationManager.AppSettings["DireccionMSQColas"].ToString(); // @".\private$\CondominioCola";
                MessageQueue cola             = new MessageQueue(rutaCola);
                int          cantidadMensajes = cola.GetAllMessages().Count();
                if (cantidadMensajes > 0)
                {
                    foreach (Message mensajeTodo in cola.GetAllMessages())
                    {
                        cola.Formatter = new XmlMessageFormatter(new Type[] { typeof(Cuota) });
                        Message mensaje   = cola.Receive();
                        Cuota   pagoCuota = (Cuota)mensaje.Body;

                        int cuotaRegistrado = -1;
                        cuotaRegistrado = cuotaDAO.PagarCuota(pagoCuota);
                    }
                }

                /* FIN LEER LA COLA DE MENSAJES Y GUARDAR EN BASE DE DATOS */

                lstCuota = cuotaDAO.ListarMorosos(pPeriodo);
            }
            catch (Exception exception)
            {
                throw new FaultException <RetornaMensaje>
                          (new RetornaMensaje
                {
                    Mensage     = string.Format(resMensajes.msjNoListado, "Cuota"),
                    CodigoError = exception.GetHashCode().ToString(),
                    Exito       = true
                }
                          , new FaultReason(exception.Message));
            }
            return(lstCuota);
        }
Example #4
0
        /// <summary>
        /// Permite buscar cuota por Id de registro
        /// </summary>
        /// <param name="pIdCuota"></param>
        /// <returns></returns>
        public Cuota BuscarCuota(int pIdCuota)
        {
            Cuota cuota = new Cuota();

            try
            {
                cuotaDAO = new CuotaDAO();
                cuota    = cuotaDAO.Buscar(pIdCuota);
            }
            catch (Exception exception)
            {
                throw new FaultException <RetornaMensaje>
                          (new RetornaMensaje
                {
                    Mensage     = string.Format(resMensajes.msjNoBuscado, "Cuota"),
                    CodigoError = exception.GetHashCode().ToString(),
                    Exito       = false
                }
                          , new FaultReason(exception.Message));
            }
            return(cuota);
        }