示例#1
0
        private void ShowData_Click(object sender, RoutedEventArgs e)
        {
            /*List<People> peoples = new List<People>();
             * finalresult.Text = "1";
             * peoples = MineSQLite.GetData();
             * finalresult.Text = "2";
             * String result = "";
             * foreach(People x in peoples)
             * {
             *  result = result + "工号:" + x.id + "姓名:" + x.name + "年龄:" + x.age + "性别:" + x.sex + "\n";
             * }
             * finalresult.Text = result;
             */
            string data = "";

            int i = 0;

            while (i < 20)
            {
                //自己写的faker类的返回的一个json字符串
                data = FakerData.fakername();
                //JsonReader jsonReader = new JsonReader(new StringReader(data));
                //不要像上面那样用,直接反序列化相应的对象就可以了,要结合faker类的RuleFor用
                People people = JsonConvert.DeserializeObject <People>(data);
                MineSQLite.AddData(people);
                ++i;
            }
            System.Diagnostics.Debug.WriteLine(data);
            //ole.WriteLine("Json格式字符串:");
            finalresult.Text = data;
        }
示例#2
0
 private void AddData_Click(object sender, RoutedEventArgs e)
 {
     while (i < 20)
     {
         People people = new People {
             id = i, name = "张金龙", age = 20, sex = 1
         };
         MineSQLite.AddData(people);
         ++i;
     }
     finalresult.Text = "添加完成";
 }
示例#3
0
 /// <summary>
 /// 初始化单一实例应用程序对象。这是执行的创作代码的第一行,
 /// 已执行,逻辑上等同于 main() 或 WinMain()。
 /// </summary>
 public App()
 {
     this.InitializeComponent();
     this.Suspending += OnSuspending;
     MineSQLite.InitializaDatabase();
 }
示例#4
0
 private void DeleteData_Click(object sender, RoutedEventArgs e)
 {
     MineSQLite.deleteData();
     System.Diagnostics.Debug.WriteLine("删除数据成功");
 }