示例#1
0
        private void but_materia_asignar_Click(object sender, EventArgs e)
        {
            if (this.validardatos())
            {
                if (ingreso != 1)
                {
                    MessageBox.Show("Debe ingresar el nombre y promoción, y a continuación presionar enter",
                                    "Modificar Materia",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }
                else
                {
                    ca.v_nombre      = tex_nombre.Text;
                    ca.v_promocion   = tex_promocion.Text;
                    ca.v_descripcion = tex_descripcion.Text;
                    ca.v_Dfacultad   = com_facultad.SelectedItem.ToString();
                    ca.v_usuario_m   = this.usuario;

                    if (che_activar_carrera.Checked == true)
                    {
                        ca.v_estado = 'A';
                    }


                    try
                    {
                        this.ocultar_Pantalla();
                        frm_carrera_materia_asi FRM_CARRERA_MATERIA_ASI = new frm_carrera_materia_asi(this.usuario, ca.v_nombre, ca.v_promocion);
                        FRM_CARRERA_MATERIA_ASI.ShowDialog();
                        this.mostrar_Pantalla();
                    }
                    catch (SqlException ex)
                    {
                        for (int i = 0; i < ex.Errors.Count; i++)
                        {
                            errorMessages.Append("Index #" + i + "\n" +
                                                 "Message: " + ex.Errors[i].Message + "\n" +
                                                 "LineNumber: " + ex.Errors[i].LineNumber + "\n" +
                                                 "Source: " + ex.Errors[i].Source + "\n" +
                                                 "Procedure: " + ex.Errors[i].Procedure + "\n");
                        }
                        Console.WriteLine(errorMessages.ToString());

                        MessageBox.Show(ex.Errors[0].Message.ToString(),
                                        "Modificar Carrera",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
                    }
                }
            }
        }
        private void but_materia_asignar_Click(object sender, EventArgs e)
        {
            if (this.validardatos())
            {
                if (ingreso != 1)
                {
                    MessageBox.Show("Debe ingresar el nombre y promoción, y a continuación presionar enter",
                    "Modificar Materia",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                }
                else
                {
                    ca.v_nombre = tex_nombre.Text;
                    ca.v_promocion = tex_promocion.Text;
                    ca.v_descripcion = tex_descripcion.Text;
                    ca.v_Dfacultad = com_facultad.SelectedItem.ToString();
                    ca.v_usuario_m = this.usuario;

                    if (che_activar_carrera.Checked == true)
                    {
                        ca.v_estado = 'A';
                    }

                    try
                    {
                        this.ocultar_Pantalla();
                        frm_carrera_materia_asi FRM_CARRERA_MATERIA_ASI = new frm_carrera_materia_asi(this.usuario, ca.v_nombre, ca.v_promocion);
                        FRM_CARRERA_MATERIA_ASI.ShowDialog();
                        this.mostrar_Pantalla();
                    }
                    catch (SqlException ex)
                    {
                        for (int i = 0; i < ex.Errors.Count; i++)
                        {
                            errorMessages.Append("Index #" + i + "\n" +
                            "Message: " + ex.Errors[i].Message + "\n" +
                            "LineNumber: " + ex.Errors[i].LineNumber + "\n" +
                            "Source: " + ex.Errors[i].Source + "\n" +
                            "Procedure: " + ex.Errors[i].Procedure + "\n");
                        }
                        Console.WriteLine(errorMessages.ToString());

                        MessageBox.Show(ex.Errors[0].Message.ToString(),
                        "Modificar Carrera",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Warning);

                    }

                }
            }
        }