コード例 #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            Preinscripciones.Confirmacion conf = new Preinscripciones.Confirmacion();
            int registros_ok = 0;

            if (conf.ShowDialog() == DialogResult.OK)
            {
                AccesoDatos aq = new AccesoDatos();

                SqlCommand comando = new SqlCommand();



                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    try {
                        comando = DatosSP.Preinscriptos(int.Parse(dataGridView1.Rows[i].Cells[10].Value.ToString()), "MAYO 2018", "0",
                                                        dataGridView1.Rows[i].Cells[8].Value.ToString(), dataGridView1.Rows[i].Cells[7].Value.ToString(),
                                                        dataGridView1.Rows[i].Cells[12].Value.ToString(), dataGridView1.Rows[i].Cells[11].Value.ToString(),
                                                        0, dataGridView1.Rows[i].Cells[6].Value.ToString(), dataGridView1.Rows[i].Cells[5].Value.ToString()
                                                        );


                        aq.EjecutarProcedimientoAlmacenado(comando, "CargaPreinscripto");
                        registros_ok++;
                    }
                    catch (Exception ex) {
                        //  MessageBox.Show(ex.ToString());
                    }
                }

                MessageBox.Show("Registros cargados correctamente: " + registros_ok);
            }
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Preinscripciones.Confirmacion cq = new Preinscripciones.Confirmacion();

            if (cq.ShowDialog() == DialogResult.OK)
            {
                string consulta = "delete from Interesados  where email='" + tb_Email.Text + "'";
                sq.cargaTabla("q", consulta, ref ds);
                MessageBox.Show("Interesado eliminado.");
                this.Close();
            }
        }
コード例 #3
0
ファイル: ImportarExcel.cs プロジェクト: SoldierIced/Sasai_NF
        private void button2_Click(object sender, EventArgs e)
        {
            if (MEDUSA == true)
            {
                try
                {
                    Preinscripciones.Confirmacion conf = new Preinscripciones.Confirmacion();
                    int registros_ok = 0;
                    if (conf.ShowDialog() == DialogResult.OK)
                    {
                        AccesoDatos aq = new AccesoDatos();

                        SqlCommand comando = new SqlCommand();



                        SqlCommand  comando2 = new SqlCommand();
                        AccesoDatos aq2      = new AccesoDatos();
                        string      codcurso = "";

                        aq2.ConfigurarProcedure(ref comando, "ExistenciaCurso");
                        comando.Connection = aq.ObtenerConexion();

                        SqlDataReader reader = comando.ExecuteReader();

                        while (reader.Read())
                        {
                            if (reader[0].ToString() != "-1")
                            {
                                bool asd = false;
                                // MessageBox.Show(comboBox1.Items[comboBox1.SelectedIndex].ToString());

                                //    MessageBox.Show(comboBox1.Text);

                                if (textBox1.Text != "")
                                {
                                    asd = true;
                                    if (asd == true)
                                    {
                                        //      MessageBox.Show(reader[0].ToString());
                                        codcurso = reader[0].ToString();

                                        for (int i = 0; i < dataGridView1.Rows.Count; i++)
                                        {
                                            try
                                            {
                                                comando = DatosSP.Preinscriptos(int.Parse(dataGridView1.Rows[i].Cells[10].Value.ToString()), codcurso, "0",
                                                                                dataGridView1.Rows[i].Cells[8].Value.ToString(), dataGridView1.Rows[i].Cells[7].Value.ToString(),
                                                                                dataGridView1.Rows[i].Cells[20].Value.ToString(), dataGridView1.Rows[i].Cells[19].Value.ToString(),
                                                                                dataGridView1.Rows[i].Cells[6].Value.ToString(), dataGridView1.Rows[i].Cells[5].Value.ToString(),
                                                                                codespe(textBox1.Text)
                                                                                );


                                                aq.EjecutarProcedimientoAlmacenado(comando, "CargaPreinscripto");
                                                registros_ok++;
                                                dataGridView1.Rows[i].DefaultCellStyle.BackColor = System.Drawing.Color.Green;
                                            }
                                            catch (Exception ex)
                                            {
                                            }
                                        }

                                        MessageBox.Show("Registros cargados correctamente: " + registros_ok);
                                    }
                                    else
                                    {
                                        MessageBox.Show("Esa especialidad no existe.");
                                    }
                                }
                                else
                                {
                                    MessageBox.Show("Tiene que seleccionar una especialidad.");
                                }
                            }
                            else
                            {
                                MessageBox.Show("No hay un curso que sea el actual, antes de cargar preinscriptos favor de crear curso actual.");
                            }
                        }
                    }
                }
                catch (Exception ex) {
                    //  MessageBox.Show(ex.ToString());
                }
            }
            else
            {
                MessageBox.Show("Recuerde que tiene que cargar antes el excel.");
            }
        }