Ejemplo n.º 1
0
        public static void Update(int IdInventario, int NDato)
        {
            if (Find(IdInventario))
            {
                Inventario v = Search(IdInventario);
                if (v != null)
                {
                    switch (NDato)
                    {
                    case 1:
                        Console.WriteLine("\nNueva Cantidad: ");
                        v.Cantidad = Scanner.NextInt();
                        break;

                    case 2:
                        Console.Write("\nNuevo Precio Base: ");
                        v.PrecioBase = Scanner.NextLong();
                        break;

                    case 3:
                        Console.Write("\nNuevo Precio de venta: ");
                        v.PrecioVenta = Scanner.NextLong();
                        break;

                    case 4:
                        Console.Write("\nFecha de ingreso dd/MM/yyy: ");
                        v.FechaIngreso = DateTime.ParseExact(Console.ReadLine(), "d/MM/yyyy", null);
                        break;

                    case 5:
                        Console.Write("\nFecha de Salida dd/MM/yyy: ");
                        v.FechaSalida = DateTime.ParseExact(Console.ReadLine(), "d/MM/yyyy", null);
                        break;
                    }

                    Edit(ListaInventario.IndexOf(v), NDato - 1, v, "Files/Inventario.txt");
                }
                else
                {
                    Console.WriteLine("¡Oooops, A ocurrido un erro!");
                }
            }
        }
Ejemplo n.º 2
0
        public static void Update(long CedCliente, int NDato)
        {
            if (Find(CedCliente))
            {
                Cliente v = Search(CedCliente);
                if (v != null)
                {
                    switch (NDato)
                    {
                    case 1:
                        Console.Write("\nNueva Cedula: ");
                        v.Cedula = Scanner.NextLong();
                        break;

                    case 2:
                        Console.Write("\nNuevo Nombre: ");
                        v.Nombre = Scanner.NextLine();
                        break;

                    case 3:
                        Console.Write("\nNueva Fecha de nacimiento dd/MM/yyy: ");
                        v.FechaNacimiento = DateTime.ParseExact(Console.ReadLine(), "d/MM/yyyy", null);
                        break;

                    case 4:
                        Console.Write("\nNuevo Sexo\n1. Femenino.\n2. Masculino.\n:: ");
                        if (Scanner.NextInt() == 1)
                        {
                            v.Sexo = Sexo.Femnino;
                        }
                        else
                        {
                            v.Sexo = Sexo.Masculino;
                        }
                        break;

                    case 5:
                        Console.Write("\nNuevo Teléfono: ");
                        v.Telefono = Scanner.NextLong();
                        break;

                    case 6:
                        Console.Write("\nNuevo Correo: ");
                        v.Correo = Scanner.NextLine();
                        break;

                    case 7:
                        Console.Write("\nNueva Dirección: ");
                        v.Direccion = Scanner.NextLine();
                        break;

                    case 8:
                        Console.Write("\nNuevo Estado civil\n1. Soltero.\n2. Casado.\n3. Viudo.\n4. Divorciado.\n5. Union libre.\n:: ");
                        int estado = Scanner.NextInt();
                        for (int i = 0; i < 5; i++)
                        {
                            if (estado - 1 == i)
                            {
                                v.EstadoCivil = (EstadoCivil)i;
                                break;
                            }
                            ;
                        }
                        break;
                    }

                    Edit(ListaClientes.IndexOf(v), NDato - 1, v, "Files/Cliente.txt");
                }
                else
                {
                    Console.WriteLine("¡Oooops, A ocurrido un erro!");
                }
            }
        }
