Exemple #1
0
 public void TestMethod1()
 {
     BBook bll = new BBook();
     MBook model = new MBook();
     model.Name = "操作系统";
     model.Author = "不知道了";
     model.Press = 2;
     model.PressDateTime = new DateTime(1990, 10, 1);
     model.IsRead = 1;
     bool ret = bll.AddBook(model);
     Assert.AreEqual(ret, true);
 }
Exemple #2
0
        private void BTN_AddBook_Click(object sender, EventArgs e)
        {
            BBook bll = new BBook();
            MBook model = new MBook();
            Random random = new Random();
            int a = random.Next(10000, 100000);
            model.KeyID = DateTime.Now.ToString("yyyyMMddHHmmss") + "0" + a;
            model.Name = this.TXT_BookName.Text.ToString();
            model.Author = this.TXT_BookAuthor.Text.ToString();
            bool ret = bll.AddBook(model);

            if (ret == true)
            {
                MessageBox.Show("添加成功");
            }
            else
            {
                MessageBox.Show("添加不成功");
            }
        }