private void ChangeClassesProgramPlanID(string id)
        {
            _logSaver.ClearBatch();

            List <JHClassRecord> classList = new List <JHClassRecord>();

            foreach (var cla in JHClass.SelectByIDs(K12.Presentation.NLDPanels.Class.SelectedSource))
            {
                cla.RefProgramPlanID = id;
                classList.Add(cla);

                string desc = string.Empty;
                if (string.IsNullOrEmpty(id))
                {
                    desc = string.Format("班級「{0}」不指定課程規劃", cla.Name);
                }
                else
                {
                    desc = string.Format("班級「{0}」指定課程規劃為:{1}", cla.Name, ProgramPlan.Instance.Items[id].Name);
                }
                _logSaver.AddBatch("成績系統.課程規劃", "班級指定課程規劃", desc);
            }
            if (classList.Count > 0)
            {
                JHClass.Update(classList);
                _logSaver.LogBatch();
            }
        }
Exemple #2
0
        private void ChangeClassesScoreCalcRuleID(string id)
        {
            _logSaver.ClearBatch();
            List <ClassRecordEditor> classRecordEditors = new List <ClassRecordEditor>();

            foreach (var cla in Class.Instance.SelectedList)
            {
                ClassRecordEditor editor = cla.GetEditor();
                editor.RefScoreCalcRuleID = id;
                classRecordEditors.Add(editor);

                string desc = string.Empty;
                if (string.IsNullOrEmpty(id))
                {
                    desc = string.Format("班級「{0}」不指定計算規則", cla.Name);
                }
                else
                {
                    desc = string.Format("班級「{0}」指定計算規則為:{1}", cla.Name, ScoreCalcRule.Instance.Items[id].Name);
                }
                _logSaver.AddBatch("成績系統.計算規則", "班級指定計算規則", desc);
            }
            if (classRecordEditors.Count > 0)
            {
                classRecordEditors.SaveAllEditors();
                _logSaver.LogBatch();

                // 同步班級JHDAL
                List <string> classIDs = (from data in Class.Instance.SelectedList select data.ID).ToList();
                JHClass.RemoveByIDs(classIDs);
                JHClass.SelectByIDs(classIDs);
            }
        }