Beispiel #1
0
 private void Preloader_DoWork(object sender, DoWorkEventArgs e)
 {
     PPCollection = new ProgramPlanCollection();
     foreach (JHProgramPlanRecord record in JHProgramPlan.SelectAll())
     {
         PPCollection.Add(record.ID, record);
     }
 }
        private void InitialProgramPlanList()
        {
            //if (!ProgramPlan.Instance.Loaded) ProgramPlan.Instance.SyncAllBackground();
            cboProgramPlan.Items.Add("<不指定>");

            foreach (var item in JHProgramPlan.SelectAll())
            {
                cboProgramPlan.Items.Add(item);
            }
        }
Beispiel #3
0
        private void Button_PopupOpen(object sender, PopupOpenEventArgs e)
        {
            RibbonBarButton button = sender as RibbonBarButton;

            entity = "" + button.Tag;
            if (entity == "Class" && K12.Presentation.NLDPanels.Class.SelectedSource.Count <= 0)
            {
                return;
            }
            if (entity == "Student" && K12.Presentation.NLDPanels.Student.SelectedSource.Count <= 0)
            {
                return;
            }

            foreach (var item in JHProgramPlan.SelectAll())
            {
                MenuButton mb = e.VirtualButtons[item.Name];
                mb.Tag    = item.ID;
                mb.Click += new EventHandler(ChangeProgramPlanID);
            }
        }
Beispiel #4
0
        /// <summary>
        /// 設定使用者介面
        /// </summary>
        public void SetupPresentation()
        {
            if (_initialize)
            {
                return;
            }

            programPlanCache = new Dictionary <string, JHProgramPlanRecord>();

            _classProgramPlanField.PreloadVariableBackground += delegate
            {
                foreach (JHProgramPlanRecord record in JHProgramPlan.SelectAll())
                {
                    if (!programPlanCache.ContainsKey(record.ID))
                    {
                        programPlanCache.Add(record.ID, record);
                    }
                }
            };

            _classProgramPlanField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                JHProgramPlanRecord record = GetProgramPlan(JHClass.SelectByID(e.Key));

                if (record != null)
                {
                    e.Value = record.Name;
                }
                else
                {
                    e.Value = "";
                }
            };
            K12.Presentation.NLDPanels.Class.AddListPaneField(_classProgramPlanField);

            _studentProgramPlanField.PreloadVariableBackground += delegate
            {
                foreach (JHProgramPlanRecord record in JHProgramPlan.SelectAll())
                {
                    if (!programPlanCache.ContainsKey(record.ID))
                    {
                        programPlanCache.Add(record.ID, record);
                    }
                }
            };

            _studentProgramPlanField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                JHStudentRecord     stu    = JHStudent.SelectByID(e.Key);
                JHProgramPlanRecord record = GetProgramPlan(stu);
                if (record != null)
                {
                    e.Value = string.IsNullOrEmpty(stu.OverrideProgramPlanID) ? record.Name : "(指定)" + record.Name;
                }
                else
                {
                    e.Value = "";
                }
            };
            K12.Presentation.NLDPanels.Student.AddListPaneField(_studentProgramPlanField);

            JHClass.AfterUpdate += delegate
            {
                _classProgramPlanField.Reload();
            };

            JHStudent.AfterUpdate += delegate
            {
                _studentProgramPlanField.Reload();
            };

            AddAssignProgramPlanButtons();

            _initialize = true;
        }