Ejemplo n.º 3
0
        public static void MenuClientes()
        {
            int option;

            LoadList();

            do
            {
                Console.Write("\n\tBienvenido al menú de clienteses\n" +
                              "\t1. Crear clientes.\n" +
                              "\t2. Eliminar clientes.\n" +
                              "\t3. Editar clientes.\n" +
                              "\t4. Listar clienteses.\n" +
                              "\t5. Busacar clientes.\n" +
                              "\t6. Salir.\n" +
                              "\t:: ");

                option = Scanner.NextInt();

                switch (option)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Crear clientes ---");
                    Cliente v = new Cliente();

                    Console.Write("\nCedula: ");
                    v.Cedula = Scanner.NextLong();

                    Console.Write("\nNombre: ");
                    v.Nombre = Scanner.NextLine();

                    Console.Write("\nFecha de nacimiento dd/MM/yyy: ");
                    v.FechaNacimiento = DateTime.ParseExact(Console.ReadLine(), "d/MM/yyyy", null);

                    Console.Write("\nSexo\n1. Femenino.\n2. Masculino.\n:: ");
                    if (Scanner.NextInt() == 1)
                    {
                        v.Sexo = Sexo.Femnino;
                    }
                    else
                    {
                        v.Sexo = Sexo.Masculino;
                    }

                    Console.Write("\nTeléfono: ");
                    v.Telefono = Scanner.NextLong();

                    Console.Write("\nCorreo: ");
                    v.Correo = Scanner.NextLine();

                    Console.Write("\nDirección: ");
                    v.Direccion = Scanner.NextLine();

                    Console.Write("\nEstado civil\n1. Soltero.\n2. Casado.\n3. Viudo.\n4. Divorciado.\n5. Union libre.\n:: ");
                    int estado = Scanner.NextInt();
                    for (int i = 0; i < 5; i++)
                    {
                        if (estado - 1 == i)
                        {
                            v.EstadoCivil = (EstadoCivil)i;
                        }
                        ;
                    }

                    if (ListaClientes.Count != 0)     //Si la lista no esta vacia le asigan el id del último + 1
                    {
                        v.IdCliente = ListaClientes.Last().IdCliente + 1;
                    }
                    else     //Si la lista esta vacia lo pone como el primero
                    {
                        v.IdCliente = 1;
                    }

                    v.Add();

                    break;

                case 2:
                    Console.Clear();
                    Console.Write("\n\t--- Eliminar clientes ---\nNúmero de cédula del clientes: ");
                    Int64 NCClientes = Scanner.NextLong();

                    if (Find(NCClientes))
                    {
                        Cliente vn = Search(NCClientes);
                        vn.Show();
                        Console.Write("\n¿Borrar cliente?\n\t1. Si.\n\t2. No.\n::");
                        if (Scanner.NextInt() == 1)
                        {
                            vn.Delete();
                            Delete(vn);
                            Console.WriteLine("\n¡Proceso realizado con éxito!");
                        }
                        else
                        {
                            Console.WriteLine("\n¡Proceso cancelado!");
                        }
                    }

                    break;

                case 3:
                    Console.Clear();
                    Console.Write("\n\t--- Editar datos del cliente ---\n\nNúmero de cédula del cliente: ");
                    long NCedclientes = Scanner.NextLong();
                    Search(NCedclientes).Show();
                    Console.Write("\n\tOpciones a editar:\n" +
                                  "\t1.  Cédula.\n" +
                                  "\t2.  Nombre.\n" +
                                  "\t3.  Fecha de nacimiento.\n" +
                                  "\t4.  Sexo.\n" +
                                  "\t5.  Teléfono.\n" +
                                  "\t6.  Correo.\n" +
                                  "\t7.  Dirección.\n" +
                                  "\t8.  Estado civil.\n" +
                                  "\t:: ");

                    Update(NCedclientes, Scanner.NextInt());

                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Lista de clientes ---\n");
                    ToList();
                    break;

                case 5:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Buscar cliente ---\n");
                    Console.Write("\nSeleccione el método de busqueda:\n " +
                                  "\t1. Por número de cédula.\n" +
                                  "\t2. Por número de identificación.\n" +
                                  "\t3. Por número de teléfono.\n" +
                                  "\t:: ");
                    switch (Scanner.NextInt())
                    {
                    case 1:
                        Console.Write("\n\tCédula: ");
                        Search(Scanner.NextLong()).Show();
                        break;

                    case 2:
                        Console.Write("\n\tIdentificación: ");
                        Search(0, Scanner.NextInt()).Show();
                        break;

                    case 3:
                        Console.Write("\n\tTeléfono: ");
                        Search(0, 0, Scanner.NextLong()).Show();
                        break;
                    }
                    break;
                }
            } while (option != 6);
        }
