/*###########################################Fin leer######################################################*/

        /*#############################################Actualizar##################################################*/
        public static void ActualizarEstadoUsuarioRepresentate(int refRepresentante, string estado)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Modificar_crearProceso_usuario_representante", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refResponsable", Direction = System.Data.ParameterDirection.Input, Value = refRepresentante
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_estado", Direction = System.Data.ParameterDirection.Input, Value = estado
                });
                //command.Parameters.Add(new MySqlParameter() { ParameterName = "out_nombre", Direction = System.Data.ParameterDirection.Output, Value = -1 });
                var datos = ContexDb.ExecuteProcedure(command);
                //return datos.Parameters["out_nombre"].Value.ToString();

                //saber.Id = Convert.ToInt32(datos.Parameters["out_id"].Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            //return null;
        }
Пример #2
0
        public static Organizacion LeerOrganizacion(int refSolicitud)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Leer_Organizacion", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = refSolicitud
                });
                var datos = ContexDb.GetDataSet(command);
                if (datos.Tables[0].Rows.Count == 1)
                {
                    var          prodData     = datos.Tables[0].Rows[0];
                    Organizacion organizacion = new Organizacion()
                    {
                        Nombre = prodData["nombre"].ToString(),
                        TipoOE = new TipoOE {
                            Nombre = prodData["tipo"].ToString()
                        },
                    };

                    return(organizacion);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(null);
        }
Пример #3
0
 public static Boolean EliminarParticipante(int IdSolicitud, String IdParticipante, DateTime FechaModificacion)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Eliminar_Participante", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = IdSolicitud
         });
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_refParticipante", Direction = System.Data.ParameterDirection.Input, Value = IdParticipante
         });
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_fechaModificacion", Direction = System.Data.ParameterDirection.Input, Value = FechaModificacion
         });
         //command.Parameters.Add(new MySqlParameter() { ParameterName = "out_id", Direction = System.Data.ParameterDirection.Output, Value = -1 });
         var datos = ContexDb.ExecuteProcedure(command);
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(false);
 }
Пример #4
0
        public static void AgregarCategoria(int idSolicitud, int idCategoria, DateTime FechaModificacion)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Agregar_categoria", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = idSolicitud
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refCategoria", Direction = System.Data.ParameterDirection.Input, Value = idCategoria
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_fechaModificacion", Direction = System.Data.ParameterDirection.Input, Value = FechaModificacion
                });

                var datos = ContexDb.ExecuteProcedure(command);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
Пример #5
0
        public static void AgregarParSol(String refParticipante, int refSolicitud, DateTime FechaModificacion)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Agregar_parsol", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refParticipante", Direction = System.Data.ParameterDirection.Input, Value = refParticipante
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = refSolicitud
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_fechaModificacion", Direction = System.Data.ParameterDirection.Input, Value = FechaModificacion
                });
                //command.Parameters.Add(new MySqlParameter() { ParameterName = "out_id", Direction = System.Data.ParameterDirection.Output, Value = -1 });
                var datos = ContexDb.ExecuteProcedure(command);

                //saber.Id = Convert.ToInt32(datos.Parameters["out_id"].Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
 /*#############################################Leer######################################################*/
 /// <summary>
 /// Muestra los datos de la declaracion de gastos en base al id de esta
 /// </summary>
 /// <param name="RefDeclaracionGastos"></param>
 /// <returns>Devuelve los datos principales de la declaracion de gastos que son la fecha limite del evento, el monto total de la documentacion guardada y el monto total de los documentos seleccionados a rendir. En caso de que exista algun problema, devuelve un null.</returns>
 public static DeclaracionGastos LeerDeclaracionGastos(int RefDeclaracionGastos)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Leer_Declaracion_Gastos", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_refDeclaracionGastos", Direction = System.Data.ParameterDirection.Input, Value = RefDeclaracionGastos
         });
         var datos = ContexDb.GetDataSet(command);
         if (datos.Tables[0].Rows.Count == 1)
         {
             DeclaracionGastos declaracionGastos;
             var prodData = datos.Tables[0].Rows[0];
             declaracionGastos = new DeclaracionGastos()
             {
                 Id                 = Convert.ToInt32(prodData["id"]),
                 FechaLimite        = Convert.ToDateTime(prodData["fechaLimite"]),
                 TotalDocumentacion = Convert.ToInt32(prodData["totalDocumentacion"]),
                 TotalRendido       = Convert.ToInt32(prodData["totalRendido"])
             };
             return(declaracionGastos);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(null);
 }
        public static int EliminarDocumentosDG(int IdDeclaracionGastos)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Eliminar_documentos_declaracion_gastos", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_idDeclaracionGastos", Direction = System.Data.ParameterDirection.Input, Value = IdDeclaracionGastos
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "out_validacion", Direction = System.Data.ParameterDirection.Output, Value = -1
                });
                var datos = ContexDb.ExecuteProcedure(command);

                return(Convert.ToInt32(datos.Parameters["out_validacion"].Value));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(-1);
        }
 public static String Leer_Correo(string Email)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "leer_Correo", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_email", Direction = System.Data.ParameterDirection.Input, Value = Email
         });
         var datos = ContexDb.GetDataSet(command);
         if (datos.Tables[0].Rows.Count == 1)
         {
             System.Data.DataRow row = datos.Tables[0].Rows[0];
             var prodData            = row;
             return(prodData["email"].ToString());
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     finally
     {
     }
     return(null);
 }
