コード例 #1
0
        public int insertChannel(TVChannel achannel)
        {
            MySqlCommand command = connection.CreateCommand();

            command.CommandText = "insert into  tvchannels (Channel,Name) values (" + achannel.channel + ",'" + achannel.name + "')";
            command.ExecuteNonQuery();
            achannel.id = (int )command.LastInsertedId;
            return(achannel.id);
        }
コード例 #2
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);
        }