コード例 #1
0
ファイル: Form1.cs プロジェクト: mswiczar/SearchPPT
        private void buttonConsultar_Click(object sender, EventArgs e)
        {
            AddValue thevalue = (AddValue)thebusqueda.ChannelsSource[this.comboBoxCanalBuscar.SelectedIndex];

            thebusqueda.fillProgramas((int)thevalue.Value);
            this.listBoxOrigen.DataSource = null;

            this.listBoxOrigen.DataSource    = thebusqueda.ProgramasOrigen;
            this.listBoxOrigen.DisplayMember = "Display";
            this.listBoxOrigen.ValueMember   = "Value";


            thebusqueda.ProgramasDest.Clear();
            this.listBoxDestino.DataSource = null;
        }
コード例 #2
0
        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 tvshow  in (" + commaseparatedstring + ")";
            command.ExecuteNonQuery();
            return(0);
        }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: mswiczar/SearchPPT
        private void buttonRemove_Click(object sender, EventArgs e)
        {
            for (int count = 0; count < listBoxDestino.SelectedItems.Count; count++)
            {
                AddValue thevalue = (AddValue)this.listBoxDestino.SelectedItems[count];
                thebusqueda.ProgramasOrigen.Add(thevalue);
                thebusqueda.ProgramasDest.Remove(thevalue);
            }


            this.listBoxOrigen.DataSource    = null;
            this.listBoxOrigen.DataSource    = thebusqueda.ProgramasOrigen;
            this.listBoxOrigen.DisplayMember = "Display";
            this.listBoxOrigen.ValueMember   = "Value";


            this.listBoxDestino.DataSource    = null;
            this.listBoxDestino.DataSource    = thebusqueda.ProgramasDest;
            this.listBoxDestino.DisplayMember = "Display";
            this.listBoxDestino.ValueMember   = "Value";
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: mswiczar/SearchPPT
        private void buttonEjecutar_Click(object sender, EventArgs e)
        {
            // BUSCAR SI EXISTE EL NOMBRE DEL PROGRAMA CON EL NOMBRE DEL CANAL.
            // SI EXISTE. USAR EL PROGRAMA
            // SI NO EXISTE APLICAR.-
            TVChannel achannel;
            TVShow    ashow;

            achannel = new TVChannel();
            AddValue thevalue = (AddValue)thebusqueda.ChannelsDest[this.comboBoxCanalAsignar.SelectedIndex];

            achannel.id   = (int)thevalue.Value;
            achannel.name = thevalue.Display;

            ashow         = new TVShow();
            ashow.name    = this.textBoxProgramaNombre.Text;
            ashow.channel = achannel.id;

            int idTVShow = thebusqueda.existeShowChannel(ashow);

            if (idTVShow != 0) //existe
            {
                DialogResult result1 = MessageBox.Show(
                    "Dicho programa existe para el mismo canal\nDesea utilizar el existente?\nSi su respuesta es NO, cambie el nombre del programa.", "Depurador de Canales",
                    MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result1 == DialogResult.No)
                {
                    return;
                }
                else
                {
                    ashow.id = idTVShow;
                    Transaccion atransaccion;
                    atransaccion            = new Transaccion();
                    atransaccion.new_tvshow = ashow.id;
                    thebusqueda.insertTransaccion(atransaccion);
                    thebusqueda.makeRollback(atransaccion, thebusqueda.ProgramasDest);
                    thebusqueda.updateTvdatafiles(atransaccion, thebusqueda.ProgramasDest, ashow);

                    thebusqueda.updateTvshow(atransaccion, thebusqueda.ProgramasDest);
                    atransaccion.estado = 1;
                    thebusqueda.updateTransaccion(atransaccion);
                }
            }
            else
            {
                thebusqueda.insertShow(ashow);
                Transaccion atransaccion;
                atransaccion            = new Transaccion();
                atransaccion.new_tvshow = ashow.id;
                thebusqueda.insertTransaccion(atransaccion);
                thebusqueda.makeRollback(atransaccion, thebusqueda.ProgramasDest);
                thebusqueda.updateTvdatafiles(atransaccion, thebusqueda.ProgramasDest, ashow);

                thebusqueda.updateTvshow(atransaccion, thebusqueda.ProgramasDest);
                atransaccion.estado = 1;
                thebusqueda.updateTransaccion(atransaccion);
            }
            MessageBox.Show(
                "Transaccion realizada con exito!!!!!", "Depurador de Canales",
                MessageBoxButtons.OK, MessageBoxIcon.Information);

            buttonConsultar_Click(null, null);
        }