Ejemplo n.º 1
0
        /// <summary>
        /// Devuelve una lista de transacciones deacuerdo a un vehiculo o las devuelve todas
        /// </summary>
        /// <param name="parametro">Puede representar el IdVehiculo</param>
        /// <returns>Devuelve una lista de objetos transaccion</returns>
        public static List <Transaccion> listar(int parametro)
        {
            _Transaccion tran = null;

            if (parametro > 0)
            {
                Transaccion t = new Transaccion {
                    Id_Vehiculo = parametro
                };
                tran = new _Transaccion(t);
            }
            else
            {
                tran = new _Transaccion(new Transaccion());
            }
            var result = tran.listar();

            return(result);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Permite anular transaccion especifica
        /// </summary>
        /// <param name="idTransaccion">Representa un numero de identificacion de una transaccion</param>
        /// <returns>1 si tiene exito, -1 en caso contrario</returns>
        public static int anular(int idTransaccion)
        {
            int         result = -1;
            Transaccion tran   = new Transaccion()
            {
                IdTransaccion = idTransaccion
            };

            try
            {
                _Transaccion db = new _Transaccion(tran);
                result = db.anular();
            }
            catch (Exception ex)
            {
                result = -1;
                throw ex;
            }
            return(result);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Permite agregar una transaccion al modelo
        /// </summary>
        /// <param name="idUsuario">Numero de identificacion del usuario</param>
        /// <param name="idVehiculo">Numero de identificacion del vehiculo</param>
        /// <param name="fecha">Fecha de la transaccion</param>
        /// <param name="activo">Estado de la transaccion</param>
        /// <returns>1 en caso de tener exito, -1 en caso contrario</returns>
        public static int agregar(int idUsuario, int idVehiculo, DateTime fecha, bool activo)
        {
            int         result = -1;
            Transaccion tran   = new Transaccion()
            {
                Id_usuario       = idUsuario,
                Id_Vehiculo      = idVehiculo,
                FechaTransaccion = fecha,
                Activo           = activo
            };

            try
            {
                _Transaccion db = new _Transaccion(tran);
                result = db.agregar();
            }
            catch (Exception ex)
            {
                result = -1;
                throw ex;
            }
            return(result);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            //Guardamos transaccion
            new _Transaccion(new Transaccion {
                Id_usuario = 1, Id_Vehiculo = 23, FechaTransaccion = DateTime.Now.Date, Activo = true
            }).agregar();
            Console.WriteLine("transaccion guardada");
            var ult = new _Transaccion().getUltima();

            new _Abono(new Abono {
                Id_transaccion = ult.IdTransaccion, id_detalle = 1, Monto = 1000
            }).Agregar();
            Console.WriteLine("Abono agregado");
            Console.ReadKey();
            //try
            //{
            ////Agregando Usuarios
            ////TipoUsuarioController.agregar("Administrador");
            ////TipoUsuarioController.agregar("Cajero");
            //////Usuario
            ////UsuariosController.agregar("001-221190-0025A", "Noel", "Obando", "", "78553482", "*****@*****.**", true, "altair", "123321", 1);
            //UsuariosController.agregar("", "aizen", "souske", "", "", "", true, "aizen", "123321", 2);
            //    //Agregando Socios
            //    SociosController.agregar(DateTime.Now, "", "Hermogenes", " Martinez", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Luis", "Martinez", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Santos", "Somarriba", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Miriam", "Morales", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Maria", "Orozco", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Carlos", "Sandoval", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Edgar", "Fonseca", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Daniel", "Chinchilla", "", "", "", true);
            //    SociosController.agregar(DateTime.Now, "", "Marvin", "Castañeda", "", "", "", true);
            //    Console.WriteLine("Ultimo Socio agregado");
            //    Console.WriteLine("Socios Agregados");
            //    //Data Source=.;Initial Catalog=Etramulv2;Integrated Security=True;Pooling=False;MultipleActiveResultSets=True
            //    VehiculosController.agregar(2, "M 2287", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(2, "M 2023", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(2, "M 2024", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(2, "M 2434", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(2, "M 0574", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(3, "M 1940", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(3, "M 2460", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(3, "M 2459", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(3, "M 0891", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(3, "M 2170", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(4, "M 2348", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(4, "M 0813", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(4, "M 1093", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(4, "M 1528", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(5, "M 0571", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(6, "M 1890", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(6, "M 1277", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(7, "M 2432", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(7, "M 1235", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(7, "M 2526", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(8, "M 0620", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(9, "M 2410", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(9, "M 2663", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(9, "M 1060", "MERCEDEZ", "BENZ");
            //    VehiculosController.agregar(9, "M 2433", "MERCEDEZ", "BENZ");

            //    VehiculosController.agregar(10, "M 2411", "MERCEDEZ", "BENZ");
            //    Console.WriteLine("Agregados");
            //    Console.ReadKey();
            //}
            //catch (Exception ex)
            //{
            //    Console.WriteLine(ex.Message);
            //}
        }