private void button1_Click(object sender, EventArgs e) { /** * ISettings tempSet = new CarSignalSettings(); * ModuleConfig.SaveSettings(tempSet, "test.config"); * Application.Exit(); * */ /** * SettingPair tsp = new SettingPair(); * tsp.ImplementClass = new CarSignalSettings().GetType(); * tsp.FilePath = "test.config"; * CSettings csetting = new CSetup(tsp).Settings as CSettings; * */ SettingPair sp1 = new SettingPair(); sp1.ImplementClass = new CarSignalSettings().GetType(); sp1.FilePath = "CarSignal.config"; SettingPair sp2 = new SettingPair(); sp2.ImplementClass = new MotorSignalSettings().GetType(); sp2.FilePath = "MotorSignal.config"; ExamSetup setupFrm = new ExamSetup(); Dictionary <string, SettingPair> tempSettings = new Dictionary <string, SettingPair>(); tempSettings.Add("汽车设置", sp1); tempSettings.Add("Test 2", sp2); setupFrm.ConfigTable = tempSettings; setupFrm.Show(); }
public object listexamsetup() { var examperiods = new List <ExamPeriod>(); examperiods.Add(ExamPeriod.Morning); examperiods.Add(ExamPeriod.Afternoon); examperiods.Add(ExamPeriod.Evening); var subjectuse = new List <int>(); foreach (var group in _context.SubjectGroups.Where(w => w.Status == StatusType.Active).OrderBy(o => o.ID)) { foreach (var subject in _context.Subjects.Where(w => w.Status == StatusType.Active & w.SubjectGroupID == group.ID).OrderBy(o => o.Order)) { subjectuse.Add(subject.ID); foreach (var period in examperiods) { var setup = _context.ExamSetups.Where(w => w.SubjectGroupID == group.ID & w.SubjectID == subject.ID & w.ExamPeriod == period).FirstOrDefault(); if (setup == null) { setup = new ExamSetup(); setup.ExamPeriod = period; setup.SubjectGroupID = group.ID; setup.SubjectID = subject.ID; setup.choosed = false; setup.Create_On = DateUtil.Now(); setup.Update_On = DateUtil.Now(); _context.ExamSetups.Add(setup); } } } } _context.SaveChanges(); var unuse = _context.ExamSetups.Where(w => !subjectuse.Contains(w.SubjectID)); if (unuse.Count() > 0) { _context.ExamSetups.RemoveRange(unuse); } _context.SaveChanges(); return(_context.ExamSetups.Select(s => new { id = s.ID, examperiod = s.ExamPeriod, examperiodname = s.ExamPeriod.toExamPeriodName(), choosed = s.choosed, group = s.SubjectGroup.Name, subject = s.Subject.Name, subjectorder = s.Subject.Order, create_on = DateUtil.ToDisplayDateTime(s.Create_On), create_by = s.Create_By, update_on = DateUtil.ToDisplayDateTime(s.Update_On), update_by = s.Update_By, }).OrderBy(o => o.examperiod).ThenBy(o => o.group).ThenBy(o => o.subjectorder).ToArray()); }
private void btnItemParam_Click(object sender, EventArgs e) { Dictionary <string, SettingPair> tempSettings = GetOptionConfigTable(); if (tempSettings.Count == 0) { return; } ExamSetup setupFrm = new ExamSetup(); setupFrm.ConfigTable = tempSettings; setupFrm.ShowDialog(); }