private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            if (rent == null)
            {
                return;
            }

            TBinfo.Text = rent.Info;
            if (!rent.Approved)
            {
                TBinfo.Text += " (未审核)";
            }
            TBinfo.Background = new SolidColorBrush(MyColor.NameColor(rent.Info, 0.2));
            TBinfo.Foreground = new SolidColorBrush(WindowIndex.textColor);

            TBhost.Content = "申请人: " + DatabaseLinker.GetName(rent.pId);

            Classroom c = Building.GetClassroom(rent.cId);

            if (c != null)
            {
                TBclassroom.Content = "教室: " + c.Name;
            }
            else
            {
                TBclassroom.Visibility      = Visibility.Collapsed;
                TBclassroom_Copy.Visibility = Visibility.Collapsed;
            }

            TBrentTime.Content = "时间: " + rent.Time.Display();

            List <int> listPId = DatabaseLinker.GetPIdList(rent.rId);

            TBtakepartinInfo.Content = "参加人数: " + listPId.Count;

            if (rent.Time.BeenOver)
            {
                TBChoose.Content = "课程已结束";
            }
            else if (father.personRentTable.Contains(rent.rId))
            {
                TBChoose.Content = "从我的课程表删除";
            }
            else
            {
                TBChoose.Content = "加入我的课程表";
            }

            if (rent.Approved || father.Peron is User)
            {
                TBOK.Visibility      = Visibility.Collapsed;
                TBDecline.Visibility = Visibility.Collapsed;
            }
        }
        // 系统消息初始化
        private void TextBlockMessageInitialize(TextBlock tb, SysMsg msg)
        {
            string sendName = DatabaseLinker.GetName(msg.SendId);

            tb.FontSize = 24;
            tb.Padding  = new Thickness(16);
            tb.Inlines.Add(new Bold(new Run(sendName + ": (" + msg.Time.ToString("yyyy/MM/dd") + ")\r\n")));
            tb.Inlines.Add(new Run("  " + msg.Info));
            tb.TextWrapping = TextWrapping.Wrap;

            //  tb.MouseEnter += tbRent_MouseEnter;
            //  tb.MouseLeave += tbRent_MouseLeave;

            tb.Tag = msg;
        }
        private void TBtakepartinInfo_MouseDown(object sender, MouseButtonEventArgs e)
        {
            string s = "";

            List <int> listPId = DatabaseLinker.GetPIdList(rent.rId);

            foreach (int pId in listPId)
            {
                s += DatabaseLinker.GetName(pId) + " ";
            }

            if (listPId.Count == 0)
            {
                s = "暂时没有人参加。";
            }
            MessageBox.Show(s, "参加同学名单");
        }
Exemple #4
0
        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            TBinfo.Text = person.Name + "申请的活动";
            TBinfo.Focus();

            TBhost.Content = "申请人: " + DatabaseLinker.GetName(person.pId);

            TBclassroom.Content = "教室: " + classroom.Name;

            for (int i = 0; i < 6; ++i)
            {
                if (classChosen >= RentTime.typicalClassRent[i, 0] && classChosen <= RentTime.typicalClassRent[i, 1])
                {
                    classStart = RentTime.typicalClassRent[i, 0];
                    classEnd   = RentTime.typicalClassRent[i, 1];
                }
            }
            TBrentTime.Content = "时间: " + date.Month + "月" + date.Day + "日, 第" + classStart + "节至第" + classEnd + "节";
        }
        //(管理员功能)查看未审核课程
        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);
        }