private void btnIng_Click(object sender, EventArgs e) { Base_de_datos.CodMed = lblCod.Text; Base_de_datos.nommedi = lblNom.Text; Base_de_datos.cant = lblCan.Text; dataGridView1.DataSource = null; lblCan.Text = "*"; lblNom.Text = "*"; lblDes.Text = "*"; lblCod.Text = "*"; label10.Text = "*"; txtCod.Text = ""; txtnom.Text = ""; btnIng.Enabled = false; ingresoPrendaExisntente a = new ingresoPrendaExisntente(); a.ShowDialog(); if (a.DialogResult == DialogResult.OK) { Base_de_datos busc = new Base_de_datos(); busc.BuscarRopaNom1(""); dataGridView1.DataSource = busc.Mostrar_Resultados(); } }
private void btnBuscar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtcant.Text) == false) { MessageBox.Show("Llene la cantidad"); return; } if (int.Parse(txtcant.Text) <= 0) { MessageBox.Show("La cantidad no pueder ser menor a 1"); return; } Base_de_datos.Registro_RopaEx(int.Parse(txtcod.Text), textBox1.Text.ToUpper(), (int.Parse(txtcant.Text) + cant), cat); Base_de_datos.movimientoRopaIng(int.Parse(txtcod.Text), textBox1.Text.ToUpper(), int.Parse(txtcant.Text)); MessageBox.Show("Prenda Ingresada."); Base_de_datos busc = new Base_de_datos(); busc.BuscarPrenda(); dataGridView1.DataSource = busc.Mostrar_Resultados(); txtcod.Clear(); textBox1.Clear(); txtcant.Clear(); DialogResult = DialogResult.OK; this.Hide(); }
private void Modifiar_usuario_Load(object sender, EventArgs e) { Base_de_datos busc = new Base_de_datos(); busc.BuscarUsuario(); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
public Modificar_ropa() { InitializeComponent(); dataGridView1.AllowUserToAddRows = false; Base_de_datos busc = new Base_de_datos(); busc.BuscarCategoriaNom(""); dataGridView1.DataSource = busc.Mostrar_Resultados(); foreach (DataGridViewRow row in dataGridView1.Rows) { txtUnidad.Items.Add(row.Cells[1].Value.ToString()); } txtcod.Text = Base_de_datos.CodMed; txtnom.Text = Base_de_datos.nommedi; txtUnidad.Text = Base_de_datos.cate; if (Base_de_datos.estadoE == "ACT") { cmbestado.Text = "Activo"; } else { cmbestado.Text = "Inactivo"; } }
private void Modificar_servcios_Load(object sender, EventArgs e) { Base_de_datos busc = new Base_de_datos(); busc.BuscarServicio(); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
private void btningresar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtNombreRol.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(textBox1.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } int ver = Base_de_datos.validarNomNivel(txtNombreRol.Text); if (ver != 1) { MessageBox.Show("Nivel ya existente"); return; } Base_de_datos.Registro_Nivel(txtNombreRol.Text, float.Parse(textBox1.Text)); MessageBox.Show("Registrado con exito"); this.Hide(); }
private void btnBuscar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtnom.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtcant.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtUnidad.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } int ver = Base_de_datos.validarNomRopa(txtnom.Text); if (ver != 1) { MessageBox.Show("Prenda ya existente"); return; } Base_de_datos.Registro_Ropa(1, txtnom.Text, int.Parse(txtcant.Text), txtUnidad.SelectedItem.ToString()); MessageBox.Show("Prenda Ingresada con exito"); Busqueda_ropa a = new Busqueda_ropa(); Base_de_datos busc = new Base_de_datos(); busc.BuscarRopaNom1(""); a.dataGridView1.DataSource = busc.Mostrar_Resultados(); this.Hide(); }
public static void registrar_empleado(string nom1, string nom2, string ape1, string ape2, string correo, string id, string sexo, string tel) { SqlConnection con; con = Base_de_datos.Conectar(); try { con.Open(); SqlCommand cmd = new SqlCommand("Mante_empleados", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Primer_nombre_empleado", nom1)); cmd.Parameters.Add(new SqlParameter("@Segundo_nombre_empleado", nom2)); cmd.Parameters.Add(new SqlParameter("@Primer_apellido_empleado", ape1)); cmd.Parameters.Add(new SqlParameter("@Segundo_apellido_empleado", ape2)); cmd.Parameters.Add(new SqlParameter("@Correo_empleado", correo)); cmd.Parameters.Add(new SqlParameter("@Numero_identidad_empleado", id)); cmd.Parameters.Add(new SqlParameter("@Sexo_empleado", sexo)); cmd.Parameters.Add(new SqlParameter("@Telefono_empleado", tel)); cmd.ExecuteNonQuery(); } catch { } finally { con.Close(); } }
private void btningresar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtNombreServicio.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtprecio.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (Base_de_datos.validarServicio(txtNombreServicio.Text) == 0) { MessageBox.Show("Servicio ya existente"); return; } Base_de_datos.Registro_Servicio(txtNombreServicio.Text.ToUpper(), txtDescripcion.Text.ToUpper(), txtprecio.Text.ToUpper()); MessageBox.Show("Registrado con exito"); this.Hide(); }
private void btnBuscar_Click(object sender, EventArgs e) { int ver = Base_de_datos.validarNomMedMod(codigomed.Text, txtnom.Text); if (ver != 1) { MessageBox.Show("Medicamento ya existente"); return; } Base_de_datos.Actualizar_Medicamento(int.Parse(codigomed.Text), txtnom.Text.ToUpper(), txtcant.Text.ToUpper(), richTextBox1.Text.ToUpper(), txtprecio.Text.ToUpper(), txtUnidad.SelectedItem.ToString()); MessageBox.Show("Medicamento guardado con exito"); DialogResult = DialogResult.OK; this.Hide(); codigomed.Clear(); codigomed.Focus(); txtnom.Enabled = false; txtcant.Enabled = false; richTextBox1.Enabled = false; txtprecio.Enabled = false; txtUnidad.Enabled = false; txtnom.Clear(); codigomed.Clear(); richTextBox1.Clear(); txtcant.Clear(); txtprecio.Clear(); codigomed.Enabled = true; }
private void txtnom_TextChanged_1(object sender, EventArgs e) { if (radioButton1.Checked && txtnom.TextLength >= 0) { Base_de_datos busc = new Base_de_datos(); busc.BuscarMedNom(txtnom.Text.ToUpper()); dataGridView1.DataSource = busc.Mostrar_Resultados(); } else if (radioButton2.Checked && txtCod.TextLength == 0) { Base_de_datos busc = new Base_de_datos(); busc.BuscarMedNom(""); dataGridView1.DataSource = busc.Mostrar_Resultados(); } else if (radioButton2.Checked && txtCod.TextLength >= 1) { Base_de_datos busc = new Base_de_datos(); busc.BuscarMedCod(txtCod.Text); dataGridView1.DataSource = busc.Mostrar_Resultados(); } else { dataGridView1.DataSource = null; } lblCan.Text = "*"; lblNom.Text = "*"; lblDes.Text = "*"; lblCod.Text = "*"; txtUnidad.Text = "*"; label10.Text = "*"; button1.Enabled = false; btnIng.Enabled = false; btnSac.Enabled = false; }
private void btnModificar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtNombreRol.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } int ver = Base_de_datos.validarNomPuestoMod(txtCodigoRol.Text, txtNombreRol.Text); if (ver >= 1) { MessageBox.Show("Puesto ya existente"); return; } String estado; if (cmbestado.Text == "Activo") { estado = "ACT"; } else { estado = "INC"; } Base_de_datos.Actualizar_Puesto(int.Parse(txtCodigoRol.Text), txtNombreRol.Text, estado); MessageBox.Show("Puesto modificado"); this.Hide(); }
private void txtcodigo_TextChanged(object sender, EventArgs e) { if (txtcodigo.TextLength >= 1) { Base_de_datos.busqueda_citas(int.Parse(txtcodigo.Text), dgvcitas); } }
public static void expediente(string ID) { SqlConnection con; con = Base_de_datos.Conectar(); try { con.Open(); SqlCommand cmd = new SqlCommand("SELECT * FROM [dbo].[Pacientes] WHERE [Numero_identidad_paciente]=@id", con); cmd.Parameters.AddWithValue("@id", ID); SqlDataReader registro = cmd.ExecuteReader(); if (registro.Read()) { MessageBox.Show("El numero de expediente es : " + registro["Codigo_expediente_paciente"].ToString()); } } catch { } finally { con.Close(); } }
private void txtCod_TextChanged(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtCod.Text) == false) { txtdescripcion.Clear(); } if (radioSerNombre.Checked && txtnom.TextLength >= 1) { Base_de_datos busc = new Base_de_datos(); busc.BuscarSerNom(txtnom.Text.ToUpper()); dataGridView1.DataSource = busc.Mostrar_Resultados(); } else if (radioSerCodigo.Checked && txtCod.TextLength >= 1) { Base_de_datos busc = new Base_de_datos(); busc.BuscarSerCod(txtCod.Text); dataGridView1.DataSource = busc.Mostrar_Resultados(); } else { dataGridView1.DataSource = null; } }
private void button4_Click(object sender, EventArgs e) { if (txtriesgo.Text != "Alto" && txtriesgo.Text != "Medio" && txtriesgo.Text != "Bajo") { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (txtriesgo.Text == "Alto") { riesgo = 1; } if (txtriesgo.Text == "Medio") { riesgo = 2; } if (txtriesgo.Text == "Bajo") { riesgo = 3; } Base_de_datos.Actualizar_Riesgo(riesgo, txtcita.Text); MessageBox.Show("Se ha guardado con exito"); if (MessageBox.Show("Desea regresar al menu?", "Confirmar", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.Hide(); } }
private void btnAgregar_Click(object sender, EventArgs e) { if (txtCantidad.Text == "0") { MessageBox.Show("Ingrese un numero mayor a 0"); return; } if (!string.IsNullOrEmpty(txtdescripcion.Text) == false) { MessageBox.Show("Seleccione un Servicio"); return; } if (!string.IsNullOrEmpty(txtCantidad.Text) == false) { MessageBox.Show("Seleccione una Cantidad"); return; } if (Base_de_datos.ValidarFacturaDetalle(lblCodigoFacturaSer.Text, a.ToString()) == 1) { Base_de_datos.Detalle_Servicio(int.Parse(lblCodigoFacturaSer.Text), CodigoS, int.Parse(txtCantidad.Text)); Base_de_datos busc = new Base_de_datos(); busc.BuscarDetalle(lblCodigoFacturaSer.Text); dataGridView2.DataSource = busc.Mostrar_Resultados(); btnGuardar.Enabled = true; a = int.Parse(dataGridView2[1, 0].Value.ToString()); } else { MessageBox.Show("Servicio ya Ingresado"); } }
private void Modificacion_medida_Load(object sender, EventArgs e) { Base_de_datos busc = new Base_de_datos(); busc.BuscarMedida(); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
private void button2_Click(object sender, EventArgs e) { Base_de_datos.CodMed = lblCod.Text; Base_de_datos.nommedi = lblNom.Text; Base_de_datos.cant = lblCan.Text; Base_de_datos.desc = txtUnidad.Text; Base_de_datos.unidad = label10.Text; btnIng.Enabled = false; btnSac.Enabled = false; button1.Enabled = false; lblCan.Text = "*"; lblNom.Text = "*"; lblDes.Text = "*"; lblCod.Text = "*"; txtUnidad.Text = "*"; label10.Text = "*"; txtCod.Text = ""; txtnom.Text = ""; dataGridView1.DataSource = null; venc a = new venc(); a.ShowDialog(); if (a.DialogResult == DialogResult.OK) { Base_de_datos busc = new Base_de_datos(); busc.BuscarMedNom(""); dataGridView1.DataSource = busc.Mostrar_Resultados(); } }
public static int Log(string txtusuario, string txtcontraseña) { SqlConnection con; con = Base_de_datos.Conectar(); con.Open(); SqlCommand cmd = new SqlCommand("SELECT Nombre_usuario, Contrasena_usuario from Usuarios WHERE Nombre_usuario LIKE @nom AND Contrasena_usuario LIKE @usu", con); cmd.Parameters.AddWithValue("nom", txtusuario); cmd.Parameters.AddWithValue("usu", txtcontraseña); SqlDataAdapter da = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); da.Fill(dt); if (dt.Rows.Count == 1) { menu a = new menu(); a.Show(); con.Close(); return(1); } else { MessageBox.Show("Usuario o contrasena incorrecta"); con.Close(); return(0); } }
private void btnregistrar_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtnom1.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtape1.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (rdf.Checked == false && rdm.Checked == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtid.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } Base_de_datos.registrar_empleado(txtnom1.Text, txtnom2.Text, txtape1.Text, txtape2.Text, txtcorreo.Text, txtid.Text, sexo, txttel.Text); this.Close(); menu a = new menu(); a.Show(); }
public static void Registro(string nom1, string nom2, string ape1, string ape2, string lugar, string fecha, string padre, string madre, string identidad, string sexo, int riesgo) { SqlConnection con; con = Base_de_datos.Conectar(); try { con.Open(); SqlCommand cmd = new SqlCommand("Mante_pacientes", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new SqlParameter("@Primer_nombre_paciente", nom1)); cmd.Parameters.Add(new SqlParameter("@Segundo_nombre_paciente", nom2)); cmd.Parameters.Add(new SqlParameter("@Primer_apellido_paciente", ape1)); cmd.Parameters.Add(new SqlParameter("@Segundo_apellido_paciente", ape2)); cmd.Parameters.Add(new SqlParameter("@Lugar_nacimiento", lugar)); cmd.Parameters.Add(new SqlParameter("@Fecha_nacimiento", fecha)); cmd.Parameters.Add(new SqlParameter("@Nombre_padre_paciente", padre)); cmd.Parameters.Add(new SqlParameter("@Nombre_madre_paciente", madre)); cmd.Parameters.Add(new SqlParameter("@Numero_identidad_paciente", identidad)); cmd.Parameters.Add(new SqlParameter("@Sexo_paciente", sexo)); cmd.Parameters.Add(new SqlParameter("@Codigo_riesgo", riesgo)); cmd.ExecuteNonQuery(); } catch { } finally { con.Close(); } }
private void ingresoPrendaExisntente_Load(object sender, EventArgs e) { Base_de_datos busc = new Base_de_datos(); busc.BuscarPrenda(); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
public Busqueda_ropa() { InitializeComponent(); Base_de_datos busc = new Base_de_datos(); busc.BuscarRopaNom1(""); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
public Busqueda_medicamentos() { Base_de_datos busc = new Base_de_datos(); InitializeComponent(); busc.BuscarMedNom(""); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
private void pictureBox7_Click(object sender, EventArgs e) { dataGridView1.Visible = true; Base_de_datos a = new Base_de_datos(); a.BuscarEmpleado(); dataGridView1.DataSource = a.Mostrar_Resultados(); }
public Modificar_puesto() { InitializeComponent(); Base_de_datos busc = new Base_de_datos(); busc.BuscarPuesto(); dataGridView1.DataSource = busc.Mostrar_Resultados(); }
private void btningresar_Click(object sender, EventArgs e) { string Permisos = ""; if (!string.IsNullOrEmpty(txtNombreRol.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (chkPacientes.Checked) { Permisos = (Permisos + "A"); } if (chkEmpleados.Checked) { Permisos = (Permisos + "B"); } if (chkUsuarios.Checked) { Permisos = (Permisos + "C"); } if (chkFacturacion.Checked) { Permisos = (Permisos + "D"); } if (chkInventario.Checked) { Permisos = (Permisos + "E"); } if (chkDocumentos.Checked) { Permisos = (Permisos + "F"); } if (chkMantenimientos.Checked) { Permisos = (Permisos + "G"); } int x = Base_de_datos.Registro_Rol(txtNombreRol.Text.ToUpper(), Permisos); if (x == 1) { MessageBox.Show("Rol Ingresado Correctamente"); this.Hide(); } else { txtNombreRol.Clear(); chkDocumentos.Checked = false; chkEmpleados.Checked = false; chkFacturacion.Checked = false; chkInventario.Checked = false; chkMantenimientos.Checked = false; chkPacientes.Checked = false; chkUsuarios.Checked = false; } }
private void button1_Click(object sender, EventArgs e) { string Nom = Base_de_datos.Nombre_medicamento(txtmedicamento.Text); if (!string.IsNullOrEmpty(txtcita.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtmedicamento.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (!string.IsNullOrEmpty(txtcantidad.Text) == false) { MessageBox.Show("Llene todos los campos obligatorios"); return; } if (int.Parse(txtcantidad.Text) == 0) { MessageBox.Show("Imposible ingresar 0"); return; } int ver = Base_de_datos.VerificarMedicamento(txtmedicamento.Text); if (ver != 1) { MessageBox.Show("No existe el medicamento"); return; } txtcita.Enabled = false; pictureBox1.Enabled = false; int a; a = Base_de_datos.validarMed(int.Parse(txtcita.Text), int.Parse(txtmedicamento.Text)); if (a == 1) { MessageBox.Show("Medicamento ya ingresado"); return; } Base_de_datos.validmedi(txtmedicamento.Text); if (int.Parse(txtcantidad.Text) > int.Parse(Base_de_datos.cant)) { MessageBox.Show("No hay suficiente medicamento"); return; } Base_de_datos.registrar_recetas(int.Parse(txtcita.Text), int.Parse(txtmedicamento.Text), int.Parse(txtcantidad.Text)); dataGridView2.Rows.Add(); txtnombre.Text = Nom; int contfilas = dataGridView2.Rows.Count - 1; dataGridView2[0, contfilas].Value = txtmedicamento.Text; dataGridView2[1, contfilas].Value = txtnombre.Text; dataGridView2[2, contfilas].Value = txtcantidad.Text; }
private void button2_Click(object sender, EventArgs e) { int indice; indice = dataGridView2.CurrentRow.Index; dataGridView2.Rows.RemoveAt(indice); Base_de_datos.Quitar(int.Parse(txtcita.Text), a); button2.Enabled = false; }