Ejemplo n.º 4
0
        public static void MenuInventario()
        {
            int option;

            LoadList();

            do
            {
                Console.Write("\n\tBienvenido al menú de Inventario\n" +
                              "\t1. Crear Item.\n" +
                              "\t2. Eliminar Item.\n" +
                              "\t3. Editar Item.\n" +
                              "\t4. Listar Item.\n" +
                              "\t5. Buscar Item.\n" +
                              "\t6. Salir.\n" +
                              "\t:: ");

                option = Scanner.NextInt();

                switch (option)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Crear Item ---");
                    Inventario v = new Inventario();

                    Carro.LoadList();
                    Console.WriteLine("\t--- Elija un carro para el Item ---");
                    Console.WriteLine("\t--- Lista de carros ---");
                    Carro.ToList();
                    Console.Write("\t Ingrese ID del carro\n:: ");
                    v.Car = Carro.Search(Scanner.NextInt());

                    Console.Write("\nCantidad: ");
                    v.Cantidad = Scanner.NextInt();

                    Console.Write("\nPrecio Base: ");
                    v.PrecioBase = Scanner.NextLong();

                    Console.Write("\nPrecio de Venta: ");
                    v.PrecioVenta = Scanner.NextLong();

                    Console.Write("\nFecha de ingreso: ");
                    v.FechaIngreso = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", null);

                    Console.Write("\nFecha de salida: ");
                    v.FechaSalida = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", null);

                    if (ListaInventario.Count != 0)
                    {
                        v.IdInventario = ListaInventario.Last().IdInventario + 1;
                    }
                    else
                    {
                        v.IdInventario = 1;
                    }

                    v.Show();

                    if (!itemExistValues(v))
                    {
                        v.Add();
                    }

                    break;

                case 2:
                    Console.Clear();
                    Console.Write("\n\t--- Eliminar Item ---\nNúmero de ID del Item: ");
                    int Item = Scanner.NextInt();

                    if (Find(Item))
                    {
                        Inventario vn = Search(Item);
                        vn.Show();
                        Console.Write("\n¿Borrar Carro?\n\t1. Si.\n\t2. No.\n:: ");
                        if (Scanner.NextInt() == 1)
                        {
                            vn.Delete();
                            Delete(vn);
                            Console.WriteLine("\n¡Proceso realizado con éxito!");
                        }
                        else
                        {
                            Console.WriteLine("\n¡Proceso cancelado!");
                        }
                    }

                    break;

                case 3:
                    Console.Clear();
                    Console.Write("\n\t--- Editar datos del Item ---\nNúmero de ID del Item: ");
                    int IdItem = Scanner.NextInt();
                    Search(IdItem).Show();
                    Console.Write("\n\tOpciones a editar:\n" +
                                  "\t1.  Cantidad.\n" +
                                  "\t2.  Precio Base.\n" +
                                  "\t3.  Precio de Venta.\n" +
                                  "\t4.  Fecha de ingreso.\n" +
                                  "\t5.  Fecha de salida.\n" +
                                  "\t:: ");

                    Update(IdItem, Scanner.NextInt());

                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Lista de Items ---\n");
                    ToList();
                    break;

                case 5:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Buscar Item ---\n");

                    Console.Write("\nIngrese el ID del Item.\n:: ");
                    Search(Scanner.NextInt()).Show();
                    break;
                }
            } while (option != 6);
        }
Ejemplo n.º 5
0
        public static void MenuCarro()
        {
            int option;

            LoadList();

            do
            {
                Console.Write("\n\tBienvenido al menú de Carros\n" +
                              "\t1. Crear Carro.\n" +
                              "\t2. Eliminar Carro.\n" +
                              "\t3. Editar Carro.\n" +
                              "\t4. Listar Carros.\n" +
                              "\t5. Buscar Carro.\n" +
                              "\t6. Salir.\n" +
                              "\t:: ");

                option = Scanner.NextInt();

                switch (option)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Crear Carro ---");
                    Carro v = new Carro();

                    Console.Write("\nCódigo de chasis: ");
                    v.VIN = Scanner.NextLine();

                    Console.Write("\nModelo: ");
                    v.Modelo = Scanner.NextLine();

                    Console.Write("\nColor: ");
                    v.Color = Scanner.NextLine();

                    Console.Write("\nMarca: ");
                    v.Marca = Scanner.NextLine();

                    Console.Write("\nCombustible\n1. Gasolina.\n2. Biodiésel.\n3. Gas Natural.\n4. Diésel.\n:: ");
                    int tipo = Scanner.NextInt();
                    for (int i = 0; i < 4; i++)
                    {
                        if (tipo - 1 == i)
                        {
                            v.TipoCombustible = (Combustible)i;
                            break;
                        }
                        ;
                    }

                    Console.Write("\nTransmisión\n1. Manual.\n2. Automatica.\n3. CVT.\n:: ");
                    int transmision = Scanner.NextInt();
                    for (int i = 0; i < 3; i++)
                    {
                        if (transmision - 1 == i)
                        {
                            v.TipoTransmision = (Transmision)i;
                        }
                        ;
                    }

                    if (ListaCarros.Count != 0)
                    {
                        v.IdCarro = ListaCarros.Last().IdCarro + 1;
                    }
                    else
                    {
                        v.IdCarro = 1;
                    }

                    v.Show();
                    v.Add();
                    break;

                case 2:
                    Console.Clear();
                    Console.Write("\n\t--- Eliminar Carro ---\nCódigo de chasis del Carro: ");
                    string VIN = Scanner.NextLine();

                    if (Find(VIN))
                    {
                        Carro vn = Search(VIN);
                        vn.Show();
                        Console.Write("\n¿Borrar Carro?\n\t1. Si.\n\t2. No.\n::");
                        if (Scanner.NextInt() == 1)
                        {
                            vn.Delete();
                            Delete(vn);
                            Console.WriteLine("\n¡Proceso realizado con éxito!");
                        }
                        else
                        {
                            Console.WriteLine("\n¡Proceso cancelado!");
                        }
                    }

                    break;

                case 3:
                    Console.Clear();
                    Console.Write("\n\t--- Editar datos del Carro ---\nNúmero de ID del Carro: ");
                    int IdCarro = Scanner.NextInt();
                    Search(IdCarro).Show();
                    Console.Write("\n\tOpciones a editar:\n" +
                                  "\t1.  Cédula.\n" +
                                  "\t2.  Nombre.\n" +
                                  "\t3.  Fecha de nacimiento.\n" +
                                  "\t4.  Sexo.\n" +
                                  "\t5.  Teléfono.\n" +
                                  "\t6.  Correo.\n" +
                                  "\t7.  Dirección.\n" +
                                  "\t8.  Estado civil.\n" +
                                  "\t:: ");

                    Update(IdCarro, Scanner.NextInt());

                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Lista de Carro ---\n");
                    ToList();
                    break;

                case 5:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Buscar Carro ---\n");

                    Console.Write("\nIngrese el ID del carro.\n:: ");
                    Search(Scanner.NextInt()).Show();
                    break;
                }
            } while (option != 6);
        }
