Beispiel #1
0
        private void btnEliminar_Click(object sender, EventArgs e)

        {
            string _error = "";

            if (txt_Nombre_Ciudad.Text.Length == 0)
            {
                _error = "EL nombre ciudad no Puede estar Vacio";
            }
            if (_error.Length == 0)
            {
                try
                {
                    string _nombre_ciudad = txt_Nombre_Ciudad.Text;
                    int    resul          = AccesoLogica.Delete("nombre_ciudad = '" + _nombre_ciudad + "' ", "ciudad");

                    if (resul == 1)
                    {
                        MessageBox.Show("La Ciudad se ha Eliminado Correctamente", "Eliminado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        llenar_grid("id_ciudad > 0");
                        limpiar();
                    }
                }
                catch (NpgsqlException)
                {
                    MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void btnEliminar_Click_1(object sender, EventArgs e)
        {
            string _error = "";

            if (txt_numero_carton_documentos.Text.Length == 0)
            {
                _error = "EL nombre caminos no Puede estar Vacio";
            }
            if (_error.Length == 0)
            {
                try
                {
                    string _numero_carton_documentos = txt_numero_carton_documentos.Text;
                    int    resul = AccesoLogica.Delete("numero_carton_documentos = '" + _numero_carton_documentos + "' ", "carton_documentos");

                    if (resul == 1)
                    {
                        MessageBox.Show("El Carton se ha Eliminado Correctamente", "Eliminado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        llenar_grid("id_carton_documentos > 0");
                        limpiar();
                    }
                }
                catch (NpgsqlException)
                {
                    MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 public void Elimina_ProductoEntrega(int _numero_entregas_d, int _id_productos)
 {
     try
     {
         int resul = AccesoLogica.Delete("numero_entregas_d = '" + _numero_entregas_d + "' AND id_productos = '" + _id_productos + "'  ", "entregas");
     }
     catch (NpgsqlException)
     {
         throw;
     }
 }
Beispiel #4
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            string _error = "";

            if (txt_nombre_indice_detalle.Text.Length == 0)
            {
                _error = "EL nombre de indice detalle no Puede estar Vacio";
            }
            if (_error.Length == 0)
            {
                DialogResult dialogo = MessageBox.Show("¿Seguro desea eliminar este registro?",
                                                       "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogo == DialogResult.Yes)
                {
                    try
                    {
                        string _nombre_indice_detalle = txt_nombre_indice_detalle.Text;
                        int    resul = AccesoLogica.Delete("nombre_indice_detalle = '" + _nombre_indice_detalle + "' ", "temp_indice");

                        if (resul == 1)
                        {
                            MessageBox.Show("El Detalle se ha Eliminado Correctamente", "Eliminado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            llenar_grid("tipo_indice.id_tipo_indice = temp_indice.id_tipo_indice");

                            limpiar();
                        }
                    }
                    catch (NpgsqlException)
                    {
                        MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                }
            }
            else
            {
                MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #5
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            string _error = "";

            if (txt_nombre_caminos.Text.Length == 0)
            {
                _error = "EL nombre caminos no Puede estar Vacio";
            }
            if (_error.Length == 0)
            {
                DialogResult dialogo = MessageBox.Show("¿Seguro desea eliminar este registro?",
                                                       "Eliminar", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (dialogo == DialogResult.Yes)
                {
                    try
                    {
                        string _nombre_caminos = txt_nombre_caminos.Text;
                        int    resul           = AccesoLogica.Delete("nombre_caminos = '" + _nombre_caminos + "' ", "caminos");

                        if (resul == 1)
                        {
                            MessageBox.Show("El Camino se ha Eliminado Correctamente", "Eliminado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                            llenar_grid("usuarios.id_usuarios = caminos.id_usuarios AND proyectos.id_proyectos = caminos.id_proyectos");
                            limpiar();
                        }
                    }
                    catch (NpgsqlException)
                    {
                        MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                else
                {
                }
            }
            else
            {
                MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #6
0
        static void Main(string[] args)
        {
            ///borro los errores
            AccesoLogica.Delete("id_errores_importacion > 0", "errores_importacion");

            buscaCategoria();


            ///resumen
            Console.WriteLine("Documentos Nuevos: " + ResumenDiario._cantidad_doc + " Total de Páginas Nuevas: " + ResumenDiario._paginas_doc);


            Console.WriteLine("Enviado resumen ...");


            ResumenInsertSend RIS = new ResumenInsertSend();


            try
            {
                RIS.InsertaResumen(ResumenDiario._cantidad_doc, ResumenDiario._paginas_doc);
            }
            catch (Exception Ex)
            {
                SendError.EnviarErrorImportacion("Enviar Correo", Ex.Message);
            }


            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("<----------------------------------------->");
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Termino el Proceso. FELICITACIONES !!! ...");

            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("<----------------------------------------->");

            Console.Read();
        }
Beispiel #7
0
        private void btnGuardar_Click(object sender, EventArgs e)
        {
            int    _id_tipo_indice        = 0;
            string _nombre_indice_detalle = "";
            int    _min_indice_detalle    = 0;
            int    _max_indice_detalle    = 0;
            int    _orden_indice_detalle  = 0;
            int    _id_indice_cabeza1     = 0;
            int    _id_indice_cabeza      = 0;
            int    _id_cam               = 0;
            int    numeros               = 0;
            int    registros             = 0;
            int    _orden_temporal       = 0;
            int    _orden_detalle        = 0;
            string _error                = "";
            string _nombre_indice_cabeza = txt_nombre_indice.Text;
            int    _id_caminos           = Convert.ToInt16(cbm_caminos.SelectedValue.ToString());

            //CONSULTO INDICE CABEZA

            string columnas3 = "indice_cabeza.id_indice_cabeza";
            string tablas3   = "public.indice_cabeza";
            string where3    = "indice_cabeza.nombre_indice_cabeza = '" + _nombre_indice_cabeza + "' AND indice_cabeza.id_caminos = '" + _id_caminos + "'";

            DataTable dtCabeza = AccesoLogica.Select(columnas3, tablas3, where3);

            foreach (DataRow renglon in dtCabeza.Rows)
            {
                _id_indice_cabeza1 = Convert.ToInt32(renglon["id_indice_cabeza"].ToString());
            }



            //CONSULTO TABLA TEMPORAL

            string columnas1 = "temp_indice.id_temp_indice, tipo_indice.id_tipo_indice, tipo_indice.nombre_tipo_indice, temp_indice.nombre_indice_detalle, temp_indice.min_indice_detalle, temp_indice.max_indice_detalle, temp_indice.orden_indice_detalle";
            string tablas    = "public.tipo_indice,  public.temp_indice";

            string where = "temp_indice.id_tipo_indice = tipo_indice.id_tipo_indice";
            DataTable dtTemporal1 = AccesoLogica.Select(columnas1, tablas, where);

            registros = dtTemporal1.Rows.Count;

            foreach (DataRow renglon in dtTemporal1.Rows)
            {
                _orden_temporal = Convert.ToInt32(renglon["orden_indice_detalle"].ToString());
            }

            //CONSULTO INDICE DETALLE

            string    columnas8 = "indice_detalle.orden_indice_detalle";
            string    tablas8   = " public.indice_detalle, public.tipo_indice";
            string    where8    = "tipo_indice.id_tipo_indice = indice_detalle.id_tipo_indice AND indice_detalle.id_indice_cabeza = '" + _id_indice_cabeza1 + "'";
            DataTable dtDetalle = AccesoLogica.Select(columnas8, tablas8, where8);

            foreach (DataRow renglon8 in dtDetalle.Rows)
            {
                _orden_detalle = Convert.ToInt32(renglon8["orden_indice_detalle"].ToString());
            }

            //CONSULTO INDICE CABEZA

            string    columnas50 = "indice_cabeza.nombre_indice_cabeza, caminos.id_caminos";
            string    tablas50   = " public.indice_cabeza, public.caminos";
            string    where50    = "caminos.id_caminos = indice_cabeza.id_caminos AND indice_cabeza.id_caminos = '" + _id_caminos + "'";
            DataTable dtCabeza50 = AccesoLogica.Select(columnas50, tablas50, where50);

            foreach (DataRow renglon50 in dtCabeza50.Rows)
            {
                _id_cam = Convert.ToInt32(renglon50["id_caminos"].ToString());
            }



            if (registros <= 0)
            {
                MessageBox.Show("No existe datos para Guardar", "Error al Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            if (registros > 0)
            {
                if (_nombre_indice_cabeza.Length == 0)
                {
                    _error = "Debe Indicar un Nombre de Indice Cabeza";
                }

                if (_error.Length == 0)

                {
                    if (_orden_temporal == _orden_detalle)
                    {
                        MessageBox.Show("Ya existe un indice con el Orden " + _orden_detalle, " Error al Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else if (_id_cam == _id_caminos)
                    {
                        MessageBox.Show("Ya existe un indice con el Camino Seleccionado", " Error al Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        string datos     = _nombre_indice_cabeza + "?" + _id_caminos;
                        string columnas  = "_nombre_indice_cabeza?_id_caminos";
                        string tipodatos = "NpgsqlDbType.Varchar?NpgsqlDbType.Integer";


                        try
                        {
                            int resul = AccesoLogica.Insert(datos, columnas, tipodatos, "ins_indice_cabeza");

                            string columnas15 = "indice_cabeza.id_indice_cabeza";
                            string tablas15   = "public.indice_cabeza";
                            string where15    = "indice_cabeza.nombre_indice_cabeza = '" + _nombre_indice_cabeza + "' AND indice_cabeza.id_caminos = '" + _id_caminos + "'";

                            DataTable dtCabeza15 = AccesoLogica.Select(columnas15, tablas15, where15);

                            foreach (DataRow renglon in dtCabeza15.Rows)
                            {
                                _id_indice_cabeza = Convert.ToInt32(renglon["id_indice_cabeza"].ToString());
                            }

                            foreach (DataRow renglon in dtTemporal1.Rows)
                            {
                                _id_tipo_indice        = Convert.ToInt32(renglon["id_tipo_indice"].ToString());
                                _nombre_indice_detalle = Convert.ToString(renglon["nombre_indice_detalle"].ToString());
                                _min_indice_detalle    = Convert.ToInt32(renglon["min_indice_detalle"].ToString());
                                _max_indice_detalle    = Convert.ToInt32(renglon["max_indice_detalle"].ToString());
                                _orden_indice_detalle  = Convert.ToInt32(renglon["orden_indice_detalle"].ToString());

                                string datos2     = _id_indice_cabeza + "?" + _id_tipo_indice + "?" + _nombre_indice_detalle + "?" + _min_indice_detalle + "?" + _max_indice_detalle + "?" + _orden_indice_detalle;
                                string columnas2  = "_id_indice_cabeza?_id_tipo_indice?_min_indice_detalle?_max_indice_detalle?_orden_indice_detalle?_nombre_indice_detalle";
                                string tipodatos2 = "NpgsqlDbType.Integer?NpgsqlDbType.Integer?NpgsqlDbType.Integer?NpgsqlDbType.Integer?NpgsqlDbType.Integer?NpgsqlDbType.Varchar";


                                try
                                {
                                    int result = AccesoLogica.Insert(datos2, columnas2, tipodatos2, "ins_indice_detalle");

                                    try
                                    {
                                        numeros = numeros + 1;
                                        int resulT = AccesoLogica.Delete("nombre_indice_detalle = '" + _nombre_indice_detalle + "' ", "temp_indice");
                                        llenar_grid("tipo_indice.id_tipo_indice = temp_indice.id_tipo_indice");
                                        limpiar();
                                        limpiar1();
                                    }
                                    catch (NpgsqlException)
                                    {
                                        MessageBox.Show("No se Pudo Sumar", "Error al Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                    }
                                }
                                catch (NpgsqlException errores) {
                                    MessageBox.Show(errores.Message, "Error");
                                }
                            }
                        }
                        catch (NpgsqlException)
                        {
                            MessageBox.Show("No se Pudo Guardar el registro en la Base de Datos", "Error al Guardar", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        if (numeros > 0)
                        {
                            MessageBox.Show("Se ha Registrado Correctamente " + numeros + " Registros", "Guardado Correctamente", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                    }
                }
                else
                {
                    MessageBox.Show(_error, "Error de validación", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }