private void but_consultar_editorial_Click(object sender, EventArgs e)
        {
            StringBuilder errorMessages = new StringBuilder();
            Editorial edi = new Editorial();
            if (tex_nombre_editorial.Text.Length == 0)
            {
                this.inicializarDatos();
                MessageBox.Show("Debe ingresar un Nombre",
                "Consultar Editorial",
                MessageBoxButtons.OK,
                MessageBoxIcon.Warning);
            }
            else
            {
                try
                {
                    edi.v_nombre_editorial = tex_nombre_editorial.Text;
                    //edi.v_Dpais= com_pais.SelectedItem.ToString();
                    if ((edi.ConsultarEditorial(edi)).v_nombre_editorial.Length != 0)
                    {
                        tex_nombre_editorial.Text = edi.v_nombre_editorial;
                        tex_direccion.Text = edi.v_direccion_editorial;

                        SLpais = new SortedList();
                        SLpais.Add(edi.v_Dpais, edi.v_Dpais);
                        com_pais.DataSource = SLpais.GetValueList();
                        com_pais.Show();
                    }

                }
                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());

                    this.inicializarDatos();

                    SLpais.Clear();
                    com_pais.DataSource = null;
                    com_pais.Show();

                    MessageBox.Show(ex.Errors[0].Message.ToString(),
                    "Consultar Editorial",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                }

            }
        }
Esempio n. 2
0
        public int EliminarEditorial(Editorial editorial)
        {
            editorial.v_TipoEvento = "E";
            DatosSistema datos = new DatosSistema();

            string[] parametros = { "@v_nombre",
                                    "@v_usuarioM",
                                    "@v_TipoEvento" };

            return(datos.Ejecutar("proEliminarEditorial", parametros,
                                  editorial.v_nombre_editorial,
                                  editorial.v_usuario_m,
                                  editorial.v_TipoEvento));
        }
Esempio n. 3
0
 public Editorial ConsultarEditorial(Editorial editorial)
 {
     DatosSistema datos = new DatosSistema();
     editorial.v_TipoEvento = "C";
     var dt = new DataTable();
     string[] parametros = { "@v_nombre", "@v_TipoEvento" };
     dt = datos.getDatosTabla("proConsultarEditorial", parametros, editorial.v_nombre_editorial, editorial.v_TipoEvento);
     foreach (DataRow fila in dt.Rows)
     {
         editorial.v_nombre_editorial = fila["nombre"].ToString();
         editorial.v_Dpais = fila["pais"].ToString();
         editorial.v_direccion_editorial = fila["direccion"].ToString();
     }
     return editorial;
 }
Esempio n. 4
0
        public Editorial OptenerPais(Editorial editorial)
        {
            DatosSistema datos = new DatosSistema();

            editorial.v_TipoEvento = "P";
            var dt = new DataTable();

            string[] parametros = { "@v_TipoEvento" };
            dt = datos.getDatosTabla("proDevolverDatos", parametros, editorial.v_TipoEvento);
            foreach (DataRow fila in dt.Rows)
            {
                editorial.v_pais.Add(fila["Pais"].ToString());
            }
            return(editorial);
        }
        private void but_agregar_editorial_Click(object sender, EventArgs e)
        {
            if (this.verificar_datos_editorial())
            {

                if (tex_direccion.Text.Length == 0)
                {
                    tex_direccion.Text = "";
                }

                StringBuilder errorMessages = new StringBuilder();
                Editorial edi = new Editorial();

                edi.v_nombre_editorial = tex_nombre_editorial.Text;
                edi.v_Dpais = com_pais.SelectedItem.ToString();
                edi.v_direccion_editorial = tex_direccion.Text;
                edi.v_usuario_i = this.usuario;

                try
                {
                    if (edi.AgregarEditorial(edi) != 0)
                    {
                        MessageBox.Show("Editorial creada correctamente" + "\n" +"Nombre: " + edi.v_nombre_editorial,
                        "Agregar Editorial",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information);
                        this.inicializarDatos();
                    }
                }
                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());
                    this.inicializarDatos();
                    MessageBox.Show(ex.Errors[0].Message.ToString(),
                    "Agregar Editorial",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                }
            }
        }