Пример #9
0
        public static List <Campus> Leer_Campus()
        {
            List <Campus> campus  = new List <Campus>();
            var           command = new MySqlCommand()
            {
                CommandText = "Leer_Campus", CommandType = System.Data.CommandType.StoredProcedure
            };

            try
            {
                var datos = ContexDb.GetDataSet(command);
                if (datos.Tables[0].Rows.Count > 0)
                {
                    foreach (System.Data.DataRow row in datos.Tables[0].Rows)
                    {
                        var    prodData = row;
                        Campus camp     = new Campus()
                        {
                            Id     = Convert.ToInt32(prodData["id"]),
                            Nombre = prodData["nombre"].ToString()
                        };
                        campus.Add(camp);
                    }
                    return(campus);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(null);
        }
Пример #10
0
        public static int ActualizarInstitucion(int IdInstitucion, string Abreviatura, string Nombre)
        {
            int result;

            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Actualizar_Institucion", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_id", Direction = System.Data.ParameterDirection.Input, Value = IdInstitucion
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_abreviacion", Direction = System.Data.ParameterDirection.Input, Value = Abreviatura
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_nombre", Direction = System.Data.ParameterDirection.Input, Value = Nombre
                });
                var datos = ContexDb.ExecuteProcedure(command);
                result = 1;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                result = -1;
            }
            return(result);
        }
        /*Se debe cambiar a consultas de usuario*/
        public static int IniciarSesion(Login login)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "iniciar_sesion", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_usuario", Direction = System.Data.ParameterDirection.Input, Value = login.Usuario
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_clave", Direction = System.Data.ParameterDirection.Input, Value = login.Clave
                });
                var datos = ContexDb.GetDataSet(command);

                if (datos.Tables[0].Rows.Count == 1)
                {
                    System.Data.DataRow row = datos.Tables[0].Rows[0];
                    var prodData            = row;
                    return(Convert.ToInt32(prodData["id"].ToString()));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(-1);
        }
