Exemple #1
0
        /// <summary>
        /// Método para insertar datos
        /// </summary>
        /// <param name="parametros"></param>
        /// <param name="procedimiento"></param>
        /// <returns></returns>
        public List <PersonaColaEntity> InsertarDatos(SqlParameter[] parametrosProcedure, string nombreProcedure)
        {
            List <PersonaColaEntity> lista = new List <PersonaColaEntity>();
            SqlDataReader            reader;

            try
            {
                SqlCommand comando = this.oSQLGeneraComando(nombreProcedure, parametrosProcedure);
                reader = comando.ExecuteReader();
                while (reader.Read())
                {
                    int numeroAtencion             = 0;
                    PersonaColaEntity listaPersona = new PersonaColaEntity();
                    numeroAtencion              = reader.GetInt32(0);
                    listaPersona.NumeroCola     = reader.GetInt32(1);
                    listaPersona.NumeroAtencion = numeroAtencion.ToString().PadLeft(4, '0');

                    lista.Add(listaPersona);
                }
            }
            catch (Exception ex)
            {
                throw new Exception();
                //registroLogs_Common.GuardarLog(ex.Message);
            }
            finally
            {
                this.Desconectar();
            }
            return(lista);
        }
Exemple #2
0
 public SqlParameter[] Mapeo(PersonaColaEntity Ent)
 {
     SqlParameter[] parametros =
     {
         new SqlParameter("@name", Ent.PersonaNombre),
         new SqlParameter("@id",   Ent.IdPersona),
     };
     return(parametros);
 }
Exemple #3
0
        public static List <PersonaColaEntity> GuardarNuevoTurno(string Id, string Nombre)
        {
            List <PersonaColaEntity> lista = new List <PersonaColaEntity>();
            PersonaCola       personaCola  = new PersonaCola();
            PersonaColaEntity pc           = new PersonaColaEntity()
            {
                PersonaNombre = Nombre,
                IdPersona     = Id
            };

            lista = personaCola.Guardar(pc);
            return(lista);
        }
Exemple #4
0
        public List <PersonaColaEntity> Guardar(PersonaColaEntity Ent)
        {
            List <PersonaColaEntity> lista = new List <PersonaColaEntity>();

            try
            {
                SqlParameter[] parametros = Mapeo(Ent);
                lista = objBase.InsertarDatos(parametros, "SP_GUARDARNUEVOTURNO");
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            return(lista);
        }
Exemple #5
0
        public List <PersonaColaEntity> GetData(PersonaColaEntity Ent)
        {
            List <PersonaColaEntity> lista = new List <PersonaColaEntity>();

            try
            {
                SqlParameter[] parametros = Mapeo(Ent);
                DataSet        ds         = objBase.dsEjecutarProcedimiento("SP_GETDATA", parametros);
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    int numeroAtencion        = 0;
                    PersonaColaEntity persona = new PersonaColaEntity();
                    numeroAtencion         = int.Parse(item[0].ToString());
                    persona.NumeroCola     = int.Parse(item[1].ToString());
                    persona.NumeroAtencion = numeroAtencion.ToString().PadLeft(4, '0');
                    lista.Add(persona);
                }
            }
            catch (Exception ex)
            {
                throw new Exception();
            }
            return(lista);
        }