Exemplo n.º 1
0
        private void btnGuardarTarifa_Click(object sender, EventArgs e)
        {
            if (cboRuta.SelectedItem == null || cboUnidad.SelectedItem == null || cboClienteF.SelectedItem == null)
            {
                throw new Exception();
            }
            try
            {
                int    idruta          = Convert.ToInt32((cboRuta.SelectedItem as ComboboxItem).Value.ToString());
                int    idunidad        = Convert.ToInt32((cboUnidad.SelectedItem as ComboboxItem).Value.ToString());
                int    idclientefiscal = Convert.ToInt32((cboClienteF.SelectedItem as ComboboxItem).Value.ToString());
                string estatus         = "ACTIVO";
                Tarifa tarifa          = new Tarifa(idruta, idunidad, idclientefiscal, estatus);

                if (Accion == "ALTA")
                {
                    FormInicio.GuardaTarifa(tarifa);
                }
                else if (Accion == "EDITAR")
                {
                    FormInicio.EditaTarifa(tarifa);
                }
                else if (Accion == "ELIMINAR")
                {
                    FormInicio.EliminaTarifa(tarifa);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error al guardar el registro" + error.Message);
            }
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            CargadoraInformacion c = new CargadoraInformacion(@"..\\..\\Almacenamiento\Base de datos\");

            c.AlmacenarInformacion("TRIPTYPES.txt");
            c.AlmacenarInformacion("SCHEDULETYPES.txt");
            c.AlmacenarInformacion("DATAPLAN.txt");
            c.AlmacenarInformacion("ARCS.txt");
            c.AlmacenarInformacion("CALENDAR.txt");
            c.AlmacenarInformacion("LINES.txt");
            c.AlmacenarInformacion("LINESARCS.txt");
            c.AlmacenarInformacion("LINESTOPS.txt");
            c.AlmacenarInformacion("PLANVERSIONS.txt");
            c.AlmacenarInformacion("SCHEDULEPROFILES.txt");
            c.AlmacenarInformacion("STOPS.txt");
            c.AlmacenarInformacion("TASKS.txt");
            c.AlmacenarInformacion("TRIPS.txt");
            //VentanaMIO ventanaMIO = new VentanaMIO(c);

            Simulacion sim = new Simulacion();

            sim.cargarEstaciones(Utilidades.AgruparParadas(c.STOPS, sim));
            //sim.GenerarPasajeros();
            sim.cargarArcos(c.ARCS);

            sim.Estaciones.floydWarshall();

            sim.CargarRutas(c.LINESTOPS, c.LINES);
            //sim.cargarViajes(c.TRIPS);
            FormInicio ventanaMIO = new FormInicio(c, sim);

            ventanaMIO.ShowDialog();
        }
Exemplo n.º 3
0
        public UserControlNovoModelo(FormInicio _formIni)
        {
            InitializeComponent();

            _FormInicio = _formIni;
            Fotografia  = "nada";
        }
Exemplo n.º 4
0
        private void btnGuardarUnidad_Click(object sender, EventArgs e)
        {
            if (cboTransportista.SelectedItem == null)
            {
                throw new Exception();
            }
            try
            {
                int    idTransportista = Convert.ToInt32((cboTransportista.SelectedItem as ComboboxItem).Value.ToString());
                string nombre          = txtNombre.Text;
                string placas          = txtPlacas.Text;
                double pesoMaximo      = Convert.ToDouble(txtPesoMaximo.Text);
                double costoxKilometro = Convert.ToDouble(txtCostoKilometro.Text);
                string estatus         = "ACTIVO";
                Unidad unidad          = new Unidad(idTransportista, nombre, placas, pesoMaximo, costoxKilometro, estatus);

                if (Accion == "ALTA")
                {
                    FormInicio.GuardaUnidad(unidad);
                }
                else if (Accion == "EDITAR")
                {
                    FormInicio.EditaUnidad(unidad);
                }
                else if (Accion == "ELIMINAR")
                {
                    FormInicio.EliminaUnidad(unidad);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error al guardar el registro" + error.Message);
            }
        }
Exemplo n.º 5
0
        private void btnGuardarPedido_Click(object sender, EventArgs e)
        {
            try
            {
                int    idclienteorigen  = Convert.ToInt32((cboClienteO.SelectedItem as ComboboxItem).Value);
                int    idclientedestino = Convert.ToInt32((cboClienteD.SelectedItem as ComboboxItem).Value);
                string delivery         = txtDelivery.Text;
                double peso             = Convert.ToDouble(txtPeso.Text);
                double piezas           = Convert.ToDouble(txtPiezas.Text);
                string estatus          = "ACTIVO";
                Pedido pedido           = new Pedido(idclienteorigen, idclientedestino, delivery, peso, piezas, estatus);

                if (Accion == "ALTA")
                {
                    FormInicio.GuardaPedido(pedido);
                }
                else if (Accion == "EDITAR")
                {
                    FormInicio.EditaPedido(pedido);
                }
                else if (Accion == "ELIMINAR")
                {
                    FormInicio.EliminaPedido(pedido);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error al guardar el registro" + error.Message);
            }
        }
Exemplo n.º 6
0
        private void btnGuardarViaje_Click(object sender, EventArgs e)
        {
            List <Pedido> pedidos = new List <Pedido>();

            foreach (var i in listPedidos.CheckedItems)
            {
                ComboboxItem item   = (i as ComboboxItem);
                Pedido       pedido = FormInicio.ObtenPedido(item.Value);
                pedidos.Add(pedido);
            }

            double PesoTotal = pedidos.Sum(sum => sum.Peso);

            if (cboRuta.SelectedItem == null)
            {
                throw new Exception();
            }
            if (cboSucursal.SelectedItem == null)
            {
                throw new Exception();
            }
            if (Accion == "ALTA")
            {
                if (listPedidos.CheckedItems.Count == 0)
                {
                    throw new Exception();
                }
            }

            try
            {
                int    idRuta     = Convert.ToInt32((cboRuta.SelectedItem as ComboboxItem).Value.ToString());
                int    idSucursal = Convert.ToInt32((cboSucursal.SelectedItem as ComboboxItem).Value.ToString());
                string folio      = txtFolio.Text;
                string estatus    = "ACTIVO";
                Viaje  viaje      = new Viaje(idSucursal, idRuta, 0, folio, PesoTotal, estatus);

                if (Accion == "ALTA")
                {
                    FormInicio.GuardaViaje(viaje);
                    Viaje nViaje = FormInicio.ObtenViaje(viaje.Folio);
                    FormInicio.EditaPedidosIdViaje(pedidos, nViaje.IdViaje);
                    //FormInicio.EditaViaje(nViaje);
                }
                else if (Accion == "EDITAR")
                {
                    FormInicio.EditaViaje(viaje);
                }
                else if (Accion == "ELIMINAR")
                {
                    FormInicio.EliminaViaje(viaje);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error al guardar el registro" + error.Message);
            }
        }
Exemplo n.º 7
0
 private void CargaLabels()
 {
     Thread.CurrentThread.CurrentCulture   = new CultureInfo(FormInicio.GetCulture());
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(FormInicio.GetCulture());
     label2.Text             = Strings.Nombre;
     label4.Text             = Strings.Direccion;
     btnGuardarSucursal.Text = Strings.Guardar;
     btnCerrarModal.Text     = Strings.Cerrar;
 }
Exemplo n.º 8
0
        public UserControlErmos(FormInicio _ini)
        {
            InitializeComponent();

            _FormInicio = _ini;
            ListaErmos  = new List <Ermo>();

            CarregarErmos();
        }
Exemplo n.º 9
0
        public UserControlOutras(FormInicio formInicio)
        {
            InitializeComponent();

            _FormInicio = formInicio;
            ListaOutras = new List <Outras>();

            CarregarOutras();
        }
Exemplo n.º 10
0
        public UserControlClubes(FormInicio _formIni)
        {
            InitializeComponent();

            _FormInicio = _formIni;
            listaCLubes = new List <Clube>();

            CarregarListaClubes();
        }
Exemplo n.º 11
0
        public UserControlGaleria(FormInicio _Fornini)
        {
            InitializeComponent();

            _FormInicio  = _Fornini;
            ListaModelos = new List <Modelo>();

            CarregarModelos();
        }
Exemplo n.º 12
0
 private void CargaLabels()
 {
     Thread.CurrentThread.CurrentCulture   = new CultureInfo(FormInicio.GetCulture());
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(FormInicio.GetCulture());
     label2.Text = Strings.RazonSocial;
     label1.Text = Strings.NombreComercial;
     label4.Text = Strings.Comision;
     btnGuardarTransportista.Text = Strings.Guardar;
     btnCerrarModal.Text          = Strings.Cerrar;
 }
Exemplo n.º 13
0
        public UserControlInicio(FormInicio _fInit)
        {
            InitializeComponent();

            _FormInicio = _fInit;
            lockedData  = true;

            CarregarINFOdisco();
            CarregarEstatisticas();
        }
Exemplo n.º 14
0
        public UserControlNovasGalerias(FormInicio _formI, Modelo Este_)
        {
            InitializeComponent();

            _FormInicio = _formI;
            EsteModelo  = Este_;
            ListaDados  = new List <ngModel>();

            panelShowDirectory.Hide();
        }
Exemplo n.º 15
0
        public UserControlNovaGaleria(FormInicio _formIni, Modelo _este)
        {
            InitializeComponent();

            _FormInicio   = _formIni;
            Esta          = _este;
            CaminhosFotos = new List <string>();
            CaminhosFotos.Clear();

            CarregarDados();
        }
Exemplo n.º 16
0
        private void CargaLabels()
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo(FormInicio.GetCulture());
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(FormInicio.GetCulture());
            label4.Text = Strings.Ruta;
            label1.Text = Strings.Unidad;
            label2.Text = Strings.ClienteFiscal;

            btnGuardarTarifa.Text = Strings.Guardar;
            btnCerrarModal.Text   = Strings.Cerrar;
        }
Exemplo n.º 17
0
 private void CargaLabels()
 {
     Thread.CurrentThread.CurrentCulture   = new CultureInfo(FormInicio.GetCulture());
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(FormInicio.GetCulture());
     label2.Text           = Strings.Nombre;
     label1.Text           = Strings.Placas;
     label3.Text           = Strings.PesoMaximo;
     label5.Text           = Strings.CostoxKilometro;
     label4.Text           = Strings.Transportista;
     btnGuardarUnidad.Text = Strings.Guardar;
     btnCerrarModal.Text   = Strings.Cerrar;
 }
Exemplo n.º 18
0
 private void CargaLabels()
 {
     Thread.CurrentThread.CurrentCulture   = new CultureInfo(FormInicio.GetCulture());
     Thread.CurrentThread.CurrentUICulture = new CultureInfo(FormInicio.GetCulture());
     label1.Text         = Strings.EstadoDestino;
     label2.Text         = Strings.EstadoOrigen;
     label3.Text         = Strings.CPOrigen;
     label5.Text         = Strings.CPDestino;
     label4.Text         = Strings.Kilometros;
     btnGuardarRuta.Text = Strings.Guardar;
     btnCerrarModal.Text = Strings.Cerrar;
 }
Exemplo n.º 19
0
        private void CargaLabels()
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo(FormInicio.GetCulture());
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(FormInicio.GetCulture());
            label2.Text = Strings.ClienteOrigen;
            label1.Text = Strings.ClienteDestino;
            label3.Text = Strings.Pedido;
            label5.Text = Strings.Peso;
            label4.Text = Strings.Piezas;

            btnGuardarPedido.Text = Strings.Guardar;
            btnCerrarModal.Text   = Strings.Cerrar;
        }
Exemplo n.º 20
0
 private void textBox1_TextChanged(object sender, EventArgs e)
 {
     if (textBox1.Text.Length == 4)
     {
         if (Funcionalidades.MD5Hash(textBox1.Text) == Funcionalidades.MD5Hash("3302"))
         {
             this.Hide();
             FormInicio _Ini = new FormInicio();
             _Ini.ShowDialog();
             this.Close();
         }
     }
 }
Exemplo n.º 21
0
        private void CargaLabels()
        {
            Thread.CurrentThread.CurrentCulture   = new CultureInfo(FormInicio.GetCulture());
            Thread.CurrentThread.CurrentUICulture = new CultureInfo(FormInicio.GetCulture());
            label4.Text = Strings.Ruta;
            label1.Text = Strings.Sucursal;
            label3.Text = Strings.Folio;
            label5.Text = Strings.PesoTotal;
            label2.Text = Strings.Pedidos;

            btnGuardarViaje.Text = Strings.Guardar;
            btnCerrarModal.Text  = Strings.Cerrar;
        }
Exemplo n.º 22
0
        public UserControlVerModelo(FormInicio _formIni, Modelo _este)
        {
            InitializeComponent();

            _FormInicio       = _formIni;
            EsteModelo        = _este;
            _listaGalerias    = new List <Galeria>();
            _listaAssociacoes = new List <PertenceA>();
            _listaClubes      = new List <Clube>();

            CarregarDados();

            //Aumentar visualizacoes deste modelo
            Funcionalidades.AumentarModeloVisu(EsteModelo.ID, EsteModelo.Visualizacoes + 1);
        }
Exemplo n.º 23
0
        public void bindCboClientes()
        {
            List <Cliente> clientesOrigen  = FormInicio.ObtenClientesOrigen();
            List <Cliente> clientesDestino = FormInicio.ObtenClientesDestino();

            cboClienteO.Items.Clear();
            cboClienteD.Items.Clear();

            foreach (Cliente c in clientesOrigen)
            {
                ComboboxItem item = new ComboboxItem(c.NombreComercial, c.IdCliente);
                cboClienteO.Items.Add(item);
            }

            foreach (Cliente c in clientesDestino)
            {
                ComboboxItem item = new ComboboxItem(c.NombreComercial, c.IdCliente);
                cboClienteD.Items.Add(item);
            }

            if (clientesOrigen.Count() > 0)
            {
                Cliente      primerCliente = clientesOrigen.FirstOrDefault();
                ComboboxItem primerValor   = new ComboboxItem(primerCliente.NombreComercial, primerCliente.IdCliente);
                cboClienteO.SelectedItem = primerValor;
                cboClienteO.Text         = primerCliente.NombreComercial;
            }
            else
            {
                cboClienteO.SelectedItem = null;
                cboClienteO.Text         = "NO DATA";
            }

            if (clientesDestino.Count() > 0)
            {
                Cliente      primerCliente = clientesDestino.FirstOrDefault();
                ComboboxItem primerValor   = new ComboboxItem(primerCliente.NombreComercial, primerCliente.IdCliente);
                cboClienteD.SelectedItem = primerValor;
                cboClienteD.Text         = primerCliente.NombreComercial;
            }
            else
            {
                cboClienteD.SelectedItem = null;
                cboClienteD.Text         = "NO DATA";
            }
        }
Exemplo n.º 24
0
        private void btnGuardarRuta_Click(object sender, EventArgs e)
        {
            List <Ruta> rutasExistentes = FormInicio.ObtenRutas();

            try
            {
                int    cporigen      = Convert.ToInt32(txtCPOrigen.Text);
                int    cpdestino     = Convert.ToInt32(txtCPDestino.Text);
                string estadodestino = txtEstadoDestino.Text;
                string estadoorigen  = txtEstadoOrigen.Text;
                double kilometros    = Convert.ToDouble(txtKilometros.Text);
                string estatus       = "ACTIVO";
                Ruta   ruta          = new Ruta(estadoorigen, estadodestino, cporigen, cpdestino, kilometros, estatus);

                foreach (Ruta r in rutasExistentes)
                {
                    bool isEstadoOrigen  = (r.EstadoOrigen == ruta.EstadoOrigen);
                    bool isEstadoDestino = (r.EstadoDestino == ruta.EstadoDestino);
                    bool isCPOrigen      = (r.CPOrigen == ruta.CPOrigen);
                    bool isCPDestino     = (r.CPDestino == ruta.CPDestino);
                    bool isKilometros    = (r.Kilometros == ruta.Kilometros);
                    if (isEstadoOrigen && isEstadoDestino && isCPOrigen && isCPDestino && isKilometros)
                    {
                        throw new Exception("\nInformacion Duplicada");
                    }
                }


                if (Accion == "ALTA")
                {
                    FormInicio.GuardaRuta(ruta);
                }
                else if (Accion == "EDITAR")
                {
                    FormInicio.EditaRuta(ruta);
                }
                else if (Accion == "ELIMINAR")
                {
                    FormInicio.EliminaRuta(ruta);
                }
            }
            catch (Exception error)
            {
                MessageBox.Show("Ha ocurrido un error al guardar el registro" + error.Message);
            }
        }
Exemplo n.º 25
0
        public void Show(Viaje viaje, string accion)
        {
            Accion = accion;
            bindCboRutas();
            bindCboSucursales();
            bindListPedidos(viaje);
            Ruta     ruta     = FormInicio.ObtenRuta(viaje.IdRuta);
            Sucursal sucursal = FormInicio.ObtenSucursal(viaje.IdSucursal);
            Tarifa   tarifa   = FormInicio.ObtenTarifa(viaje.IdTarifa);

            if (Accion == "EDITAR")
            {
                txtFolio.Text     = viaje.Folio;
                txtPesoTotal.Text = viaje.PesoTotal.ToString();

                cboRuta.SelectedItem     = new ComboboxItem(ruta.ToString(), ruta.IdRuta);
                cboRuta.Text             = ruta.ToString();
                cboSucursal.SelectedItem = new ComboboxItem(sucursal.Nombre, sucursal.IdSucursal);
                cboSucursal.Text         = sucursal.Nombre;


                btnGuardarViaje.Text = "EDITAR";
                Show();
            }
            else if (Accion == "ELIMINAR")
            {
                txtFolio.Text     = viaje.Folio;
                txtPesoTotal.Text = viaje.PesoTotal.ToString();

                cboRuta.SelectedItem     = new ComboboxItem(ruta.ToString(), ruta.IdRuta);
                cboRuta.Text             = ruta.ToString();
                cboSucursal.SelectedItem = new ComboboxItem(sucursal.Nombre, sucursal.IdSucursal);
                cboSucursal.Text         = sucursal.Nombre;


                txtFolio.Enabled     = false;
                txtPesoTotal.Enabled = false;
                cboRuta.Enabled      = false;
                cboSucursal.Enabled  = false;

                btnGuardarViaje.Text = "ELIMINAR";
                Show();
            }
        }
Exemplo n.º 26
0
        public void bindListPedidos(Viaje viaje = null)
        {
            List <Pedido> pedidos = new List <Pedido>();

            if (viaje == null)
            {
                pedidos = FormInicio.ObtenPedidos();
            }
            else
            {
                pedidos = FormInicio.ObtenPedidosxViaje(viaje.IdViaje);
            }

            foreach (Pedido p in pedidos)
            {
                ComboboxItem item = new ComboboxItem(p.Delivery, p.IdPedido);
                listPedidos.Items.Add(item);
            }
        }
Exemplo n.º 27
0
        public void Show(Tarifa tarifa, string accion)
        {
            Accion = accion;
            bindCboRutas();
            bindCboUnidades();
            bindCboClientesFiscales();
            Ruta    ruta    = FormInicio.ObtenRuta(tarifa.IdRuta);
            Unidad  unidad  = FormInicio.ObtenUnidad(tarifa.IdUnidad);
            Cliente cliente = FormInicio.ObtenCliente(tarifa.IdClienteFiscal);

            if (Accion == "EDITAR")
            {
                cboRuta.SelectedItem     = new ComboboxItem(ruta.ToString(), ruta.IdRuta);
                cboRuta.Text             = ruta.ToString();
                cboClienteF.SelectedItem = new ComboboxItem(cliente.NombreComercial, cliente.IdCliente);
                cboClienteF.Text         = cliente.NombreComercial;
                cboUnidad.SelectedItem   = new ComboboxItem(unidad.Nombre, unidad.IdUnidad);
                cboUnidad.Text           = unidad.Nombre;

                txtPrecioACliente.Text      = tarifa.PrecioACliente.ToString();
                txtCostoATransportista.Text = tarifa.CostoATransportista.ToString();
                btnGuardarTarifa.Text       = "EDITAR";
                Show();
            }
            else if (Accion == "ELIMINAR")
            {
                cboRuta.SelectedItem        = new ComboboxItem(ruta.ToString(), ruta.IdRuta);
                cboRuta.Text                = ruta.ToString();
                cboClienteF.SelectedItem    = new ComboboxItem(cliente.NombreComercial, cliente.IdCliente);
                cboClienteF.Text            = cliente.NombreComercial;
                cboUnidad.SelectedItem      = new ComboboxItem(unidad.Nombre, unidad.IdUnidad);
                cboUnidad.Text              = unidad.Nombre;
                txtPrecioACliente.Text      = tarifa.PrecioACliente.ToString();
                txtCostoATransportista.Text = tarifa.CostoATransportista.ToString();

                cboRuta.Enabled       = false;
                cboUnidad.Enabled     = false;
                cboClienteF.Enabled   = false;
                btnGuardarTarifa.Text = "ELIMINAR";
                Show();
            }
        }
Exemplo n.º 28
0
        private void btnGuardarSucursal_Click(object sender, EventArgs e)
        {
            string   nombre    = txtNombre.Text;
            string   direccion = txtDireccion.Text;
            string   estatus   = "ACTIVO";
            Sucursal sucursal  = new Sucursal(nombre, direccion, estatus);

            if (Accion == "ALTA")
            {
                FormInicio.GuardaSucursal(sucursal);
            }
            else if (Accion == "EDITAR")
            {
                FormInicio.EditaSucursal(sucursal);
            }
            else if (Accion == "ELIMINAR")
            {
                FormInicio.EliminaSucursal(sucursal);
            }
        }
Exemplo n.º 29
0
        private void btnGuardarTransportista_Click(object sender, EventArgs e)
        {
            string        razonSocial     = txtRazonSocial.Text;
            string        nombreComercial = txtNombreComercial.Text;
            double        comision        = Convert.ToDouble(txtComision.Text);
            string        estatus         = "ACTIVO";
            Transportista transportista   = new Transportista(razonSocial, nombreComercial, comision, estatus);

            if (Accion == "ALTA")
            {
                FormInicio.GuardaTransportista(transportista);
            }
            else if (Accion == "EDITAR")
            {
                FormInicio.EditaTransportista(transportista);
            }
            else if (Accion == "ELIMINAR")
            {
                FormInicio.EliminaTransportista(transportista);
            }
        }
Exemplo n.º 30
0
        public void bindCboSucursales()
        {
            List <Sucursal> sucursales = FormInicio.ObtenSucursales();

            foreach (Sucursal s in sucursales)
            {
                ComboboxItem item = new ComboboxItem(s.Nombre, s.IdSucursal);
                cboSucursal.Items.Add(item);
            }

            if (sucursales.Count() > 0)
            {
                Sucursal     primerSucursal = sucursales.FirstOrDefault();
                ComboboxItem primerValor    = new ComboboxItem(primerSucursal.Nombre, primerSucursal.IdSucursal);
                cboSucursal.SelectedItem = primerValor;
                cboSucursal.Text         = primerSucursal.Nombre;
            }
            else
            {
                cboSucursal.SelectedItem = null;
                cboSucursal.Text         = "NO DATA";
            }
        }