コード例 #1
0
        async Task AddMagneticCardNormalGroup()
        {
            db = slSecure.DB.GetDB();

            //非同步模擬成同步
            var q = await db.LoadAsync<tblMagneticCardNormalGroup>(from b in db.GetTblMagneticCardNormalGroupQuery() select b);
            tblMagneticCardNormalGroup bc = q.Last();

            db.tblMagneticCardNormalGroups.Add(

               new tblMagneticCardNormalGroup()
               {
                   //NormalID = bc.NormalID + 1,
                   NormalName = txt_NormalName.Text,
                   UpdateDate = DateTime.Now,
                   Memo = tb_Memo.Text
               }
               );
            try
            {
                bool res = await db.SubmitChangesAsync();
                MessageBox.Show("新增定期卡群組成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Adding Data failed due to " + ex.Message);
            }
        }
コード例 #2
0
        async void QueryMagneticCardNormalGroup()
        {
            db = slSecure.DB.GetDB();
            //非同步模擬成同步
            var q = await db.LoadAsync<tblMagneticCardNormalGroup>(db.GetTblMagneticCardNormalGroupQuery());
            dataGrid.ItemsSource = q;

            NewMagneticCardNormalGroup();
        }
コード例 #3
0
        async Task ModifyMagneticCardNormalGroup()
        {
            db = slSecure.DB.GetDB();
            var normalID = int.Parse(txt_NormalID.Text);
            //非同步模擬成同步
            var q = await db.LoadAsync<tblMagneticCardNormalGroup>(from b in db.GetTblMagneticCardNormalGroupQuery() where b.NormalID == normalID select b);
            tblMagneticCardNormalGroup bc = q.First();
            bc.NormalName = txt_NormalName.Text;
            bc.UpdateDate = DateTime.Now;
            bc.Memo = tb_Memo.Text;

            try
            {
                bool res = await db.SubmitChangesAsync();
                MessageBox.Show("修改定期卡群組成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Data updation failed due to " + ex.Message);
            }

        }
コード例 #4
0
        async Task DeleteMagneticCardNormalGroup()
        {
            db = slSecure.DB.GetDB();
            var normalID = int.Parse(txt_NormalID.Text);
            //非同步模擬成同步
            var q = await db.LoadAsync<tblMagneticCardNormalGroup>(from b in db.GetTblMagneticCardNormalGroupQuery() where b.NormalID == normalID select b);
            tblMagneticCardNormalGroup bc = q.First();

            db.tblMagneticCardNormalGroups.Remove(bc);
            try
            {
                bool res = await db.SubmitChangesAsync();
                MessageBox.Show("刪除定期卡群組成功!");
            }
            catch (Exception ex)
            {
                MessageBox.Show("Data deletion failed due to " + ex.Message);
            }
        }