Example #1
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            Validaciones.Clear();


            if (ValidarCampos())
            {
                switch (Operacion)
                {
                case "agregar":
                    try
                    {
                        DataBase.Paciente newPac = new DataBase.Paciente
                        {
                            Paciente_Nom    = txt_name.Text.Trim(),
                            Paciente_Ape    = txt_ape.Text.Trim(),
                            Paciente_Doc    = txt_doc.Text.Trim(),
                            Paciente_Dom    = txt_dom.Text.Trim(),
                            Paciente_Tel    = txt_tel.Text.Trim(),
                            Paciente_OS     = (Int32)cmb_OS.SelectedValue,
                            Paciente_FecNac = dtp_fecnac.Value.Date.ToString()
                        };
                        ch.Pacientes.InsertOnSubmit(newPac);
                        ch.SubmitChanges();
                        MessageBox.Show("Se ha cargado un nuevo paciente");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("El paciente no se ha podido cargar, por favor vuelva a intentar");
                        break;
                    }

                case "modificar":
                    try
                    {
                        int PacId = Convert.ToInt32(dgv_Pac.CurrentRow.Cells[0].Value);
                        DataBase.Paciente paciente = ch.Pacientes.Where(w => w.Paciente_Id == PacId).FirstOrDefault();
                        paciente.Paciente_Nom    = txt_name.Text.Trim();
                        paciente.Paciente_Ape    = txt_ape.Text.Trim();
                        paciente.Paciente_Doc    = txt_doc.Text.Trim();
                        paciente.Paciente_Dom    = txt_dom.Text.Trim();
                        paciente.Paciente_Tel    = txt_tel.Text.Trim();
                        paciente.Paciente_OS     = (Int32)cmb_OS.SelectedValue;
                        paciente.Paciente_FecNac = dtp_fecnac.Value.Date.ToString();
                        ch.SubmitChanges();
                        MessageBox.Show("el paciente ha sido modificado");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("El paciente no se ha podido actualizar, por favor vuelva a intentar");
                        break;
                    }
                }
                this.Pacientes_Load();
            }
        }
 private void btn_cancel_Click(object sender, EventArgs e)
 {
     Validaciones.Clear();
     this.cmb_month.Enabled = true;
     this.cmb_year.Enabled  = false;
     this.HrsTrabajadas_Load(false, true);
 }
Example #3
0
 private void btn_new_Click(object sender, EventArgs e)
 {
     Validaciones.Clear();
     grp_Listados.Enabled = false;
     grp_Datos.Enabled    = true;
     LimpiarCampos();
     Operacion = "agregar";
 }
Example #4
0
 private void btn_Nuevo_Click(object sender, EventArgs e)
 {
     Validaciones.Clear();
     txt_Codigo.ReadOnly       = false;
     grp_Productos.Enabled     = true;
     grp_ListadoProduc.Enabled = false;
     LimpiarCampos();
     operacion = "agregar";
 }
        private void btn_new_Click(object sender, EventArgs e)
        {
            Validaciones.Clear();
            grp_Horas.Enabled = false;
            grp_Datos.Enabled = true;
            LimpiarCampos();
            Operacion = "agregar";

            int thid = Convert.ToInt32(cmb_TiposHrs.SelectedValue);
        }
Example #6
0
        private void btn_Confirmar_Click(object sender, EventArgs e)
        {
            Validaciones.Clear();
            Database.DataClassesDataContext cc = new Database.DataClassesDataContext();

            if (ValidarCampos())
            {
                switch (operacion)
                {
                case "agregar":
                    try
                    {
                        Database.Cliente newcliente = new Database.Cliente();
                        newcliente.Nombre    = txt_Nombre.Text.Trim();
                        newcliente.Apellido  = txt_Apellido.Text.Trim();
                        newcliente.Direccion = txt_Domicilio.Text.Trim();
                        newcliente.Telefono  = txt_Telefono.Text.Trim();
                        cc.Clientes.InsertOnSubmit(newcliente);
                        cc.SubmitChanges();
                        MessageBox.Show("Nuevo cliente cargado!");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("No se pudo guardar el cliente ingresado!");
                        break;
                    }


                case "modificar":
                    try
                    {
                        int ClienteId = Convert.ToInt32(dgv_Clientes.CurrentRow.Cells[0].Value);
                        var query     = cc.Clientes.Where(w => w.Id == ClienteId).FirstOrDefault();
                        query.Nombre    = txt_Nombre.Text.Trim();
                        query.Apellido  = txt_Apellido.Text.Trim();
                        query.Direccion = txt_Domicilio.Text.Trim();
                        query.Telefono  = txt_Telefono.Text.Trim();
                        cc.SubmitChanges();
                        MessageBox.Show("Cliente Actualizado!");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("No se pudo actualizar correctamente el cliente!");
                        break;
                    }
                }
                this.Cliente_Load();
            }
        }
