public async Task ServerModule_SayFormalHello_EmptyName_ShouldThrowException() { //Arrange var fakeHelloServices = Mock.Of <IIndex <string, IHelloService> >(); var fakeArtistSearchService = Mock.Of <IArtistSearchService>(); var bootstrapper = new ConfigurableBootstrapper(with => { var module = new ServerModule(fakeHelloServices, fakeArtistSearchService); with.Module(module); }); var browser = new Browser(bootstrapper, defaults: to => to.Accept("application/json")); //Act var result = await browser.Get("/SayHello", with => { with.Query("name", string.Empty); with.HttpRequest(); }); //Assert result.StatusCode.Should().Be(HttpStatusCode.BadRequest); result.Body.AsString().Should().Be("A name must be specified"); }
static public void Main() { ServerModule.AutoManaged("https://module.ischool.com.tw/module/193005/k12.service_learning.creationitems/udm.xml"); //服務學習資料項目 RibbonBarItem insert = MotherForm.RibbonBarItems["學務作業", "線上作業"]; insert["服務學習線上開設"].Size = RibbonBarButton.MenuButtonSize.Medium; insert["服務學習線上開設"].Enable = Permissions.務學習線上開設權限; insert["服務學習線上開設"].Click += delegate { new CreationItem().ShowDialog(); }; Catalog ribbon1 = RoleAclSource.Instance["學務作業"]; ribbon1.Add(new FISCA.Permission.RibbonFeature(Permissions.務學習線上開設, "服務學習線上開設")); MenuButton mb = MotherForm.RibbonBarItems["學生", "資料統計"]["報表"]["學務相關報表"]; mb["服務學習記錄卡"].Enable = Permissions.務學習記錄卡權限; mb["服務學習記錄卡"].Click += delegate { new RecordCard().ShowDialog(); }; Catalog ribbon2 = RoleAclSource.Instance["學生"]["報表"]; ribbon2.Add(new FISCA.Permission.RibbonFeature(Permissions.務學習記錄卡, "服務學習記錄卡")); }
public async Task ServerModule_SayInformalHello_NoHelloServiceImplementation_ShouldThrowException() { //Arrange var name = "John Doe"; var fakeHelloServices = Mock.Of <IIndex <string, IHelloService> >(); var fakeHelloService = default(IHelloService); Mock.Get(fakeHelloServices).Setup(it => it.TryGetValue(It.IsAny <string>(), out fakeHelloService)) .Returns(false); var fakeArtistSearchService = Mock.Of <IArtistSearchService>(); var bootstrapper = new ConfigurableBootstrapper(with => { var module = new ServerModule(fakeHelloServices, fakeArtistSearchService); with.Module(module); }); var browser = new Browser(bootstrapper, defaults: to => to.Accept("application/json")); //Act BrowserResponse result = null; Func <Task> act = async() => result = await browser.Get($"/SayHello2/{HttpUtility.UrlEncode(name)}", with => { with.Query("name", name); with.HttpRequest(); }); //Assert act.ShouldNotThrow(); result.StatusCode.Should().Be(HttpStatusCode.InternalServerError); result.Body.AsString().Should().Be("No HelloService implementation was found"); Mock.Get(fakeHelloServices).Verify(it => it.TryGetValue(It.Is <string>(p => p == "Informal"), out fakeHelloService), Times.Once); }
public async Task ServerModule_SayFormalHello_Ok() { //Arrange var name = "John Doe"; var fakeHelloServices = Mock.Of <IIndex <string, IHelloService> >(); var helloMessage = "Hello Test"; var fakeHelloService = Mock.Of <IHelloService>(it => it.Hello(It.IsAny <string>()) == helloMessage); Mock.Get(fakeHelloServices).Setup(it => it.TryGetValue(It.IsAny <string>(), out fakeHelloService)) .Returns(true); var fakeArtistSearchService = Mock.Of <IArtistSearchService>(); var bootstrapper = new ConfigurableBootstrapper(with => { var module = new ServerModule(fakeHelloServices, fakeArtistSearchService); with.Module(module); }); var browser = new Browser(bootstrapper, defaults: to => to.Accept("application/json")); //Act var result = await browser.Get("/SayHello", with => { with.Query("name", name); with.HttpRequest(); }); //Assert result.StatusCode.Should().Be(HttpStatusCode.OK); result.Body.AsString().Should().Be(helloMessage); Mock.Get(fakeHelloServices).Verify(it => it.TryGetValue(It.Is <string>(p => p == "Formal"), out fakeHelloService), Times.Once); Mock.Get(fakeHelloService).Verify(it => it.Hello(It.Is <string>(p => p == name)), Times.Once); }
private void Awake() { if (Singleton != null) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); Singleton = this; GameLift = new GameLiftServer(); }
public async Task ServerModule_SearchArtist_Ok() { //Arrange var artistName = "Test"; var fakeHelloServices = Mock.Of <IIndex <string, IHelloService> >(); var fakeArtistSerachResult = new ArtistSearchModel { Artists = new List <Artist> { new Artist { Name = "Artist1", BannerImgUri = "/img1.png" }, new Artist { Name = "Artist2", BannerImgUri = "/img2.png" } } }; var fakeArtistSearchService = Mock.Of <IArtistSearchService>(); Mock.Get(fakeArtistSearchService).Setup(it => it.Serach(It.IsAny <string>())) .Returns(fakeArtistSerachResult); var bootstrapper = new ConfigurableBootstrapper(with => { with.RootPathProvider <TestingRootPathProvider>(); with.ViewFactory <TestingViewFactory>(); var module = new ServerModule(fakeHelloServices, fakeArtistSearchService); with.Module(module); }); var browser = new Browser(bootstrapper, defaults: to => to.Accept("application/json")); //Act var result = await browser.Get($"/searchArtist/{artistName}", with => { with.HttpRequest(); with.Header("accept", "text/html"); }); //Assert result.StatusCode.Should().Be(HttpStatusCode.OK); result.GetViewName().Should().Be("test"); result.GetModel <ArtistSearchModel>().Artists.Any().Should().BeTrue(); result.GetModel <ArtistSearchModel>().Should().Be(fakeArtistSerachResult); Mock.Get(fakeArtistSearchService).Verify(it => it.Serach(It.Is <string>(p => p == artistName)), Times.Once); }
private void NotifyModulesOnResponse(ExpandoObject data, bool original = false) { if (Modules != null) { for (int i = 0; i < Modules.Count; i++) { ServerModule module = Modules[i]; if (module != null) { module.OnResponse(data, original); } } } }
private void OnSecondsTimerTick(object state = null) { if (Modules != null) { for (int i = 0; i < Modules.Count; i++) { ServerModule module = Modules[i]; if (module != null) { module.OnSecondsTimerTick(); } } } }
static public void Main() { tool._A.Select <AbsenceUDT>(); tool._A.Select <RollCallLog>(); ServerModule.AutoManaged("http://module.ischool.com.tw/module/138/OnlineNamed/udm.xml"); RibbonBarItem Print = FISCA.Presentation.MotherForm.RibbonBarItems["學務作業", "APP線上點名"]; Print["點名節次缺曠別設定"].Click += delegate { ConfigFrom cf = new ConfigFrom(); cf.ShowDialog(); }; }
private async Task SendStatus(IMessageChannel channel) { var serverModule = new ServerModule(); await channel.SendMessageAsync("", embed : serverModule.JustJumpEmbed.WithFooter("Updated " + DateTime.Now.ToShortTimeString())); await channel.SendMessageAsync("", embed : serverModule.HightowerEmbed.WithFooter("Updated " + DateTime.Now.ToShortTimeString())); await channel.SendMessageAsync("", embed : serverModule.GmodEmbed.WithFooter("Updated " + DateTime.Now.ToShortTimeString())); await channel.SendMessageAsync("", embed : (await serverModule.GetMinecraftEmbed()).WithFooter( "Updated " + DateTime.Now.ToShortTimeString())); }
public void TradeCancel(Client sender, Client destClient, ServerModule callerModule) { foreach (var module in Modules.Where(serverModule => !Equals(serverModule, callerModule))) { module.OnTradeCancel(sender, destClient); } var trade = CurrentTrades.Find(t => t.Equals(sender.ID, destClient.ID)); if (trade == null) { Logger.Log(LogType.Error, $"Error while cancelling trade request! trade was null."); return; } CurrentTrades.Remove(trade); Logger.Log(LogType.Trade, $"{sender.Name} cancelled a trade request with {destClient.Name}. Module {callerModule.GetType().Name}"); }
public void TradeConfirm(Client sender, Client destClient, ServerModule callerModule) { foreach (var module in Modules.Where(serverModule => !Equals(serverModule, callerModule))) { module.OnTradeConfirm(sender, destClient); } var trade = CurrentTrades.Find(t => t.Equals(sender.ID, destClient.ID)); if (trade == null) { Logger.Log(LogType.Error, "Error while confirming trade request! trade was null."); return; } try { if (trade.Client0ID == sender.ID) { trade.Client0Confirmed = true; } if (trade.Client1ID == sender.ID) { trade.Client1Confirmed = true; } if (trade.Client0Confirmed && trade.Client1Confirmed) { Services.GetService <DatabaseService>().DatabaseSet(new TradeTable(Services.GetService <DatabaseService>(), trade)); CurrentTrades.Remove(trade); } } catch (Exception e) { Logger.Log(LogType.Error, $"Error while confirming trade request! Type: {e.GetType()}, Message: {e.Message}"); CurrentTrades.Remove(trade); } Logger.Log(LogType.Trade, $"{sender.Name} confirmed a trade request with {destClient.Name}. Module {callerModule.GetType().Name}"); }
public async Task EnableModule(string moduleName, ulong id) { var matches = DbContext.ServerModules .AsQueryable() .Where(sm => sm.ServerId == id && sm.Name == moduleName); if (matches.Any()) { var match = matches.First(); match.Disabled = false; } else { var match = new ServerModule() { ServerId = id, Name = moduleName, Disabled = false }; DbContext.ServerModules.Add(match); } await DbContext.SaveChangesAsync().ConfigureAwait(false); }
public async Task ServerModule_HelloWorld_Ok() { //Arrange var fakeHelloServices = Mock.Of <IIndex <string, IHelloService> >(); var fakeArtistSearchService = Mock.Of <IArtistSearchService>(); var bootstrapper = new ConfigurableBootstrapper(with => { var module = new ServerModule(fakeHelloServices, fakeArtistSearchService); with.Module(module); }); var browser = new Browser(bootstrapper, defaults: to => to.Accept("application/json")); //Act var result = await browser.Get("/", with => { with.HttpRequest(); }); //Assert result.StatusCode.Should().Be(HttpStatusCode.OK); result.Body.AsString().Should().Be("Hello World"); }
public ServerClient(ServerModule serverModule) : base(serverModule) { }
public static void Main() { //診斷模式不要執行 UDM 更新。 if (!RTContext.IsDiagMode) { ServerModule.AutoManaged("http://module.ischool.com.tw/module/137815/School_IBSH/udm.xml"); } // 課程加入教師檢視 Course.Instance.AddView(new TeacherCategoryView()); //Sync UDT Table AccessHelper a = new AccessHelper(); a.Select <ConductRecord>("uid is null"); a.Select <CourseExtendRecord>("uid is null"); a.Select <ConductSetting>("uid is null"); a.Select <SubjectRecord>("uid is null"); a.Select <GpaRef>("uid is null"); #region 限註冊 // 學生 Catalog ribbon = RoleAclSource.Instance["學生"]["功能按鈕"]; ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0169", "匯出學期歷程")); ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0170", "匯入學期歷程")); ribbon.Add(new RibbonFeature("JHSchool.Student.SubjectScoreCalculate", "計算科目成績")); ribbon = RoleAclSource.Instance["學生"]["資料項目"]; ribbon.Add(new DetailItemFeature("JHSchool.Student.Detail.SemsScore", "學期成績")); //班級 ribbon = RoleAclSource.Instance["班級"]["功能按鈕"]; ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0070", "班級開課")); ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0070.HrtConductInputForm", "指標輸入")); // 課程 ribbon = RoleAclSource.Instance["課程"]["功能按鈕"]; ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0031", "匯出課程修課學生")); ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0021", "匯入課程修課學生")); ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0070.CourseScoreInputForm", "成績輸入")); ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0070.SubjectConductInputForm", "指標輸入")); ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0070.CourseGradeEditor", "批次修改開課年級")); ribbon = RoleAclSource.Instance["課程"]["資料項目"]; ribbon.Add(new DetailItemFeature("JHSchool.Course.Detail.BasicInfo", "基本資料")); ribbon.Add(new DetailItemFeature("JHSchool.Course.Detail.AttendStudent", "修課學生")); //教務作業 ribbon = RoleAclSource.Instance["教務作業"]; //ribbon.Add(new RibbonFeature("JHSchool.EduAdmin.Ribbon0000", "評量名稱管理")); ribbon.Add(new RibbonFeature("JHSchool.EduAdmin.Ribbon.SubjectManager", "科目資料管理")); ribbon.Add(new RibbonFeature("CourseGradeB.EduAdminExtendControls.Ribbon.SetHoursOpeningForm", "開放時間管理")); ribbon.Add(new RibbonFeature("CourseGradeB.EduAdminExtendControls.Ribbon.SubjectScoreCalculateByGradeyear", "批次計算科目成績")); ribbon.Add(new RibbonFeature("CourseGradeB.EduAdminExtendControls.Ribbon.GpaRefForm", "歷屆GPA統計")); ribbon.Add(new RibbonFeature("CourseGradeB.EduAdminExtendControls.Ribbon.SemsHistoryMaker", "產生學期歷程")); ribbon.Add(new RibbonFeature("CourseGradeB.EduAdminExtendControls.Ribbon.CourseScoreStatusForm", "輸入狀況檢視(評量成績)")); ribbon.Add(new RibbonFeature("CourseGradeB.EduAdminExtendControls.Ribbon.HRTConductStatusForm", "輸入狀況檢視(Conduct班導師)")); ribbon.Add(new RibbonFeature("CourseGradeB.EduAdminExtendControls.Ribbon.SubjectConductStatusForm", "輸入狀況檢視(Conduct授課老師)")); //ribbon.Add(new RibbonFeature("JHSchool.EduAdmin.Ribbon.ExamTemplateManager", "評分樣板設定")); //學務作業 ribbon = RoleAclSource.Instance["學務作業"]; ribbon.Add(new RibbonFeature("JHSchool.StuAdmin.Ribbon.ConductTitleManager", "指標管理")); #endregion #region 資料項目 // 基本資料 //Course.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<BasicInfoItem>()); Course.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider <BasicInfoItem>()); // 修課學生 Course.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider <SCAttendItem>()); // 學期成績 Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider <SemsSubjScoreItem>()); #endregion #region 課程/編輯 RibbonBarItem rbItem = Student.Instance.RibbonBarItems["教務"]; RibbonBarButton rbButton; rbItem = Course.Instance.RibbonBarItems["編輯"]; rbButton = rbItem["新增"]; rbButton.Size = RibbonBarButton.MenuButtonSize.Large; rbButton.Image = Properties.Resources.btnAddCourse; rbButton.Enable = User.Acl["JHSchool.Course.Ribbon0000"].Executable; rbButton.Click += delegate { new CourseGradeB.CourseExtendControls.Ribbon.AddCourse().ShowDialog(); }; rbButton = rbItem["刪除"]; rbButton.Size = RibbonBarButton.MenuButtonSize.Large; rbButton.Image = Properties.Resources.btnDeleteCourse; rbButton.Enable = User.Acl["JHSchool.Course.Ribbon0010"].Executable; rbButton.Click += delegate { if (Course.Instance.SelectedKeys.Count == 1) { JHSchool.Data.JHCourseRecord record = JHSchool.Data.JHCourse.SelectByID(Course.Instance.SelectedKeys[0]); //int CourseAttendCot = Course.Instance.Items[record.ID].GetAttendStudents().Count; List <JHSchool.Data.JHSCAttendRecord> scattendList = JHSchool.Data.JHSCAttend.SelectByStudentIDAndCourseID(new List <string>() { }, new List <string>() { record.ID }); int attendStudentCount = 0; foreach (JHSchool.Data.JHSCAttendRecord scattend in scattendList) { if (scattend.Student.Status == K12.Data.StudentRecord.StudentStatus.一般) { attendStudentCount++; } } if (attendStudentCount > 0) { MsgBox.Show(record.Name + " 有" + attendStudentCount.ToString() + "位修課學生,請先移除修課學生後再刪除課程."); } else { string msg = string.Format("確定要刪除「{0}」?", record.Name); if (MsgBox.Show(msg, "刪除課程", MessageBoxButtons.YesNo) == DialogResult.Yes) { #region 自動刪除非一般學生的修課記錄 List <JHSchool.Data.JHSCAttendRecord> deleteSCAttendList = new List <JHSchool.Data.JHSCAttendRecord>(); foreach (JHSchool.Data.JHSCAttendRecord scattend in scattendList) { JHSchool.Data.JHStudentRecord stuRecord = JHSchool.Data.JHStudent.SelectByID(scattend.RefStudentID); if (stuRecord == null) { continue; } if (stuRecord.Status != K12.Data.StudentRecord.StudentStatus.一般) { deleteSCAttendList.Add(scattend); } } List <string> studentIDs = new List <string>(); foreach (JHSchool.Data.JHSCAttendRecord scattend in deleteSCAttendList) { studentIDs.Add(scattend.RefStudentID); } List <JHSchool.Data.JHSCETakeRecord> sceList = JHSchool.Data.JHSCETake.SelectByStudentAndCourse(studentIDs, new List <string>() { record.ID }); JHSchool.Data.JHSCETake.Delete(sceList); JHSchool.Data.JHSCAttend.Delete(deleteSCAttendList); #endregion JHSchool.Data.JHCourse.Delete(record); //刪除CourseExtendRecord List <CourseExtendRecord> list = a.Select <CourseExtendRecord>("ref_course_id=" + record.ID); if (list.Count > 0) { a.DeletedValues(list); } // 加這主要是重新整理 Course.Instance.SyncDataBackground(record.ID); } else { return; } } } }; RibbonBarButton CouItem = Course.Instance.RibbonBarItems["編輯"]["刪除"]; Course.Instance.SelectedListChanged += delegate { // 課程刪除不能多選 CouItem.Enable = (Course.Instance.SelectedList.Count < 2) && User.Acl["JHSchool.Course.Ribbon0010"].Executable; }; //指定評分樣板 //CouItem = Course.Instance.RibbonBarItems["指定"]["指定評分樣板"]; //Course.Instance.SelectedListChanged += delegate //{ // CouItem.Enable = (Course.Instance.SelectedList.Count > 0); //}; //CouItem.Click += delegate //{ // new CourseGradeB.CourseExtendControls.Ribbon.GiveRefExamTemplateForm(K12.Presentation.NLDPanels.Course.SelectedSource).ShowDialog(); //}; RibbonBarItem scores = JHSchool.Course.Instance.RibbonBarItems["教務"]; scores["成績輸入"].Size = RibbonBarButton.MenuButtonSize.Medium; scores["成績輸入"].Image = Properties.Resources.exam_write_64; scores["成績輸入"].Enable = Framework.User.Acl["JHSchool.Course.Ribbon0070.CourseScoreInputForm"].Executable; scores["成績輸入"].Click += delegate { if (K12.Presentation.NLDPanels.Course.SelectedSource.Count == 1) { CourseRecord courseRecord = Course.Instance.SelectedList[0]; //int key = int.Parse(courseRecord.ID); //int value = Global.Instance.CourseExtendCatch.ContainsKey(key) ? Global.Instance.CourseExtendCatch[key] : -1; //if (value == -1) // FISCA.Presentation.Controls.MsgBox.Show("課程 '" + courseRecord.Name + "' 沒有評量設定。"); //else new CourseGradeB.CourseExtendControls.Ribbon.CourseScoreInputForm(courseRecord).ShowDialog(); } }; K12.Presentation.NLDPanels.Course.SelectedSourceChanged += delegate { scores["成績輸入"].Enable = K12.Presentation.NLDPanels.Course.SelectedSource.Count == 1 && Framework.User.Acl["JHSchool.Course.Ribbon0070.CourseScoreInputForm"].Executable; }; RibbonBarItem conduct = JHSchool.Course.Instance.RibbonBarItems["教務"]; conduct["指標輸入"].Size = RibbonBarButton.MenuButtonSize.Medium; conduct["指標輸入"].Image = Properties.Resources.exam_write_64; conduct["指標輸入"].Enable = Framework.User.Acl["JHSchool.Course.Ribbon0070.SubjectConductInputForm"].Executable; conduct["指標輸入"].Click += delegate { if (K12.Presentation.NLDPanels.Course.SelectedSource.Count == 1) { CourseRecord courseRecord = Course.Instance.SelectedList[0]; new CourseGradeB.CourseExtendControls.Ribbon.SubjectConductInputForm(courseRecord).ShowDialog(); } }; K12.Presentation.NLDPanels.Course.SelectedSourceChanged += delegate { conduct["指標輸入"].Enable = K12.Presentation.NLDPanels.Course.SelectedSource.Count == 1 && Framework.User.Acl["JHSchool.Course.Ribbon0070.SubjectConductInputForm"].Executable; }; RibbonBarItem editGrade = JHSchool.Course.Instance.RibbonBarItems["指定"]; editGrade["批次修改開課年級"].Size = RibbonBarButton.MenuButtonSize.Medium; editGrade["批次修改開課年級"].Image = Properties.Resources.record_b_write_64; editGrade["批次修改開課年級"].Enable = Framework.User.Acl["JHSchool.Course.Ribbon0070.CourseGradeEditor"].Executable; editGrade["批次修改開課年級"].Click += delegate { if (K12.Presentation.NLDPanels.Course.SelectedSource.Count > 0) { new CourseGradeB.CourseExtendControls.Ribbon.CourseGradeEditor(K12.Presentation.NLDPanels.Course.SelectedSource).ShowDialog(); } }; K12.Presentation.NLDPanels.Course.SelectedSourceChanged += delegate { editGrade["批次修改開課年級"].Enable = K12.Presentation.NLDPanels.Course.SelectedSource.Count > 0 && Framework.User.Acl["JHSchool.Course.Ribbon0070.CourseGradeEditor"].Executable; }; #endregion #region 匯出/匯入 RibbonBarButton rbItemExport = Student.Instance.RibbonBarItems["資料統計"]["匯出"]; RibbonBarButton rbItemImport = Student.Instance.RibbonBarItems["資料統計"]["匯入"]; rbItemExport["成績相關匯出"]["匯出學期歷程"].Enable = User.Acl["JHSchool.Student.Ribbon0169"].Executable; rbItemExport["成績相關匯出"]["匯出學期歷程"].Click += delegate { SmartSchool.API.PlugIn.Export.Exporter exporter = new CourseGradeB.ImportExport.ExportSemesterHistory(); CourseGradeB.ImportExport.ExportStudentV2 wizard = new CourseGradeB.ImportExport.ExportStudentV2(exporter.Text, exporter.Image); exporter.InitializeExport(wizard); wizard.ShowDialog(); }; rbItemImport["成績相關匯入"]["匯入學期歷程"].Enable = User.Acl["JHSchool.Student.Ribbon0170"].Executable; rbItemImport["成績相關匯入"]["匯入學期歷程"].Click += delegate { SmartSchool.API.PlugIn.Import.Importer importer = new CourseGradeB.ImportExport.ImportSemesterHistory(); CourseGradeB.ImportExport.ImportStudentV2 wizard = new CourseGradeB.ImportExport.ImportStudentV2(importer.Text, importer.Image); importer.InitializeImport(wizard); wizard.ShowDialog(); }; RibbonBarItem rbItemCourseImportExport = Course.Instance.RibbonBarItems["資料統計"]; rbItemCourseImportExport["匯出"]["匯出課程修課學生"].Enable = User.Acl["JHSchool.Course.Ribbon0031"].Executable; rbItemCourseImportExport["匯出"]["匯出課程修課學生"].Click += delegate { SmartSchool.API.PlugIn.Export.Exporter exporter = new CourseGradeB.ImportExport.Course.ExportCourseStudents(""); CourseGradeB.ImportExport.Course.ExportStudentV2 wizard = new CourseGradeB.ImportExport.Course.ExportStudentV2(exporter.Text, exporter.Image); exporter.InitializeExport(wizard); wizard.ShowDialog(); }; rbItemCourseImportExport["匯入"]["匯入課程修課學生"].Enable = User.Acl["JHSchool.Course.Ribbon0021"].Executable; rbItemCourseImportExport["匯入"]["匯入課程修課學生"].Click += delegate { SmartSchool.API.PlugIn.Import.Importer importer = new CourseGradeB.ImportExport.Course.ImportCourseStudents(""); CourseGradeB.ImportExport.Course.ImportStudentV2 wizard = new CourseGradeB.ImportExport.Course.ImportStudentV2(importer.Text, importer.Image); importer.InitializeImport(wizard); wizard.ShowDialog(); }; #endregion #region 班級功能 rbButton = K12.Presentation.NLDPanels.Class.RibbonBarItems["教務"]["班級開課"]; rbButton.Enable = User.Acl["JHSchool.Class.Ribbon0070"].Executable; rbButton.Image = Properties.Resources.organigram_refresh_64; rbButton["直接開課"].Click += delegate { if (Class.Instance.SelectedList.Count > 0) { new CourseGradeB.ClassExtendControls.Ribbon.CreateCoursesDirectly(); } }; RibbonBarItem hrtConduct = JHSchool.Class.Instance.RibbonBarItems["教務"]; hrtConduct["指標輸入"].Size = RibbonBarButton.MenuButtonSize.Medium; hrtConduct["指標輸入"].Image = Properties.Resources.exam_write_64; hrtConduct["指標輸入"].Enable = Framework.User.Acl["JHSchool.Class.Ribbon0070.HrtConductInputForm"].Executable; hrtConduct["指標輸入"].Click += delegate { if (K12.Presentation.NLDPanels.Class.SelectedSource.Count == 1) { new CourseGradeB.ClassExtendControls.Ribbon.HrtSelectSchoolYear(K12.Presentation.NLDPanels.Class.SelectedSource[0]).ShowDialog(); } }; K12.Presentation.NLDPanels.Class.SelectedSourceChanged += delegate { hrtConduct["指標輸入"].Enable = K12.Presentation.NLDPanels.Class.SelectedSource.Count == 1 && Framework.User.Acl["JHSchool.Class.Ribbon0070.HrtConductInputForm"].Executable; }; #endregion #region 教務作業功能 FISCA.Presentation.RibbonBarItem eduitem1 = FISCA.Presentation.MotherForm.RibbonBarItems["教務作業", "基本設定"]; eduitem1["對照/代碼"].Image = Properties.Resources.notepad_lock_64; eduitem1["對照/代碼"].Size = FISCA.Presentation.RibbonBarButton.MenuButtonSize.Large; FISCA.Presentation.RibbonBarItem eduitem2 = FISCA.Presentation.MotherForm.RibbonBarItems["教務作業", "批次作業/檢視"]; eduitem2["成績作業"].Image = Properties.Resources.calc_save_64; eduitem2["成績作業"].Size = FISCA.Presentation.RibbonBarButton.MenuButtonSize.Large; eduitem2["成績作業"]["批次計算科目成績"].Enable = User.Acl["CourseGradeB.EduAdminExtendControls.Ribbon.SubjectScoreCalculateByGradeyear"].Executable; eduitem2["成績作業"]["批次計算科目成績"].Click += delegate { new CourseGradeB.EduAdminExtendControls.Ribbon.SubjectScoreCalculateByGradeyear().ShowDialog(); }; eduitem2["成績作業"]["歷屆GPA統計"].Enable = User.Acl["CourseGradeB.EduAdminExtendControls.Ribbon.GpaRefForm"].Executable; eduitem2["成績作業"]["歷屆GPA統計"].Click += delegate { new GpaRefForm().ShowDialog(); }; //產生學期歷程 eduitem2["成績作業"]["產生學期歷程"].Enable = User.Acl["CourseGradeB.EduAdminExtendControls.Ribbon.SemsHistoryMaker"].Executable; eduitem2["成績作業"]["產生學期歷程"].Click += delegate { new CourseGradeB.EduAdminExtendControls.Ribbon.SemsHistoryMaker().ShowDialog(); }; //評量輸入狀況檢視 eduitem2["成績作業"]["輸入狀況檢視(評量成績)"].Enable = User.Acl["CourseGradeB.EduAdminExtendControls.Ribbon.CourseScoreStatusForm"].Executable; eduitem2["成績作業"]["輸入狀況檢視(評量成績)"].Click += delegate { new CourseGradeB.EduAdminExtendControls.Ribbon.CourseScoreStatusForm().ShowDialog(); }; //Conduct輸入狀況檢視(班導師) eduitem2["成績作業"]["輸入狀況檢視(Conduct、StandardBase班導師)"].Enable = User.Acl["CourseGradeB.EduAdminExtendControls.Ribbon.HRTConductStatusForm"].Executable; eduitem2["成績作業"]["輸入狀況檢視(Conduct、StandardBase班導師)"].Click += delegate { new CourseGradeB.EduAdminExtendControls.Ribbon.HRTConductStatusForm().ShowDialog(); }; //Conduct輸入狀況檢視(授課老師) eduitem2["成績作業"]["輸入狀況檢視(Conduct、StandardBase授課老師)"].Enable = User.Acl["CourseGradeB.EduAdminExtendControls.Ribbon.SubjectConductStatusForm"].Executable; eduitem2["成績作業"]["輸入狀況檢視(Conduct、StandardBase授課老師)"].Click += delegate { new CourseGradeB.EduAdminExtendControls.Ribbon.SubjectConductStatusForm().ShowDialog(); }; RibbonBarItem eduitem3 = EduAdmin.Instance.RibbonBarItems["基本設定"]; eduitem3["管理"].Size = RibbonBarButton.MenuButtonSize.Large; eduitem3["管理"].Image = Properties.Resources.network_lock_64; //rbItem["管理"]["評量名稱管理"].Enable = User.Acl["JHSchool.EduAdmin.Ribbon0000"].Executable; //rbItem["管理"]["評量名稱管理"].Click += delegate //{ // new CourseGradeB.CourseExtendControls.Ribbon.ExamManager().ShowDialog(); //}; eduitem3["管理"]["科目資料管理"].Enable = User.Acl["JHSchool.EduAdmin.Ribbon.SubjectManager"].Executable; eduitem3["管理"]["科目資料管理"].Click += delegate { new CourseGradeB.EduAdminExtendControls.Ribbon.SubjectManager().ShowDialog(); }; eduitem3["管理"]["開放時間管理"].Enable = User.Acl["CourseGradeB.EduAdminExtendControls.Ribbon.SetHoursOpeningForm"].Executable; eduitem3["管理"]["開放時間管理"].Click += delegate { new CourseGradeB.EduAdminExtendControls.Ribbon.SetHoursOpeningForm().ShowDialog(); }; //rbItem["設定"].Image = Properties.Resources.sandglass_unlock_64; //rbItem["設定"].Size = RibbonBarButton.MenuButtonSize.Large; //rbItem["設定"]["評分樣板設定"].Enable = User.Acl["JHSchool.EduAdmin.Ribbon.ExamTemplateManager"].Executable; //rbItem["設定"]["評分樣板設定"].Click += delegate //{ // new CourseGradeB.EduAdminExtendControls.Ribbon.ExamTemplateManager().ShowDialog(); //}; #endregion #region 學務作業功能 FISCA.Presentation.RibbonBarItem stuitem1 = FISCA.Presentation.MotherForm.RibbonBarItems["學務作業", "基本設定"]; //item3["管理"].Image = Properties.Resources.network_lock_64; //item3["管理"].Size = FISCA.Presentation.RibbonBarButton.MenuButtonSize.Large; stuitem1["管理"]["指標管理"].Enable = User.Acl["JHSchool.StuAdmin.Ribbon.ConductTitleManager"].Executable; stuitem1["管理"]["指標管理"].Click += delegate { new CourseGradeB.StuAdminExtendControls.ConductSettingForm().ShowDialog(); }; #endregion #region 學生功能 //註冊成績計算功能項目。 FISCA.Presentation.RibbonBarItem student_rbitem = FISCA.Presentation.MotherForm.RibbonBarItems["學生", "教務"]; student_rbitem["成績作業"].Size = RibbonBarButton.MenuButtonSize.Large; student_rbitem["成績作業"].Image = Properties.Resources.calc_save_64; student_rbitem["成績作業"]["計算科目成績"].Enable = false; K12.Presentation.NLDPanels.Student.SelectedSourceChanged += delegate { student_rbitem["成績作業"]["計算科目成績"].Enable = K12.Presentation.NLDPanels.Student.SelectedSource.Count > 0 && User.Acl["JHSchool.Student.SubjectScoreCalculate"].Executable; }; student_rbitem["成績作業"]["計算科目成績"].Click += delegate { new CourseGradeB.StudentExtendControls.Ribbon.SubjectScoreCalculate(K12.Presentation.NLDPanels.Student.SelectedSource).ShowDialog(); }; #endregion //教師系統類別 Tagging.Main(); ResCourseData(); }
public void TestMethod1() { ServerModule serverModule = new ServerModule(this, jsconfig); }
static public void Main() { ServerModule.AutoManaged("http://module.ischool.com.tw/module/138/Club_Universal/udm.xml"); //FISCA.RTOut.WriteLine("註冊Gadget - 參加社團(學生):" + WebPackage.RegisterGadget("Student", "fd56eafc-3601-40a0-82d9-808f72a8272b", "參加社團(學生)").Item2); //FISCA.RTOut.WriteLine("註冊Gadget - 社團(老師):" + WebPackage.RegisterGadget("Teacher", "6080a7c0-60e7-443c-bad7-ecccb3a86bcf", "社團(老師)").Item2); #region 處理UDT Table沒有的問題 ConfigData cd = K12.Data.School.Configuration["通用社團UDT載入設定"]; bool checkClubUDT = false; string name = "社團UDT是否已載入_20210912"; //如果尚無設定值,預設為 if (string.IsNullOrEmpty(cd[name])) { cd[name] = "false"; } //檢查是否為布林 bool.TryParse(cd[name], out checkClubUDT); if (!checkClubUDT) { AccessHelper _accessHelper = new AccessHelper(); _accessHelper.Select <CLUBRecord>("UID = '00000'"); _accessHelper.Select <SCJoin>("UID = '00000'"); _accessHelper.Select <WeightProportion>("UID = '00000'"); _accessHelper.Select <CadresRecord>("UID = '00000'"); _accessHelper.Select <DTScore>("UID = '00000'"); _accessHelper.Select <DTClub>("UID = '00000'"); _accessHelper.Select <ResultScoreRecord>("UID = '00000'"); //new _accessHelper.Select <VolunteerRecord>("UID = '00000'"); _accessHelper.Select <ConfigRecord>("UID = '00000'"); cd[name] = "true"; cd.Save(); } #endregion //增加一個社團Tab MotherForm.AddPanel(ClubAdmin.Instance); //增加一個ListView ClubAdmin.Instance.AddView(new ExtracurricularActivitiesView()); //驗證規則 FactoryProvider.FieldFactory.Add(new CLUBFieldValidatorFactory()); FactoryProvider.RowFactory.Add(new CLUBRowValidatorFactory()); // .NET 版本預設為Ss13(已過時) ,會被擋住, 透過更正連線解決, //ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls; #region 毛毛蟲 //學生社團成績 FeatureAce UserPermission = FISCA.Permission.UserAcl.Current[Permissions.學生社團成績_資料項目]; if (UserPermission.Editable || UserPermission.Viewable) { K12.Presentation.NLDPanels.Student.AddDetailBulider(new FISCA.Presentation.DetailBulider <StudentResultItem>()); } //社團照片 UserPermission = FISCA.Permission.UserAcl.Current[Permissions.社團照片]; if (UserPermission.Editable || UserPermission.Viewable) { ClubAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <ClubImageItem>()); } #region 社團基本資料 UserPermission = FISCA.Permission.UserAcl.Current[Permissions.社團基本資料]; if (UserPermission.Editable || UserPermission.Viewable) { IClubDetailItemAPI itemB = FISCA.InteractionService.DiscoverAPI <IClubDetailItemAPI>(); if (itemB != null) { ClubAdmin.Instance.AddDetailBulider(itemB.CreateBasicInfo()); } else { ClubAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <ClubDetailItem>()); } } #endregion //社團限制 UserPermission = FISCA.Permission.UserAcl.Current[Permissions.社團限制]; if (UserPermission.Editable || UserPermission.Viewable) { ClubAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <ClubRestrictItem>()); } //社團學生 UserPermission = FISCA.Permission.UserAcl.Current[Permissions.社團參與學生]; if (UserPermission.Editable || UserPermission.Viewable) { ClubAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <ClubStudent>()); } //社團幹部 UserPermission = FISCA.Permission.UserAcl.Current[Permissions.社團幹部]; if (UserPermission.Editable || UserPermission.Viewable) { ClubAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <CadresItem>()); } #endregion #region 功能按鈕 #region 編輯 { RibbonBarItem edit = ClubAdmin.Instance.RibbonBarItems["編輯"]; edit["新增社團"].Size = RibbonBarButton.MenuButtonSize.Large; edit["新增社團"].Image = Properties.Resources.health_and_leisure_add_64; edit["新增社團"].Enable = Permissions.新增社團權限; edit["新增社團"].Click += delegate { NewAddClub insert = new NewAddClub(); insert.ShowDialog(); }; edit["複製社團"].Size = RibbonBarButton.MenuButtonSize.Large; edit["複製社團"].Image = Properties.Resources.rotate_64; edit["複製社團"].Enable = false; edit["複製社團"].Click += delegate { CopyClub insert = new CopyClub(); insert.ShowDialog(); }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); edit["複製社團"].Enable = SourceCount && Permissions.複製社團權限; }; edit["刪除社團"].Size = RibbonBarButton.MenuButtonSize.Large; edit["刪除社團"].Image = Properties.Resources.health_and_leisure_remove_64; edit["刪除社團"].Enable = false; edit["刪除社團"].Click += delegate { DeleteClub(); }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); ClubAdmin.Instance.ListPaneContexMenu["刪除社團"].Enable = SourceCount && Permissions.刪除社團權限; edit["刪除社團"].Enable = SourceCount && Permissions.刪除社團權限; }; } #endregion #region 資料統計 { RibbonBarItem totle = ClubAdmin.Instance.RibbonBarItems["資料統計"]; totle["匯出"].Size = RibbonBarButton.MenuButtonSize.Large; totle["匯出"].Image = Properties.Resources.Export_Image; totle["匯出"]["匯出社團基本資料"].Enable = Permissions.匯出社團基本資料權限; totle["匯出"]["匯出社團基本資料"].Click += delegate { SmartSchool.API.PlugIn.Export.Exporter exporter = new K12.Club.Volunteer.CLUB.ExportCLUBData(); K12.Club.Volunteer.CLUB.ExportStudentV2 wizard = new K12.Club.Volunteer.CLUB.ExportStudentV2(exporter.Text, exporter.Image); exporter.InitializeExport(wizard); wizard.ShowDialog(); }; totle["匯出"]["匯出聯課活動成績(資料介接)"].Enable = Permissions.匯出社團成績_資料介接權限; totle["匯出"]["匯出聯課活動成績(資料介接)"].Click += delegate { SmartSchool.API.PlugIn.Export.Exporter exporter = new K12.Club.Volunteer.CLUB.SpecialResult(); K12.Club.Volunteer.CLUB.ExportStudentV2 wizard = new K12.Club.Volunteer.CLUB.ExportStudentV2(exporter.Text, exporter.Image); exporter.InitializeExport(wizard); wizard.ShowDialog(); }; totle["匯出"]["匯出社團幹部清單"].Enable = Permissions.匯出社團幹部清單權限; totle["匯出"]["匯出社團幹部清單"].Click += delegate { SmartSchool.API.PlugIn.Export.Exporter exporter = new K12.Club.Volunteer.CLUB.ClubCadResult(); K12.Club.Volunteer.CLUB.ExportStudentV2 wizard = new K12.Club.Volunteer.CLUB.ExportStudentV2(exporter.Text, exporter.Image); exporter.InitializeExport(wizard); wizard.ShowDialog(); }; totle["匯出"]["匯出社團參與學生"].Enable = Permissions.匯出社團參與學生權限; totle["匯出"]["匯出社團參與學生"].Click += delegate { (new Ribbon.Export.frmExportSCJoin()).ShowDialog(); }; totle["匯入"].Size = RibbonBarButton.MenuButtonSize.Large; totle["匯入"].Image = Properties.Resources.Import_Image; totle["匯入"]["匯入社團基本資料"].Enable = Permissions.匯入社團基本資料權限; totle["匯入"]["匯入社團基本資料"].Click += delegate { new ImportCLUBData().Execute(); }; totle["匯入"]["匯入社團參與學生"].Enable = Permissions.匯入社團參與學生權限; totle["匯入"]["匯入社團參與學生"].Click += delegate { new ImportSCJoinData().Execute(); ClubEvents.RaiseAssnChanged(); }; totle["匯入"]["匯入社團幹部清單"].Enable = Permissions.匯入社團幹部清單權限; totle["匯入"]["匯入社團幹部清單"].Click += delegate { new ImportClubCadres().Execute(); ClubEvents.RaiseAssnChanged(); }; totle["報表"].Size = RibbonBarButton.MenuButtonSize.Large; totle["報表"].Image = Properties.Resources.Report; // 2018/01/16 羿均 註解較舊功能 totle["報表"]["社團點名單"].Enable = false; totle["報表"]["社團點名單"].Click += delegate { AssociationsPointList insert = new AssociationsPointList(); }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); totle["報表"]["社團點名單"].Enable = SourceCount && Permissions.社團點名單權限; }; totle["報表"]["社團點名單(套表列印)"].Enable = false; totle["報表"]["社團點名單(套表列印)"].Click += delegate { ClubPointsListForm insert = new ClubPointsListForm(); insert.ShowDialog(); }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); totle["報表"]["社團點名單(套表列印)"].Enable = SourceCount && Permissions.社團點名單_套表列印權限; }; totle["報表"]["社團成績單"].Enable = false; totle["報表"]["社團成績單"].Click += delegate { ClubTranscript insert = new ClubTranscript(); }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); totle["報表"]["社團成績單"].Enable = SourceCount && Permissions.社團成績單權限; }; totle["報表"]["社團概況表"].Enable = Permissions.社團概況表權限; totle["報表"]["社團概況表"].Click += delegate { CLUBFactsTable insert = new CLUBFactsTable(); insert.ShowDialog(); }; } #endregion #region 學生選社 { RibbonBarItem oder = ClubAdmin.Instance.RibbonBarItems["學生選社"]; oder["開放選社時間"].Size = RibbonBarButton.MenuButtonSize.Medium; oder["開放選社時間"].Image = Properties.Resources.time_frame_refresh_128; oder["開放選社時間"].Enable = Permissions.開放選社時間權限; oder["開放選社時間"].Click += delegate { OpenClubJoinDateTime insert = new OpenClubJoinDateTime(); insert.ShowDialog(); }; // 2018/01/16 羿均 因應弘文高中需求新增 oder["匯出選社結果"].Size = RibbonBarButton.MenuButtonSize.Medium; oder["匯出選社結果"].Image = Properties.Resources.Export_Image; oder["匯出選社結果"].Enable = Permissions.學生選社志願設定權限; oder["匯出選社結果"].Click += delegate { Report.匯出選社結果.ExportStudentClubForm e = new Report.匯出選社結果.ExportStudentClubForm(); e.ShowDialog(); }; // 2018/1/15 羿均 此為社團2.0開發工具: 隨機填入學生社團志願 //RibbonBarItem test = ClubAdmin.Instance.RibbonBarItems["測試資料"]; //test["隨機填入學生志願"].Size = RibbonBarButton.MenuButtonSize.Medium; //test["隨機填入學生志願"].Image = Properties.Resources.group_up_64; //test["隨機填入學生志願"].Enable = true; //test["隨機填入學生志願"].Click += delegate //{ // AutoVolunteer a = new AutoVolunteer(); //}; oder["選社志願設定"].Size = RibbonBarButton.MenuButtonSize.Medium; oder["選社志願設定"].Image = Properties.Resources.presentation_a_config_64; oder["選社志願設定"].Enable = Permissions.學生選社志願設定權限; oder["選社志願設定"].Click += delegate { V_Config v = new V_Config(); v.ShowDialog(); }; oder["志願分配作業"].Size = RibbonBarButton.MenuButtonSize.Medium; oder["志願分配作業"].Image = Properties.Resources.group_up_64; oder["志願分配作業"].Enable = Permissions.學生社團分配權限; oder["志願分配作業"].Click += delegate { //是診斷模式 是超級使用者 按下Shift if (FISCA.RTContext.IsDiagMode && FISCA.Authentication.DSAServices.IsSysAdmin && Control.ModifierKeys == Keys.Shift) { //一個社團選社資料清空功能 SCJReMove move = new SCJReMove(); move.ShowDialog(); } else { VolunteerClassForm form = new VolunteerClassForm(); DialogResult dr = form.ShowDialog(); if (dr == DialogResult.Yes) { FISCA.Presentation.MotherForm.SetStatusBarMessage("社團資料已重新讀取"); ClubEvents.RaiseAssnChanged(); } } }; } #endregion #region 檢查 { RibbonBarItem check = ClubAdmin.Instance.RibbonBarItems["檢查"]; check["未選社團檢查"].Size = RibbonBarButton.MenuButtonSize.Medium; check["未選社團檢查"].Image = Properties.Resources.group_help_64; check["未選社團檢查"].Enable = Permissions.未選社團學生權限; check["未選社團檢查"].Click += delegate { CheckStudentIsNotInClub insert = new CheckStudentIsNotInClub(); insert.ShowDialog(); }; check["重覆選社檢查"].Size = RibbonBarButton.MenuButtonSize.Medium; check["重覆選社檢查"].Image = Properties.Resources.meeting_64; check["重覆選社檢查"].Enable = Permissions.重覆選社檢查權限; check["重覆選社檢查"].Click += delegate { RepeatForm insert = new RepeatForm(); insert.ShowDialog(); }; check["調整社團學生"].Size = RibbonBarButton.MenuButtonSize.Medium; check["調整社團學生"].Image = Properties.Resources.layers_64; check["調整社團學生"].Enable = false; check["調整社團學生"].Click += delegate { if (ClubAdmin.Instance.SelectedSource.Count > 7) { MsgBox.Show("所選社團大於7個\n本功能最多僅處理7個社團!!"); } else if (ClubAdmin.Instance.SelectedSource.Count < 2) { MsgBox.Show("使用調整社團學生功能\n必須2個以上社團!!"); } else { SplitClasses insert = new SplitClasses(); insert.ShowDialog(); } }; check["檢查/批次社團鎖社"].Size = RibbonBarButton.MenuButtonSize.Medium; check["檢查/批次社團鎖社"].Image = Properties.Resources.layers_64; check["檢查/批次社團鎖社"].Enable = Permissions.檢查批次社團鎖社權限; check["檢查/批次社團鎖社"].Click += delegate { Ribbon.檢查_批次社團鎖社.MutipleLockForm mutiplelock = new Ribbon.檢查_批次社團鎖社.MutipleLockForm(); mutiplelock.ShowDialog(); }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); check["調整社團學生"].Enable = SourceCount && Permissions.調整社團學生權限; }; } #endregion #region 成績 { RibbonBarItem Results = ClubAdmin.Instance.RibbonBarItems["成績"]; Results["成績輸入"].Size = RibbonBarButton.MenuButtonSize.Medium; Results["成績輸入"].Image = Properties.Resources.marker_fav_64; Results["成績輸入"].Enable = false; Results["成績輸入"].Click += delegate { ClubResultsInput insert = new ClubResultsInput(); insert.ShowDialog(); }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); Results["成績輸入"].Enable = SourceCount && Permissions.成績輸入權限; }; Results["評量比例"].Size = RibbonBarButton.MenuButtonSize.Medium; Results["評量比例"].Image = Properties.Resources.barchart_64; Results["評量比例"].Enable = Permissions.評量項目權限; Results["評量比例"].Click += delegate { GradingProjectConfig insert = new GradingProjectConfig(); insert.ShowDialog(); }; Results["學期結算"].Size = RibbonBarButton.MenuButtonSize.Medium; Results["學期結算"].Image = Properties.Resources.brand_write_64; Results["學期結算"].Enable = false; Results["學期結算"].Click += delegate { IClubClearingFormAPI itemK = FISCA.InteractionService.DiscoverAPI <IClubClearingFormAPI>(); if (itemK != null) { itemK.CreateBasicForm().ShowDialog(); } else { ClearingForm insert = new ClearingForm(); insert.ShowDialog(); } }; ClubAdmin.Instance.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (ClubAdmin.Instance.SelectedSource.Count > 0); Results["學期結算"].Enable = SourceCount && Permissions.學期結算權限; }; Results["成績輸入時間"].Size = RibbonBarButton.MenuButtonSize.Medium; Results["成績輸入時間"].Image = Properties.Resources.time_frame_refresh_128; Results["成績輸入時間"].Enable = Permissions.成績輸入時間權限; Results["成績輸入時間"].Click += delegate { ResultsInputDateTime insert = new ResultsInputDateTime(); insert.ShowDialog(); }; } #endregion #region 課程 { RibbonBarItem course = ClubAdmin.Instance.RibbonBarItems["課程"]; course["轉入課程"].Size = RibbonBarButton.MenuButtonSize.Medium; course["轉入課程"].Image = Properties.Resources.library_up_64; course["轉入課程"].Enable = Permissions.轉入課程權限; course["轉入課程"].Click += delegate { frmImportToCourse form = new frmImportToCourse(); form.ShowDialog(); }; } #endregion #region 右鍵選單 ClubAdmin.Instance.NavPaneContexMenu["重新整理"].Click += delegate { ClubEvents.RaiseAssnChanged(); }; ClubAdmin.Instance.ListPaneContexMenu["刪除社團"].Enable = false; ClubAdmin.Instance.ListPaneContexMenu["刪除社團"].Click += delegate { DeleteClub(); }; #endregion #endregion #region 學生功能按鈕 { RibbonBarItem Print = FISCA.Presentation.MotherForm.RibbonBarItems["學生", "資料統計"]; Print["匯出"]["社團相關匯出"]["匯出社團學期成績"].Enable = Permissions.匯出社團學期成績權限; Print["匯出"]["社團相關匯出"]["匯出社團學期成績"].Click += delegate { SmartSchool.API.PlugIn.Export.Exporter exporter = new ExportStudentClubResult(); ExportStudentV2 wizard = new ExportStudentV2(exporter.Text, exporter.Image); exporter.InitializeExport(wizard); wizard.ShowDialog(); }; } { RibbonBarItem Print = FISCA.Presentation.MotherForm.RibbonBarItems["學生", "資料統計"]; Print["匯出"]["社團相關匯出"]["匯出社團志願序"].Enable = Permissions.匯出社團志願序權限; Print["匯出"]["社團相關匯出"]["匯出社團志願序"].Click += delegate { SmartSchool.API.PlugIn.Export.Exporter exporter = new K12.Club.Volunteer.CLUB.ExportVolunteerRecord(); ExportStudentV2 wizard = new ExportStudentV2(exporter.Text, exporter.Image); exporter.InitializeExport(wizard); wizard.ShowDialog(); }; } { RibbonBarItem Print = FISCA.Presentation.MotherForm.RibbonBarItems["學生", "資料統計"]; Print["匯入"]["社團相關匯入"]["匯入社團志願序"].Enable = Permissions.匯入社團志願序權限; Print["匯入"]["社團相關匯入"]["匯入社團志願序"].Click += delegate { new ImportVolunteerMPG().Execute(); }; } { RibbonBarItem Print = FISCA.Presentation.MotherForm.RibbonBarItems["學生", "資料統計"]; Print["報表"]["社團相關報表"]["社團幹部證明單"].Enable = Permissions.社團幹部證明單權限; Print["報表"]["社團相關報表"]["社團幹部證明單"].Click += delegate { CadreProveReport cpr = new CadreProveReport(); cpr.ShowDialog(); }; } #endregion #region 班級功能按鈕 { RibbonBarItem InClass = FISCA.Presentation.MotherForm.RibbonBarItems["班級", "資料統計"]; InClass["報表"]["社團相關報表"]["班級學生選社同意確認單"].Enable = false; InClass["報表"]["社團相關報表"]["班級學生選社同意確認單"].Click += delegate { ElectionForm insert = new ElectionForm(); insert.ShowDialog(); }; InClass["報表"]["社團相關報表"]["班級社團成績單"].Enable = false; InClass["報表"]["社團相關報表"]["班級社團成績單"].Click += delegate { ClassClubTranscript insert = new ClassClubTranscript(); insert.ShowDialog(); }; K12.Presentation.NLDPanels.Class.SelectedSourceChanged += delegate { //是否選擇大於0的社團 bool SourceCount = (K12.Presentation.NLDPanels.Class.SelectedSource.Count > 0); bool a = (SourceCount && Permissions.班級學生選社_確認表_權限); InClass["報表"]["社團相關報表"]["班級學生選社同意確認單"].Enable = a; bool b = (SourceCount && Permissions.班級社團成績單權限); InClass["報表"]["社團相關報表"]["班級社團成績單"].Enable = b; }; } #endregion #region 登錄權限代碼 //是否能夠只用單一代碼,決定此模組之使用 Catalog detail1; detail1 = RoleAclSource.Instance["社團"]["功能按鈕"]; detail1.Add(new RibbonFeature(Permissions.新增社團, "新增社團")); detail1.Add(new RibbonFeature(Permissions.複製社團, "複製社團")); detail1.Add(new RibbonFeature(Permissions.刪除社團, "刪除社團")); detail1.Add(new RibbonFeature(Permissions.成績輸入, "成績輸入")); detail1.Add(new RibbonFeature(Permissions.評量項目, "評量比例")); detail1.Add(new RibbonFeature(Permissions.學期結算, "學期結算")); detail1.Add(new RibbonFeature(Permissions.未選社團學生, "未選社團學生")); detail1.Add(new RibbonFeature(Permissions.調整社團學生, "調整社團學生")); detail1.Add(new RibbonFeature(Permissions.檢查批次社團鎖社, "檢查/批次社團鎖社")); detail1.Add(new RibbonFeature(Permissions.開放選社時間, "開放選社時間")); detail1.Add(new RibbonFeature(Permissions.成績輸入時間, "成績輸入時間")); detail1.Add(new RibbonFeature(Permissions.重覆選社檢查, "重覆選社檢查")); detail1.Add(new RibbonFeature(Permissions.轉入課程, "轉入課程")); //志願序獨有 detail1.Add(new RibbonFeature(Permissions.學生選社志願設定, "學生選社志願設定")); detail1.Add(new RibbonFeature(Permissions.學生社團分配, "學生社團分配")); detail1 = RoleAclSource.Instance["社團"]["匯出/匯入"]; detail1.Add(new RibbonFeature(Permissions.匯出社團基本資料, "匯出社團基本資料")); detail1.Add(new RibbonFeature(Permissions.匯出社團幹部清單, "匯出社團幹部清單")); detail1.Add(new RibbonFeature(Permissions.匯出社團成績_資料介接, "匯出社團學期成績(資料介接)")); detail1.Add(new RibbonFeature(Permissions.匯出社團參與學生, "匯出社團參與學生")); //匯入 detail1.Add(new RibbonFeature(Permissions.匯入社團基本資料, "匯入社團基本資料")); detail1.Add(new RibbonFeature(Permissions.匯入社團參與學生, "匯入社團參與學生")); detail1.Add(new RibbonFeature(Permissions.匯入社團幹部清單, "匯入社團幹部清單")); detail1 = RoleAclSource.Instance["社團"]["報表"]; detail1.Add(new RibbonFeature(Permissions.社團點名單, "社團點名單")); detail1.Add(new RibbonFeature(Permissions.社團點名單_套表列印, "社團點名單(套表列印)")); detail1.Add(new RibbonFeature(Permissions.社團成績單, "社團成績單")); detail1.Add(new RibbonFeature(Permissions.社團概況表, "社團概況表")); detail1 = RoleAclSource.Instance["社團"]["資料項目"]; detail1.Add(new DetailItemFeature(Permissions.社團基本資料, "基本資料")); detail1.Add(new DetailItemFeature(Permissions.社團照片, "社團照片")); detail1.Add(new DetailItemFeature(Permissions.社團限制, "社團限制")); detail1.Add(new DetailItemFeature(Permissions.社團參與學生, "參與學生")); detail1.Add(new DetailItemFeature(Permissions.社團幹部, "社團幹部")); detail1 = RoleAclSource.Instance["班級"]["報表"]; detail1.Add(new RibbonFeature(Permissions.班級學生選社_確認表, "班級學生選社同意確認單")); detail1.Add(new RibbonFeature(Permissions.班級社團成績單, "班級社團成績單")); detail1 = RoleAclSource.Instance["學生"]["匯出/匯入"]; detail1.Add(new RibbonFeature(Permissions.匯出社團學期成績, "匯出社團學期成績")); detail1.Add(new RibbonFeature(Permissions.匯出社團志願序, "匯出社團志願序")); detail1.Add(new RibbonFeature(Permissions.匯入社團志願序, "匯入社團志願序")); detail1 = RoleAclSource.Instance["學生"]["資料項目"]; detail1.Add(new DetailItemFeature(Permissions.學生社團成績_資料項目, "社團成績")); detail1 = RoleAclSource.Instance["學生"]["報表"]; detail1.Add(new RibbonFeature(Permissions.社團幹部證明單, "社團幹部證明單")); #endregion ClubAdmin.Instance.SelectedSourceChanged += delegate { FISCA.Presentation.MotherForm.SetStatusBarMessage("選擇「" + ClubAdmin.Instance.SelectedSource.Count + "」個社團"); }; }
public void TradeRequest(Client sender, DataItems monster, Client destClient, ServerModule callerModule) { foreach (var module in Modules.Where(serverModule => !Equals(serverModule, callerModule))) { module.OnTradeRequest(sender, monster, destClient); } TradeInstance trade; if (!CurrentTrades.Any(t => t.Equals(sender.ID, destClient.ID))) { CurrentTrades.Add(trade = new TradeInstance { Client0ID = sender.ID, Client1ID = destClient.ID }); } else { trade = CurrentTrades.First(t => t.Equals(sender.ID, destClient.ID)); } try // TODO: specify exceptions that should be processed here. { if (trade.Client0ID == sender.ID) { trade.Client0Monster = new Monster(monster); } if (trade.Client1ID == sender.ID) { trade.Client1Monster = new Monster(monster); } } catch (Exception e) { Logger.Log(LogType.Error, $"Error while creating trade request! Type: {e.GetType()}, Message: {e.Message}"); CurrentTrades.Remove(trade); } Logger.Log(LogType.Trade, $"{sender.Name} sent a trade request to {destClient.Name}. Module {callerModule.GetType().Name}"); }
static public void Main() { ServerModule.AutoManaged("http://module.ischool.com.tw/module/138/Club_Acrossdivisions/udm.xml"); #region 處理UDT Table沒有的問題 ConfigData cd = K12.Data.School.Configuration["跨部別社團UDT載入設定"]; bool checkClubUDT = false; string name = "社團UDT是否已載入_20140709"; //如果尚無設定值,預設為 if (string.IsNullOrEmpty(cd[name])) { cd[name] = "false"; } //檢查是否為布林 bool.TryParse(cd[name], out checkClubUDT); if (!checkClubUDT) { tool._A.Select <EnglishTable>("UID = '00000'"); tool._A.Select <LoginSchool>("UID = '00000'"); cd[name] = "true"; cd.Save(); } #endregion RibbonBarItem InClass = FISCA.Presentation.MotherForm.RibbonBarItems["社團", "跨部別"]; InClass["志願分配部別設定(跨部別)"].Enable = Permissions.連線權限; InClass["志願分配部別設定(跨部別)"].Image = Properties.Resources.asymmetric_network_64; InClass["志願分配部別設定(跨部別)"].Click += delegate { NowConnection con = new NowConnection(); con.ShowDialog(); }; InClass["社團志願分配(跨部別)"].Image = Properties.Resources.flip_horizontal_64; InClass["社團志願分配(跨部別)"].Enable = Permissions.社團志願分配權限; InClass["社團志願分配(跨部別)"].Click += delegate { VolunteerAssignment cva = new VolunteerAssignment(); cva.ShowDialog(); }; RibbonBarItem InClass2 = FISCA.Presentation.MotherForm.RibbonBarItems["社團", "資料統計"]; InClass2["報表"].Image = Properties.Resources.Report; InClass2["報表"].Size = RibbonBarButton.MenuButtonSize.Large; InClass2["報表"]["社團點名單(跨部別)"].Enable = Permissions.社團點名單權限; InClass2["報表"]["社團點名單(跨部別)"].Click += delegate { ClubPointForm cpl = new ClubPointForm(); cpl.ShowDialog(); }; InClass2["報表"]["社團概況表(跨部別)"].Enable = Permissions.社團概況表權限; InClass2["報表"]["社團概況表(跨部別)"].Click += delegate { SocietiesOverviewTable sot = new SocietiesOverviewTable(); sot.ShowDialog(); }; InClass2["報表"]["匯出選社結果(跨部別)"].Enable = Permissions.匯出選社結果權限; InClass2["報表"]["匯出選社結果(跨部別)"].Click += delegate { Ribbon.ExportAcrossDataForm ex = new Ribbon.ExportAcrossDataForm(); ex.ShowDialog(); }; //是否能夠只用單一代碼,決定此模組之使用 Catalog detail1; detail1 = RoleAclSource.Instance["社團"]["功能項目"]; detail1.Add(new RibbonFeature(Permissions.連線, "連線_跨部別")); detail1.Add(new RibbonFeature(Permissions.社團志願分配, "社團志願分配_跨部別")); detail1 = RoleAclSource.Instance["社團"]["報表"]; detail1.Add(new RibbonFeature(Permissions.社團點名單, "社團點名單_跨部別")); detail1.Add(new RibbonFeature(Permissions.社團概況表, "社團概況表_跨部別")); detail1.Add(new RibbonFeature(Permissions.匯出選社結果, "匯出選社結果_跨部別")); }
protected Client(ServerModule serverModule) => Module = serverModule;
public static void Main() { #region 模組啟用先同步Schmea //K12.Data.Configuration.ConfigData cd = K12.Data.School.Configuration["調代課UDT載入設定"]; //bool checkClubUDT = false; //string name = "調代課UDT_20131008"; ////如果尚無設定值,預設為 //if (string.IsNullOrEmpty(cd[name])) //{ // cd[name] = "false"; //} ////檢查是否為布林 //bool.TryParse(cd[name], out checkClubUDT); //if (!checkClubUDT) //{ ServerModule.AutoManaged("http://module.ischool.com.tw/module/89/KHCentralOffice/udm.xml"); SchemaManager Manager = new SchemaManager(FISCA.Authentication.DSAServices.DefaultConnection); Manager.SyncSchema(new School()); Manager.SyncSchema(new ApproachStatistics()); Manager.SyncSchema(new VagrantStatistics()); Manager.SyncSchema(new SchoolLog()); //cd[name] = "true"; //cd.Save(); //} #endregion FISCA.Presentation.MotherForm.StartMenu["安全性"]["權限管理"].Click += (sender, e) => new FISCA.Permission.UI.RoleManager().ShowDialog(); DSAServices.AutoDisplayLoadingMessageOnMotherForm(); GlobalSchoolCache = new DynamicCache(); //建立一個空的快取。 InitAsposeLicense(); InitStartMenu(); InitConfigurationStorage(); InitMainPanel(); //MainPanel.ListPaneContexMenu["執行 SQL 並匯出"].Click += delegate //{ // new ExportQueryData().Export(); //}; new FieldManager(); new DetailItems(); //new RibbonButtons(); //new ImportExport();//匯入學校資料 Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["開放時間"].Image = Properties.Resources.school_events_config_128; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["開放時間"].Size = RibbonBarButton.MenuButtonSize.Medium; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["開放時間"].Click += (sender, e) => new OpenTime().ShowDialog(); Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["開放時間"].Enable = Permissions.開放時間權限; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"].Image = Properties.Resources.paste_64; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"].Size = RibbonBarButton.MenuButtonSize.Medium; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"]["畢業學生進路統計表"].Click += (sender, e) => new Approach_Report("國中畢業學生進路調查填報表格", Properties.Resources._102學年度國中畢業學生進路調查填報表格).ShowDialog(); Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"]["畢業學生進路統計表"].Enable = Permissions.畢業學生進路統計表權限; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"]["畢業學生進路複核表"].Click += (sender, e) => new Approach_Report("國中畢業學生進路調查填報複核表", Properties.Resources._102學年度國中畢業學生進路調查填報複核表).ShowDialog(); Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"]["畢業學生進路複核表"].Enable = Permissions.畢業學生進路複核表權限; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"]["畢業未升學未就業學生動向"].Click += (sender, e) => new UnApproach_Report("國中畢業未升學未就業學生動向", Properties.Resources.中畢業未升學未就業學生動向).ShowDialog(); Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["報表"]["畢業未升學未就業學生動向"].Enable = Permissions.畢業未升學未就業學生動向權限; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["未上傳學校"].Size = RibbonBarButton.MenuButtonSize.Medium; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["未上傳學校"].Image = Properties.Resources.school_search_128; Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["未上傳學校"].Click += (sender, e) => new UnApproach_Check().ShowDialog(); Program.MainPanel.RibbonBarItems["畢業學生進路調查"]["未上傳學校"].Enable = Permissions.未上傳學校權限; FISCA.Permission.Catalog AdminCatalog = FISCA.Permission.RoleAclSource.Instance["畢業學生進路調查"]["功能按鈕"]; AdminCatalog.Add(new RibbonFeature(Permissions.未上傳學校, "未上傳學校")); AdminCatalog.Add(new RibbonFeature(Permissions.畢業未升學未就業學生動向, "畢業未升學未就業學生動向")); AdminCatalog.Add(new RibbonFeature(Permissions.畢業學生進路統計表, "畢業學生進路統計表")); AdminCatalog.Add(new RibbonFeature(Permissions.畢業學生進路複核表, "畢業學生進路複核表")); AdminCatalog.Add(new RibbonFeature(Permissions.開放時間, "開放時間")); FISCA.Permission.Catalog DetailCatalog = FISCA.Permission.RoleAclSource.Instance["畢業學生進路調查"]["資料項目"]; DetailCatalog.Add(new DetailItemFeature(Permissions.學校基本資料, "學校基本資料")); DetailCatalog.Add(new DetailItemFeature(Permissions.學校進路統計, "學校進路統計")); RefreshFilteredSource(); FISCA.Presentation.MotherForm.Form.Text = GetTitleText(); }
/// <summary> /// Use this method to register server modules from subclasses /// </summary> protected internal void RegisterModule(ServerModule module) { _serverModules.Add(module); }
protected StandardClient(Socket socket, ServerModule serverModule) : base(serverModule) { Stream = (TPacketTransmission)Activator.CreateInstance(typeof(TPacketTransmission), socket); }