Ejemplo n.º 1
0
        public void changeState(Utils.State st, ConsultaEN consulta)
        {
            state = st;

            if (state != Utils.State.NONE)
            {
                box_text_cliente.Enabled = false;
            }

            if (state == Utils.State.NEW)
            {
                if (consulta != null && consulta.Mascota != null)
                {
                    controller.cargarDatosMascota(consulta.Mascota);
                }
            }
            else if (state == Utils.State.MODIFY || state == Utils.State.DESTROY)
            {
                if (consulta != null)
                {
                    controller.cargarDatosConsulta(consulta);

                    if (st == Utils.State.DESTROY)
                    {
                        image_del_Click(new object(), new EventArgs());
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public EmpleadoEN getStateScreen_Empleados(DataGridViewCellEventArgs ev, ref Utils.State action)
        {
            EmpleadoEN empEN = null;
            string     emp   = "";

            if (form.ListaEmpleados.Columns[ev.ColumnIndex].Name.Equals("VerEmpleado"))
            {
                action = Utils.State.MODIFY;
            }

            if (action == Utils.State.MODIFY)
            {
                emp = form.ListaEmpleados.Rows[ev.RowIndex].Cells[0].Value.ToString();
            }

            for (int i = 0; i < empleados_buscados.Count; i++)
            {
                if (emp.Equals(empleados_buscados[i].DNI))
                {
                    empEN = empleados_buscados[i];
                    break;
                }
            }

            return(empEN);
        }
Ejemplo n.º 3
0
        public MascotaEN getDataGridViewState(DataGridViewCellEventArgs ev, ref Utils.State st, ref ClienteEN aux_cliente)
        {
            string    IdMascota = "", idCliente = "";
            MascotaEN mascota = null;

            if (form.dataGridView.Columns[ev.ColumnIndex].Name.Equals("Ver"))
            {
                st        = Utils.State.MODIFY;
                IdMascota = form.dataGridView.Rows[ev.RowIndex].Cells[0].Value.ToString();
                if (lista_mascotas != null && lista_mascotas.Count > 0 && IdMascota != "")
                {
                    for (int i = 0; i < lista_mascotas.Count; i++)
                    {
                        if (lista_mascotas[i].IdMascota == Convert.ToInt32(IdMascota))
                        {
                            mascota = lista_mascotas[i];
                            break;
                        }
                    }
                }
            }

            idCliente = form.dataGridView.Rows[ev.RowIndex].Cells[4].Value.ToString();
            if (idCliente != "")
            {
                aux_cliente = Utils._IClienteCAD.DameClientePorOID(idCliente);
            }


            return(mascota);
        }
Ejemplo n.º 4
0
 private void btn_erase_Click(object sender, EventArgs e)
 {
     EnableForm(true);
     haBorradoFormulario = true;
     controller.ClearForm();
     state = Utils.State.NONE;
 }
Ejemplo n.º 5
0
 private void btn_eliminar_si_Click(object sender, EventArgs e)
 {
     controller.ProcesarInformacion();
     controller.ClearForm();
     EnableForm(true);
     state = Utils.State.NONE;
 }
Ejemplo n.º 6
0
 private void btn_eliminar_si_Click(object sender, EventArgs e)
 {
     state = Utils.State.DESTROY;
     EnableForm(true);
     controller.ProcesarInformacion();
     state = Utils.State.NONE;
     menu.CargarClienteCompartido(null);
 }
Ejemplo n.º 7
0
 private void image_del_Click(object sender, EventArgs e)
 {
     if (state == Utils.State.MODIFY)
     {
         state = Utils.State.DESTROY;
         EnableForm(false);
     }
 }
Ejemplo n.º 8
0
        private void image_add_Click(object sender, EventArgs e)
        {
            if (state == Utils.State.NONE || state == Utils.State.NEW)
            {
                state = Utils.State.NEW;
            }

            controller.ProcesarInformacion();
        }
Ejemplo n.º 9
0
        private void dataGrid_tratamientos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Utils.State   st          = Utils.State.NONE;
            TratamientoEN tratamiento = controller.getDataGridViewState(e, ref st);

            if (tratamiento != null)
            {
                changeState(st, tratamiento);
            }
        }
Ejemplo n.º 10
0
 public void DesactivateForm()
 {
     Hide();
     if (haBorradoCliente)
     {
         state = Utils.State.MODIFY;
         controller.cargarDatosCliente(menu.clienteCompartido);
         haBorradoCliente = false;
     }
 }
Ejemplo n.º 11
0
 private void btn_erase_Click(object sender, EventArgs e)
 {
     state                = Utils.State.NEW;
     haBorradoCliente     = true;
     text_dni.Enabled     = true;
     controller.clienteEN = null;
     controller.ClearForm();
     controller.Buscar();
     state = Utils.State.NONE;
 }
Ejemplo n.º 12
0
        private void btn_erase_Click(object sender, EventArgs e)
        {
            if (state == Utils.State.MODIFY)
            {
                text_nombre.Enabled = true;
            }

            controller.ClearForm();
            state = Utils.State.NONE;
            EnableForm(true);
        }
Ejemplo n.º 13
0
 public void changeState(Utils.State st)
 {
     state = st;
     if (state == Utils.State.MODIFY || state == Utils.State.DESTROY)
     {
         text_dni.Enabled = false;
         if (state == Utils.State.DESTROY)
         {
             btn_eliminar_Click(new object(), new EventArgs());
         }
     }
 }
Ejemplo n.º 14
0
        override public bool LaunchFacturaScreen(Utils.State state)
        {
            bool ret = false;

            if (FormActual != f_factura.ID)
            {
                ret        = true;
                FormActual = f_factura.ID;
                f_factura.Show();
                f_factura.changeState(state);
            }
            return(ret);
        }
Ejemplo n.º 15
0
        private void dataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            Utils.State aux_state    = Utils.State.NONE;
            ConsultaEN  aux_consulta = controller.getStateScreen(e, ref aux_state);

            if (aux_consulta != null)
            {
                if (menu.LaunchConsultaScreen(aux_state, aux_consulta))
                {
                    DesactivateForm();
                }
            }
        }
Ejemplo n.º 16
0
        override public bool LaunchTratamientoScreen(Utils.State state, TratamientoEN tratamiento)
        {
            bool ret = false;

            if (FormActual != f_tratamiento.ID)
            {
                ret        = true;
                FormActual = f_tratamiento.ID;
                f_tratamiento.Show();
                f_tratamiento.changeState(state, tratamiento);
            }
            return(ret);
        }
Ejemplo n.º 17
0
        private void btn_erase_Click(object sender, EventArgs e)
        {
            state             = Utils.State.NEW;
            haBorradoEmpleado = true;

            if (state == Utils.State.MODIFY)
            {
                tb_dni.Enabled = true;
            }

            controller.ClearForm();
            state = Utils.State.NONE;
        }
Ejemplo n.º 18
0
        override public bool LaunchEmpleadoScreen(Utils.State state)
        {
            bool ret = false;

            if (FormActual != f_empleado.ID)
            {
                ret        = true;
                FormActual = f_empleado.ID;
                f_empleado.Show();
                f_empleado.changeState(state);
            }
            return(ret);
        }
Ejemplo n.º 19
0
        public void changeState(Utils.State st)
        {
            //AQUI COMPRUEBO EL ESTADO ACTUAL DE LA PANTALLA, PORQUE ESTE METODO SOLO SE EJECUTARA
            //CADA VEZ QUE HAGAMOS UNA ACCION REFERIDA CON AÑADIR, MODIFICAR O ELIMINAR EN LA PANTALLA
            //TANTO SI PINCHAMOS EN EL DATAGRID COMO SI NOS LA INFORMACION DE OTRA PANTALLA

            state = st;

            if (state == Utils.State.MODIFY)
            {
                text_dni.Enabled = false;
            }
        }
Ejemplo n.º 20
0
        override public bool LaunchConsultaScreen(Utils.State state, ConsultaEN consulta)
        {
            bool ret = false;

            if (FormActual != f_consulta.ID)
            {
                ret        = true;
                FormActual = f_consulta.ID;
                f_consulta.Show();
                f_consulta.changeState(state, consulta);
            }
            return(ret);
        }
        private void CellContentClick_empleados(object sender, DataGridViewCellEventArgs e)
        {
            Utils.State aux_state = Utils.State.NONE;
            EmpleadoEN  emp       = controller.getStateScreen_Empleados(e, ref aux_state);

            if (emp != null)
            {
                menu.CargarEmpleadoCompartido(emp);
                if (menu.LaunchEmpleadoScreen(aux_state))
                {
                    DesactivateForm();
                }
            }
        }
Ejemplo n.º 22
0
        public void changeState(Utils.State st, TratamientoEN tra)
        {
            state = st;
            if (state == Utils.State.MODIFY || state == Utils.State.DESTROY)
            {
                text_nombre.Enabled = false;
                controller.cargarDatosTratamiento(tra);

                if (state == Utils.State.DESTROY)
                {
                    btn_eliminar_Click(new object(), new EventArgs());
                }
            }
        }
Ejemplo n.º 23
0
        private void box_label_aceptar_Click(object sender, EventArgs e)
        {
            string name_msc = box_text_nombre_mascota.Text;

            if (name_msc != "")
            {
                state = Utils.State.NEW;
                controller.cargarDatosMascota(null);
                combo_nombreAnimal.Items.Add(name_msc);
                combo_nombreAnimal.SelectedItem = name_msc;
                EnableForm(true);
                box_NombreAnimal.Visible = false;
                box_NombreAnimal.Enabled = false;
            }
        }
Ejemplo n.º 24
0
        private void btn_guardar_Click(object sender, EventArgs e)
        {
            if (state == Utils.State.NONE || state == Utils.State.NEW)
            {
                state = Utils.State.NEW;
            }
            else
            {
                state = Utils.State.MODIFY;
            }

            controller.ProcesarInformacion();
            EnableForm(true);
            state = Utils.State.MODIFY;
        }
        private void CellContentClick_Clientes(object sender, DataGridViewCellEventArgs e)
        {
            Utils.State st      = Utils.State.NONE;
            ClienteEN   cliente = controller.getStateScreen_Clientes(e, ref st);


            if (cliente != null)
            {
                menu.CargarClienteCompartido(cliente);

                if (menu.LaunchClienteScreen())
                {
                    DesactivateForm();
                }
            }
        }
Ejemplo n.º 26
0
 private void btn_eliminar_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Seguro que desea eliminar a esta mascota", "Eliminar Mascota", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
     {
         state = Utils.State.DESTROY;
         EnableForm(true);
         controller.ProcesarInformacion();
         state = Utils.State.NONE;
         menu.CargarClienteCompartido(null);
         controller.DevolverMascotaENComboBox();
     }
     else
     {
         EnableForm(true);
         state = Utils.State.MODIFY;
     }
 }
Ejemplo n.º 27
0
        private void btn_eliminar_Click(object sender, EventArgs e)
        {
            if (state == Utils.State.MODIFY)
            {
                EnableForm(false);
                if (MessageBox.Show("¿Seguro que desea eliminar este tratamiento?", "Eliminar tratamiento", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    state = Utils.State.DESTROY;
                    controller.ProcesarInformacion();
                }
                else
                {
                    state = Utils.State.MODIFY;
                }

                EnableForm(true);
            }
        }
Ejemplo n.º 28
0
        override public bool LaunchMascotaScreen(Utils.State st, MascotaEN mascota)
        {
            bool ret = false;

            if (FormActual != f_mascota.ID)
            {
                ret        = true;
                FormActual = f_mascota.ID;

                if (mascota == null && f_mascota.state == Utils.State.NONE)
                {
                    st = Utils.State.NONE;
                }

                f_mascota.changeState(st, mascota);
                f_mascota.Show();
            }
            return(ret);
        }
        public ConsultaEN getStateScreen(DataGridViewCellEventArgs ev, ref Utils.State st)
        {
            string     cli = "";
            ConsultaEN c   = null;

            if (form.dataGridView.Columns[ev.ColumnIndex].Name.Equals("Ver"))
            {
                st = Utils.State.MODIFY;
            }

            cli = form.dataGridView.Rows[ev.RowIndex].Cells[0].Value.ToString();

            if (cli != "")
            {
                c = Utils._IConsultaCAD.DameConsultaPorOID(Convert.ToInt32(cli));
            }

            return(c);
        }
Ejemplo n.º 30
0
        private void btn_eliminar_Click(object sender, EventArgs e)
        {
            if (state == Utils.State.MODIFY)
            {
                EnableForm(false);
                if (MessageBox.Show("Seguro que desea despedir a este empleado", "Despedir usuario", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
                {
                    state = Utils.State.DESTROY;
                    controller.ProcesarInformacion();
                    controller.ClearForm();
                }
                else
                {
                    state = Utils.State.MODIFY;
                }

                EnableForm(true);
            }
        }