private void button5_Click(object sender, EventArgs e) { string where = "where o.idfleteros = '" + u.Idfleteros + "' and o.valorizado = '0' and o.anulado = '0'"; frmListaOrdenesCarga frm = new frmListaOrdenesCarga(where, idusuario); frm.ShowDialog(); }
private void button3_Click(object sender, EventArgs e) { try { string where = ""; if (textBox1.Text != "") { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.ptoventa = '" + textBox1.Text + "'"; } if (textBox2.Text != "") { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.nrocarga = '" + textBox2.Text + "'"; } if (lblCliente.Text != "") { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.idclientes = '" + lblCliente.Text + "'"; } if (lblFletero.Text != "") { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.idfleteros = '" + lblFletero.Text + "'"; } if (cmbSucursal.SelectedIndex != -1) { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.idsucursales = '" + Convert.ToInt32(cmbSucursal.SelectedValue) + "'"; } if (rbValVal.Checked) { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.valorizado = '1'"; } else if (rbValNo.Checked) { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.valorizado = '0'"; } if (rbEsAnu.Checked) { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.anulado = '1'"; } else if (rbEsNoAnu.Checked) { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " o.anulado = '0'"; } DateTime fecha; if (DateTime.TryParse(mskDesde.Text, out fecha) == true && DateTime.TryParse(mskHasta.Text, out fecha) == true) { DateTime desde = Convert.ToDateTime(mskDesde.Text); DateTime hasta = Convert.ToDateTime(mskHasta.Text); if (desde < hasta) { if (where != "") { where = where + " and"; } else { where = "where "; } where = where + " fecha between '" + desde.ToString("yyyy-MM-dd") + "' and '" + hasta.ToString("yyyy-MM-dd") + "'"; } else { MessageBox.Show("La fecha desde debe ser menor a la de hasta"); } } frmListaOrdenesCarga frm = new frmListaOrdenesCarga(where, idusuario); frm.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }