예제 #1
0
        public AccountDTO CheckUser(LoginDTO login, DeviceDTO deviceDTO)
        {
            ILogin     loginlogic = new SignLogic();
            AccountDTO accountDTO = new AccountDTO();

            accountDTO = loginlogic.GetLogin(login, deviceDTO);

            return(accountDTO);
        }
예제 #2
0
        public bool GetRegistration(RegistrationDTO registrationDTO)
        {
            IRegistration registrationlogic = new SignLogic();

            return(registrationlogic.GetRegistred(registrationDTO));
        }
        public void GetData(UIResult result, MetroWindow window)
        {
            _window       = window;
            _window.Title = $"{result.Name} 结果";

            var value = WebAPI.Instance.GetMixedResult(result.TaskID);

            if (!value.Item1)
            {
                if (value.Item3.IndexOf("签名非法") != -1)
                {
                    if (SignLogic.SignCheck())
                    {
                        value = WebAPI.Instance.GetMixedResult(result.TaskID);
                    }
                }
            }

            if (value.Item1)
            {
                // 获取模型
                var model = value.Item2;

                // 结果班级
                _resultClasses = model.ResultClasses?.ToList();

                // 走班模型
                var cl = CommonDataManager.GetCLCase(base.LocalID);

                // 课时详细
                var details = (from c in model.ResultClasses
                               from rc in c.ResultDetails
                               select new
                {
                    c.ClassID,
                    rc.ClassHourId,
                    rc.DayPeriod
                });

                List <UITeacher> teachers = new List <UITeacher>();

                foreach (var rc in model.ResultClasses)
                {
                    var classModel = cl.GetClassByID(rc.ClassID);

                    if (rc.ResultDetails != null)
                    {
                        foreach (var rd in rc.ResultDetails)
                        {
                            Button rb = new Button();
                            rb.Style      = (Style)window.FindResource("ItemStyle");
                            rb.Background = this.GetRandomColor(classModel.CourseID);
                            rb.Click     += Rb_Click;
                            rb.Content    = classModel.Display;
                            rb.Opacity    = 0.9;
                            rb.FontSize   = 13;
                            rb.Margin     = new System.Windows.Thickness(2);

                            var position = this.Results.FirstOrDefault(r => r.Period.Period == rd.DayPeriod.Period);
                            if (position != null)
                            {
                                if (rd.DayPeriod.Day == DayOfWeek.Friday)
                                {
                                    position.Fridays.Add(rb);
                                }
                                else if (rd.DayPeriod.Day == DayOfWeek.Thursday)
                                {
                                    position.Thursdays.Add(rb);
                                }
                                else if (rd.DayPeriod.Day == DayOfWeek.Wednesday)
                                {
                                    position.Wednesdays.Add(rb);
                                }
                                else if (rd.DayPeriod.Day == DayOfWeek.Tuesday)
                                {
                                    position.Tuesdays.Add(rb);
                                }
                                else if (rd.DayPeriod.Day == DayOfWeek.Monday)
                                {
                                    position.Mondays.Add(rb);
                                }
                                else if (rd.DayPeriod.Day == DayOfWeek.Saturday)
                                {
                                    position.Saturdays.Add(rb);
                                }
                                else if (rd.DayPeriod.Day == DayOfWeek.Sunday)
                                {
                                    position.Sundays.Add(rb);
                                }
                            }

                            _buttons.Add(rb);
                        }
                    }

                    #region 获取教师信息

                    var classHourIDs = from c in details select c.ClassHourId;
                    var classHours   = cl.GetClassHours(classHourIDs?.ToArray());
                    classHours?.ForEach(ch =>
                    {
                        ch.Teachers.ForEach(t =>
                        {
                            var teacher = teachers.FirstOrDefault(tt => tt.ID.Equals(t.ID));
                            if (teacher == null)
                            {
                                teachers.Add(new UITeacher()
                                {
                                    ID           = t.ID,
                                    Name         = t.Name,
                                    ClassHourIDs = new List <int> {
                                        ch.ID
                                    }
                                });
                            }
                            else
                            {
                                var has = teacher.ClassHourIDs.Contains(ch.ID);
                                if (!has)
                                {
                                    teacher.ClassHourIDs.Add(ch.ID);
                                }
                            }
                        });
                    });

                    #endregion
                }

                this.Teachers      = teachers;
                this.SelectTeacher = teachers.FirstOrDefault();
            }
        }
        public void GetData(UIResult result, MetroWindow window)
        {
            _resultDetailsWindow       = window;
            _resultDetailsWindow.Title = $"{result.Name} 结果";

            var cp = CommonDataManager.GetCPCase(base.LocalID);

            _courses = cp.Courses;

            var value = WebAPI.Instance.GetAdminResult(result.TaskID);

            if (!value.Item1)
            {
                if (value.Item3.IndexOf("签名非法") != -1)
                {
                    if (SignLogic.SignCheck())
                    {
                        value = WebAPI.Instance.GetAdminResult(result.TaskID);
                    }
                }
            }

            if (value.Item1)
            {
                _resultClasses = value.Item2.ResultClasses?.ToList();

                List <UIClass>   classes  = new List <UIClass>();
                List <UITeacher> teachers = new List <UITeacher>();

                if (_resultClasses != null)
                {
                    // 1.根据结果获取班级
                    foreach (var rc in _resultClasses)
                    {
                        var classInfo = cp.Classes.FirstOrDefault(c => c.ID.Equals(rc.ClassID));
                        if (classInfo != null)
                        {
                            UIClass uiClass = new UIClass()
                            {
                                ID   = classInfo.ID,
                                Name = classInfo.Name
                            };
                            classes.Add(uiClass);
                        }
                    }

                    // 2.根据班级获取教师
                    var classHourIDs = from c in _resultClasses from rd in c.ResultDetails select rd.ClassHourId;
                    var classHours   = cp.GetClassHours(classHourIDs?.ToArray());
                    classHours?.ForEach(ch =>
                    {
                        ch.Teachers.ForEach(t =>
                        {
                            var teacher = teachers.FirstOrDefault(tt => tt.ID.Equals(t.ID));
                            if (teacher == null)
                            {
                                teachers.Add(new UITeacher()
                                {
                                    ID           = t.ID,
                                    Name         = t.Name,
                                    ClassHourIDs = new List <int> {
                                        ch.ID
                                    }
                                });
                            }
                            else
                            {
                                teacher.ClassHourIDs.Add(ch.ID);
                            }
                        });
                    });
                }

                this.Classes     = classes;
                this.SelectClass = this.Classes.FirstOrDefault();

                this.Teachers      = teachers;
                this.SelectTeacher = teachers?.FirstOrDefault();
            }
        }