Ejemplo n.º 6
0
        public static void Update(int IdCarro, int NDato)
        {
            if (Find(IdCarro))
            {
                Carro v = Search(IdCarro);
                if (v != null)
                {
                    switch (NDato)
                    {
                    case 1:
                        Console.WriteLine("\nNuevo Número de Chasis: ");
                        v.VIN = Scanner.NextLine();
                        break;

                    case 2:
                        Console.Write("\nNueva Modelo: ");
                        v.Modelo = Scanner.NextLine();
                        break;

                    case 3:
                        Console.Write("\nNuevo Color: ");
                        v.Color = Scanner.NextLine();
                        break;

                    case 4:
                        Console.Write("\nNuevo Marca: ");
                        v.Marca = Scanner.NextLine();
                        break;

                    case 5:
                        Console.Write("\nNuevo Combustible\n1. Gasolina.\n2. Biodiésel.\n3. Gas Natural.\n4. Diésel.\n:: ");
                        int tipo = Scanner.NextInt();
                        for (int i = 0; i < 4; i++)
                        {
                            if (tipo - 1 == i)
                            {
                                v.TipoCombustible = (Combustible)i;
                                break;
                            }
                            ;
                        }
                        break;

                    case 6:
                        Console.Write("\nNueva Transmisión\n1. Manual.\n2. Automatica.\n3. CVT.\n:: ");
                        int transmision = Scanner.NextInt();
                        for (int i = 0; i < 3; i++)
                        {
                            if (transmision - 1 == i)
                            {
                                v.TipoTransmision = (Transmision)i;
                                break;
                            }
                            ;
                        }
                        break;
                    }

                    Edit(ListaCarros.IndexOf(v), NDato - 1, v, "Files/Carro.txt");
                }
                else
                {
                    Console.WriteLine("¡Oooops, A ocurrido un erro!");
                }
            }
        }
