Beispiel #1
0
        public static string actualizar(EstudioRF01 e)
        {
            string mensaje = "";

            if (
                string.IsNullOrEmpty(e.Nombre) ||
                string.IsNullOrEmpty(e.Descripcion) ||
                string.IsNullOrEmpty(e.Categoría) ||
                string.IsNullOrEmpty(e.Costo.ToString())
                )
            {
                mensaje = "Favor de completar el formulario o usar el formato correcto";
            }
            else
            {
                bool isUpdated = DataAccessLayer.EstudioDAL.actualizar(e);
                if (isUpdated)
                {
                    mensaje = "actualizado correctamente";
                }
                else
                {
                    mensaje = "Error de actualizacion";
                }
            }
            return(mensaje);
        }
Beispiel #2
0
        private void btnaceptar_Click(object sender, EventArgs e)
        {
            EstudioRF01 es = new EstudioRF01();
            bool        estado;

            if (rboActivo.Checked)
            {
                estado = true;
            }
            else
            {
                estado = false;
            }
            if (!frmEstudiosRF01.validar)
            {
                //instancia del medico


                //llenar con informacion
                try
                {
                    es.Nombre      = txtNombre.Text;
                    es.Descripcion = txtDescripcion.Text;
                    es.Categoría   = cboCategoria.SelectedItem.ToString();
                    es.Costo       = Convert.ToDouble(txtCosto.Text);
                    es.Estado      = estado;
                }
                catch
                {
                }
                string mensaje = BusinessLogicLayer.EstudioBLL.insertar(es);
                if (string.IsNullOrEmpty(mensaje))
                {
                    MessageBox.Show("El estudio se registro correctamente");
                    txtNombre.Text            = "";
                    txtDescripcion.Text       = "";
                    txtCosto.Text             = "";
                    cboCategoria.SelectedItem = null;
                    rboSuspendido.Checked     = false;
                    rboSuspendido.Checked     = true;
                }
                else
                {
                    MessageBox.Show(mensaje, "Error");
                }
            }
            else
            {
                es.Nombre      = txtNombre.Text;
                es.Descripcion = txtDescripcion.Text;
                es.Categoría   = cboCategoria.SelectedItem.ToString();
                es.Costo       = Convert.ToDouble(txtCosto.Text);
                es.Estado      = estado;

                string mensaje = BusinessLogicLayer.EstudioBLL.actualizar(es);

                MessageBox.Show(mensaje);
            }
        }
Beispiel #3
0
        private void frmCobroDelPaciente_Load(object sender, EventArgs e)
        {
            EstudioRF01 est = new EstudioRF01();

            est.Id          = 1;
            est.Nombre      = "Chequeo";
            est.Descripcion = "Se checará la presión arterial";
            est.Categoría   = "Tomografía";
            est.Costo       = 150;
            estudios.Add(est);

            dataGridView1.DataSource = estudios;

            txtTotal.Text          = estudios[0].Costo.ToString();
            txtNombrePacDeu.Text   = "Juan";
            txtApellidoPacDeu.Text = "Limas";

            txtResiPacDeu.Text = "Calle Rio Nazas #128 Jardines del Canadá";
            txtTotal.Text      = estudios[0].Costo.ToString();
        }
Beispiel #4
0
        public static string insertar(EstudioRF01 e)
        {
            string mensaje = "";

            //validar que no hay campos vacios
            if (
                string.IsNullOrEmpty(e.Nombre) ||
                string.IsNullOrEmpty(e.Descripcion) ||
                string.IsNullOrEmpty(e.Categoría) ||
                string.IsNullOrEmpty(e.Costo.ToString())

                )
            {
                mensaje = "Favor de completar el formulario o usar el formato correcto";
            }
            else
            {
                //validar que el medico no se repita
                bool isExist = DataAccessLayer.EstudioDAL.consultaPorNombre(e.Nombre);
                if (isExist)
                {
                    mensaje = "Estudio ya registrado";
                }
                else
                {
                    bool isInserted = DataAccessLayer.EstudioDAL.insertar(e);
                    if (isInserted)
                    {
                        mensaje = "";
                    }
                    else
                    {
                        mensaje = "Error de insercion";
                    }
                }
            }
            return(mensaje);
        }
Beispiel #5
0
 //actualizar
 public static bool actualizar(EstudioRF01 e)
 {
     db.EstudiosRF01.Attach(e);
     db.Entry(e).State = EntityState.Modified;//actualizacion
     return(db.SaveChanges() > 0);
 }
Beispiel #6
0
 public static bool insertar(EstudioRF01 e)
 {
     db.EstudiosRF01.Add(e);
     return(db.SaveChanges() > 0);
 }