public int updateTvdatafiles(Transaccion atransaccion, ArrayList aprogramasdest, TVShow ashow) { MySqlCommand command = connection.CreateCommand(); string commaseparatedstring; int i; commaseparatedstring = "-1000"; for (i = 0; i < aprogramasdest.Count; i++) { AddValue avalue = (AddValue)aprogramasdest[i]; commaseparatedstring = commaseparatedstring + " , " + avalue.Value; } command.CommandText = "update tvdatafiles set channel = " + ashow.channel + " , tvshow = " + atransaccion.new_tvshow + " where id in (" + commaseparatedstring + ")"; command.ExecuteNonQuery(); return(0); }
public int makeRollback(Transaccion atransaccion, ArrayList aprogramasdest) { MySqlCommand command = connection.CreateCommand(); string commaseparatedstring; int i; commaseparatedstring = "-1000"; for (i = 0; i < aprogramasdest.Count; i++) { AddValue avalue = (AddValue)aprogramasdest[i]; commaseparatedstring = commaseparatedstring + " , " + avalue.Value; } command.CommandText = "insert into old_tvdatafiles (id,old_channel,old_tvshow,new_tvshow,transaccion_id) select id ,channel,tvshow," + atransaccion.new_tvshow + "," + atransaccion.id + " from tvdatafiles where tvshow in (" + commaseparatedstring + ")"; command.ExecuteNonQuery(); return(0); }
//thebusqueda.updateTvshow(atransaccion, thebusqueda.ProgramasDest); public int updateTvshow(Transaccion atransaccion, ArrayList aprogramasdest) { MySqlCommand command = connection.CreateCommand(); string commaseparatedstring; int i; commaseparatedstring = "-1000"; for (i = 0; i < aprogramasdest.Count; i++) { AddValue avalue = (AddValue)aprogramasdest[i]; commaseparatedstring = commaseparatedstring + " , " + avalue.Value; } command.CommandText = "update tvshows set estado = -1 where id in (" + commaseparatedstring + ") and estado =0"; command.ExecuteNonQuery(); return(0); }
private void button3_Click(object sender, EventArgs e) { /* * create view vw_transaccion * as ( * SELECT transaccion.id AS transaccion_id, fecha, transaccion.estado AS transaccion_estado, new_tvshow, tvshows.name, * tvchannels.name as tvchannels_name * FROM transaccion, tvshows, tvchannels * WHERE transaccion.new_tvshow = tvshows.id * AND tvshows.id = transaccion.new_tvshow * and tvchannels.id = tvshows.channel * ) */ string strwhere = "select * from vw_transaccion where (1 =1) "; 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 (fecha >= '" + 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 (fecha <= '" + dateto + "')"; } if (this.checkBoxEstado.Checked) { AddValue thevalue = (AddValue)thebusqueda.ArrayEstados[this.comboBoxEstado.SelectedIndex]; strwhere = strwhere + " and transaccion_estado = " + thevalue.Value; } this.thebusqueda.arrayMaestros.Clear(); this.thebusqueda.fillMaestro(strwhere); this.listViewDetalle.Items.Clear(); foreach (Transaccion value in thebusqueda.arrayMaestros) { ListViewItem listViewItem1 = new ListViewItem(); listViewItem1.Tag = value; listViewItem1.Text = value.fecha; listViewItem1.SubItems.Add(value.estado_descripcion); listViewItem1.SubItems.Add(value.channel_name); listViewItem1.SubItems.Add(value.tvshow_name); this.listViewDetalle.Items.Add(listViewItem1); } }