示例#1
0
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            string name      = NameTextBox.Text;
            string writter   = WritterTextBox.Text;
            string time      = TimeTextBox.Text;
            string publisher = PublishTextBox.Text;
            string page      = PageTextBox.Text;
            string id        = NumberTextBox.Text;

            Thread thread = new Thread(threadStart);

            thread.Start();

            Book deletebook = new Book();

            for (int i = 0; i < remineder.Count; i++)
            {
                if (name == remineder[i].name && writter == remineder[i].writter && time == remineder[i].time &&
                    publisher == remineder[i].publisher && page == remineder[i].page && id == remineder[i].ID)
                {
                    IsRightForm isright = new IsRightForm();
                    if (isright.show())
                    {
                        deletebook.Delete(i);
                        BookDataGridView.Rows.Clear();
                        NumberTextBox.Clear();
                        NameTextBox.Clear();
                        WritterTextBox.Clear();
                        TimeTextBox.Clear();
                        PublishTextBox.Clear();
                        PageTextBox.Clear();
                        ShowAllBook();
                        break;
                    }
                }
                else if (i == remineder.Count - 1)
                {
                    MessageBox.Show("此书不存在");
                    break;
                }
            }
            //摧毁线程
            thread.Abort();
        }
示例#2
0
 public string ShowBorrow()
 {
     this.ShowDialog();
     if (click_button)
     {
         IsRightForm isright = new IsRightForm();
         if (isright.show())
         {
             return(IDTextBox.Text + " " + NameTextBox.Text);
         }
         else
         {
             return("");
         }
     }
     else
     {
         return("");
     }
 }
示例#3
0
        private void RightButton_Click(object sender, EventArgs e)
        {
            IsRightForm isright = new IsRightForm();

            if (isright.show())
            {
                if (NameTextBox.Text != "" && AgeTextBox.Text != "" && SexTextBox.Text != "" && EthnicTextBox.Text != "")
                {
                    OnTimeEventFuntion(NameTextBox.Text, AgeTextBox.Text, SexTextBox.Text, EthnicTextBox.Text, BrithdayDateTimePicker.Value.ToString("yyyy-MM-dd"), RegisterDateTimePicker.Value.ToString("yyyy-MM-dd"));
                    NameTextBox.Clear();
                    AgeTextBox.Clear();
                    SexTextBox.Clear();
                    EthnicTextBox.Clear();
                    MessageBox.Show("新用户添加成功");
                }
                else
                {
                    MessageBox.Show("消息填写不完整");
                }
            }
        }
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            string id        = IDTextBox.Text;
            string name      = NameTextBox.Text;
            string age       = AgeTextBox.Text;
            string sex       = SexTextBox.Text;
            string ethnic    = EthnicTextBox.Text;
            string birthday  = BrithdayTextBox.Text;
            string registday = RegistTextBox.Text;

            Thread thread = new Thread(threadStart);

            thread.Start();

            User userbook = new User();

            for (int i = 0; i < remineder.Count; i++)
            {
                if (id == remineder[i].ID && name == remineder[i].name && age == remineder[i].age && sex == remineder[i].sex &&
                    ethnic == remineder[i].ethnic && birthday == remineder[i].brithday && registday == remineder[i].register)
                {
                    IsRightForm isright = new IsRightForm();
                    if (isright.show())
                    {
                        userbook.Delete(i);
                        UserDataGridView.Rows.Clear();
                        ShowAllBook();
                        MessageBox.Show("删除用户成功");
                        break;
                    }
                }
                else if (i == remineder.Count - 1)
                {
                    MessageBox.Show("输入信息有误");
                    break;
                }
            }
            //摧毁线程
            thread.Abort();
        }