private void button3_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtID.Text)) { MessageBox.Show("Por favor selecciones al Prospecto"); } else { DialogResult Opcion; Opcion = MessageBox.Show("Esta seguro de enviar al prospecto: " + textBox10.Text + "Con el Estatus de: " + comboBox1.Text, "Actualizar Grupo", MessageBoxButtons.YesNoCancel); if (Opcion == DialogResult.Yes) { try { String ID = txtID.Text; //String nombre = comboNombre.Text; string sql = "UPDATE prospecto2 SET estatus= '" + comboBox1.Text + "', observaciones= '" + txtObserv.Text + "'WHERE id= '" + ID + "'"; //Usando la clase de conexion SqlConnection conexionBD = Conexion.conexion(); conexionBD.Open(); try { SqlCommand comando = new SqlCommand(sql, conexionBD); comando.ExecuteNonQuery(); MessageBox.Show("Estatus Actualizado"); cargarProspectos(); cargarProspectosEnviados(); cargarProspectosAutorizado(); cargarProspectosRechazados(); txtID.Clear(); textBox10.Clear(); textBox11.Clear(); textBox12.Clear(); txtObserv.Clear(); //this.Close(); } catch (SqlException ex) { MessageBox.Show("Error al Actualizar el Estatus" + ex.Message); } finally { conexionBD.Close(); } } catch (Exception ex) { MessageBox.Show("Ocurrio un error" + ex); }; } if (Opcion == DialogResult.No) { MessageBox.Show("No se envio el Estatus"); } if (Opcion == DialogResult.Cancel) { MessageBox.Show("Se cancelo la operación"); } } }
private void button1_Click_1(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(textBox4.Text) || string.IsNullOrEmpty(textBox5.Text) || string.IsNullOrEmpty(textBox6.Text) || string.IsNullOrEmpty(textBox7.Text) || string.IsNullOrEmpty(textBox8.Text) || string.IsNullOrEmpty(textBox9.Text)) { MessageBox.Show("Por favor complete los campos vacios"); } else { String nombreP = textBox1.Text; String primerA = textBox2.Text; String segundoA = textBox3.Text; String calle = textBox4.Text; int numero = Convert.ToInt32(textBox5.Text); String colonia = textBox6.Text; int codigoPostal = Convert.ToInt32(textBox7.Text); String telefono = textBox8.Text; String RFC = textBox9.Text; //String Documento = txtRuta.Text; String estatus = "Enviado"; //sentencia para agregar a base de datos string sql = "INSERT INTO prospecto2 (Nombre, PrimerApellido, SegundApellido, Calle, Numero, CodigoPostal, Telefono, RFC,estatus,observaciones) " + "VALUES ('" + nombreP + "','" + primerA + "','" + segundoA + "', '" + calle + "', " + numero + ", " + codigoPostal + ", '" + telefono + "', '" + RFC + "', '" + estatus + "', '')"; //Usando la clase de conexion SqlConnection conexionBD = Conexion.conexion(); conexionBD.Open(); try { SqlCommand comando = new SqlCommand(sql, conexionBD); comando.ExecuteNonQuery(); MessageBox.Show("Registro Guardado"); cargarProspectosEnviados(); DOCS d = new DOCS(); d.txtRFCDoc.Text = textBox9.Text; d.ShowDialog(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); textBox4.Clear(); textBox5.Clear(); textBox6.Clear(); textBox7.Clear(); textBox8.Clear(); textBox9.Clear(); //txtRuta.Clear(); } catch (SqlException ex) { MessageBox.Show("Error al guardar" + ex.Message); } finally { conexionBD.Close(); } } }
public void cargarObservaciones() { try { String id = dataGridView1.CurrentRow.Cells[0].Value.ToString(); SqlDataReader reader = null; string sql = "SELECT observaciones, Nombre, PrimerApellido, SegundApellido, Calle, Numero, CodigoPostal, Telefono, RFC FROM Prospecto2 WHERE id = " + id + ";"; //abrir la conexion SqlConnection conexionBD = Conexion.conexion(); conexionBD.Open(); try { SqlCommand comando = new SqlCommand(sql, conexionBD); reader = comando.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { txtObersvaciones.Text = Convert.ToString(reader.GetString(0)); txtNombre.Text = Convert.ToString(reader.GetString(1)); txtPrimerA.Text = Convert.ToString(reader.GetString(2)); txtSegundoA.Text = Convert.ToString(reader.GetString(3)); txtCalle.Text = Convert.ToString(reader.GetString(4)); txtNumero.Text = Convert.ToString(reader.GetInt32(5)); txtCP.Text = Convert.ToString(reader.GetInt32(6)); txtTelefono.Text = Convert.ToString(reader.GetString(7)); txtRFC.Text = Convert.ToString(reader.GetString(8)); //txtDocumento.Text = Convert.ToString(reader.GetString(9)); } } else { MessageBox.Show("No se encontraron registros"); } } catch (SqlException ex) { MessageBox.Show("Error al buscar" + ex.Message); } finally { conexionBD.Close(); } } catch (Exception ex) { MessageBox.Show("Ocurrio un error" + ex); }; }
public void cargarProspectosRechazados() { SqlConnection conexionBD = Conexion.conexion(); conexionBD.Open(); SqlCommand cmd = conexionBD.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT id, Nombre, PrimerApellido, SegundApellido, estatus FROM prospecto2 Where estatus = 'Rechazado'"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); dataGridView4.DataSource = dt; conexionBD.Close(); }
public void cargarDocumentos() { SqlConnection conexionBD = Conexion.conexion(); conexionBD.Open(); SqlCommand cmd = conexionBD.CreateCommand(); cmd.CommandType = CommandType.Text; cmd.CommandText = "SELECT id, RFCProspecto, nombre, realname FROM documentos where RFCProspecto= '" + txtRFC.Text + "'"; cmd.ExecuteNonQuery(); DataTable dt = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(dt); dataGridView5.DataSource = dt; conexionBD.Close(); }
private void Registrar_Load(object sender, EventArgs e) { SqlConnection conexionBD = Conexion.conexion(); conexionBD.Open(); }