private void comboBoxCanal_SelectedIndexChanged(object sender, EventArgs e) { AddValue thevalue = (AddValue)thebusqueda.Channels[this.comboBoxCanal.SelectedIndex]; this.comboBoxPrograma.DataSource = null; thebusqueda.fillPrograms(thevalue.Value); if (thebusqueda.Programas.Count != 0) { this.comboBoxPrograma.DataSource = thebusqueda.Programas; this.comboBoxPrograma.DisplayMember = "Display"; this.comboBoxPrograma.ValueMember = "Value"; } }
private void buttonBuscar_Click(object sender, EventArgs e) { bool is_withData = true; if (myformresultado == null) { myformresultado = new formResultado(); } myformresultado.calledForm = this; string strwhere = "(1 = 1) "; if (checkBoxCanal.Checked) { AddValue thevalue = (AddValue)thebusqueda.Channels[this.comboBoxCanal.SelectedIndex]; strwhere = strwhere + " and (tvchannels_Channel = " + thevalue.Value + ")"; } if (checkBoxDesde.Checked) { string datefrom = ""; datefrom = dateTimePickerDesde.Value.Date.Year.ToString(); datefrom = datefrom + "-" + dateTimePickerDesde.Value.Date.Month.ToString(); datefrom = datefrom + "-" + dateTimePickerDesde.Value.Date.Day.ToString(); strwhere = strwhere + " and (tvdatafiles_recordDate >= '" + datefrom + "')"; } if (checkBoxHasta.Checked) { string dateto = ""; dateto = dateTimePickerHasta.Value.Date.Year.ToString(); dateto = dateto + "-" + dateTimePickerHasta.Value.Date.Month.ToString(); dateto = dateto + "-" + dateTimePickerHasta.Value.Date.Day.ToString(); strwhere = strwhere + " and (tvdatafiles_recordDate <= '" + dateto + "')"; } if (checkBoxPrograma.Checked) { strwhere = strwhere + " and (tvshows_name like '%" + textBoxPrograma.Text + "%')"; } if (checkBoxProgramaExacto.Checked) { if (thebusqueda.Programas.Count > 0) { AddValue thevalue = (AddValue)thebusqueda.Programas[this.comboBoxPrograma.SelectedIndex]; strwhere = strwhere + " and (tvshows_id = " + thevalue.Value.ToString() + ")"; } } if (checkBoxUsuario.Checked) { AddValue thevalue = (AddValue)thebusqueda.Users[this.comboBoxUsuario.SelectedIndex]; strwhere = strwhere + " and (tvdatafiles_UserId = " + thevalue.Value + ")"; } if ( (textBoxL1C1.Text != "") || (textBoxL1C2.Text != "") || (textBoxL1C3.Text != "") || (textBoxL1C4.Text != "") || (textBoxL1C5.Text != "") || (textBoxL2C1.Text != "") || (textBoxL2C2.Text != "") || (textBoxL2C3.Text != "") || (textBoxL2C4.Text != "") || (textBoxL2C5.Text != "") || (textBoxL3C1.Text != "") || (textBoxL3C2.Text != "") || (textBoxL3C3.Text != "") || (textBoxL3C4.Text != "") || (textBoxL3C5.Text != "") || (textBoxL4C1.Text != "") || (textBoxL4C2.Text != "") || (textBoxL4C3.Text != "") || (textBoxL4C4.Text != "") || (textBoxL4C5.Text != "") ) { thebusqueda.ListaPalabras.Clear(); bool first_and = false; strwhere = strwhere + " and ( "; if ((textBoxL1C1.Text != "") || (textBoxL1C2.Text != "") || (textBoxL1C3.Text != "") || (textBoxL1C4.Text != "") || (textBoxL1C5.Text != "")) { strwhere = strwhere + " ((1=1)"; if (textBoxL1C1.Text != "") { string source = parse(textBoxL1C1.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL1C2.Text != "") { string source = parse(textBoxL1C2.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL1C3.Text != "") { string source = parse(textBoxL1C3.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL1C4.Text != "") { string source = parse(textBoxL1C4.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL1C5.Text != "") { string source = parse(textBoxL1C5.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } strwhere = strwhere + " )"; first_and = true; } if ((textBoxL2C1.Text != "") || (textBoxL2C2.Text != "") || (textBoxL2C3.Text != "") || (textBoxL2C4.Text != "") || (textBoxL2C5.Text != "")) { if (first_and) { strwhere = strwhere + " or ((1=1)"; } else { strwhere = strwhere + " ((1=1)"; } if (textBoxL2C1.Text != "") { string source = parse(textBoxL2C1.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL2C2.Text != "") { string source = parse(textBoxL2C2.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL2C3.Text != "") { string source = parse(textBoxL2C3.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL2C4.Text != "") { string source = parse(textBoxL2C4.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL2C5.Text != "") { string source = parse(textBoxL2C5.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } strwhere = strwhere + " )"; first_and = true; } if ((textBoxL3C1.Text != "") || (textBoxL3C2.Text != "") || (textBoxL3C3.Text != "") || (textBoxL3C4.Text != "") || (textBoxL3C5.Text != "")) { if (first_and) { strwhere = strwhere + " or ((1=1)"; } else { strwhere = strwhere + " ((1=1)"; } if (textBoxL3C1.Text != "") { string source = parse(textBoxL3C1.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL3C2.Text != "") { string source = parse(textBoxL3C2.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL3C3.Text != "") { string source = parse(textBoxL3C3.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL3C4.Text != "") { string source = parse(textBoxL3C4.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL3C5.Text != "") { string source = parse(textBoxL3C5.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } strwhere = strwhere + " )"; first_and = true; } if ((textBoxL4C1.Text != "") || (textBoxL4C2.Text != "") || (textBoxL4C3.Text != "") || (textBoxL4C4.Text != "") || (textBoxL4C5.Text != "")) { if (first_and) { strwhere = strwhere + " or ((1=1)"; } else { strwhere = strwhere + " ((1=1)"; } if (textBoxL4C1.Text != "") { string source = parse(textBoxL4C1.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL4C2.Text != "") { string source = parse(textBoxL4C2.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL4C3.Text != "") { string source = parse(textBoxL4C3.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL4C4.Text != "") { string source = parse(textBoxL4C4.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } if (textBoxL4C5.Text != "") { string source = parse(textBoxL4C5.Text); if (smallsearch(source)) { strwhere = strwhere + " and ( INSTR(tvinfo_data, '" + source + "'))"; } else { strwhere = strwhere + " and ( (match(`tvinfo_data`) against ('" + source + "' in boolean mode ) ) )"; } } strwhere = strwhere + " )"; first_and = true; } strwhere = strwhere + " )"; } else { if ((checkBoxTipo1.Checked) || (checkBoxTipo2.Checked) || (checkBoxTipo3.Checked)) { is_withData = true; } else { is_withData = false; } } // aca hacer el if del tvinfo. //INSTR( infotype, 'T' ) !=0 if ((checkBoxTipo1.Checked) || (checkBoxTipo2.Checked) || (checkBoxTipo3.Checked)) { strwhere = strwhere + " and ( (1=1) "; if (checkBoxTipo1.Checked) { AddValue thevalue = (AddValue)thebusqueda.Tipos1[this.comboBoxTipo1.SelectedIndex]; string search_strinfo = thebusqueda.getStringFromIntInfoType(thevalue.Value); strwhere = strwhere + " and (INSTR(tvinfo_infotype ,'" + search_strinfo + "') !=0)"; } if (checkBoxTipo2.Checked) { //comboBoxAndOr1 AddValue thevalue = (AddValue)thebusqueda.Tipos2[this.comboBoxTipo2.SelectedIndex]; string search_strinfo = thebusqueda.getStringFromIntInfoType(thevalue.Value); if ((comboBoxAndOr1.SelectedIndex) == 0) { strwhere = strwhere + " and (INSTR(tvinfo_infotype ,'" + search_strinfo + "') !=0)"; } else { strwhere = strwhere + " or (INSTR(tvinfo_infotype ,'" + search_strinfo + "') !=0)"; } } if (checkBoxTipo3.Checked) { AddValue thevalue = (AddValue)thebusqueda.Tipos3[this.comboBoxTipo3.SelectedIndex]; string search_strinfo = thebusqueda.getStringFromIntInfoType(thevalue.Value); if ((comboBoxAndOr2.SelectedIndex) == 0) { strwhere = strwhere + " and (INSTR(tvinfo_infotype ,'" + search_strinfo + "') !=0)"; } else { strwhere = strwhere + " or (INSTR(tvinfo_infotype ,'" + search_strinfo + "') !=0)"; } } strwhere = strwhere + ")"; } Console.WriteLine(strwhere); myformresultado.Show(); thebusqueda.pagina = 0; myformresultado.executesql(thebusqueda, strwhere, checkBoxAscendente.Checked, is_withData, chkBusquedaTotal.Checked); myformresultado.BringToFront(); myformresultado.gotofirst(); myformresultado.WindowState = FormWindowState.Normal; }