I provided the source code, it basicly retrieves data from a file and read that file store it into a List then outputting it.
Below is where I am currently at, and final output, the difference is "Author Name: " and final output is "Author Name: Bruna Martinuzzi" (with respective order)
It will output like this
Department Name: Clothing
Floor: 2
Price: 23.44
Price with taxes: 26.72
Product: tennisT by Nike
Department Name: Clothing
Floor: 2
Price: 42.35
Price with taxes: 48.28
Product: Sweat Top by Reebok
Department Name: Clothing
Floor: 2
Price: 38.99
Price with taxes: 44.45
Product: Khaki Casuals by LaCoste
Department Name: Reading
Floor: 1
Price: 12.78
Price with taxes: 13.67
Title: The Leader as a Mensch
Publisher: Six Seconds
Author Name:
Department Name: Reading
Floor: 1
Price: 23.44
Price with taxes: 25.08
Title: Software Teamwork: Taking Ownership for Success
Publisher: Addison-Wesley Professional
Author Name:
Department Name: Reading
Floor: 1
Price: 45.99
Price with taxes: 49.21
Title: ASP.NET MVC 1.0
Publisher: Wrox Press
Author Name:
Department Name: Reading
Floor: 1
Price: 7.54
Price with taxes: 8.07
Magazine Name: Wired
Issue Month: September Issue Year: 2010
Department Name: Reading
Floor: 1
Price: 5.88
Price with taxes: 6.29
Magazine Name: PC World
Issue Month: September Issue Year: 2010
But I want to get it like this
Department Name: Clothing
Floor: 2
Price: 23.44
Price with taxes: 26.72
Product: tennisT by Nike
Department Name: Clothing
Floor: 2
Price: 42.35
Price with taxes: 48.28
Product: Sweat Top by Reebok
Department Name: Clothing
Floor: 2
Price: 38.99
Price with taxes: 44.45
Product: Khaki Casuals by LaCoste
Department Name: Reading
Floor: 1
Price: 12.78
Price with taxes: 13.67
Title: The Leader as a Mensch
Publisher: Six Seconds
Author Name: Bruna Martinuzzi
Department Name: Reading
Floor: 1
Price: 23.44
Price with taxes: 25.08
Title: Software Teamwork: Taking Ownership for Success
Publisher: Addison-Wesley Professional
Author Name: Jim Brosseau
Department Name: Reading
Floor: 1
Price: 45.99
Price with taxes: 49.21
Title: ASP.NET MVC 1.0
Publisher: Wrox Press
Author Name: Scott Guthrie
Department Name: Reading
Floor: 1
Price: 7.54
Price with taxes: 8.07
Magazine Name: Wired
Issue Month: September Issue Year: 2010
Department Name: Reading
Floor: 1
Price: 5.88
Price with taxes: 6.29
Magazine Name: PC World
Issue Month: September Issue Year: 2010
Loading
Bryian TanPosted Oct 5, 2010, 12:58 PM
Click on my display name "Bryian Tan" and click on the "Contact User" link to send me a private message.
Thanks,
Bryian Tan
David ChenPosted Oct 4, 2010, 1:04 AM
thanks again, btw may I have your email? haha
Bryian TanPosted Oct 3, 2010, 5:15 PM
You need to write more code to get the Author name. I'll show you how to get the author name but you have to figure out on how to display it.
static List
{
string[] books = Reader.ReadLines(PathMgr.BOOKS_FILE);
//get the authors from authors.csv
string[] authors = Reader.ReadLines(PathMgr.AUTHORS_FILE);
string[] authorDetail;
string authorName = string.Empty;
for (int i = 0; i < books.Length; i++)
{
string[] booksDetail = books[i].Split(',');
for (int a = 0; a < authors.Length; a++)
{
//author book identifier abcef123,
//author last and first name Martinuzzi, Bruna
authorDetail = authors[a].Split(",".ToCharArray());
//if the book written by the author then get their first and last name
if (authorDetail[(int)Reader.eAuthors.random] == booksDetail[(int)Reader.eBooks.random])
{
authorName = authorDetail[(int)Reader.eAuthors.firstName] + authorDetail[(int)Reader.eAuthors.lastName];
break;
}
}
decimal booksPrice =
Convert.ToDecimal(booksDetail[(int)Reader.eBooks.price]);
storeItems.Add(new Books(booksDetail[(int)Reader.eBooks.name],
booksDetail[(int)Reader.eBooks.publish],
booksPrice));
}
return storeItems;
}
Thanks,
Bryian Tan
JurePosted Oct 3, 2010, 12:37 AM