Beispiel #1
0
    Int32 DisplayBrands(string BrandFilter)
    {
        Int32  PhoneNo;   //var to store the primary key
        string PhoneName; //var to store the PhoneName
        string Brand;     // var to store the Brand

        ;                 //create an instance of the phone book class
        clsPhoneCollection PhoneBook = new clsPhoneCollection();

        PhoneBook.FilterByBrand(BrandFilter);                 //filter by brand
        Int32 RecordCount;                                    //var store the count of records
        Int32 Index = 0;                                      //var to store the index for the loop

        RecordCount = PhoneBook.Count;                        //get the count of records
        lstPhones.Items.Clear();                              //clear the list box
        while (Index < RecordCount)                           //while there are records to process
        {
            PhoneNo   = PhoneBook.PhoneList[Index].PhoneNo;   //get the primary key
            PhoneName = PhoneBook.PhoneList[Index].PhoneName; //get the phonename
            Brand     = PhoneBook.PhoneList[Index].Brand;     //get the brand
            //create a new entry for the list box
            ListItem NewEntry = new ListItem(Brand + " " + PhoneName, PhoneNo.ToString());
            lstPhones.Items.Add(NewEntry); // add the phone to the list
            Index++;                       // move the index to the next record
        }
        return(RecordCount);
    }
Beispiel #2
0
 public override string ToString()
 {
     return(base.ToString() + ": "
            + "[User Id:" + UserId.ToString()
            + "], [Name:" + Name.ToString()
            + "], [Age:" + Age.ToString()
            + "], [Email:" + Email.ToString()
            + "], [PhoneNo:" + PhoneNo.ToString() + "]");
 }