Example #7
0
 private void btn_updte_Click(object sender, EventArgs e)
 {
     if (txt_name.Text == "")
     {
         MessageBox.Show("Debe seleccionar un terapeuta para poder realizar la modificacion");
         this.Terapeuta_Load();
     }
     else
     {
         Validaciones.Clear();
         grp_Listados.Enabled = false;
         grp_Datos.Enabled    = true;
         Operacion            = "modificar";
     }
 }
Example #8
0
 private void btn_Modificar_Click(object sender, EventArgs e)
 {
     if (txt_Apellido.Text == "")
     {
         MessageBox.Show("Debe elegir un cliente para modificar");
         this.Cliente_Load();
     }
     else
     {
         Validaciones.Clear();
         grp_Datos.Enabled   = true;
         grp_Listado.Enabled = false;
         operacion           = "modificar";
     }
 }
Example #9
0
 private void btn_upda_Click(object sender, EventArgs e)
 {
     if (txt_name.Text == "")
     {
         MessageBox.Show("Debe seleccionar una obra social para poder modificarla");
         this.ObraSocial_Load();
     }
     else
     {
         Validaciones.Clear();
         grp_Listado.Enabled = false;
         grp_Datos.Enabled   = true;
         Operacion           = "modificar";
     }
 }
Example #10
0
 private void btn_Modificar_Click(object sender, EventArgs e)
 {
     if (txt_Codigo.Text == "")
     {
         MessageBox.Show("Debe seleccionar un producto para modificar!");
         this.Productos_Load();
     }
     else
     {
         Validaciones.Clear();
         txt_Codigo.ReadOnly       = true;
         grp_Productos.Enabled     = true;
         grp_ListadoProduc.Enabled = false;
         operacion = "modificar";
     }
 }
Example #11
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            Validaciones.Clear();


            if (ValidarNombre())
            {
                switch (Operacion)
                {
                case "agregar":
                    try
                    {
                        DataBase.Obras_Sociale newOS = new DataBase.Obras_Sociale();
                        newOS.ObSoc_Nom = txt_name.Text.Trim();
                        ch.Obras_Sociales.InsertOnSubmit(newOS);
                        ch.SubmitChanges();
                        MessageBox.Show("Nueva Obra Social cargada");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("La obra social no se ha podido cargar, por favor vuelva a intentar");
                        break;
                    }

                case "modificar":
                    try
                    {
                        int OSId  = Convert.ToInt32(dgv_ObraSocial.CurrentRow.Cells[0].Value);
                        var query = ch.Obras_Sociales.Where(w => w.ObSoc_Id == OSId).FirstOrDefault();
                        query.ObSoc_Nom = txt_name.Text.Trim();
                        ch.SubmitChanges();
                        MessageBox.Show("La Obra Social ha sido modificada");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("La obra social no se ha podido actualizar, por favor vuelva a intentar");
                        break;
                    }
                }
                this.ObraSocial_Load();
            }
        }
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            Validaciones.Clear();


            if (ValidarCampos())
            {
                switch (Operacion)
                {
                case "agregar":
                    try
                    {
                        DataBase.Horas_Trabajada newHT = new DataBase.Horas_Trabajada
                        {
                            HrTrab_Cant   = Convert.ToDecimal(txt_hrs.Text.Trim()),
                            HrTrab_Lugar  = txt_place.Text.Trim(),
                            HrTrab_Pac    = (Int32)cmb_Pac.SelectedValue,
                            HrTrab_TipoHr = (Int32)cmb_TiposHrs.SelectedValue,
                            HrTrab_Mes    = txt_month.Text.Trim(),
                            HrTrab_Precio = this.TotalACobrar((Int32)cmb_TiposHrs.SelectedValue, Convert.ToDecimal(txt_hrs.Text.Trim())),
                            HrTrab_Cob    = false
                        };
                        ch.Horas_Trabajadas.InsertOnSubmit(newHT);
                        ch.SubmitChanges();
                        MessageBox.Show("Se ha cargado una nueva sesion");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("La sesion no se ha podido cargar, por favor vuelva a intentar");
                        break;
                    }
                }
                MesaCargar = txt_month.Text.Trim();
                this.HrsTrabajadas_Load(false, true);
            }
        }
Example #13
0
 private void txt_tel_KeyPress(object sender, KeyPressEventArgs e)
 {
     Validaciones.Clear();
 }
Example #14
0
 private void btn_cancel_Click(object sender, EventArgs e)
 {
     Validaciones.Clear();
     this.Terapeuta_Load();
 }
