void LoadPurchasedItems ()
		{
			var purchases = _billingHelper.GetPurchases (ItemType.InApp);

			_purchasesAdapter = new PurchaseAdapter (this, purchases);
			_lvPurchsedItems.Adapter = _purchasesAdapter;
		}
        //加载数据
        private void LoadData()
        {
            try
            {
                DataSet         SupplierList;
                SupplierAdapter sadapter = new SupplierAdapter(
                    SQLConnection.GetDataBase());
                PurchaseAdapter padapter = new PurchaseAdapter(
                    SQLConnection.GetDataBase());

                SupplierList = sadapter.GetAllSupplier();           //获取所有供应商信息
                PurchaseList = padapter.GetAllPurchase();           //获取所有进货信息

                DataTable     table   = SupplierList.Tables["Supplier"];
                DataSetHelper phelper = new DataSetHelper(ref PurchaseList);

                SupplierList.Tables.Remove("Supplier");
                PurchaseList.Tables.Add(table);    //添加子表
                PurchaseList.Relations.Add("PAndS", PurchaseList.Tables["Supplier"].Columns["Sno"],
                                           PurchaseList.Tables["Purchase"].Columns["Sno"]);

                phelper.SelectJoinInto("PurchaseAndSupplier", PurchaseList.Tables["Purchase"],
                                       "Pno,Sno,PAndS.Sname,Pdate", "1=1", "Pno");

                //加载进货信息
                LV_PurchaseAndSupplier.ItemsSource = PurchaseList.Tables["PurchaseAndSupplier"].DefaultView;

                //加载进货细节
                if (LV_PurchaseAndSupplier.Items.Count != 0)
                {
                    //选择第一项
                    LV_PurchaseAndSupplier.SelectedIndex = 0;
                    LoadPurchaseDetailData(0);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("异常发生,请检查数据库连接", "错误", MessageBoxButton.OK,
                                MessageBoxImage.Error);
                //写入日志
            }
        }
Пример #3
0
		/// <summary>
		/// Loads the purchased items.
		/// </summary>
		private void LoadPurchasedItems ()
		{
			// Ask the open connection's billing handler to get any purchases
			var purchases = _serviceConnection.BillingHandler.GetPurchases (ItemType.Product);

			// Display any existing purchases
			_purchasesAdapter = new PurchaseAdapter (this, purchases);
			_lvPurchsedItems.Adapter = _purchasesAdapter;
		}