Пример #12
0
 public static List <Institucion> LeerInstituciones()
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Leer_Institucion", CommandType = System.Data.CommandType.StoredProcedure
         };
         var datos = ContexDb.GetDataSet(command);
         List <Institucion> instituciones = new List <Institucion>();
         if (datos.Tables[0].Rows.Count > 0)
         {
             foreach (System.Data.DataRow row in datos.Tables[0].Rows)
             {
                 var prodData    = row;
                 var institucion = new Institucion()
                 {
                     Id                = Convert.ToInt32(prodData["id"]),
                     Abreviacion       = prodData["abreviacion"].ToString(),
                     Nombre            = prodData["nombre"].ToString(),
                     Estado            = prodData["estado"].ToString(),
                     EstadoEliminacion = prodData["estadoEliminacion"].ToString()
                 };
                 instituciones.Add(institucion);
             }
         }
         return(instituciones);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(null);
 }
 public static Modulo Leer_Modulo(int idModulo)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Leer_Modulo", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_idModulo", Direction = System.Data.ParameterDirection.Input, Value = idModulo
         });
         var datos = ContexDb.GetDataSet(command);
         if (datos.Tables[0].Rows.Count > 0)
         {
             Modulo modulo = new Modulo()
             {
                 Id     = Convert.ToInt32(datos.Tables[0].Rows[0]["id"]),
                 Nombre = datos.Tables[0].Rows[0]["nombre"].ToString()
             };
             return(modulo);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(null);
 }
 public static Boolean ActualizarEstadoProceso(int estado, int refProceso, String nombreProceso)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Actualizar_Estado_Proceso", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_estado", Direction = System.Data.ParameterDirection.Input, Value = estado
         });
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_refProceso", Direction = System.Data.ParameterDirection.Input, Value = refProceso
         });
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_nombreProceso", Direction = System.Data.ParameterDirection.Input, Value = nombreProceso
         });
         var datos = ContexDb.ExecuteProcedure(command);
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(false);
 }
 public static void Actualizar_Proceso_Resolucion_DecGatos(int proceso, int id_proceso, int id_procesoActual)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "actualizar_estado_proceso", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_proceso", Direction = System.Data.ParameterDirection.Input, Value = id_proceso
         });
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_id_procesoFondo", Direction = System.Data.ParameterDirection.Input, Value = id_proceso
         });
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_id_proceso_actual", Direction = System.Data.ParameterDirection.Input, Value = id_procesoActual
         });
         var datos = ContexDb.ExecuteProcedure(command);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
 }
Пример #16
0
        public static void AgregarCategoria(SolicitudCategoria categoria)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "agregar_categoria", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = categoria.RefSolicitud
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refCategoria", Direction = System.Data.ParameterDirection.Input, Value = categoria.RefCategoria
                });
                //command.Parameters.Add(new MySqlParameter() { ParameterName = "out_id", Direction = System.Data.ParameterDirection.Output, Value = -1 });
                var datos = ContexDb.ExecuteProcedure(command);

                //saber.Id = Convert.ToInt32(datos.Parameters["out_id"].Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        public static String ModificarEstadoResponsable(string refResponsable, string estado)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "cambiar_estado_responsable", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refResponsable", Direction = System.Data.ParameterDirection.Input, Value = refResponsable
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_estado", Direction = System.Data.ParameterDirection.Input, Value = estado
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "out_nombre", Direction = System.Data.ParameterDirection.Output, Value = -1
                });
                var datos = ContexDb.ExecuteProcedure(command);
                return(datos.Parameters["out_nombre"].Value.ToString());

                //saber.Id = Convert.ToInt32(datos.Parameters["out_id"].Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(null);
        }
Пример #18
0
        public static void AgregarProcesoFondo(int refOrganizacion, int refSolicitud, int estado)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "crear_proceso_fondo", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refOrganizacion", Direction = System.Data.ParameterDirection.Input, Value = refOrganizacion
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = refSolicitud
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_estado", Direction = System.Data.ParameterDirection.Input, Value = estado
                });
                //command.Parameters.Add(new MySqlParameter() { ParameterName = "out_id", Direction = System.Data.ParameterDirection.Output, Value = -1 });
                var datos = ContexDb.ExecuteProcedure(command);

                //saber.Id = Convert.ToInt32(datos.Parameters["out_id"].Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        public static int DocumentoSeleccionado(int Estado, int IdDocumento)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Modificar_seleccion_documento", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_idDocumento", Direction = System.Data.ParameterDirection.Input, Value = IdDocumento
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_estado", Direction = System.Data.ParameterDirection.Input, Value = Estado
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "out_validacion", Direction = System.Data.ParameterDirection.Output, Value = -1
                });
                var datos = ContexDb.ExecuteProcedure(command);

                return(Convert.ToInt32(datos.Parameters["out_validacion"].Value));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(-1);
        }