Example #15
0
        private void btn_confirm_Click(object sender, EventArgs e)
        {
            Validaciones.Clear();


            if (ValidarCampos())
            {
                switch (Operacion)
                {
                case "agregar":
                    try
                    {
                        DataBase.Terapeuta newTer = new DataBase.Terapeuta
                        {
                            Terapeuta_Nom  = txt_name.Text.Trim(),
                            Terapeuta_Ape  = txt_ape.Text.Trim(),
                            Terapeuta_Doc  = txt_doc.Text.Trim(),
                            Terapeuta_Dom  = txt_dom.Text.Trim(),
                            Terapeuta_Mail = txt_mail.Text.Trim(),
                            Terapeuta_Mat  = txt_mat.Text.Trim(),
                            Terapeuta_Tel  = txt_tel.Text.Trim(),
                            Terapeuta_Prof = (Int32)cmb_prof.SelectedValue
                        };
                        ch.Terapeutas.InsertOnSubmit(newTer);
                        ch.SubmitChanges();
                        MessageBox.Show("Se ha cargado un nuevo terapeuta");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("El terapeuta no se ha podido cargar, por favor vuelva a intentar");
                        break;
                    }

                case "modificar":
                    try
                    {
                        int TerId = Convert.ToInt32(dgv_Ter.CurrentRow.Cells[0].Value);
                        DataBase.Terapeuta terapeuta = ch.Terapeutas.Where(w => w.Terapeuta_Id == TerId).FirstOrDefault();
                        terapeuta.Terapeuta_Nom  = txt_name.Text.Trim();
                        terapeuta.Terapeuta_Ape  = txt_ape.Text.Trim();
                        terapeuta.Terapeuta_Doc  = txt_doc.Text.Trim();
                        terapeuta.Terapeuta_Dom  = txt_dom.Text.Trim();
                        terapeuta.Terapeuta_Mail = txt_mail.Text.Trim();
                        terapeuta.Terapeuta_Mat  = txt_mat.Text.Trim();
                        terapeuta.Terapeuta_Tel  = txt_tel.Text.Trim();
                        terapeuta.Terapeuta_Prof = (Int32)cmb_prof.SelectedValue;
                        ch.SubmitChanges();
                        MessageBox.Show("El terapeuta ha sido modificado");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("El terapeuta no se ha podido actualizar, por favor vuelva a intentar");
                        break;
                    }
                }
                this.Terapeuta_Load();
            }
        }
Example #16
0
 private void textBoxProductoCantidad_KeyPress(object sender, KeyPressEventArgs e)
 {
     Validaciones.Clear();
 }
Example #17
0
 private void btn_Cancelar_Click(object sender, EventArgs e)
 {
     Validaciones.Clear();
     this.Cliente_Load();
 }
Example #18
0
        private void btn_Confirmar_Click(object sender, EventArgs e)
        {
            Validaciones.Clear();
            Database.DataClassesDataContext cp = new Database.DataClassesDataContext();

            if (ValidarCampos())
            {
                switch (operacion)
                {
                case "agregar":
                    try
                    {
                        Database.Producto newproducto = new Database.Producto();
                        newproducto.Prod_Cod    = Int32.Parse(txt_Codigo.Text);
                        newproducto.Prod_Desc   = txt_Producto.Text;
                        newproducto.Prod_Precio = Decimal.Parse(txt_Precio.Text);
                        if (cb_Web.Checked)
                        {
                            newproducto.Prod_Web = true;
                        }
                        else
                        {
                            newproducto.Prod_Web = false;
                        }
                        cp.Productos.InsertOnSubmit(newproducto);
                        cp.SubmitChanges();
                        MessageBox.Show("Nuevo producto cargado!");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("No se pudo guardar el producto ingresado!");
                        break;
                    }


                case "modificar":
                    try
                    {
                        int ProductoId = Convert.ToInt32(dgv_Productos.CurrentRow.Cells[0].Value);
                        var query      = cp.Productos.Where(w => w.Prod_Cod == ProductoId).FirstOrDefault();
                        query.Prod_Cod    = Int32.Parse(txt_Codigo.Text);;
                        query.Prod_Desc   = txt_Producto.Text;
                        query.Prod_Precio = Decimal.Parse(txt_Precio.Text);
                        if (cb_Web.Checked)
                        {
                            query.Prod_Web = true;
                        }
                        else
                        {
                            query.Prod_Web = false;
                        }
                        cp.SubmitChanges();
                        MessageBox.Show("Producto Actualizado!");
                        break;
                    }
                    catch (Exception ex)
                    {
                        System.Console.WriteLine(ex.Message);
                        MessageBox.Show("No se pudo actualizar correctamente el producto!");
                        break;
                    }
                }
                this.Productos_Load();
            }
        }
Example #19
0
 private void btn_cancel_Click(object sender, EventArgs e)
 {
     Validaciones.Clear();
     this.ObraSocial_Load();
 }
Example #20
0
 private void text_AbonaCon_KeyPress(object sender, KeyPressEventArgs e)
 {
     Validaciones.Clear();
 }