Ejemplo n.º 7
0
        public static void MenuAdminVendedor()
        {
            int option;

            LoadList();

            do
            {
                Console.Write("\n\tBienvenido al menú de Vendedores\n" +
                              "\t1. Crear vendedor.\n" +
                              "\t2. Eliminar vendedor.\n" +
                              "\t3. Editar vendedor.\n" +
                              "\t4. Listar vendedores.\n" +
                              "\t5. Busacar vendedor.\n" +
                              "\t6. Salir.\n" +
                              "\t:: ");

                option = Scanner.NextInt();

                switch (option)
                {
                case 1:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Crear vendedor ---");
                    Vendedor v = new Vendedor();

                    Console.Write("\nCedula: ");
                    v.Cedula = Scanner.NextLong();

                    Console.Write("\nNombre: ");
                    v.Nombre = Scanner.NextLine();

                    Console.Write("\nFecha de nacimiento dd/MM/yyy: ");
                    v.FechaNacimiento = DateTime.ParseExact(Console.ReadLine(), "dd/MM/yyyy", null);

                    Console.Write("\nSexo\n1. Femenino.\n2. Masculino.\n:: ");
                    if (Scanner.NextInt() == 1)
                    {
                        v.Sexo = Sexo.Femnino;
                    }
                    else
                    {
                        v.Sexo = Sexo.Masculino;
                    }

                    Console.Write("\nTeléfono: ");
                    v.Telefono = Scanner.NextLong();

                    Console.Write("\nCorreo: ");
                    v.Correo = Scanner.NextLine();

                    Console.Write("\nDirección: ");
                    v.Direccion = Scanner.NextLine();

                    Console.Write("\nEstado civil\n1. Soltero.\n2. Casado.\n3. Viudo.\n4. Divorciado.\n5. Union libre.\n:: ");
                    int estado = Scanner.NextInt();
                    for (int i = 0; i < 5; i++)
                    {
                        if (estado - 1 == i)
                        {
                            v.EstadoCivil = (EstadoCivil)i;
                            break;
                        }
                        ;
                    }



                    Console.Write("\nFecha de ingreso dd/MM/yyy: ");
                    v.FechaIngreso = DateTime.ParseExact(Console.ReadLine(), "d/MM/yyyy", null);

                    Console.Write("\nSalario: ");
                    v.Salario = Scanner.NextInt();

                    Console.Write("\nProfesión: ");
                    v.Profesion = Scanner.NextLine();

                    Console.Write("\nCalificación de 1 a 10: ");
                    v.Calificacion = Scanner.NextInt();

                    if (ListaVendedor.Count != 0)
                    {
                        v.IdVendedor = ListaVendedor.Last().IdVendedor + 1;
                    }
                    else
                    {
                        v.IdVendedor = 1;
                    }


                    v.Add();

                    break;

                case 2:
                    Console.Clear();
                    Console.Write("\n\t--- Eliminar vendedor ---\n\nNúmero de cédula del Vendedor: ");
                    Int64 NCVendedor = Scanner.NextLong();

                    if (Find(NCVendedor))
                    {
                        Vendedor vn = Search(NCVendedor);
                        Console.WriteLine();
                        vn.Show();
                        Console.Write("\n¿Borrar Vendedor?\n\t1. Si.\n\t2. No.\n:: ");
                        if (Scanner.NextInt() == 1)
                        {
                            vn.Delete();
                            Delete(vn);
                            Console.WriteLine("\n¡Proceso realizado con éxito!");
                        }
                        else
                        {
                            Console.WriteLine("\n¡Proceso cancelado!");
                        }
                    }

                    break;

                case 3:
                    Console.Clear();
                    Console.Write("\n\t--- Editar datos del Vendedor ---\nNúmero de cédula del Vendedor: ");
                    Int64 NCedVendedor = Scanner.NextLong();
                    Search(NCedVendedor).Show();
                    Console.Write("\n\tOpciones a editar:\n" +
                                  "\t1.  Cédula.\n" +
                                  "\t2.  Nombre.\n" +
                                  "\t3.  Fecha de nacimiento.\n" +
                                  "\t4.  Sexo.\n" +
                                  "\t5.  Teléfono.\n" +
                                  "\t6.  Correo.\n" +
                                  "\t7.  Dirección.\n" +
                                  "\t8.  Estado civil.\n" +
                                  "\t9.  Fecha de ingreso.\n" +
                                  "\t10. Salario.\n" +
                                  "\t11. Profesión.\n" +
                                  "\t12. Calificación.\n" +
                                  "\t:: ");

                    Update(NCedVendedor, Scanner.NextInt());

                    break;

                case 4:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Lista de vendedores ---\n");
                    ToList();
                    break;

                case 5:
                    Console.Clear();
                    Console.WriteLine("\n\t-- Buscar vendedor ---");
                    Console.Write("\nSeleccione el método de busqueda\n" +
                                  "\t1. Por número de cédula.\n" +
                                  "\t2. Por número de identificación.\n" +
                                  "\t3. Por número de teléfono.\n" +
                                  "\t:: ");
                    switch (Scanner.NextInt())
                    {
                    case 1:
                        Console.Write("\n\tCédula: ");
                        Search(Scanner.NextLong()).Show();
                        break;

                    case 2:
                        Console.Write("\n\tIdentificación: ");
                        Search(0, Scanner.NextInt()).Show();
                        break;

                    case 3:
                        Console.Write("\n\tTeléfono: ");
                        Search(0, 0, Scanner.NextInt()).Show();
                        break;
                    }
                    break;
                }
            } while (option != 6);
        }