Exemple #1
0
    Int32 DisplayOrders(string DestinationPostcodeFilter)
    {
        clsOrderCollection MyOrderBook = new clsOrderCollection();
        //var to store the count of records
        Int32  RecordCount;
        Int32  OrderNo;
        string CollectionPostcode;
        string DestinationCountry;
        string DestinationPostcode;
        string DateCreated;
        string ParcelSize;
        string Status;

        //var to store the index
        Int32 Index = 0;

        //clear the list of any existing items
        lbxOrderInfor.Items.Clear();
        //call the filter by post code method
        MyOrderBook.FilterByDestinationPostcodeAndCustomerNo(DestinationPostcodeFilter, CustomerNo);
        ////Store the Orderlist
        //OrderBook.OrderList = MyOrderBook.OrderList;
        RecordCount = MyOrderBook.Count;
        while (Index < RecordCount)
        {
            OrderNo             = Convert.ToInt32(MyOrderBook.OrderList[Index].OrderNo);
            CollectionPostcode  = Convert.ToString(MyOrderBook.OrderList[Index].CollectionPostcode);
            DestinationCountry  = Convert.ToString(MyOrderBook.OrderList[Index].DestinationCountry);
            DestinationPostcode = Convert.ToString(MyOrderBook.OrderList[Index].DestinationPostcode);
            DateCreated         = Convert.ToString(MyOrderBook.OrderList[Index].DateCreated);
            ParcelSize          = Convert.ToString(MyOrderBook.OrderList[Index].ParcelSize);
            Status = Convert.ToString(MyOrderBook.OrderList[Index].Status);
            ListItem NewItem = new ListItem("OrderNo: " + OrderNo + " / " +
                                            "Collection PC: " + CollectionPostcode + " / " +
                                            "Destination Country: " + DestinationCountry + " / " +
                                            "Destination PC: " + DestinationPostcode + " / " +
                                            "Date Created: " + DateCreated + " / " +
                                            "Parcel Size: " + ParcelSize + " / " +
                                            "Status: " + Status);
            lbxOrderInfor.Items.Add(NewItem);
            Index++;
        }
        //return the number of records found
        return(RecordCount);
    }