public void upload(UIResult result)
        {
            var adjustRecord = base.LocalID.DeSerializeAdjustRecord <ResultAdjustmentModel>(result.TaskID);

            if (adjustRecord == null)
            {
                this.ShowDialog("提示信息", "没有调整记录,无法上传!", DialogSettingType.OnlyOkButton, DialogType.Warning);
                return;
            }

            var confirm = this.ShowDialog("提示信息", "确认上传方案?", DialogSettingType.OkAndCancel, DialogType.Warning);

            if (confirm == DialogResultType.OK)
            {
                var operation = WebAPI.Instance.WriteBackResult(result.TaskID, adjustRecord);
                if (operation.Item1)
                {
                    result.IsUploaded = true;
                    var local   = CommonDataManager.GetLocalCase(base.LocalID);
                    var results = ResultDataManager.GetResults(base.LocalID);
                    local.Serizlize(results);
                    this.ShowDialog("提示信息", "上传成功!", DialogSettingType.NoButton, DialogType.None);
                }
                else
                {
                    this.ShowDialog("提示信息", operation.Item3, DialogSettingType.OnlyOkButton, DialogType.Warning);
                }
            }
        }
Example #2
0
        public void Initilize()
        {
            Messenger.Default.Register <HostView>(this, save);

            this.Comments = CommonDataManager.GetAdminRuleComments(AdministrativeRuleEnum.LockedCourse);

            var tempResults = ResultDataManager.GetResults(base.LocalID);

            this.Results = tempResults.Where(r => r.IsUsed)?.ToList();

            var local = CommonDataManager.GetLocalCase(base.LocalID);

            _colors = local.CourseColors;

            #region 获取规则

            var rule = CommonDataManager.GetAminRule(base.LocalID);
            if (rule.TimeTableLockedTimes == null)
            {
                _lockedRule = new TimeTableLockRule();
            }
            else
            {
                _lockedRule = new TimeTableLockRule()
                {
                    LockedTimeTable = rule.TimeTableLockedTimes.LockedTimeTable?.Select(t =>
                    {
                        return(new LockedClassTimeTable()
                        {
                            ClassID = t.ClassID,
                            LockedCourseTimeTable = t.LockedCourseTimeTable?.Select(tt =>
                            {
                                return new LockedClassCourseTimeTable()
                                {
                                    CourseID = tt.CourseID,
                                    LockedTimes = tt.LockedTimes?.ToList()
                                };
                            })?.ToList()
                        });
                    })?.ToList()
                };
            }

            #endregion

            #region 锁定任务ID

            if (local.LockedTaskID != 0)
            {
                this.SelectResult = this.Results.FirstOrDefault(r => r.TaskID.Equals(local.LockedTaskID));
                if (this.SelectResult != null)
                {
                    Refresh();
                }
            }

            #endregion
        }
        public void Initilize()
        {
            var results = ResultDataManager.GetResults(base.LocalID);

            if (results != null)
            {
                this.Results = new ObservableCollection <UIResult>(results);
            }
        }
        public void Delete(UIResult result)
        {
            var confirm = this.ShowDialog("提示信息", $"是否确认删除?\r\n {result.Name}", DialogSettingType.OkAndCancel, DialogType.Warning);

            if (confirm == DialogResultType.OK)
            {
                Results.Remove(result);
                var results = ResultDataManager.GetResults(base.LocalID);
                results.RemoveAll(r => r.TaskID == result.TaskID);

                var caseModel = CommonDataManager.GetLocalCase(base.LocalID);
                if (caseModel != null)
                {
                    caseModel.Serizlize(results);
                }
            }
        }
        public void precharge(UIResult result)
        {
            var sample = WebAPI.Instance.SampleTask(result.TaskID);

            if (sample.Item1)
            {
                // 预览
                PrechargeResultWindow precharge = new PrechargeResultWindow(result.Name, sample.Item2);
                precharge.Closed += (s, arg) =>
                {
                    // 如果预览结果为True.
                    if (precharge.DialogResult == true)
                    {
                        var results = ResultDataManager.GetResults(base.LocalID);
                        var local   = CommonDataManager.GetLocalCase(base.LocalID);

                        if (precharge.IsUseResult)
                        {
                            var value = WebAPI.Instance.ConfirmTask(result.TaskID);
                            if (value.Item1)
                            {
                                result.IsUsed = true;
                                local.Serizlize(results);

                                // 更新界面
                                var uiTask = this.Results.FirstOrDefault(r => r.TaskID.Equals(result.TaskID));
                                if (uiTask != null)
                                {
                                    uiTask.IsUsed = true;
                                    uiTask.RaiseChanged();
                                }

                                this.ShowDialog("提示信息", "操作成功!", DialogSettingType.NoButton, DialogType.None);
                            }
                            else
                            {
                                this.ShowDialog("提示信息", "操作失败!", DialogSettingType.OnlyOkButton, DialogType.Warning);
                            }
                        }
                        else
                        {
                            var value = WebAPI.Instance.AbandonTask(result.TaskID);
                            if (value.Item1)
                            {
                                this.Results.Remove(result);
                                results.RemoveAll(r => r.TaskID == result.TaskID);
                                local.Serizlize(results);

                                this.ShowDialog("提示信息", "操作成功!", DialogSettingType.NoButton, DialogType.None);
                            }
                            else
                            {
                                this.ShowDialog("提示信息", "操作失败!", DialogSettingType.OnlyOkButton, DialogType.Warning);
                            }
                        }
                    }
                };
                precharge.ShowDialog();
            }
            else
            {
                this.ShowDialog("提示信息", sample.Item3, DialogSettingType.OnlyOkButton, DialogType.Warning);
            }
        }
Example #6
0
 public void Initilize()
 {
     this.Results = ResultDataManager.GetResults(base.LocalID);
 }
Example #7
0
        public void Initilize()
        {
            var tempResults = ResultDataManager.GetResults(base.LocalID);

            this.Results = tempResults.Where(r => r.IsUsed)?.ToList();
        }