コード例 #1
0
ファイル: frmSupplier.cs プロジェクト: zeedurwesh/Mobile-Fix
        public void loadSuppliers()
        {
            clsDBSupplier dbSupplier = new clsDBSupplier();
            List<clsSupplier> suppliers = dbSupplier.SupplierList();

            Int32 Index = 0;
            
            lstSupplier.Items.Clear();
            while (Index < suppliers.Count)
            {
                clsSupplier supplier = suppliers[Index];

                ListViewItem NewItem = new ListViewItem();
                NewItem.Text = supplier.Name;
                NewItem.SubItems.Add(supplier.Address);
                NewItem.SubItems.Add(supplier.Town);
                NewItem.SubItems.Add(supplier.Postcode);
                NewItem.SubItems.Add(supplier.ContactName);
                NewItem.SubItems.Add(supplier.ContactNumber);
              
                NewItem.Tag = supplier;
                lstSupplier.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
                lstSupplier.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
                lstSupplier.Items.Add(NewItem); //Add the item to ListView

                Index++; //move the index to the next record
            }
        }
コード例 #2
0
        public void loadSuppliers(clsProductRecord productRecord)
        {
            clsDBSupplier      dbSupplier = new clsDBSupplier();
            List <clsSupplier> suppliers  = dbSupplier.SupplierList();

            Int32 Index = 0;

            cmbSupplierName.DisplayMember = "Name";
            cmbSupplierName.ValueMember   = "ID";
            cmbSupplierName.Items.Clear();
            while (Index < suppliers.Count)
            {
                clsSupplier supplier = suppliers[Index];
                cmbSupplierName.Items.Add(supplier); //add the supplier to the list
                if (productRecord != null && (productRecord.SupplierId == supplier.ID))
                {
                    cmbSupplierName.SelectedItem = supplier;
                }

                Index++; //move the index to the next record
            }
        }