예제 #1
0
        private void dataGridRecorrido_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Mensaje         mensaje      = Mensaje.Instance;
            RecorridoDAO    recorridoDAO = RecorridoDAO.getInstance();
            DataGridViewRow fila         = dataGridRecorrido.Rows[e.RowIndex];
            long            recorridoID  = Convert.ToInt64(fila.Cells["ID"].Value);


            if (e.ColumnIndex == dataGridRecorrido.Columns["columnBaja"].Index)
            {
                DialogResult respuesta = mensaje.mostrarPreguntaSiNo("¿Esta seguro de que quiere dar de baja el Recorrido?");

                if (respuesta.ToString().Equals("Yes"))
                {
                    recorridoDAO.bajaRecorrido(recorridoID);
                    mensaje.mostrarNormal("El recorrido fue dado de baja.");
                }
            }
            else if (e.ColumnIndex == dataGridRecorrido.Columns["columnModificar"].Index)
            {
                FormModificarRecorrido formModificarRecorrido = new FormModificarRecorrido(recorridoID, this);
                formModificarRecorrido.Show();
            }

            this.cargarTabla();
        }
예제 #2
0
        private DataTable buscar()
        {
            RecorridoDAO recorridoDAO = RecorridoDAO.getInstance();
            DataTable    recorridos   = recorridoDAO.getRecorridos(tb_Codigo.Text, tb_CiudadOrigen.Text, tb_CiudadDestino.Text, cb_TipoServicio.Text, cb_Habilitado.Text);

            return(recorridos);
        }
예제 #3
0
        public void cargarTabla()
        {
            RecorridoDAO recorridoDAO = RecorridoDAO.getInstance();

            DataTable recorridos = recorridoDAO.getRecorridos();

            dataGridRecorrido.DataSource = recorridos;
        }
예제 #4
0
 protected override List <RecorridoViewModel> GetData()
 {
     return(RecorridoDAO.GetAllWithFilters(
                this.Filters.LikeFilter,
                this.Filters.ExactFilter,
                this.Filters.DropdownFilterSelectedOption)
            .Select(x => new RecorridoViewModel(x)).ToList());
 }
예제 #5
0
        protected override void guardar(Recorrido recorrido)
        {
            RecorridoDAO recorridoDAO = RecorridoDAO.getInstance();

            recorridoDAO.modificarRecorrido(recorrido, codigoAnterior);

            formListado.cargarTabla();
        }
예제 #6
0
 public FormModificarRecorrido(long idRecorrido, FormListadoRecorrido formListadoRecorrido)
 {
     InitializeComponent();
     this.codigoAnterior = idRecorrido;
     this.formListado    = formListadoRecorrido;
     this.recorrido      = RecorridoDAO.getInstance().getRecorrido(idRecorrido);
     this.completarValores();
 }
예제 #7
0
        private void cargarDatos()
        {
            MicroDAO      microDAO            = MicroDAO.getInstance();
            List <String> patentesHabilitadas = microDAO.getPatentesHabilitadas();

            cb_PatenteMicro.Items.AddRange(patentesHabilitadas.ToArray());

            RecorridoDAO     recorridoDAO          = RecorridoDAO.getInstance();
            List <Recorrido> recorridosHabilitados = recorridoDAO.getRecorridosHabilitados();

            cb_RecorridoCodigo.Items.AddRange(recorridosHabilitados.ToArray());
        }
예제 #8
0
 public decimal CalcularCostoDeRuta()
 {
     if (IdRecorrido != 0)
     {
         RecorridoViewModel recorrido = new RecorridoViewModel(RecorridoDAO.GetByID(IdRecorrido));
         return(recorrido.CalcularCostoDeRecorrido());
     }
     else
     {
         return(0);
     }
 }
예제 #9
0
        public Form_Recorrido_Edit(OnEditSuccessDelegate <RecorridoViewModel> onEditSuccess, int idRecorrido)
        {
            InitializeComponent();

            _OnEditSuccess = onEditSuccess;

            //obtengo el recorrido de la base y lo mapeo a un viewmodel
            _ViewModel = new RecorridoViewModel(RecorridoDAO.GetByID(idRecorrido));

            //bindeo las propiedades del viewmodel a los controles
            BindViewModel();
        }
예제 #10
0
        private void HandleDelete(int id)
        {
            try
            {
                DialogResult result = MessageBox.Show("¿Desea eliminar el recorrido?", "Eliminar", MessageBoxButtons.YesNo);

                if (result == System.Windows.Forms.DialogResult.Yes)
                {
                    RecorridoDAO.Delete(id);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                this.PopulateDataGridView();
            }
        }
예제 #11
0
        private void gridResultados_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0 || e.RowIndex >= gridResultados.Rows.Count - 1)
            {
                return;
            }

            if (e.ColumnIndex == gridResultados.Columns["Ver"].Index)
            {
                switch (tipoListado.SelectedItem.ToString())
                {
                case "Cruceros con mayor cantidad de días fuera de servicio":
                    break;

                default:
                    Decimal codRecorrido = Convert.ToDecimal(gridResultados[1, e.RowIndex].Value);
                    Decimal precio       = new RecorridoDAO().precioRecorrido(codRecorrido);
                    new RecorridoForm().show(codRecorrido, precio);
                    break;
                }
            }
        }
예제 #12
0
 public void Edit()
 {
     RecorridoDAO.Edit(this.MapToDomainObject());
 }
예제 #13
0
 public void Add()
 {
     RecorridoDAO.Add(this.MapToDomainObject());
 }
예제 #14
0
        protected virtual void guardar(Recorrido recorrido)
        {
            RecorridoDAO recorridoDAO = RecorridoDAO.getInstance();

            recorridoDAO.guardarNuevo(recorrido);
        }
예제 #15
0
 private void LoadDropdowns()
 {
     dropdownRecorrido.Input.DataSource    = RecorridoDAO.GetAll().Select(x => new RecorridoViewModel(x)).ToList();
     dropdownRecorrido.Input.DisplayMember = "Descripcion";
     dropdownRecorrido.Input.ValueMember   = "IdRecorrido";
 }