示例#1
0
 private void btn_eliminar_histo_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Seguro que dese Eliminar?", "Salir", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         int id_historial = Convert.ToInt32(lb_id_historial.Text);
         int serie = int.Parse(lb_serie_mascota.Text);
         int respuesta = new NHistorialClinico().N_Eliminar_Historial_Clinico(id_historial);
         if (respuesta == 0)
         {
             MessageBox.Show("Error Al Eliminar Por favor intente nuevamente");
         }
         else
         {
             MessageBox.Show("Eliminado Correctamente");
             Lista_HistorialClinicobyMascota(serie);
             limpieza_cajasHistorial();
             btn_registrar_histo.Enabled = false;
             btn_cancelar_histo.Enabled = false;
             btn_nuevo_histo.Enabled = true;
             Inhabilitar_CajasHistorial();
             this.lb_id_historial.Text = "";
             this.btn_modificar_histo.Text = "Editar";
             btn_modificar_histo.Enabled = false;
             btn_eliminar_histo.Enabled = false;
         }
     }
 }
示例#2
0
        private void btn_modificar_histo_Click(object sender, EventArgs e)
        {
            btn_eliminar_histo.Enabled = false;
            if (btn_modificar_histo.Text.Equals("Editar"))
            {
                btn_modificar_histo.Text = "Guardar Cambios";
                Habilitar_CajasHistorial();
                btn_cancelar_histo.Enabled = true;

            }
            else
            {
                if (btn_modificar_histo.Text.Equals("Guardar Cambios"))
                {
                    Boolean band1 = false;
                    String mensaje = "Por Favor Complete los campos obligatorios : \n";
                    String descripcion = "";
                    Decimal precio;
                    int id_historial = Convert.ToInt32(lb_id_historial.Text);
                    DateTime f_historial = Convert.ToDateTime(fecha_historial.Text);
                    if (!String.IsNullOrEmpty(text_descripcion_histo.Text))
                    {
                        descripcion = text_descripcion_histo.Text;
                    }
                    else
                    {
                        mensaje = mensaje + "\n - Casilla de Descripcion";
                        band1 = true;
                    }
                    if (!String.IsNullOrEmpty(text_precio_histo.Text))
                    {
                        precio = Convert.ToDecimal(this.text_precio_histo.Text);
                    }
                    else
                    {
                        precio = 0;
                    }
                    if (band1 == true)
                    {
                        MessageBox.Show(mensaje);
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(this.lb_serie_mascota.Text))
                        {
                            int serie = int.Parse(lb_serie_mascota.Text);
                            int respuesta = new NHistorialClinico().N_Modificar_Historial_Clinico(f_historial, descripcion, precio, id_historial);
                            if (respuesta == 0)
                            {
                                MessageBox.Show("Error Al Guardar Por favor intente nuevamente");

                            }
                            else
                            {
                                MessageBox.Show("Cambios Guardados Correctamente");
                                Lista_HistorialClinicobyMascota(serie);
                                limpieza_cajasHistorial();
                                btn_registrar_histo.Enabled = false;
                                btn_cancelar_histo.Enabled = false;
                                btn_nuevo_histo.Enabled = true;
                                Inhabilitar_CajasHistorial();
                                this.lb_id_historial.Text = "";
                                this.btn_modificar_histo.Text = "Editar";
                                btn_modificar_histo.Enabled = false;

                            }
                        }
                        else
                        {
                            MessageBox.Show("Ocurrio Un Error - Intente Nuevamente");
                        }
                    }
                }

            }
        }
示例#3
0
        public void Lista_HistorialClinicobyMascota(int serie)
        {
            List<HistorialClinico> lista_historial = new NHistorialClinico().Historial_Clinico_ByMascota(serie);
            this.grilla_historial.Rows.Clear();
            for (int i = 0; i < lista_historial.Count; i++)
            {
                int reglon = this.grilla_historial.Rows.Add();
                this.grilla_historial.Rows[reglon].Cells["ID"].Value = lista_historial[i].Id.ToString();
                this.grilla_historial.Rows[reglon].Cells["FECHA"].Value = lista_historial[i].Fecha.ToShortDateString();
                this.grilla_historial.Rows[reglon].Cells["DESCRIPCION"].Value = lista_historial[i].Descripcion;
                this.grilla_historial.Rows[reglon].Cells["PRECIO"].Value = lista_historial[i].Precio;

            }
        }