private void comboBox4_KeyDown(object sender, KeyEventArgs e) { DataTable dtt = new DataTable(); try { if (e.KeyCode == Keys.Enter) { dataGridView2.DataSource = null; using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select Cedula from clientes where Nombre='" + comboBox4.Text + "'"; MySqlDataAdapter adapt = new MySqlDataAdapter(mysql.cadenasql, mysql.con); adapt.Fill(dtt); dataGridView2.DataSource = dtt; mysql.Dispose(); } } } catch (Exception efd) { Mensaje.Error(efd, "797"); } }
private void dataGridView1_Click(object sender, EventArgs e) { try { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select * from vendedores where Codigo='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.lector = mysql.comando.ExecuteReader(); while (mysql.lector.Read()) { nombre.Text = mysql.lector["Nombre"].ToString(); telefono.Text = mysql.lector["Telefono"].ToString(); correo.Text = mysql.lector["Correo"].ToString(); direccion.Text = mysql.lector["Direccion"].ToString(); } mysql.Dispose(); button1.Enabled = true; direccion.Focus(); } } catch (Exception excep) { Mensaje.Error(excep, "102"); } }
private void dataGridView1_KeyUp(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select * from clientes where Cedula='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.lector = mysql.comando.ExecuteReader(); while (mysql.lector.Read()) { nombre.Text = mysql.lector["Nombre"].ToString(); telefono.Text = mysql.lector["Descripcion"].ToString(); correo.Text = mysql.lector["Correo"].ToString(); direccion.Text = mysql.lector["Direccion"].ToString(); } mysql.Dispose(); } } } catch (Exception excep) { Mensaje.Error(excep, "102"); } }
public void imprimir() { try { streamToPrint = new StreamReader ("Abonohistorico.txt"); try { printFont = new Font("Segoe UI", 10); PrintDocument pd = new PrintDocument(); pd.PrintPage += new PrintPageEventHandler (this.printDocument1_PrintPage); pd.Print(); } finally { streamToPrint.Close(); } } catch (Exception err_004) { Mensaje.Error(err_004, "128"); } }
public void agregarPayment() { try { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "update abonos set flag=0"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.ExecuteNonQuery(); mysql.cadenasql = "insert into abonos(Cedula,NumFactura,Abono,flag,CodigoCajero,Fecha,TipoPago)values('" + comboBox1.Text + "','" + comboBox2.Text + "','" + double.Parse(textBox1.Text.Trim()).ToString("0.00000000", CultureInfo.InvariantCulture) + "','1','" + textBox3.Text + "','" + DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + " " + DateTime.Now.Hour + ":" + DateTime.Now.Minute + ":" + DateTime.Now.Second + "','" + comboBox3.Text + "')"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.ExecuteNonQuery(); mysql.Dispose(); } } catch (Exception err_mysql19) { Mensaje.Error(err_mysql19, "371"); } }
private void textBox1_KeyDown(object sender, KeyEventArgs e) { try { using (var mysql = new Mysql()) { mysql.conexion(); DataTable dtDatos = new DataTable(); string query = "select * from vendedores where Nombre like '" + textBox1.Text + "%'"; MySqlDataAdapter mdaDatos = new MySqlDataAdapter(query, mysql.con); mdaDatos.Fill(dtDatos); dataGridView1.DataSource = dtDatos; mysql.Dispose(); } } catch (Exception euju) { Mensaje.Error(euju, "71"); using (var mysql = new Mysql()) { if (mysql.con.State == ConnectionState.Open) { mysql.Dispose(); } } } }
private void button1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { try { if (cnbd.consultar(textBox1, textBox2)) { //MessageBox.Show("si"); this.Visible = false; f1.Show(); f1.facturando.Text = textBox1.Text.Trim(); f1.textBox4.Text = codigo(); f1.textBox20.Text = administ; } else { MessageBox.Show("Este usuario no existe", "Usuario no identificado", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception err_sqlite003) { Mensaje.Error(err_sqlite003, "146"); } } }
private void button1_Click(object sender, EventArgs e) { try { if (!string.IsNullOrEmpty(dataGridView1.CurrentRow.Cells[0].Value.ToString()) && !string.IsNullOrEmpty(telefono.Text) && !string.IsNullOrEmpty(correo.Text) && !string.IsNullOrEmpty(direccion.Text)) { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "update vendedores set Nombre='" + nombre.Text + "',Telefono='" + telefono.Text.Trim() + "'" + ",Correo='" + correo.Text.Trim() + "',Direccion='" + direccion.Text.Trim() + "' where Codigo='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.ExecuteNonQuery(); mysql.Dispose(); MessageBox.Show("Solicitud procesada correctamente", "Acción realizada", MessageBoxButtons.OK, MessageBoxIcon.Information); button1.Enabled = false; cod.Focus(); } } } catch (Exception excep) { Mensaje.Error(excep, "102"); } }
public void saldo() { try { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select Saldo from saldos where NumFactura='" + comboBox2.Text + "' and CodigoCliente='" + comboBox1.Text + "'"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.ExecuteNonQuery(); mysql.lector = mysql.comando.ExecuteReader(); if (mysql.lector.Read()) { textBox2.Text = mysql.lector["Saldo"].ToString(); } mysql.Dispose(); } } catch (Exception err_saldo) { Mensaje.Error(err_saldo, "609"); } }
public string codigo() { try { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select Codigo,Admin from registro where Nombre='" + textBox1.Text.Trim() + "'"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.ExecuteNonQuery(); mysql.lector = mysql.comando.ExecuteReader(); if (mysql.lector.Read()) { codigocajero = mysql.lector["Codigo"].ToString(); administ = mysql.lector["Admin"].ToString(); } mysql.Dispose(); } } catch (Exception lou) { Mensaje.Error(lou, "49"); } return(codigocajero); }
private void comboBox2_KeyDown(object sender, KeyEventArgs e) { DataTable df = new DataTable(); try { if (comboBox2.Text != "" && e.KeyCode == Keys.Enter) { dataGridView2.DataSource = null; using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select Item,Descripcion from items,detalles where detalles.NumeroFactura='" + comboBox2.Text + "' and detalles.Item=items.Barcode"; MySqlDataAdapter adapt = new MySqlDataAdapter(mysql.cadenasql, mysql.con); adapt.Fill(df); dataGridView2.DataSource = df; mysql.Dispose(); } label2.Visible = true; textBox1.Visible = true; label5.Visible = true; textBox2.Visible = true; button1.Visible = true; label6.Visible = true; label1.Text = "Digite el monto que desea abonar"; saldo(); textBox1.Focus(); } } catch (Exception eftyu) { Mensaje.Error(eftyu, "537"); } }
private void comboBox1_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { while (dataGridView1.Rows.Count >= 1) { dataGridView1.Rows.RemoveAt(dataGridView1.Rows.Count - 1); } comboBox2.Visible = true; comboBox2.Text = ""; comboBox2.Items.Clear(); label4.Visible = true; buscarapscliente(); if (comboBox2.Items.Count > 0) { comboBox2.SelectedIndex = 0; comboBox2.Focus(); } comboBox1.Enabled = false; } } catch (Exception ers) { Mensaje.Error(ers, "470"); } }
private void dataGridView1_KeyUp(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select * from items where Barcode='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.lector = mysql.comando.ExecuteReader(); while (mysql.lector.Read()) { descripcion.Text = mysql.lector["Descripcion"].ToString(); impuesto.Text = mysql.lector["Impuesto"].ToString(); } mysql.Dispose(); } } } catch (Exception excep) { Mensaje.Error(excep, "102"); } }
public void insertar() { try { if (!string.IsNullOrEmpty(textBox2.Text) && !string.IsNullOrEmpty(richTextBox1.Text) && !string.IsNullOrEmpty(comboBox1.Text)) { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "insert into items(Barcode,Descripcion,Impuesto)values('" + textBox2.Text.Trim() + "','" + richTextBox1.Text.Trim() + "','" + comboBox1.Text.ToUpper().Trim() + "')"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.ExecuteNonQuery(); mysql.Dispose(); MessageBox.Show("La solicitud se proceso correctamente", "Acción realizada", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Falta información", "Faltan datos", MessageBoxButtons.OK, MessageBoxIcon.Error); } textBox2.Focus(); } catch (Exception exec) { Mensaje.Error(exec, "67"); } }
public void cargarVendedores() { try { using (var mysql = new Mysql()) { mysql.conexion(); DataTable dtDatos = new DataTable(); string query = "select * from vendedores"; MySqlDataAdapter mdaDatos = new MySqlDataAdapter(query, mysql.con); mdaDatos.Fill(dtDatos); dataGridView1.DataSource = dtDatos; mysql.Dispose(); } } catch (Exception hju) { Mensaje.Error(hju, "42"); using (var mysql = new Mysql()) { if (mysql.con.State == ConnectionState.Open) { mysql.Dispose(); } } } }
private void button1_Click(object sender, EventArgs e) { try { cndb.insertar(textBox1, textBox2, check); } catch (Exception xce) { Mensaje.Error(xce, "35"); } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { try { this.Dispose(); Application.Exit(); } catch (Exception err) { Mensaje.Error(err, "203"); } }
private void printDocument1_PrintPage(object sender, PrintPageEventArgs e) { float linesPerPage = 0; float yPos = 0; int count = 0; float xPos = 0; float leftMargin = e.MarginBounds.Left; float topMargin = e.MarginBounds.Top; string line = null; try { linesPerPage = e.MarginBounds.Height / printFont.GetHeight(e.Graphics); while (count < linesPerPage && ((line = streamToPrint.ReadLine()) != null)) { yPos = (topMargin - 100) + (count * printFont.GetHeight(e.Graphics)); e.Graphics.DrawString(line, printFont, Brushes.Black, //leftMargin - 5, yPos, new StringFormat()); leftMargin - 80, yPos, new StringFormat()); count++; } if (line != null) { e.HasMorePages = true; } else { e.HasMorePages = false; } } catch (Exception err_005) { Mensaje.Error(err_005, "186"); } }
protected bool ChangeOrigen(Form NuevoOrigen) { try { if (_origen != null && NuevoOrigen != null) { _origen.Close(); } _origen = NuevoOrigen; return(true); } catch (Exception e) { Mensaje.Error(e.StackTrace); return(false); } }
public void cargarproductos() { try { using (var mysql = new Mysql()) { mysql.conexion(); DataTable dtDatos = new DataTable(); string query = "select * from items"; MySqlDataAdapter mdaDatos = new MySqlDataAdapter(query, mysql.con); mdaDatos.Fill(dtDatos); dataGridView1.DataSource = dtDatos; mysql.Dispose(); } } catch (Exception hju) { Mensaje.Error(hju, "42"); } }
private void dataGridView1_Click(object sender, EventArgs e) { try { if (dataGridView1.Rows.Count > 0) { m_frm.comboBox2.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); m_frm.textBox16.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); this.Visible = false; } } catch (Exception vf) { Mensaje.Error(vf, "118"); } }
private void dataGridView1_Click(object sender, EventArgs e) { try { if (dataGridView1.Rows.Count > 0) { this.Visible = false; m_frm.textBox1.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); m_frm.Activate(); m_frm.textBox1.Focus(); SendKeys.Send("{ENTER}"); } } catch (Exception vf) { Mensaje.Error(vf, "118"); } }
private void button1_KeyDown(object sender, KeyEventArgs e) { try { if (cnbd.consultar2(textBox1, textBox2)) { this.Visible = false; administracion ad = new administracion(); ad.Show(this); } else { MessageBox.Show("Este usuario no existe o no tiene premisos", "Usuario no identificado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception exce) { Mensaje.Error(exce, "37"); } }
private void textBox1_KeyUp(object sender, KeyEventArgs e) { try { using (var mysql = new Mysql()) { mysql.conexion(); DataTable dtDatos = new DataTable(); string query = "select Barcode from items where Barcode like '" + barcode.Text + "%'"; MySqlDataAdapter mdaDatos = new MySqlDataAdapter(query, mysql.con); mdaDatos.Fill(dtDatos); dataGridView1.DataSource = dtDatos; mysql.Dispose(); } } catch (Exception euju) { Mensaje.Error(euju, "71"); } }
private void button1_Click(object sender, EventArgs e) { try { if (cnbd.consultar(textBox1, textBox2)) { this.Visible = false; f1.Show(); f1.facturando.Text = textBox1.Text.Trim(); } else { MessageBox.Show("Este usuario no existe", "Usuario no identificado", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception err_sqlite003) { Mensaje.Error(err_sqlite003, "82"); } }
private void button1_Click(object sender, EventArgs e) { try { if (cnbd.consultar2(textBox1, textBox2)) { this.Visible = false; Menucierres ad = new Menucierres(); ad.Show(this); } else { MessageBox.Show("Este usuario no existe o no tiene premisos", "Usuario no identificado", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception exce) { MessageBox.Show(exce.ToString()); Mensaje.Error(exce, "37"); } }
private void button1_Click(object sender, EventArgs e) { try { if ((!string.IsNullOrEmpty(comboBox1.Text) && !string.IsNullOrEmpty(comboBox2.Text) && !string.IsNullOrEmpty(comboBox3.Text)) && (double.Parse(textBox1.Text.Trim()) >= 1000 && (double.Parse(textBox1.Text.Trim()) <= double.Parse(textBox2.Text.Trim())))) { agregarPayment(); formatodeactura(); for (int imp = 0; imp < Int32.Parse(numericUpDown1.Value.ToString()); imp++) { imprimir(); } button1.Visible = false; textBox1.Visible = false; textBox2.Visible = false; label2.Visible = false; label5.Visible = false; comboBox2.Visible = false; label4.Visible = false; label6.Visible = false; label1.Text = "Seleccione un cliente y presione Enter"; dispararaprocedures(); comboBox1.Enabled = true; this.Visible = false; } else { MessageBox.Show("Asegúrese de tener los siguientes datos:\n" + "1.El monto debe ser mayor o igual a 1000 y debe ser menor o igual al saldo pendiente.\n" + "2.Especifíque el tipo de pago."); } } catch (Exception err_mysql11) { Mensaje.Error(err_mysql11, "407"); } }
public void dispararaprocedures() { try { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "borrarcancelados"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.CommandType = CommandType.StoredProcedure; mysql.comando.ExecuteNonQuery(); mysql.cadenasql = "iniciarcancelados"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.CommandType = CommandType.StoredProcedure; mysql.comando.ExecuteNonQuery(); mysql.cadenasql = "crearcancelado"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.CommandType = CommandType.StoredProcedure; mysql.comando.ExecuteNonQuery(); mysql.cadenasql = "eliminarnocancelados"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.comando.CommandType = CommandType.StoredProcedure; mysql.comando.ExecuteNonQuery(); mysql.Dispose(); } } catch (Exception err_abonos02) { Mensaje.Error(err_abonos02, "91"); } }
private void dataGridView1_Click(object sender, EventArgs e) { try { if (dataGridView1.Rows.Count > 0) { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "select * from items where Barcode='" + dataGridView1.CurrentRow.Cells[0].Value.ToString() + "'"; mysql.comando = new MySqlCommand(mysql.cadenasql, mysql.con); mysql.lector = mysql.comando.ExecuteReader(); while (mysql.lector.Read()) { descripcion.Text = mysql.lector["Descripcion"].ToString(); impuesto.Text = mysql.lector["Impuesto"].ToString(); textBox1.Text = mysql.lector["OnHand"].ToString(); textBox2.Text = mysql.lector["Precio"].ToString(); textBox3.Text = mysql.lector["Costo"].ToString(); textBox4.Text = mysql.lector["Marca"].ToString(); textBox5.Text = mysql.lector["Talla"].ToString(); textBox6.Text = mysql.lector["Familia"].ToString(); textBox7.Text = mysql.lector["Estilo"].ToString(); textBox8.Text = mysql.lector["Genero"].ToString(); } mysql.Dispose(); button1.Enabled = true; descripcion.Focus(); } } } catch (Exception excep) { Mensaje.Error(excep, "102"); } }
public DataTable cargarnombrescondes() { DataTable dt = new DataTable(); try { using (var mysql = new Mysql()) { mysql.conexion(); mysql.cadenasql = "SELECT * FROM clientes"; MySqlCommand cmd = new MySqlCommand(mysql.cadenasql, mysql.con); MySqlDataAdapter adap = new MySqlDataAdapter(cmd); adap.Fill(dt); mysql.Dispose(); } } catch (Exception eds) { Mensaje.Error(eds, "794"); } return(dt); }