Exemple #1
0
 private void buscarnombre()
 {
     this.dataGridView1.DataSource = NProfeCurso1.buscarnombre(this.txtbuscar.Text);
     this.OcultarColumnas();
     label10.Text = "Total de Registros: " + Convert.ToString(dataGridView1.Rows.Count);
 }
Exemple #2
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            try
            {
                string rpta = "";
                if (this.txtnombre.Text == string.Empty)
                {
                    mensajeerror("Falta ingresar algunos datos, serán remarcados");

                    if (this.textBox3.Text.Length == 0)
                    {
                        errorProvider1.SetError(this.textBox3, "ingrese el Nombre del Profesor");
                    }
                    else
                    {
                        errorProvider1.SetError(this.textBox3, "");
                    }

                    if (this.textBox2.Text.Length == 0)
                    {
                        errorProvider1.SetError(this.textBox2, "ingrese el Curso");
                    }
                    else
                    {
                        errorProvider1.SetError(this.textBox2, "");
                    }
                }
                else
                {
                    if (this.isnuevo)
                    {
                        rpta = NProfeCurso1.Insertar(Convert.ToInt32(this.txtnombre.Text), Convert.ToInt32(textBox1.Text));
                    }
                    else
                    {
                        rpta = NProfeCurso1.Editar(Convert.ToInt32(this.txtiddamnificado.Text), Convert.ToInt32(this.txtnombre.Text), Convert.ToInt32(textBox1.Text));
                    }

                    if (rpta.Equals("OK"))
                    {
                        if (this.isnuevo)
                        {
                            this.mensajeok("Se Insertó de forma correcta el registro");
                        }
                        else
                        {
                            this.mensajeok("Se Actualizó de forma correcta el registro");
                        }
                    }
                    else
                    {
                        this.mensajeerror(rpta);
                    }

                    this.isnuevo  = false;
                    this.iseditar = false;
                    this.botones();
                    this.Limpiar();
                    this.buscarnombre();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + ex.StackTrace);
            }
        }