public WindowApplyRent(Person p, Classroom clsr, DateTime dt, int cc, WindowIndex f)
        {
            InitializeComponent();

            person = p;
            classroom = clsr;
            date = dt;
            classChosen = cc;
            father = f;

            if (father.WindowState == WindowState.Maximized)
            {
                Console.WriteLine("Max!");
                this.Width = 450;
                this.Height = 450;
                BorderBackground.Width = 450;
                BorderBackground.Height = 450;

                TBinfo.FontSize = 40;

                TBhost.FontSize =
                TBrentTime.FontSize =
                TBclassroom.FontSize =
                TBChoose.FontSize =
                TBexit.FontSize = 22;
            }
        }
        public WindowApplyRent(Person p, Classroom clsr, DateTime dt, int cc, WindowIndex f)
        {
            InitializeComponent();

            person = p;
            classroom = clsr;
            date = dt;
            classChosen = cc;
            father = f;
        }
        static public Classroom GetClassroom(int id)
        {
            Building b = GetBuilding(Classroom.CId2BId(id));

            if (null == b)
            {
                return(null);
            }

            foreach (Classroom c in b.Classrooms)
            {
                if (c.cId == id)
                {
                    return(c);
                }
            }
            return(null);
        }
        //初始化单个课程
        private void TextBlockInitialize(TextBlock tb, Rent r, bool MouseShow = true)
        {
            tb.Tag = r;

            tb.Background = MyColor.NameBrush(r.Info);
            tb.Text       = r.Info; if (!r.Approved)
            {
                tb.Text += "(未审核)";
            }
            Classroom c = Building.GetClassroom(r.cId); if (c != null)

            {
                tb.Text += ("@" + c.Name);
            }

            if (Father.WindowState == WindowState.Maximized)
            {
                tb.FontSize = 16;
            }
            else
            {
                tb.FontSize = 14;
            }

            tb.Foreground   = new SolidColorBrush(WindowIndex.textColor);
            tb.TextWrapping = TextWrapping.Wrap;


            tb.SetValue(Grid.ColumnProperty, r.Time.WeekDay);
            tb.SetValue(Grid.RowProperty, r.Time.StartClass - 1);
            tb.SetValue(Grid.RowSpanProperty, r.Time.KeepClass);

            tb.MouseDown += tb_MouseDown;

            if (MouseShow)
            {
                tb.MouseEnter += tb_MouseEnter;
                tb.MouseLeave += tb_MouseLeave;
            }
        }
        //(管理员功能)查看未审核课程
        private void TextBlockUnapprovedRentInitialize(TextBlock tb, Rent r)
        {
            string    applicantName = DatabaseLinker.GetName(r.pId);
            string    s             = r.Info;
            Classroom c             = Building.GetClassroom(r.cId); if (c != null)

            {
                s += ("@" + c.Name);
            }

            tb.Inlines.Add(new Bold(new Run(applicantName + ":\r\n")));
            tb.Inlines.Add(new Run("  " + s));

            tb.FontSize = 24;
            tb.Padding  = new Thickness(16);

            tb.MouseDown  += tbRent_MouseDown;
            tb.MouseEnter += tbRent_MouseEnter;
            tb.MouseLeave += tbRent_MouseLeave;

            tb.Tag = r;
        }
        public string Display()
        {
            string s = "";

            s += info + "\r\n";
            s += "申请人: " + DatabaseLinker.GetName(pId) + " 编号: R" + rid + "\r\n";

            Classroom c = Building.GetClassroom(cid);

            if (c != null)
            {
                s += "教室: " + c.Name + "  ";
            }
            s += "上课时间: " + Time.Display();


            //s += " :: ";
            //foreach (int id in Students)
            //{
            //    s += DatabaseLinker.GetName(id)+" ";
            //}

            return(s);
        }
        public WindowApplyRent(Person p, Classroom clsr, DateTime dt, int cc, WindowIndex f,string str)
        {
            InitializeComponent();

            person = p;
            classroom = clsr;
            date = dt;
            classChosen = cc;
            father = f;
            if (str == "big")
            {
                this.Width = 450;
                this.Height = 450;
                BorderBackground.Width = 450;
                BorderBackground.Height = 450;

                TBinfo.FontSize = 40;
                TBhost.FontSize = 22;
                TBrentTime.FontSize = 22;
                TBclassroom.FontSize = 22;
                TBChoose.FontSize = 22;
                TBexit.FontSize = 22;
            }
        }
        //设置教室。在教室发生变化的时候切换UI
        private void SetCId(int cId)
        {
            Classroom C = Building.GetClassroom(cId);
            if (null == C) return;
            if (classroom != null && classroom.cId == C.cId) return;

            TextBoxCId.Text = cId.ToString();

            classroom = C;

            LabelClassroom.Content = classroom.Name + "的第" + Schedule.CurrWeek + "周";

            sch2.ChangeOwner(classroom);

            checkoutWeek();
            ChosenRentControl();
        }
        //设置教室。在教室发生变化的时候切换UI
        private void SetCId(int cId)
        {
            Classroom C = Building.GetClassroom(cId);
            if (null == C) return;
            if (classroom != null && classroom.cId == C.cId) return;

            classroom = C;
            schedule2 = DatabaseLinker.GetClassroomRentTable(cId);
            LabelClassroom.Content = classroom.Name + "的第" + currWeek + "周";

            ScheduleInitialize(GridSchedule2, schedule2, TextBlockRents2, RectangleChosonClass2);

            ChosenRentControl();
        }