Beispiel #1
0
        public PersonDTO GetUserID(string UserName)
        {
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetUserID";
            cmd.Parameters.Clear();

            SqlParameter param = new SqlParameter("@Username", SqlDbType.NVarChar);
            param.Value = UserName;
            cmd.Parameters.Add(param);

            cmd.Transaction = trans.GetTransaction();
            cmd.Connection = trans.GetTransaction().Connection;

            SqlDataReader datareader = cmd.ExecuteReader();

            PersonDTO Person = new PersonDTO();

            while (datareader.Read() == true)
            {
                Person.UserName = (string)datareader["FK_Username"];
            }
            datareader.Close();

            return Person;
        }
Beispiel #2
0
        public List<PersonDTO> GetAllUsersID()
        {
            PersonDTO personDTO;

            cmd.CommandText = "exec GetAllUserID";

            cmd.Transaction = trans.GetTransaction();
            cmd.Connection = trans.GetTransaction().Connection;
            SqlDataReader datareader = cmd.ExecuteReader();

            List<PersonDTO> PersonID = new List<PersonDTO>();

            while (datareader.Read() == true)
            {
                personDTO = new PersonDTO();
                personDTO.UserName = (string)datareader["FK_Username"];
                PersonID.Add(personDTO);
            }
            datareader.Close();

            return PersonID;
        }