コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: Relika/Praktika2
        public void Bnsubmit_Click(object sender, RoutedEventArgs e)
        {
            Lbstatus.Content = "";
            if (TbUID.Text.ToString() != "" || Tbquantity.Text.ToString() != "")
            {
                UID uid = new UID();
                uid.Uid = TbUID.Text.Replace('/', '-');
                if (CbQuantityOff.IsChecked == true)
                {
                    uid.Quantity = "0";
                }
                uid.Quantity = Tbquantity.Text.Replace(',', '.');

                uid.Source         = System.Configuration.ConfigurationManager.AppSettings["Source"];
                uid.Event_date_UMS = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
                Lbstatus.Content   = SQLiteDBConnection.UpSert(uid);
                if (Lbstatus.Content.ToString().StartsWith("Row added, UID: "))
                {
                    TbUID.Text      = "";
                    Tbquantity.Text = "0";
                    TbUID.Focus();
                }
            }
            else
            {
                Lbstatus.Content = "UID is empty";
                logger.Info("UID is empty");
                TbUID.Focus();
            }
        }
コード例 #2
0
        public void TestInsert()
        {
            UID uid = new UID();

            uid.Uid            = "68563427";
            uid.Quantity       = "5";
            uid.Source         = "source";
            uid.Event_date_UMS = "5765475";
            uid.Entry_date     = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds().ToString();
            //SQLiteDBConnection.GetConnection();
            SQLiteDBConnection.Insert(uid);
        }
コード例 #3
0
        public void TestUpsert()
        {
            UID uid = new UID();

            uid.Uid            = "79879";
            uid.Quantity       = "10";
            uid.Source         = "source";
            uid.Event_date_UMS = "576540000";
            string status  = SQLiteDBConnection.UpSert(uid);
            string status2 = SQLiteDBConnection.StartTrigger();

            Assert.AreEqual("Row added", status);
            Assert.AreEqual("Entry date updated", status2);
        }
コード例 #4
0
        public void TestRandomUID()
        {
            int i = 0;

            String[] names = { "UID", "RMA" };
            Random   rand  = new Random();

            while (i < 800000)
            {
                UID    uid          = new UID();
                String result       = names[rand.Next(names.Length)];
                int    randomNumber = rand.Next(10000000, 99999999);
                uid.Uid            = result + randomNumber;
                uid.Quantity       = "4";
                uid.Source         = "random";
                uid.Event_date_UMS = GetRandomTime();
                SQLiteDBConnection.Insert(uid);
                //string status2 = SQLiteDBConnection.StartTrigger();
                //Assert.IsNotNull(status);
                //Assert.AreEqual("Entry date updated", status2);
                i++;
            }
        }