Esempio n. 6
0
        public int AgregarEditorial(Editorial editorial)
        {
            editorial.v_TipoEvento = "I";
            DatosSistema datos = new DatosSistema();
            string[] parametros = { "@v_nombre",
                                    "@v_Dpais",
                                    "@v_direccion",
                                    "@v_usuarioI",
                                    "@v_TipoEvento"};

            return datos.Ejecutar("proAgregarEditorial", parametros,
                                   editorial.v_nombre_editorial,
                                   editorial.v_Dpais,
                                   editorial.v_direccion_editorial,
                                   editorial.v_usuario_i,
                                   editorial.v_TipoEvento);
        }
Esempio n. 7
0
        public Editorial ConsultarEditorial(Editorial editorial)
        {
            DatosSistema datos = new DatosSistema();

            editorial.v_TipoEvento = "C";
            var dt = new DataTable();

            string[] parametros = { "@v_nombre", "@v_TipoEvento" };
            dt = datos.getDatosTabla("proConsultarEditorial", parametros, editorial.v_nombre_editorial, editorial.v_TipoEvento);
            foreach (DataRow fila in dt.Rows)
            {
                editorial.v_nombre_editorial    = fila["nombre"].ToString();
                editorial.v_Dpais               = fila["pais"].ToString();
                editorial.v_direccion_editorial = fila["direccion"].ToString();
            }
            return(editorial);
        }
Esempio n. 8
0
        public int AgregarEditorial(Editorial editorial)
        {
            editorial.v_TipoEvento = "I";
            DatosSistema datos = new DatosSistema();

            string[] parametros = { "@v_nombre",
                                    "@v_Dpais",
                                    "@v_direccion",
                                    "@v_usuarioI",
                                    "@v_TipoEvento" };

            return(datos.Ejecutar("proAgregarEditorial", parametros,
                                  editorial.v_nombre_editorial,
                                  editorial.v_Dpais,
                                  editorial.v_direccion_editorial,
                                  editorial.v_usuario_i,
                                  editorial.v_TipoEvento));
        }
Esempio n. 9
0
        public int ModificarEditorial(Editorial editorial)
        {
            editorial.v_TipoEvento = "M";
            DatosSistema datos = new DatosSistema();

            string[] parametros = { "@v_nombre",
                                    "@v_Dpais",
                                    "@v_direccion",
                                    "@v_estado",
                                    "@v_usuarioM",
                                    "@v_TipoEvento" };

            return(datos.Ejecutar("proModificarEditorial", parametros,
                                  editorial.v_nombre_editorial,
                                  editorial.v_Dpais,
                                  editorial.v_direccion_editorial,
                                  editorial.v_estado,
                                  editorial.v_usuario_m,
                                  editorial.v_TipoEvento));
        }
        private void mostrarLista()
        {
            StringBuilder errorMessages = new StringBuilder();
            Editorial edi = new Editorial();
            try
            {

                if ((edi.OptenerPais(edi)).v_pais.Count != 0)
                {
                    SLpais = new SortedList();
                    foreach (String pais in edi.v_pais)
                    {
                        SLpais.Add(pais, pais);
                    }
                    com_pais.DataSource = SLpais.GetValueList();
                    com_pais.Show();
                }

            }
            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(),
                "Agregar Editorial",
                MessageBoxButtons.OK,
                MessageBoxIcon.Warning);
            }
        }
Esempio n. 11
0
        public Editorial OptenerPais(Editorial editorial)
        {
            DatosSistema datos = new DatosSistema();
            editorial.v_TipoEvento = "P";
            var dt = new DataTable();
            string[] parametros = { "@v_TipoEvento" };
            dt = datos.getDatosTabla("proDevolverDatos", parametros, editorial.v_TipoEvento);
            foreach (DataRow fila in dt.Rows)
            {
                editorial.v_pais.Add(fila["Pais"].ToString());

            }
            return editorial;
        }