Пример #20
0
        public static void EliminarPersona(SolicitudPersona solper)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "eliminar_persona_seleccionada", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = solper.RefSolicitud
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refPersona", Direction = System.Data.ParameterDirection.Input, Value = solper.RefPersona
                });
                //command.Parameters.Add(new MySqlParameter() { ParameterName = "out_id", Direction = System.Data.ParameterDirection.Output, Value = -1 });
                var datos = ContexDb.ExecuteProcedure(command);

                //saber.Id = Convert.ToInt32(datos.Parameters["out_id"].Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        /*#############################################Crear Resolucion|######################################################*/
        public static int CrearResolucion(Resolucion resolucion)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "crear_resolucion", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_idResolucion", Direction = System.Data.ParameterDirection.Input, Value = resolucion.NumeroResolucion
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_anio", Direction = System.Data.ParameterDirection.Input, Value = resolucion.AnioResolucion
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_copiaDocumento", Direction = System.Data.ParameterDirection.Input, Value = resolucion.CopiaDocumento
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "out_id", Direction = System.Data.ParameterDirection.Output, Value = -1
                });
                var datos = ContexDb.ExecuteProcedure(command);

                return(Convert.ToInt32(datos.Parameters["out_id"].Value));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(-1);
        }
 public static List <TipoOE> LeerTipoOE()
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Leer_TipoOE", CommandType = System.Data.CommandType.StoredProcedure
         };
         var           datos   = ContexDb.GetDataSet(command);
         List <TipoOE> tipoOEs = new List <TipoOE>();
         if (datos.Tables[0].Rows.Count > 0)
         {
             foreach (System.Data.DataRow row in datos.Tables[0].Rows)
             {
                 var prodData = row;
                 var tipoOE   = new TipoOE()
                 {
                     Id                = Convert.ToInt32(prodData["id"]),
                     Nombre            = prodData["nombre"].ToString(),
                     NombreExtendido   = prodData["nombreExtendido"].ToString(),
                     Estado            = prodData["estado"].ToString(),
                     EstadoEliminacion = prodData["estadoEliminacion"].ToString()
                 };
                 tipoOEs.Add(tipoOE);
             }
             return(tipoOEs);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(null);
 }
Пример #23
0
        public static void AgregarParticipante(Persona persona)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Agregar_Participante", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_nombre", Direction = System.Data.ParameterDirection.Input, Value = persona.Nombre
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_run", Direction = System.Data.ParameterDirection.Input, Value = persona.RUN
                });
                //command.Parameters.Add(new MySqlParameter() { ParameterName = "out_id", Direction = System.Data.ParameterDirection.Output, Value = -1 });
                var datos = ContexDb.ExecuteProcedure(command);

                //saber.Id = Convert.ToInt32(datos.Parameters["out_id"].Value);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
        }
        public static int ActualizarTipoOE(int IdTipoOE, string Nombre, string NombreExtendido)
        {
            int result;

            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Actualizar_TipoOE", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_id", Direction = System.Data.ParameterDirection.Input, Value = IdTipoOE
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_nombre", Direction = System.Data.ParameterDirection.Input, Value = Nombre
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_nombreExtendido", Direction = System.Data.ParameterDirection.Input, Value = NombreExtendido
                });
                var datos = ContexDb.ExecuteProcedure(command);
                result = 1;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                result = -1;
            }
            return(result);
        }
Пример #25
0
 public static List <Categoria> LeerCategorias()
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Leer_Categorias", CommandType = System.Data.CommandType.StoredProcedure
         };
         //ejemplo command.Parameters.Add(new MySqlParameter() { ParameterName = "in_id", Direction = System.Data.ParameterDirection.Input, Value = id });
         var datos = ContexDb.GetDataSet(command);
         List <Categoria> categorias = new List <Categoria>();
         if (datos.Tables[0].Rows.Count > 0)
         {
             foreach (System.Data.DataRow row in datos.Tables[0].Rows)
             {
                 var prodData  = row;
                 var categoria = new Categoria()
                 {
                     Id     = Convert.ToInt32(prodData["id"]),
                     Nombre = prodData["nombre"].ToString()
                 };
                 categorias.Add(categoria);
             }
             return(categorias);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(null);
 }
        internal static int Leer_Estado_Proceso(int idSolicitud, int proceso)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "leer_Estado_Proceso", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_proceso", Direction = System.Data.ParameterDirection.Input, Value = proceso
                });
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_id_proceso", Direction = System.Data.ParameterDirection.Input, Value = idSolicitud
                });
                var datos = ContexDb.GetDataSet(command);

                if (datos.Tables[0].Rows.Count == 1)
                {
                    System.Data.DataRow row = datos.Tables[0].Rows[0];
                    var prodData            = row;
                    return(Convert.ToInt32(prodData["estado"].ToString()));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
            }
            return(-1);
        }
