Example #1
0
 private void CreateDbTables()
 {
     mDummyMasterTable            = new DummyMasterTable(ref mDb);
     mDummyCaptureTable           = new DummyCaptureTable(ref mDb);
     m_ShopMasterTable            = new ShopMasterTable(ref mDb);
     m_InvestmentTransactionTable = new InvestmentTransactionTable(ref mDb);
     m_CardMasterTable            = new CardMasterTable(ref mDb);
 }
        /// <summary>
        /// 収支テーブルから全件取得
        /// </summary>
        /// <returns></returns>
        public List <InvestmentTransactionData> SelectInvestmentTransaction()
        {
            // 以下は実際に使用する時の使い方の例
            MyDatabase db = MyDatabase.Instance;

            // データベースのテーブルを取得
            InvestmentTransactionTable investmentTransactionTable = db.GetInvestmentTransactionTable();

            return(investmentTransactionTable.SelectAll());
        }
        /// <summary>
        /// 収支テーブルの登録/更新
        /// </summary>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public bool InsertUpdateInvestmentTransaction(int shopId, int machineId, int machineNumber, int investment, int collection)
        {
            // 以下は実際に使用する時の使い方の例
            MyDatabase db = MyDatabase.Instance;

            // データベースのテーブルを取得
            InvestmentTransactionTable investmentTransaction = db.GetInvestmentTransactionTable();
            // トランザクションのためinsertしか行わない。更新はしない
            InvestmentTransactionData investmentData = new InvestmentTransactionData();

            // InsertまたはUpdate
            // ※同一の主キーのデータがあればUpdate、無ければInsertとなる
            investmentData.shopid        = shopId;
            investmentData.machineid     = machineId;
            investmentData.machinenumber = machineNumber;
            investmentData.investment    = investment;
            investmentData.collection    = collection;
            investmentTransaction.Update(investmentData);
            return(true);
        }