Ejemplo n.º 1
0
 public void AddToMyRentTable(int rId)
 {
     if (DatabaseLinker.AddTakepartin(pId, rId))
     {
         RentTable = DatabaseLinker.GetPersonRentTable(pid);
     }
 }
        private void TBChoose_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (rent.Time.BeenOver)
            {
                MessageBox.Show("这个课程或活动已经结束了。");
                return;
            }

            if (father.personRentTable.Contains(rent.rId))
            {
                if (MessageBox.Show("确定删除 \"" + rent.Info + "\"?", "删除课程", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                {
                    DatabaseLinker.DeleteTakepartin(father.Peron.pId, rent.rId);
                    father.personRentTable.Remove(rent);
                    father.RefreshSchedule();
                    this.Close();
                }
            }
            else
            {
                Rent rr = father.personRentTable.Add(rent.rId);
                if (rr == null)
                {
                    DatabaseLinker.AddTakepartin(father.Peron.pId, rent.rId);
                }
                else
                {
                    MessageBox.Show("添加失败。此课程同您的课程 \"" + rr.Info + "\" 存在冲突。");
                    if (!rent.Time.OnceActivity)
                    {
                        father.GotoDateClass(rr.Time.StartDate, rr.Time.StartClass);
                    }
                }

                father.RefreshSchedule();

                this.Close();
            }
        }