Ejemplo n.º 1
0
        private void AddScoreToGrpStd(int StdNum)
        {
            if (StdNum == -1)
            {
                return;
            }
            stds.Find(s => s.Number == StdNum).Score++;
            Group grp = groups.Find(g => g.Leader.Number == StdNum);

            if (grp != null)
            {
                grp.Score++; return;
            }
            foreach (var gr in groups)
            {
                Std stemp = gr.Members.Find(s => s.Number == StdNum);
                if (stemp != null)
                {
                    grp = groups.Find(g => g.Order == stemp.Group); break;
                }
            }
            if (grp != null)
            {
                grp.Score++;
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 实例化小组
 /// </summary>
 /// <param name="stds">学生列表</param>
 /// <param name="info">小组信息</param>
 public Group(List <Std> stds, GroupInfo info)
 {
     Members      = new List <Std>();
     Name         = info.Name;
     Order        = info.Order;
     Leader       = stds.Find(s => s.Number == info.LeaderNum);
     Leader.Group = Order;
     foreach (int n in info.MembersNum)
     {
         Members.Add(stds.Find(s => s.Number == n));
     }
     foreach (Std i in Members)
     {
         i.Group = Order;
     }
     Score = 0;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// 为指定学生加分
        /// </summary>
        private void AddStdWithInfo_Click(object sender, RoutedEventArgs e)
        {
            int StdNum = 0;

            if (int.TryParse(GlobalInfo.AddScoreStdInfo, out StdNum))
            {
                Std stemp = stds.Find(s => s.Number == StdNum);
                if (stemp != null)
                {
                    stemp.Score++;
                    Group grp = groups.Find(g => g.Leader.Number == StdNum);
                    if (grp != null)
                    {
                        grp.Score++;
                        GlobalInfo.AddScoreResult = "已为\n" + stemp.Name + "及其小组积分";
                        return;
                    }
                    foreach (var gr in groups)
                    {
                        stemp = gr.Members.Find(s => s.Number == StdNum);
                        if (stemp != null)
                        {
                            grp = groups.Find(g => g.Order == stemp.Group); break;
                        }
                    }
                    if (grp != null)
                    {
                        grp.Score++;
                    }
                    GlobalInfo.AddScoreResult = "已为\n" + stemp.Name + "及其小组积分";
                    return;
                }
                else
                {
                    GlobalInfo.AddScoreResult = "未找到\n学号为" + StdNum + "的学生";
                    return;
                }
            }
            else
            {
                Std stemp = stds.Find(s => s.Name == GlobalInfo.AddScoreStdInfo);
                if (stemp != null)
                {
                    stemp.Score++;
                    Group grp = groups.Find(g => g.Leader.Name == GlobalInfo.AddScoreStdInfo);
                    if (grp != null)
                    {
                        grp.Score++;
                        GlobalInfo.AddScoreResult = "已为\n" + GlobalInfo.AddScoreStdInfo + "及其小组积分";
                        return;
                    }
                    foreach (var gr in groups)
                    {
                        stemp = gr.Members.Find(s => s.Name == GlobalInfo.AddScoreStdInfo);
                        if (stemp != null)
                        {
                            grp = groups.Find(g => g.Order == stemp.Group); break;
                        }
                    }
                    if (grp != null)
                    {
                        grp.Score++;
                    }
                    GlobalInfo.AddScoreResult = "已为\n" + GlobalInfo.AddScoreStdInfo + "及其小组积分";
                    return;
                }
                else
                {
                    GlobalInfo.AddScoreResult = "未找到\n姓名为" + GlobalInfo.AddScoreStdInfo + "的学生";
                    return;
                }
            }
        }