Esempio n. 12
0
        public int ModificarEditorial(Editorial editorial)
        {
            editorial.v_TipoEvento = "M";
            DatosSistema datos = new DatosSistema();
            string[] parametros = { "@v_nombre",
                                    "@v_Dpais",
                                    "@v_direccion",
                                    "@v_estado",
                                    "@v_usuarioM",
                                    "@v_TipoEvento"};

            return datos.Ejecutar("proModificarEditorial", parametros,
                                   editorial.v_nombre_editorial,
                                   editorial.v_Dpais,
                                   editorial.v_direccion_editorial,
                                   editorial.v_estado,
                                   editorial.v_usuario_m,
                                   editorial.v_TipoEvento);
        }
Esempio n. 13
0
        public int EliminarEditorial(Editorial editorial)
        {
            editorial.v_TipoEvento = "E";
            DatosSistema datos = new DatosSistema();
            string[] parametros = { "@v_nombre",
                                    "@v_usuarioM",
                                    "@v_TipoEvento"};

            return datos.Ejecutar("proEliminarEditorial", parametros,
                                   editorial.v_nombre_editorial,
                                   editorial.v_usuario_m,
                                   editorial.v_TipoEvento);
        }
        //private void mostrarLista()
        //{
        //    StringBuilder errorMessages = new StringBuilder();
        //    Editorial edi = new Editorial();
        //    try
        //    {
        //        if ((edi.OptenerPais(edi)).v_pais.Count != 0)
        //        {
        //            SLpais = new SortedList();
        //            foreach (String pais in edi.v_pais)
        //            {
        //                SLpais.Add(pais, pais);
        //            }
        //            com_pais.DataSource = SLpais.GetValueList();
        //            com_pais.Show();
        //        }
        //    }
        //    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(),
        //        "Eliminar Editorial",
        //        MessageBoxButtons.OK,
        //        MessageBoxIcon.Warning);
        //    }
        //}
        private void but_eliminar_persona_Click(object sender, EventArgs e)
        {
            StringBuilder errorMessages = new StringBuilder();
            Editorial edi = new Editorial();
            if (tex_nombre_editorial.Text.Length == 0)
            {
                this.inicializarDatos();
                MessageBox.Show("Debe ingresar un Nombre",
                "Eliminar Editorial",
                MessageBoxButtons.OK,
                MessageBoxIcon.Warning);
            }
            else
            {
                try
                {
                    edi.v_nombre_editorial = tex_nombre_editorial.Text;
                    //edi.v_Dpais = com_pais.SelectedItem.ToString();
                    edi.v_usuario_m = this.usuario;
                    if ((edi.ConsultarEditorial(edi)).v_nombre_editorial.Length != 0)
                    {
                        tex_nombre_editorial.Text = edi.v_nombre_editorial;
                        tex_direccion.Text = edi.v_direccion_editorial;

                        SLpais = new SortedList();
                        SLpais.Add(edi.v_Dpais, edi.v_Dpais);
                        com_pais.DataSource = SLpais.GetValueList();
                        com_pais.Show();
                        com_pais.Enabled = false;

                        if ((MessageBox.Show("¿Desea eliminar la Editorial con Nombre: " + edi.v_nombre_editorial + " ?", "Eliminar Editorial", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes))
                        {

                            try
                            {
                                if (edi.EliminarEditorial(edi) != 0)
                                {

                                    SLpais.Clear();
                                    com_pais.DataSource = null;
                                    com_pais.Show();

                                    this.inicializarDatos();
                                    MessageBox.Show("Editorial eliminada correctamente",
                                    "Eliminar Editorial",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);

                                }

                            }
                            catch (SqlException ex)
                            {
                                for (int i = 0; i < ex.Errors.Count; i++)
                                {

                                    SLpais.Clear();
                                    com_pais.DataSource = null;
                                    com_pais.Show();

                                    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());
                                this.inicializarDatos();
                                MessageBox.Show(ex.Errors[0].Message.ToString(),
                                    "Eliminar Editorial",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);

                            }
                        }
                    }
                }
                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");
                    }

                    SLpais.Clear();
                    com_pais.DataSource = null;
                    com_pais.Show();

                    Console.WriteLine(errorMessages.ToString());
                    this.inicializarDatos();
                    MessageBox.Show(ex.Errors[0].Message.ToString(),
                    "Eliminar Editorial",
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);

                }

            }
        }