Пример #27
0
 public static Persona LeerParticipante(String refParticipante)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Leer_Participante", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_refParticipante", Direction = System.Data.ParameterDirection.Input, Value = refParticipante
         });
         var datos = ContexDb.GetDataSet(command);
         if (datos.Tables[0].Rows.Count == 1)
         {
             Persona participante;
             var     prodData = datos.Tables[0].Rows[0];
             participante = new Persona()
             {
                 Nombre        = prodData["nombre"].ToString(),
                 RUN           = prodData["run"].ToString(),
                 EstadoEdicion = Convert.ToInt32(prodData["estadoEdicion"])
             };
             return(participante);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.ToString());
     }
     return(null);
 }
        public static Organizacion Leer_Organizacion(int refSolicitud)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "leer_organizacion", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_refSolicitud", Direction = System.Data.ParameterDirection.Input, Value = refSolicitud
                });
                var datos = ContexDb.GetDataSet(command);
                if (datos.Tables[0].Rows.Count == 1)
                {
                    System.Data.DataRow row = datos.Tables[0].Rows[0];
                    var prodData            = row;
                    var organizacion        = new Organizacion()
                    {
                        Id   = Convert.ToInt32(prodData["id"]),
                        Tipo = prodData["tipo"].ToString()
                    };

                    return(organizacion);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            finally
            {
            }
            return(null);
        }
Пример #29
0
 /// <summary>
 /// Se encarga de eliminar una solicitud en particular y por ende elimina el proceso (Para realizar esta eliminacion, el proceso
 /// no debe tener asignado una resolucion y una declaracion de gasto)
 /// (1) Indica que se ha eliminado la solicitud correctamente
 /// (-1) Existen problemas de conexion con la base de datos o el parametro ingresado en la variable id no es correcto
 /// (-2) Aun existe la solicitud en la BD
 /// </summary>
 /// <param name="id"></param>
 /// <returns>1, -1 o -2</returns>
 public static int EliminarSolicitud(int id)
 {
     try
     {
         var command = new MySqlCommand()
         {
             CommandText = "Eliminar_solicitud", CommandType = System.Data.CommandType.StoredProcedure
         };
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "in_id", Direction = System.Data.ParameterDirection.Input, Value = id
         });
         command.Parameters.Add(new MySqlParameter()
         {
             ParameterName = "out_validacion", Direction = System.Data.ParameterDirection.Output, Value = -1
         });
         var datos = ContexDb.ExecuteProcedure(command);
         return(Convert.ToInt32(datos.Parameters["out_validacion"].Value));
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
     }
     return(-1);
 }
        public static Proceso LeerEstadoProceso(Proceso Proceso)
        {
            try
            {
                var command = new MySqlCommand()
                {
                    CommandText = "Leer_estado_proceso", CommandType = System.Data.CommandType.StoredProcedure
                };
                command.Parameters.Add(new MySqlParameter()
                {
                    ParameterName = "in_idSolicitud", Direction = System.Data.ParameterDirection.Input, Value = Proceso.Solicitud.Id
                });
                var datos = ContexDb.GetDataSet(command);

                if (datos.Tables[0].Rows.Count == 1)
                {
                    var prodData = datos.Tables[0].Rows[0];
                    Proceso.Estado      = Convert.ToInt32(prodData["estado"]);
                    Proceso.EstadoFinal = prodData["estadoFinal"].ToString();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
            }
            return(Proceso);
        }