Example #1
0
        public Boolean GenerarComprobanteAlquiler(EntComprobantedepagoalquiler fact)
        {
            SqlCommand cmd = null;
            Boolean    generar;

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd = new SqlCommand("SP_GenerarCompAlquiler", cn)
                {
                    CommandType = System.Data.CommandType.StoredProcedure,
                };

                cmd.Parameters.AddWithValue("@prmintAlquilerID", fact.Alquiler.AlquilerID);
                cmd.Parameters.AddWithValue("@prmdoubleMonto", fact.Monto);
                cmd.Parameters.AddWithValue("@prmintserie", fact.NumeroSerie);

                cn.Open();
                int result = cmd.ExecuteNonQuery();
                generar = result > 0 ? true : false;
            }
            catch (SqlException err)
            {
                throw err;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(generar);
        }
Example #2
0
        public ActionResult RealizarAlquiler(EntHabitacion habitacion, FormCollection frm)
        {
            verificarSesion();
            string dni = frm["txtDni"];

            string numeroHabitacion = frm["txtNumeroHabitacion"];

            double precio = double.Parse(frm["txtprecio"]);

            EntHuesped huesped = LogHuesped.Instancia.BuscarHuesped(dni);

            habitacion = new EntHabitacion
            {
                NumeroHabitacion = numeroHabitacion
            };

            Random rdn = new Random();

            EntAlquiler alquiler = new EntAlquiler
            {
                AlquilerID     = rdn.Next(20, int.MaxValue),
                FechadeIngreso = frm["txtFechaIngreso"],
                FechadeSalida  = frm["txtFechaSalida"],

                CantidaAdultos = int.Parse(frm["txtCantidadAdultos"]),

                CantidadKids = int.Parse(frm["txtCantidadKids"]),

                Habitacion = habitacion,
                Huesped    = huesped
            };

            try
            {
                Boolean alquila = LogAlquiler.Instancia.RealizarAlquiler(alquiler);
                if (alquila)
                {
                    EntComprobantedepagoalquiler ca = new EntComprobantedepagoalquiler
                    {
                        Alquiler    = alquiler,
                        Monto       = precio,
                        NumeroSerie = rdn.Next(10001, int.MaxValue)
                    };

                    Boolean generarCPAlquiler = LogComprobantePagoAlquiler.Instancia.GenerarComprobanteAlquiler(ca);

                    return(RedirectToAction("AlquilerMenu", "RealizarAlquiler", new { dni = huesped.Dni }));
                }
                else
                {
                    return(View(alquiler));
                }
            }
            catch (ApplicationException ex)
            {
                return(RedirectToAction("RealizarAlquiler", new { mesjException = ex.Message }));
            }
        }
Example #3
0
 public Boolean GenerarComprobanteAlquiler(EntComprobantedepagoalquiler fact)
 {
     try
     {
         return(DatComprobantePagoAlquiler.Instancia.GenerarComprobanteAlquiler(fact));
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Example #4
0
        public List <EntComprobantedepagoalquiler> IngresosAlquiler()
        {
            SqlCommand cmd = null;
            List <EntComprobantedepagoalquiler> lista = new List <EntComprobantedepagoalquiler>();

            try
            {
                SqlConnection cn = Conexion.Instancia.Conectar();
                cmd = new SqlCommand("SP_IngresosAlquiler", cn)
                {
                    CommandType = System.Data.CommandType.StoredProcedure
                };


                cn.Open();
                SqlDataReader dr = cmd.ExecuteReader();
                while (dr.Read())
                {
                    EntComprobantedepagoalquiler ca = new EntComprobantedepagoalquiler
                    {
                        Fechadeemision = Convert.ToString(dr["Fechadeemision"]),
                        Monto          = Convert.ToDouble(dr["Cantidad"])
                    };


                    lista.Add(ca);
                }
            }
            catch (SqlException e)
            {
                throw e;
            }
            finally
            {
                cmd.Connection.Close();
            }
            return(lista);
        }