Exemplo n.º 1
0
        public static void Main()
        {
            SenateTab st = new SenateTab();

            MotherForm.AddPanel(st);

            RibbonBarItem StuItem4 = FISCA.Presentation.MotherForm.RibbonBarItems["說明手冊", "網頁功能"];

            //StuItem4["上一頁"].Size = RibbonBarButton.MenuButtonSize.Large;
            //StuItem4["上一頁"].Click += delegate
            //{
            //    st.browser.Back();
            //};
            //StuItem4["下一頁"].Size = RibbonBarButton.MenuButtonSize.Large;
            //StuItem4["下一頁"].Click += delegate
            //{
            //    st.browser.Forward();
            //};

            StuItem4["重新整理"].Image  = Properties.Resources.reload_64_2;
            StuItem4["重新整理"].Size   = RibbonBarButton.MenuButtonSize.Large;
            StuItem4["重新整理"].Click += delegate
            {
                st.browser.Reload();
            };



            IList <IFeature> list = Features.EnumerateFeatures();

            foreach (IFeature each in list)
            {
                Console.WriteLine(each.Code);
            }
        }
Exemplo n.º 2
0
        public static void Main()
        {
            if (!FISCA.Authentication.DSAServices.IsSysAdmin)
            {
                return;
            }

            if (!RTContext.IsDiagMode)
            {
                return;
            }

            MotherForm.AddPanel(SQLEditor.Window);

            SQLEditor.Window.RibbonBarItems["命令"]["Run"].Image  = Properties.Resources.play_48;
            SQLEditor.Window.RibbonBarItems["命令"]["Run"].Size   = RibbonBarButton.MenuButtonSize.Large;
            SQLEditor.Window.RibbonBarItems["命令"]["Run"].Click += delegate
            {
                SQLEditor.Window.ExecuteSQL();
            };

            SQLEditor.Window.RibbonBarItems["功能"]["UDT"].Image  = Properties.Resources.table_search_48;
            SQLEditor.Window.RibbonBarItems["功能"]["UDT"].Size   = RibbonBarButton.MenuButtonSize.Large;
            SQLEditor.Window.RibbonBarItems["功能"]["UDT"].Click += delegate
            {
                new UDTTables().ShowDialog();
            };
        }
Exemplo n.º 3
0
        private static void InitMainPanel()
        {
            MainPanel       = new NLDPanel();
            MainPanel.Group = "DSAServer";
            MainPanel.SetDescriptionPaneBulider <DetailItemDescription>();

            InitBasicSearch();

            MotherForm.AddPanel(MainPanel);
            MainPanel.AddView(new DefaultView());
        }
Exemplo n.º 4
0
        static public void Main()
        {
            #region 處理UDT Table沒有的問題

            ConfigData cd           = K12.Data.School.Configuration["畢業生檔案檢索UDT載入設定"];
            bool       checkClubUDT = false;

            string name = "畢業生UDT是否已載入_20200821";
            //如果尚無設定值,預設為
            if (string.IsNullOrEmpty(cd[name]))
            {
                cd[name] = "false";
            }

            //檢查是否為布林
            bool.TryParse(cd[name], out checkClubUDT);

            if (!checkClubUDT)
            {
                AccessHelper _accessHelper = new AccessHelper();
                _accessHelper.Select <GraduateUDT>("UID = '00000'");
                _accessHelper.Select <PhotoDataUDT>("UID = '00000'");
                _accessHelper.Select <AllXMLDataUDT>("UID = '00000'");
                _accessHelper.Select <WrittenInformationUDT>("UID = '00000'");
                _accessHelper.Select <WriteCounselingUDT>("UID = '00000'");
                cd[name] = "true";
                cd.Save();
            }

            #endregion

            //增加一個頁籤
            MotherForm.AddPanel(GraduationAdmin.Instance);

            //設定一個學生資訊在上面
            GraduationAdmin.Instance.SetDescriptionPaneBulider(new DescriptionPaneBulider <StudentDescription>());

            //增加一個ListView
            GraduationAdmin.Instance.AddView(new ArchiveNoteView());    //依封存分類檢視
            GraduationAdmin.Instance.AddView(new TagView());            //依學生類別檢視
            GraduationAdmin.Instance.AddView(new GraduationYearView()); //依畢業年度檢視

            #region 資料項目

            //基本資料
            GraduationAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <GraduateDetailItem>());
            //書面資料
            GraduationAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <WrittenInfomationItem>());
            //書面資料(輔導)
            GraduationAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <WriteCounselingItem>());
            //連絡資料
            GraduationAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <InformationItem>());
            //系統封存資料(XML)
            //GraduationAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider<StorageProjectsItem>());
            //備註
            GraduationAdmin.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <RemarksItem>());

            #endregion

            #region 功能按鈕

            RibbonBarItem StudentItem = FISCA.Presentation.MotherForm.RibbonBarItems["學生", "畢業生"];
            StudentItem["建立檔案索引"].Image  = Properties.Resources.atm_lock_128;
            StudentItem["建立檔案索引"].Size   = RibbonBarButton.MenuButtonSize.Large;
            StudentItem["建立檔案索引"].Enable = false;
            StudentItem["建立檔案索引"].Click += delegate
            {
                if (K12.Presentation.NLDPanels.Student.SelectedSource.Count > 0)
                {
                    BatchArchiveStudent BAS = new BatchArchiveStudent();
                    BAS.ShowDialog();
                }
                else
                {
                    MsgBox.Show("請選擇學生。");
                }
            };

            K12.Presentation.NLDPanels.Student.SelectedSourceChanged += delegate
            {
                StudentItem["建立檔案索引"].Enable = Permissions.畢業封存權限 && K12.Presentation.NLDPanels.Student.SelectedSource.Count > 0;
            };

            //StudentItem["永久移除學生資料"].Click += delegate
            //{

            //};
            List <string> GraduationList = new List <string>();

            RibbonBarItem SystemLog = GraduationAdmin.Instance.RibbonBarItems["系統"];
            SystemLog["取得索引資料"].Size   = RibbonBarButton.MenuButtonSize.Large;
            SystemLog["取得索引資料"].Image  = Properties.Resources.layers_zoom_64;
            SystemLog["取得索引資料"].Enable = Permissions.取得封存資料權限;
            SystemLog["取得索引資料"].Click += delegate
            {
                GetGraduationFrom g = new GetGraduationFrom();
                g.ShowDialog();
                GraduationList = g.UDTkey;
            };

            RibbonBarItem Report = GraduationAdmin.Instance.RibbonBarItems["資料統計"];
            Report["匯出"].Size  = RibbonBarButton.MenuButtonSize.Large;
            Report["匯出"].Image = Properties.Resources.匯出;
            Report["匯出"]["匯出畢業生基本資料"].Enable = Permissions.匯出畢業生基本資料權限;
            Report["匯出"]["匯出畢業生基本資料"].Click += delegate
            {
                SmartSchool.API.PlugIn.Export.Exporter exporter = new ExportGraduation();
                ExportStudentV2 wizard = new ExportStudentV2(exporter.Text, exporter.Image);
                exporter.InitializeExport(wizard);
                wizard.ShowDialog();
            };

            Report["匯入"].Size  = RibbonBarButton.MenuButtonSize.Large;
            Report["匯入"].Image = Properties.Resources.匯入;
            Report["匯入"]["匯入畢業生基本資料(新增)"].Enable = Permissions.匯入畢業生基本資料權限;
            Report["匯入"]["匯入畢業生基本資料(新增)"].Click += delegate
            {
                ImportGraduation wizard = new ImportGraduation();
                wizard.Execute();

                foreach (string each in wizard.InsertListID)
                {
                    if (!GraduationList.Contains(each))
                    {
                        GraduationList.Add(each);
                    }
                }

                GraduationAdmin.Instance.BGW.RunWorkerAsync(GraduationList);
            };

            RibbonBarItem DownLoads = GraduationAdmin.Instance.RibbonBarItems["書面管理"];
            DownLoads["上傳書面"].Size   = RibbonBarButton.MenuButtonSize.Large;
            DownLoads["上傳書面"].Image  = Properties.Resources.cabinet_up_128;
            DownLoads["上傳書面"].Enable = Permissions.傳書面資料權限;
            DownLoads["上傳書面"].Click += delegate
            {
                UploadWrittenInformation infDlg = new UploadWrittenInformation();
                infDlg.ShowDialog();
            };

            DownLoads["下載書面"].Size   = RibbonBarButton.MenuButtonSize.Large;
            DownLoads["下載書面"].Image  = Properties.Resources.cabinet_down_128;
            DownLoads["下載書面"].Enable = Permissions.書面資料權限;
            DownLoads["下載書面"].Click += delegate
            {
                if (GraduationAdmin.Instance.SelectedSource.Count > 0)
                {
                    DownLoadWritlenInformation DownLoad = new DownLoadWritlenInformation();
                    DownLoad.ShowDialog();
                }
                else
                {
                    MsgBox.Show("請選擇學生。");
                }
            };

            #endregion

            //2020/8/21 - 輔導書面
            RibbonBarItem DownLoadCounseling = GraduationAdmin.Instance.RibbonBarItems["書面管理(輔導)"];
            DownLoadCounseling["上傳輔導書面"].Size   = RibbonBarButton.MenuButtonSize.Large;
            DownLoadCounseling["上傳輔導書面"].Image  = Properties.Resources.new_cabinet_up_128;
            DownLoadCounseling["上傳輔導書面"].Enable = Permissions.傳書面資料輔導權限;
            DownLoadCounseling["上傳輔導書面"].Click += delegate
            {
                UploadCounseling infDlg = new UploadCounseling();
                infDlg.ShowDialog();
            };

            DownLoadCounseling["下載輔導書面"].Size   = RibbonBarButton.MenuButtonSize.Large;
            DownLoadCounseling["下載輔導書面"].Image  = Properties.Resources.new_cabinet_down_128;
            DownLoadCounseling["下載輔導書面"].Enable = Permissions.書面資料輔導權限;
            DownLoadCounseling["下載輔導書面"].Click += delegate
            {
                if (GraduationAdmin.Instance.SelectedSource.Count > 0)
                {
                    DownLoadCounseling DownLoad = new DownLoadCounseling();
                    DownLoad.ShowDialog();
                }
                else
                {
                    MsgBox.Show("請選擇學生。");
                }
            };

            RibbonBarItem tools = GraduationAdmin.Instance.RibbonBarItems["工具"];
            tools["文件分割"].Image = Properties.Resources.windows_64;
            tools["文件分割"].Size  = RibbonBarButton.MenuButtonSize.Large;
            //DownLoads["文件分割"]["Word文件"].Enable = Permissions.下載書面資料權限;
            tools["文件分割"]["Word文件"].Click += delegate
            {
                WordCut word = new WordCut();
                word.ShowDialog();
            };

            #region 右鍵

            GraduationAdmin.Instance.ListPaneContexMenu["更新畫面資料"].Enable = Permissions.更新畫面資料權限;
            GraduationAdmin.Instance.ListPaneContexMenu["更新畫面資料"].Click += delegate
            {
                FISCA.Presentation.MotherForm.SetStatusBarMessage("開始取得學生索引資料!!");
                GraduationAdmin.Instance.BGW.RunWorkerAsync(GraduationList);
            };

            GraduationAdmin.Instance.ListPaneContexMenu["刪除選擇資料"].Enable = Permissions.刪除選擇資料權限;
            GraduationAdmin.Instance.ListPaneContexMenu["刪除選擇資料"].Click += delegate
            {
                #region 刪除選擇資料

                DialogResult dr = MsgBox.Show("您確定要刪除這些學生資料?\n將會一併將其它關聯資料刪除。", MessageBoxButtons.YesNo, MessageBoxDefaultButton.Button2);
                if (dr == DialogResult.No)
                {
                    return;
                }

                if (GraduationAdmin.Instance.SelectedSource.Count != 0)
                {
                    BackgroundWorker BGW = new BackgroundWorker();
                    BGW.WorkerReportsProgress = true;
                    BGW.DoWork += delegate
                    {
                        #region DoWork
                        AccessHelper _AccessHelper = new AccessHelper();
                        BGW.ReportProgress(0, "刪除作業,取得學生索引...");
                        List <GraduateUDT> list1 = _AccessHelper.Select <GraduateUDT>(UDT_S.PopOneCondition("UID", GraduationAdmin.Instance.SelectedSource));

                        BGW.ReportProgress(10, "刪除作業,取得XML索引資料...");
                        List <AllXMLDataUDT> list2 = _AccessHelper.Select <AllXMLDataUDT>(UDT_S.PopOneCondition("RefUDT_ID", GraduationAdmin.Instance.SelectedSource));

                        BGW.ReportProgress(25, "刪除作業,取得學生照片索引資料...");
                        List <PhotoDataUDT> list3 = _AccessHelper.Select <PhotoDataUDT>(UDT_S.PopOneCondition("RefUDT_ID", GraduationAdmin.Instance.SelectedSource));

                        BGW.ReportProgress(34, "刪除作業,取得書面索引資料...");
                        List <WrittenInformationUDT> list4 = _AccessHelper.Select <WrittenInformationUDT>(UDT_S.PopOneCondition("RefUDT_ID", GraduationAdmin.Instance.SelectedSource));

                        BGW.ReportProgress(42, "系統歷程記錄準備.");
                        DeleteAllData1 dad = new DeleteAllData1(list1);

                        BGW.ReportProgress(47, "系統歷程記錄準備..");
                        dad.setAllXml(list2);

                        BGW.ReportProgress(53, "系統歷程記錄準備...");
                        dad.setPhoto(list3);

                        BGW.ReportProgress(57, "系統歷程記錄準備.....");
                        dad.setWritten(list4);

                        BGW.ReportProgress(62, "刪除學生索引基本資料...");
                        _AccessHelper.DeletedValues(list1.ToArray());

                        BGW.ReportProgress(75, "刪除XML索引資料...");
                        _AccessHelper.DeletedValues(list2.ToArray());

                        BGW.ReportProgress(79, "刪除學生照片索引資料...");
                        _AccessHelper.DeletedValues(list3.ToArray());

                        BGW.ReportProgress(84, "刪除書面資料...");
                        _AccessHelper.DeletedValues(list4.ToArray());

                        BGW.ReportProgress(95, "刪除作業,系統歷程記錄中...");
                        ApplicationLog.Log("刪除學生索引資料", "刪除", dad.GetString());

                        BGW.ReportProgress(100, "已刪除學生索引資料。");
                        #endregion
                    };

                    BGW.ProgressChanged += delegate(object sender, ProgressChangedEventArgs e)
                    {
                        FISCA.Presentation.MotherForm.SetStatusBarMessage(e.UserState.ToString(), e.ProgressPercentage);
                    };

                    BGW.RunWorkerCompleted += delegate
                    {
                        #region RunWorkerCompleted
                        MsgBox.Show("已刪除「" + GraduationAdmin.Instance.SelectedSource.Count + "」筆學生索引資料");
                        FISCA.Presentation.MotherForm.SetStatusBarMessage("已刪除學生索引資料。");
                        foreach (string each in GraduationAdmin.Instance.SelectedSource)
                        {
                            if (GraduationList.Contains(each))
                            {
                                GraduationList.Remove(each);
                            }
                        }
                        GraduationAdmin.Instance.BGW.RunWorkerAsync(GraduationList);
                        #endregion
                    };

                    BGW.RunWorkerAsync();
                }
                else
                {
                    MsgBox.Show("未刪除任何資料。");
                    FISCA.Presentation.MotherForm.SetStatusBarMessage("未刪除任何資料。");
                }

                #endregion
            };

            #endregion

            #region  限設定
            Catalog detail;

            detail = RoleAclSource.Instance["畢業生檔案檢索"]["資料項目"];
            detail.Add(new DetailItemFeature(Permissions.基本資料, "基本資料"));
            detail.Add(new DetailItemFeature(Permissions.聯絡資訊, "聯絡資訊"));
            detail.Add(new DetailItemFeature(Permissions.書面檔案, "書面檔案"));
            detail.Add(new DetailItemFeature(Permissions.書面檔案輔導, "書面檔案(輔導)"));
            //detail.Add(new DetailItemFeature(Permissions.系統封存, "系統封存"));
            detail.Add(new DetailItemFeature(Permissions.備註, "備註"));

            detail = RoleAclSource.Instance["畢業生檔案檢索"]["功能按鈕"];
            //detail.Add(new ReportFeature(Permissions.畢業封存, "建立畢業生檔案索引"));
            detail.Add(new ReportFeature(Permissions.取得封存資料, "取得索引資料"));
            detail.Add(new ReportFeature(Permissions.匯出畢業生基本資料, "匯出畢業生基本資料"));
            detail.Add(new ReportFeature(Permissions.匯入畢業生基本資料, "匯入畢業生基本資料(新增)"));
            detail.Add(new ReportFeature(Permissions.傳書面資料, "上傳書面"));
            detail.Add(new ReportFeature(Permissions.書面資料, "下載書面"));
            detail.Add(new ReportFeature(Permissions.傳書面資料輔導, "上傳輔導書面"));
            detail.Add(new ReportFeature(Permissions.書面資料輔導, "下載輔導書面"));

            detail = RoleAclSource.Instance["畢業生檔案檢索"]["右鍵功能"];
            detail.Add(new ReportFeature(Permissions.更新畫面資料, "更新畫面資料"));
            detail.Add(new ReportFeature(Permissions.刪除選擇資料, "刪除選擇資料"));

            detail = RoleAclSource.Instance["學生"]["功能按鈕"];
            detail.Add(new ReportFeature(Permissions.畢業封存, "建立檔案索引(畢業生)"));
            #endregion
        }
Exemplo n.º 5
0
        public void SetupPresentation()
        {
            //CourseSyncAllBackground
            //2013/4/22 - 提供轉學模組更新學生清單
            FISCA.Features.Register("StudentSyncAllBackground", x =>
            {
                this.SyncAllBackground();
            });

            Student.Instance.RibbonBarItems["編輯"].Index   = 0;
            Student.Instance.RibbonBarItems["資料統計"].Index = 1;
            Student.Instance.RibbonBarItems["指定"].Index   = 2;
            Student.Instance.RibbonBarItems["教務"].Index   = 3;
            Student.Instance.RibbonBarItems["學務"].Index   = 4;

            #region RibbonBar 學生/編輯
            RibbonBarItem rbItem = Student.Instance.RibbonBarItems["編輯"];
            rbItem["新增"].Size   = RibbonBarButton.MenuButtonSize.Large;
            rbItem["新增"].Image  = StudentExtendControls.Ribbon.Resources.btnAddStudent_Image;
            rbItem["新增"].Enable = User.Acl["JHSchool.Student.Ribbon0000"].Executable;
            rbItem["新增"].Click += delegate
            {
                IRewriteAPI_JH.IStudentAddStudentAPI item = FISCA.InteractionService.DiscoverAPI <IRewriteAPI_JH.IStudentAddStudentAPI>();
                if (item != null)
                {
                    item.CreateForm().ShowDialog();
                }
                else
                {
                    new JHSchool.StudentExtendControls.Ribbon.AddStudent().ShowDialog();
                }
            };

            rbItem["刪除"].Image  = StudentExtendControls.Ribbon.Resources.btnDeleteStudent_Image;
            rbItem["刪除"].Size   = RibbonBarButton.MenuButtonSize.Large;
            rbItem["刪除"].Enable = User.Acl["JHSchool.Student.Ribbon0010"].Executable;
            rbItem["刪除"].Click += delegate
            {
                if (SelectedList.Count == 1)
                {
                    PermRecLogProcess             prlp    = new PermRecLogProcess();
                    JHSchool.Data.JHStudentRecord studRec = JHSchool.Data.JHStudent.SelectByID(SelectedList[0].ID);
                    string msg = string.Format("確定要刪除「{0}」?", studRec.Name);
                    if (FISCA.Presentation.Controls.MsgBox.Show(msg, "刪除學生", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        // 檢查刪除狀態是否有同學號或身分證號,空白可刪
                        List <string> tmpSnumList         = new List <string>();
                        List <string> tmpStudIDNumberList = new List <string>();
                        foreach (JHSchool.Data.JHStudentRecord checkStudRec in JHSchool.Data.JHStudent.SelectAll())
                        {
                            if (checkStudRec.Status == K12.Data.StudentRecord.StudentStatus.刪除)
                            {
                                if (!string.IsNullOrEmpty(checkStudRec.StudentNumber))
                                {
                                    tmpSnumList.Add(checkStudRec.StudentNumber);
                                }
                                if (!string.IsNullOrEmpty(checkStudRec.IDNumber))
                                {
                                    tmpStudIDNumberList.Add(checkStudRec.IDNumber);
                                }
                            }
                        }

                        if (tmpSnumList.Contains(studRec.StudentNumber) || tmpSnumList.Contains(studRec.IDNumber))
                        {
                            MsgBox.Show("刪除狀態有重複學號或身分證號,請先修改後再刪除!");
                            return;
                        }

                        // 修改學生狀態 delete
                        studRec.Status = K12.Data.StudentRecord.StudentStatus.刪除;
                        JHSchool.Data.JHStudent.Update(studRec);
                        Student.Instance.SyncDataBackground(studRec.ID);
                        prlp.SaveLog("學籍學生", "刪除學生", "刪除學生,姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber);
                    }
                    else
                    {
                        return;
                    }
                }
            };

            #endregion

            #region RibbonBar 學生/匯入匯出
            rbItem = Student.Instance.RibbonBarItems["資料統計"];

            rbItem["匯出"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯出"].Image = Properties.Resources.Export_Image;
            //rbItem["匯出"]["學籍相關匯出"]["匯出學生基本資料"].Enable = User.Acl["JHSchool.Student.Ribbon0030"].Executable;
            //rbItem["匯出"]["學籍相關匯出"]["匯出學生基本資料"].Click += delegate
            //{
            //        new StudentExportWizard().ShowDialog();

            //};

            rbItem["匯入"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯入"].Image = Properties.Resources.Import_Image;
            //rbItem["匯入"]["學籍相關匯入"]["匯入學生基本資料"].Enable = User.Acl["JHSchool.Student.Ribbon0020"].Executable;
            //rbItem["匯入"]["學籍相關匯入"]["匯入學生基本資料"].Click += delegate
            //{
            //    IRewriteAPI_JH.IStudentImportWizardAPI item = FISCA.InteractionService.DiscoverAPI<IRewriteAPI_JH.IStudentImportWizardAPI>();
            //    if (item != null)
            //    {
            //        item.CreateForm().ShowDialog();
            //    }
            //    else
            //    {
            //        new StudentImportWizard().ShowDialog();
            //    }

            //};
            #endregion

            //報表,是以常態呈現
            rbItem["報表"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["報表"].Image = Properties.Resources.paste_64;
            rbItem["報表"].SupposeHasChildern = true;

            #region RibbonBar 學生/指定
            //由類別模組提供。
            //rbItem = Student.Instance.RibbonBarItems["指定"];
            //rbItem["類別"].Size = RibbonBarButton.MenuButtonSize.Medium;
            //rbItem["類別"].Image = InternalExtendControls.Tagging.Resources.ctxTag_Image;
            //rbItem["類別"].SupposeHasChildern = true;
            //rbItem["類別"].PopupOpen += new EventHandler<PopupOpenEventArgs>(
            //    new TaggingMenu("JHSchool.Student.Ribbon0040", "JHSchool.Student.Ribbon0050").MenuOpen);
            #endregion

            // 要放:班級、座號、姓名、性別、學號、聯絡電話、戶籍電話、聯絡地址、戶籍地址、出生年月日、監護人、課程規劃、帳號。

            #region List Panel Fields

            ListPaneField classNameField = new ListPaneField("班級");
            classNameField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Student.Instance.Items[e.Key] != null)
                {
                    var classRec = Student.Instance.Items[e.Key].Class;
                    e.Value = (classRec == null ? "" : classRec.Name);
                }
            };
            Student.Instance.AddListPaneField(classNameField);

            ListPaneField seatNoField = new ListPaneField("座號");
            seatNoField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Student.Instance.Items[e.Key] != null)
                {
                    e.Value = Student.Instance.Items[e.Key].SeatNo;
                }
            };

            seatNoField.CompareValue += delegate(object sender, CompareValueEventArgs e)
            {
                int x, y;

                if (!int.TryParse(e.Value1.ToString(), out x))
                {
                    x = int.MaxValue;
                }

                if (!int.TryParse(e.Value2.ToString(), out y))
                {
                    y = int.MaxValue;
                }

                e.Result = x.CompareTo(y);
            };

            Student.Instance.AddListPaneField(seatNoField);

            ListPaneField nameField = new ListPaneField("姓名");
            nameField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Student.Instance.Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].Name;
                }
            };
            Student.Instance.AddListPaneField(nameField);

            ListPaneField genderField = new ListPaneField("性別");
            genderField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Student.Instance.Items[e.Key] != null)
                {
                    e.Value = Student.Instance.Items[e.Key].Gender;
                }
            };
            Student.Instance.AddListPaneField(genderField);

            ListPaneField studnumberField = new ListPaneField("學號");
            studnumberField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Student.Instance.Items[e.Key] != null)
                {
                    e.Value = Student.Instance.Items[e.Key].StudentNumber;
                }
            };
            Student.Instance.AddListPaneField(studnumberField);

            ListPaneField birthday = new ListPaneField("生日");
            birthday.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Student.Instance.Items[e.Key] != null)
                {
                    e.Value = Student.Instance.Items[e.Key].Birthday;
                }
            };
            Student.Instance.AddListPaneField(birthday);

            ListPaneField IDNumber = new ListPaneField("身分證號");
            IDNumber.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Student.Instance.Items[e.Key] != null)
                {
                    e.Value = Student.Instance.Items[e.Key].IDNumber;
                }
            };
            if (User.Acl["Student.Field.身分證號"].Executable)
            {
                Student.Instance.AddListPaneField(IDNumber);
            }

            #endregion

            #region Student Views
            Student.Instance.AddView(new JHSchool.StudentExtendControls.GradeYear_Class_View());
            //Student.Instance.AddView(new JHSchool.StudentExtendControls.CategoryView());
            #endregion

            #region 學生基本資料(20140429)

            IRewriteAPI_JH.IStudentDetailItemAPI itemB = FISCA.InteractionService.DiscoverAPI <IRewriteAPI_JH.IStudentDetailItemAPI>();
            if (itemB != null)
            {
                Student.Instance.AddDetailBulider(itemB.CreateBasicInfo());
            }
            else
            {
                Student.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <JHSchool.StudentExtendControls.BaseInfoPalmerwormItem>());
            }
            #endregion

            //            Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<StudentExtendControls.BaseInfoPalmerwormItem>());
            //            Student.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider<JHSchool.StudentExtendControls.SemesterHistoryDetail>());
            //Student.Instance.AddDetailBulider(new DetailBulider<JHSchool.StudentExtendControls.ClassItem>());
            //Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<StudentExtendControls.ClassInfoPalmerwormItem>());
            //文字評量(jenyu)
            //Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<StudentExtendControls.WordCommentPalmerworm>());


            // 電子報表(因相關功能未完成先註)
            //Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<StudentExtendControls.ElectronicPaperPalmerworm>());

            #region Search Conditions
            ConfigData cd = User.Configuration["StudentSearchOptionPreference"];

            SearchName = SearchConditionMenu["姓名"];
            SearchName.AutoCheckOnClick    = true;
            SearchName.AutoCollapseOnClick = false;
            SearchName.Checked             = cd.GetBoolean("SearchName", true);
            SearchName.Click += delegate
            {
                cd.SetBoolean("SearchName", SearchName.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            // 因用班級 Search 未用到先註 2009/9/30
            //SearchClass = SearchConditionMenu["班級"];
            //SearchClass.AutoCheckOnClick = true;
            //SearchClass.AutoCollapseOnClick = false;
            //SearchClass.Checked = cd.GetBoolean("SearchClass", true);
            //SearchClass.Click += delegate
            //{
            //    cd.SetBoolean("SearchClass", SearchClass.Checked);

            //    BackgroundWorker async = new BackgroundWorker();
            //    async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
            //    async.RunWorkerAsync(cd);
            //};

            SearchStudentNumber = SearchConditionMenu["學號"];
            SearchStudentNumber.AutoCheckOnClick    = true;
            SearchStudentNumber.AutoCollapseOnClick = false;
            SearchStudentNumber.Checked             = cd.GetBoolean("SearchStudentNumber", true);
            SearchStudentNumber.Click += delegate
            {
                cd.SetBoolean("SearchStudentNumber", SearchStudentNumber.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchStudentIDNumber = SearchConditionMenu["身分證號"];
            SearchStudentIDNumber.AutoCheckOnClick    = true;
            SearchStudentIDNumber.AutoCollapseOnClick = false;
            SearchStudentIDNumber.Checked             = cd.GetBoolean("SearchStudentIDNumber", true);
            SearchStudentIDNumber.Click += delegate
            {
                cd.SetBoolean("SearchStudentIDNumber", SearchStudentIDNumber.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchStudentParent = SearchConditionMenu["父母監護人"];
            SearchStudentParent.AutoCheckOnClick    = true;
            SearchStudentParent.AutoCollapseOnClick = false;
            SearchStudentParent.Checked             = cd.GetBoolean("SearchStudentParent", false);
            SearchStudentParent.Click += delegate
            {
                cd.SetBoolean("SearchStudentParent", SearchStudentParent.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchStudentLoginID = SearchConditionMenu["登入帳號"];
            SearchStudentLoginID.AutoCheckOnClick    = true;
            SearchStudentLoginID.AutoCollapseOnClick = false;
            SearchStudentLoginID.Checked             = cd.GetBoolean("SearchStudentLoginID", false);
            SearchStudentLoginID.Click += delegate
            {
                cd.SetBoolean("SearchStudentLoginID", SearchStudentLoginID.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchEnglishName = SearchConditionMenu["英文姓名"];
            SearchEnglishName.AutoCheckOnClick    = true;
            SearchEnglishName.AutoCollapseOnClick = false;
            SearchEnglishName.Checked             = cd.GetBoolean("SearchEnglishName", false);
            SearchEnglishName.Click += delegate
            {
                cd.SetBoolean("SearchEnglishName", SearchEnglishName.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            Present.Search += new EventHandler <SearchEventArgs>(Student_Search);
            #endregion

            //缺曠記錄(dylan)
            //Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<StudentExtendControls.AbsencePalmerwormItem>());
            //懲戒資料(dylan)
            //Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<StudentExtendControls.DemeritPalmerwormItem>());
            //獎勵資料(dylan)
            //Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<StudentExtendControls.MeritPalmerwormItem>());
            //測試的先註解了(dylan)
            //Student.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<CriticalSection.Dylan_Test_Item>());

            Present.NavPaneContexMenu.GetChild("重新整理").Click += delegate { this.SyncAllBackground(); };

            Present.Picture = Properties.Resources.StudentIcon;

            //由類別模組提供
            //Present.SetDescriptionPaneBulider(new DescriptionPaneBulider<StudentExtendControls.StudentDescription>());

            //Student.Instance.RequiredDescription += delegate(object sender, RequiredDescriptionEventArgs e)
            //{
            //    if (string.IsNullOrEmpty(e.PrimaryKey)) return;

            //    var studentRec = Student.Instance.Items[e.PrimaryKey];
            //    e.Result = studentRec.GetDescription();
            //};

            //var defaultContentBulider = new DetailBulider<StudentControls.DetailContent>();
            //defaultContentBulider.ContentBulided += delegate(object sender, ContentBulidedEventArgs<K12.StudentControls.DetailContent> e)
            //{
            //    _DetialContents.Add(e.Content);
            //    e.Content.Visible = UseDefaultDetailContent;
            //    e.Content.Disposed += delegate(object sender2, EventArgs e2)
            //    {
            //        _DetialContents.Remove((StudentControls.DetailContent)sender2);
            //    };
            //};
            //this.AddDetailBulider(defaultContentBulider);

            #region  限管理
            Catalog ribbon = RoleAclSource.Instance["學生"]["功能按鈕"];
            ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0000", "新增學生"));
            ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0010", "刪除學生"));
            //ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0020", "匯入學籍資料"));
            //ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0030", "匯出學籍資料"));
            //ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0040", "指定學生類別"));
            //ribbon.Add(new RibbonFeature("JHSchool.Student.Ribbon0050", "管理學生類別清單"));

            Catalog detail = RoleAclSource.Instance["學生"]["資料項目"];
            detail.Add(new DetailItemFeature(typeof(StudentExtendControls.BaseInfoPalmerwormItem)));
            //detail.Add(new DetailItemFeature(typeof(JHSchool.StudentExtendControls.SemesterHistoryDetail)));
            //電子報表(因相關功能未完成先註)
            //detail.Add(new DetailItemFeature(typeof(StudentExtendControls.ElectronicPaperPalmerworm)));

            //Student.Field.身分證號
            ribbon = RoleAclSource.Instance["學生"]["清單欄位"];
            ribbon.Add(new RibbonFeature("Student.Field.身分證號", "身分證號"));
            #endregion

            //#region 待刪除畢業及離校
            //GraduateList = new List<string>();
            //GraduateLeaveInfoU = getAllStudGraduateIDs("畢業", "學年度畢業");
            //GraduateLeaveInfoD = getAllStudGraduateIDs("修業", "學年度修業");
            //GraduateLeaveInfoAll = getAllStudGraduateIDByStatus("畢業或離校");

            //foreach (string str in GraduateLeaveInfoU.Keys)
            //    if (!GraduateList.Contains(str))
            //        GraduateList.Add(str);

            //foreach (string str in GraduateLeaveInfoD.Keys)
            //    if (!GraduateList.Contains(str))
            //        GraduateList.Add(str);

            //GraduateList.Add("離校(非畢修業)");

            //GraduateList.Sort();
            //#endregion

            foreach (string each in AllStatus)
            {
                CreateFilterItem(each);
            }


            //#region 待刪除畢業及離校

            //JHSchool.Data.JHStudent.AfterUpdate += delegate
            //{
            //    GraduateLeaveInfoAll = null;
            //    GraduateLeaveInfoD = null;
            //    GraduateLeaveInfoU = null;
            //    GraduateList = null;
            //    GraduateList = new List<string>();
            //    GraduateLeaveInfoU = getAllStudGraduateIDs("畢業", "學年度畢業");
            //    GraduateLeaveInfoD = getAllStudGraduateIDs("修業", "學年度修業");
            //    GraduateLeaveInfoAll = getAllStudGraduateIDByStatus("畢業或離校");
            //    foreach (string str in GraduateLeaveInfoU.Keys)
            //        if (!GraduateList.Contains(str))
            //            GraduateList.Add(str);

            //    foreach (string str in GraduateLeaveInfoD.Keys)
            //        if (!GraduateList.Contains(str))
            //            GraduateList.Add(str);

            //    GraduateList.Add("離校(非畢修業)");

            //    GraduateList.Sort();

            //    FillFilter();
            //};
            //#endregion

            bool havedef = false;
            foreach (string each in AllStatus)
            {
                havedef |= FilterMenu[each].Checked;
            }

            if (!havedef)
            {
                FilterMenu["一般"].Checked = true;
            }

            UseFilter = true;

            MotherForm.AddPanel(K12.Presentation.NLDPanels.Student);
            _Initilized = true;
            FillFilter();
        }
Exemplo n.º 6
0
        static public void Main()
        {
            string MODName = "體育競賽";

            #region Init UDT
            {
                ConfigData cd = K12.Data.School.Configuration["體育競賽模組載入設定"];

                bool   checkUDT = false;
                string name     = "體育競賽UDT是否已載入";

                // 開發過程先開啟
                cd[name] = "false";

                //如果尚無設定值,預設為
                if (string.IsNullOrEmpty(cd[name]))
                {
                    cd[name] = "false";
                }

                //檢查是否為布林
                bool.TryParse(cd[name], out checkUDT);

                if (!checkUDT) //
                {
                    AccessHelper access = new AccessHelper();
                    access.Select <UDT.Admin>("UID = '00000'");
                    access.Select <UDT.Events>("UID = '00000'");
                    access.Select <UDT.EventTemplates>("UID = '00000'");
                    access.Select <UDT.Games>("UID = '00000'");
                    access.Select <UDT.GameTypes>("UID = '00000'");
                    access.Select <UDT.GroupTypes>("UID = '00000'");
                    access.Select <UDT.HistoricalRecords>("UID = '00000'");
                    access.Select <UDT.Players>("UID = '00000'");
                    access.Select <UDT.ScoreTypes>("UID = '00000'");
                    access.Select <UDT.Teams>("UID = '00000'");
                    access.Select <UDT.GameCandidates>("UID = '00000'");
                    access.Select <UDT.SportsChief>("UID = '00000'");
                    access.Select <UDT.SportsRegistration>("UID = '00000'");
                    cd[name] = "true";
                    cd.Save();
                }
            }
            #endregion

            #region 體育競賽

            MotherForm.AddPanel(SportsPanel.Instance);

            #endregion

            #region Init Role
            {
                // 檢查腳色是否存在
                if (!DAO.Role.CheckRoleExist())
                {
                    // 建立腳色
                    _roleID = DAO.Role.CreatRole();
                }
                else
                {
                    _roleID = DAO.Role.GetRoleID();
                }
            }
            #endregion

            MotherForm.RibbonBarItems[MODName, "基本設定"]["人員設定"].Image = Properties.Resources.foreign_language_config_64;
            MotherForm.RibbonBarItems[MODName, "基本設定"]["人員設定"].Size  = RibbonBarButton.MenuButtonSize.Large;

            MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"].Image = Properties.Resources.schedule_config_64;
            MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"].Size  = RibbonBarButton.MenuButtonSize.Large;
            MotherForm.RibbonBarItems[MODName, "管理"]["管理"].Image     = Properties.Resources.recreation_info_64;
            MotherForm.RibbonBarItems[MODName, "管理"]["管理"].Size      = RibbonBarButton.MenuButtonSize.Large;
            #region 設定組別
            {
                MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"]["設定組別"].Enable = Permissions.設定組別權限;
                MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"]["設定組別"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmGroupTypes()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 設定計分方式
            {
                MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"]["設定計分方式"].Enable = Permissions.設定計分方式權限;
                MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"]["設定計分方式"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmScoreTypes()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 設定賽制
            {
                MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"]["設定賽制"].Enable = Permissions.設定賽制權限;
                MotherForm.RibbonBarItems[MODName, "基本設定"]["競賽設定"]["設定賽制"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmGameTypes()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 管理競賽樣板
            {
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理競賽樣板"].Enable = Permissions.管理競賽樣板權限;
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理競賽樣板"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmEventTemplates()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 管理競賽
            {
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理競賽"].Enable = Permissions.管理競賽權限;
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理競賽"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmEvents()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 管理報名記錄
            {
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理報名記錄"].Enable = Permissions.管理報名記錄權限;
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理報名記錄"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmRegistrationRecord()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 管理賽程
            {
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理賽程"].Enable = Permissions.管理賽程權限;
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理賽程"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmGameProducer()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion
            #region 設定體育股長
            {
                MotherForm.RibbonBarItems[MODName, "基本設定"]["人員設定"]["設定體育股長"].Enable = Permissions.設定體育股長權限;
                MotherForm.RibbonBarItems[MODName, "基本設定"]["人員設定"]["設定體育股長"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmSetSportsChief()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 管理歷年紀錄
            {
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理歷年紀錄"].Enable = Permissions.管理歷年紀錄權限;
                MotherForm.RibbonBarItems[MODName, "管理"]["管理"]["管理歷年紀錄"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmHistoricalRecords()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion
            #region 設定管理員
            {
                MotherForm.RibbonBarItems[MODName, "基本設定"]["人員設定"]["設定管理員"].Enable = Permissions.設定管理員權限;
                MotherForm.RibbonBarItems[MODName, "基本設定"]["人員設定"]["設定管理員"].Click += delegate
                {
                    if (DAO.Actor.Instance().CheckAdmin())
                    {
                        (new frmAdmin()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有體育競賽管理權限!");
                    }
                };
            }
            #endregion

            Catalog detail = new Catalog();
            detail = RoleAclSource.Instance["體育競賽"]["功能按鈕"];
            detail.Add(new RibbonFeature(Permissions.設定體育股長, "設定體育股長"));
            detail.Add(new RibbonFeature(Permissions.設定管理員, "設定管理員"));
            detail.Add(new RibbonFeature(Permissions.管理賽程, "管理賽程"));
            detail.Add(new RibbonFeature(Permissions.設定賽制, "設定賽制"));
            detail.Add(new RibbonFeature(Permissions.設定計分方式, "設定計分方式"));
            detail.Add(new RibbonFeature(Permissions.設定組別, "設定組別"));
            detail.Add(new RibbonFeature(Permissions.管理報名記錄, "管理報名記錄"));
            detail.Add(new RibbonFeature(Permissions.管理競賽, "管理競賽"));
            detail.Add(new RibbonFeature(Permissions.管理競賽樣板, "管理競賽樣板"));
            detail.Add(new RibbonFeature(Permissions.管理歷年紀錄, "管理歷年紀錄"));
        }
Exemplo n.º 7
0
        public void SetupPresentation()
        {
            Course.Instance.RibbonBarItems["編輯"].Index   = 0;
            Course.Instance.RibbonBarItems["資料統計"].Index = 1;
            Course.Instance.RibbonBarItems["指定"].Index   = 2;
            Course.Instance.RibbonBarItems["教務"].Index   = 3;

            //CourseSyncAllBackground
            FISCA.Features.Register("CourseSyncAllBackground", x =>
            {
                this.SyncAllBackground();
            });

            RibbonBarItem rbItema = Course.Instance.RibbonBarItems["編輯"];

            #region RibbonBar 學生/匯入匯出
            RibbonBarItem rbItem = Course.Instance.RibbonBarItems["資料統計"];

            rbItem["匯出"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯出"].Image = Properties.Resources.Export_Image;
            rbItem["匯出"]["匯出課程基本資料"].Enable = User.Acl["JHSchool.Course.Ribbon0030"].Executable;
            rbItem["匯出"]["匯出課程基本資料"].Click += delegate
            {
                new JHSchool.CourseExtendControls.Ribbon.CourseExportWizard().ShowDialog();
            };

            rbItem["匯入"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯入"].Image = Properties.Resources.Import_Image;
            rbItem["匯入"]["匯入課程基本資料"].Enable = User.Acl["JHSchool.Course.Ribbon0020"].Executable;
            rbItem["匯入"]["匯入課程基本資料"].Click += delegate
            {
                new JHSchool.CourseExtendControls.Ribbon.CourseImportWizard().ShowDialog();
                Course.Instance.SyncAllBackground();
            };
            #endregion

            //報表,是以常態呈現
            rbItem["報表"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["報表"].Image = Properties.Resources.paste_64;
            rbItem["報表"].SupposeHasChildern = true;

            #region RibbonBar 課程/指定
            //目的是先建立按鈕順序(新增 / 刪除 / 類別)
            //by dylan
            RibbonBarItem   rbItemx1 = Course.Instance.RibbonBarItems["編輯"];
            RibbonBarButton rbButton = rbItemx1["新增"];
            rbButton.Size = RibbonBarButton.MenuButtonSize.Large;
            rbButton      = rbItemx1["刪除"];
            rbButton.Size = RibbonBarButton.MenuButtonSize.Large;

            rbItem = Course.Instance.RibbonBarItems["指定"];
            //由類別模組提供
            //rbItem["類別"].Image = InternalExtendControls.Tagging.Resources.ctxTag_Image;
            //rbItem["類別"].Size = RibbonBarButton.MenuButtonSize.Medium;
            //rbItem["類別"].SupposeHasChildern = true;
            //rbItem["類別"].PopupOpen += new EventHandler<PopupOpenEventArgs>(
            //    new TaggingMenu("JHSchool.Course.Ribbon0040", "JHSchool.Course.Ribbon0050").MenuOpen);
            #endregion

            #region RibbonBar 課程/統計報表
            //rbItem = Course.Instance.RibbonBarItems["統計報表"];
            //rbItem["報表"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["報表"].Image = CourseExtendControls.Ribbon.Resources.btnReport_Image;
            //rbItem["報表"].Click += delegate
            //{

            //};
            #endregion

            #region RibbonBar 課程/其它
            //rbItem = Course.Instance.RibbonBarItems["其它"];
            //rbItem["修改歷程"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["修改歷程"].Image = CourseExtendControls.Ribbon.Resources.btnHistory_Image;
            //rbItem["修改歷程"].Click += delegate
            //{

            //};
            #endregion

            #region 註冊權限管理
            Catalog ribbon = RoleAclSource.Instance["課程"]["功能按鈕"];
            ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0000", "新增課程資料"));
            ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0010", "刪除課程資料"));
            ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0020", "匯入課程資料"));
            ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0030", "匯出課程資料"));
            //ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0040", "指定課程類別"));
            //ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0050", "管理課程類別清單"));
            ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0060", "分組上課"));
            ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0070", "成績輸入"));
            ribbon.Add(new RibbonFeature("JHSchool.Course.Ribbon0080", "成績計算"));

            Catalog detail = RoleAclSource.Instance["課程"]["資料項目"];

            Catalog report = RoleAclSource.Instance["課程"]["報表"];
            report.Add(new ReportFeature("JHSchool.Course.Report0000", "學生修課清單"));
            #endregion

            //ListPaneField idField = new ListPaneField("ID");
            //idField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            //{
            //    e.Value = e.Key;
            //};
            //idField.CompareValue += delegate(object sender, CompareValueEventArgs e)
            //{
            //    int x, y;

            //    if (!int.TryParse(e.Value1.ToString(), out x))
            //        x = int.MaxValue;

            //    if (!int.TryParse(e.Value2.ToString(), out y))
            //        y = int.MaxValue;

            //    e.Result = x.CompareTo(y);
            //};
            //this.AddListPaneField(idField);


            #region Search Conditions
            ConfigData cd = User.Configuration["CourseSearchOptionPreference"];

            SearchName = SearchConditionMenu["課程名稱"];
            SearchName.AutoCheckOnClick    = true;
            SearchName.AutoCollapseOnClick = false;
            SearchName.Checked             = cd.GetBoolean("SearchName", true);
            SearchName.Click += delegate
            {
                cd.SetBoolean("SearchName", SearchName.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchDomain = SearchConditionMenu["領域"];
            SearchDomain.AutoCheckOnClick    = true;
            SearchDomain.AutoCollapseOnClick = false;
            SearchDomain.Checked             = cd.GetBoolean("SearchDomain", true);
            SearchDomain.Click += delegate
            {
                cd.SetBoolean("SearchDomain", SearchDomain.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchSubject = SearchConditionMenu["科目"];
            SearchSubject.AutoCheckOnClick    = true;
            SearchSubject.AutoCollapseOnClick = false;
            SearchSubject.Checked             = cd.GetBoolean("SearchSubject", true);
            SearchSubject.Click += delegate
            {
                cd.SetBoolean("SearchSubject", SearchSubject.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            Present.Search += new EventHandler <SearchEventArgs>(Course_Search);
            #endregion

            ListPaneField nameField = new ListPaneField("名稱");
            nameField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].Name;
                }
            };
            this.AddListPaneField(nameField);

            ListPaneField domainField = new ListPaneField("領域");
            domainField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].Domain;
                }
            };
            this.AddListPaneField(domainField);

            ListPaneField subjectField = new ListPaneField("科目名稱");
            subjectField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].Subject;
                }
            };
            this.AddListPaneField(subjectField);

            ListPaneField classField = new ListPaneField("所屬班級");
            classField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    if (Items[e.Key].Class != null)
                    {
                        e.Value = Items[e.Key].Class.Name;
                    }
                }
            };
            this.AddListPaneField(classField);

            ListPaneField sectField = new ListPaneField("節數/權數");
            sectField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    string period = Items[e.Key].Period;
                    string credit = Items[e.Key].Credit;
                    if (period == credit)
                    {
                        e.Value = period;
                    }
                    else
                    {
                        e.Value = period + "/" + credit;
                    }
                }
            };
            this.AddListPaneField(sectField);

            ListPaneField schoolyearField = new ListPaneField("學年度");
            schoolyearField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].SchoolYear;
                }
            };
            this.AddListPaneField(schoolyearField);

            ListPaneField semesterField = new ListPaneField("學期");
            semesterField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].Semester;
                }
            };
            this.AddListPaneField(semesterField);

            ListPaneField semScoreField = new ListPaneField("學期成績");
            semScoreField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    if (Items[e.Key].CalculationFlag == "1")
                    {
                        e.Value = "列入";
                    }

                    if (Items[e.Key].CalculationFlag == "2")
                    {
                        e.Value = "不列入";
                    }
                }
            };
            this.AddListPaneField(semScoreField);

            //this.AddView(new AllItemView());

            this.AddView(new SubjectView());
            //this.AddView(new CategoryView()); //由類別模組提供
            this.AddView(new GradeYear_Class_View());

            //this.RequiredDescription += delegate(object sender, RequiredDescriptionEventArgs e)
            //{
            //    e.Result = this[e.PrimaryKey].GetDescription();
            //};

            Present.NavPaneContexMenu.GetChild("重新整理").Click += delegate { this.SyncAllBackground(); };

            //由類別模組提供
            //Present.SetDescriptionPaneBulider(new DescriptionPaneBulider<CourseDescription>());

            Present.FilterMenu.SupposeHasChildern = true;
            Present.FilterMenu.PopupOpen         += delegate(object sender, PopupOpenEventArgs e)
            {
                List <SemesterInfo> semesterList = new List <SemesterInfo>();
                foreach (var item in Items)
                {
                    SemesterInfo semester = new SemesterInfo();
                    semester.SchoolYear = item.SchoolYear;
                    semester.Semester   = item.Semester;
                    if (!semesterList.Contains(semester))
                    {
                        semesterList.Add(semester);
                    }
                }
                if (semesterList.Count <= 0)
                {
                    MenuButton mb = e.VirtualButtons[FiltedSemester.ToString()];
                    //mb.Visible = false;
                }
                semesterList.Sort();
                foreach (var item in semesterList)
                {
                    MenuButton mb = e.VirtualButtons[item.ToString()];
                    mb.AutoCheckOnClick    = true;
                    mb.AutoCollapseOnClick = true;
                    mb.Checked             = (item == FiltedSemester);
                    mb.Tag             = item;
                    mb.CheckedChanged += delegate
                    {
                        if (mb.Checked)
                        {
                            FiltedSemester = (SemesterInfo)mb.Tag;
                            SetSource();
                        }
                    };
                }
            };

            MotherForm.AddPanel(K12.Presentation.NLDPanels.Course);
            _Initilized = true;
            //FillFilter();

            UseFilter = true;
            SetSource();
        }
        static public void Main()
        {
            #region Init UDT
            {
                ConfigData cd = K12.Data.School.Configuration["整潔競賽模組載入設定1.0.0.7"];

                bool   checkUDT = false;
                string name     = "整潔競賽UDT是否已載入";

                //如果尚無設定值,預設為
                if (string.IsNullOrEmpty(cd[name]))
                {
                    cd[name] = "false";
                }

                //檢查是否為布林
                bool.TryParse(cd[name], out checkUDT);

                if (!checkUDT) //
                {
                    AccessHelper access = new AccessHelper();
                    access.Select <UDT.Admin>("UID = '00000'");
                    access.Select <UDT.Scorer>("UID = '00000'");
                    access.Select <UDT.Period>("UID = '00000'");
                    access.Select <UDT.Area>("UID = '00000'");
                    access.Select <UDT.ScoreSheet>("UID = '00000'");
                    // access.Select<UDT.Zone>("UID = '00000'"); 廢除區塊UDT
                    access.Select <UDT.Place>("UID = '00000'");
                    access.Select <UDT.DeDuctionItem>("UID = '00000'");
                    access.Select <UDT.DeDuctionStandard>("UID = '00000'");
                    access.Select <UDT.ScoreRule>("UID = '00000'");
                    access.Select <UDT.PcBelong>("UID = '00000'");
                    access.Select <UDT.WorkShift>("UID = '00000'");
                    access.Select <UDT.ScoreSheet>("UID = '00000'");
                    access.Select <UDT.SnapshotScoreSheet>("UID = '00000'");
                    access.Select <UDT.WeeklyStats>("UID = '00000'");
                    access.Select <UDT.WeeklyRank>("UID = '00000'");

                    cd[name] = "true";
                    cd.Save();
                }
            }
            #endregion

            #region Init Role
            {
                // 檢查腳色是否存在
                if (!DAO.Role.CheckRoleExist())
                {
                    // 建立腳色
                    _roleID = DAO.Role.CreatRole();
                }
                else
                {
                    DAO.Role.UpdateRole(); // 更新角色權限
                    _roleID = DAO.Role.GetRoleID();
                }
            }
            #endregion

            #region 整潔競賽
            {
                // 整潔競賽模組頁面
                MotherForm.AddPanel(TidyCompetitionPanel.Instance);

                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["人員設定"].Image        = Properties.Resources.foreign_language_config_64;
                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["人員設定"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["分數準則設定"].Image      = Properties.Resources.virtualcurse_config_64;
                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["分數準則設定"].Size       = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"].Image        = Properties.Resources.bank_config_128;
                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"].Image        = Properties.Resources.presentation_a_config_64;
                MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["報表"].Image     = Properties.Resources.Report;
                MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["報表"].Size      = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["管理評分紀錄"].Image = Properties.Resources.blacklist_zoom_128;
                MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["管理評分紀錄"].Size  = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["整潔競賽", "排名作業"]["計算排名"].Image        = Properties.Resources.calc_fav_64;
                MotherForm.RibbonBarItems["整潔競賽", "排名作業"]["計算排名"].Size         = RibbonBarButton.MenuButtonSize.Large;


                #region 設定
                #region 設定分數準則
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["分數準則設定"]["設定分數準則"].Enable = Permissions.設定分數準則權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["分數準則設定"]["設定分數準則"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmScoreRule()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定區域類別
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"]["設定區域類別"].Enable = Permissions.設定區域類別權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"]["設定區域類別"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmEditArea()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定區域位置
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"]["設定區域位置"].Enable = Permissions.設定區域位置權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"]["設定區域位置"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmPlace()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定位置負責班級
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"]["設定位置負責班級"].Enable = Permissions.設定位置負責班級權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["區域設定"]["設定位置負責班級"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmPcBelong()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定時段
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定時段"].Enable = Permissions.設定時段權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定時段"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmPeriod()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定扣分資料: 扣分物件&扣分項目
                {
                    //MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定扣分資料"].Enable = Permissions.設定扣分資料權限;
                    //MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定扣分資料"].Click += delegate
                    //{
                    //    if (DAO.Actor.Instance().CheckAdmin())
                    //    {
                    //        (new frmDeduction()).ShowDialog();
                    //    }
                    //    else
                    //    {
                    //        MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                    //    }

                    //};
                }
                #endregion

                #region 設定扣分物件
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定扣分物件"].Enable = Permissions.設定扣分物件權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定扣分物件"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmDeductionItem()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定扣分項目
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定扣分項目"].Enable = Permissions.設定扣分項目權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["評分設定"]["設定扣分項目"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmDeductionStandard()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定評分員
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["人員設定"]["設定評分員"].Enable = Permissions.設定評分員權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["人員設定"]["設定評分員"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmScorer()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 設定管理員
                {
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["人員設定"]["設定管理員"].Enable = Permissions.設定管理員權限;
                    MotherForm.RibbonBarItems["整潔競賽", "基本設定"]["人員設定"]["設定管理員"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmAdmin()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion
                #endregion

                #region 管理評分紀錄
                {
                    MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["管理評分紀錄"].Enable = Permissions.管理評分紀錄權限;
                    MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["管理評分紀錄"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmScoreSheet()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 計算排名
                {
                    MotherForm.RibbonBarItems["整潔競賽", "排名作業"]["計算排名"]["計算週排名"].Enable = Permissions.計算週排名權限;
                    MotherForm.RibbonBarItems["整潔競賽", "排名作業"]["計算排名"]["計算週排名"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmWeeklyScore()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region 週排名報表
                {
                    MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["報表"]["週排名報表"].Enable = Permissions.週排名報表權限;
                    MotherForm.RibbonBarItems["整潔競賽", "評分管理/統計報表"]["報表"]["週排名報表"].Click += delegate
                    {
                        if (DAO.Actor.Instance().CheckAdmin())
                        {
                            (new frmWeeklyRankReport()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有整潔競賽管理權限!");
                        }
                    };
                }
                #endregion

                #region  限管理

                Catalog detail = new Catalog();
                detail = RoleAclSource.Instance["整潔競賽"]["功能按鈕"];
                detail.Add(new RibbonFeature(Permissions.設定區域類別, "設定區域類別"));
                detail.Add(new RibbonFeature(Permissions.設定分數準則, "設定分數準則"));
                detail.Add(new RibbonFeature(Permissions.設定區域位置, "設定區域位置"));
                detail.Add(new RibbonFeature(Permissions.設定位置負責班級, "設定位置負責班級"));
                // detail.Add(new RibbonFeature(Permissions.設定扣分資料, "設定扣分資料"));
                detail.Add(new RibbonFeature(Permissions.設定扣分物件, "設定扣分物件"));
                detail.Add(new RibbonFeature(Permissions.設定扣分項目, "設定扣分項目"));
                detail.Add(new RibbonFeature(Permissions.設定時段, "設定時段"));
                detail.Add(new RibbonFeature(Permissions.設定評分員, "設定評分員"));
                detail.Add(new RibbonFeature(Permissions.設定管理員, "設定管理員"));
                detail.Add(new RibbonFeature(Permissions.管理評分紀錄, "管理評分紀錄"));
                detail.Add(new RibbonFeature(Permissions.計算週排名, "計算週排名"));
                detail.Add(new RibbonFeature(Permissions.週排名報表, "週排名報表"));
                #endregion
            }
            #endregion
        }
Exemplo n.º 9
0
        public void SetupPresentation()
        {
            Teacher.Instance.RibbonBarItems["編輯"].Index   = 0;
            Teacher.Instance.RibbonBarItems["資料統計"].Index = 1;

            #region RibbonBar 教師/編輯
            RibbonBarItem rbItem = Teacher.Instance.RibbonBarItems["編輯"];
            rbItem["新增"].Size   = RibbonBarButton.MenuButtonSize.Large;
            rbItem["新增"].Image  = TeacherExtendControls.Ribbon.Resources.btnAddTeacher;
            rbItem["新增"].Enable = User.Acl["JHSchool.Teacher.Ribbon0000"].Executable;
            rbItem["新增"].Click += delegate
            {
                new JHSchool.TeacherExtendControls.Ribbon.AddTeacher().ShowDialog();
            };

            rbItem["刪除"].Size   = RibbonBarButton.MenuButtonSize.Large;
            rbItem["刪除"].Image  = TeacherExtendControls.Ribbon.Resources.btnDeleteTeacher;
            rbItem["刪除"].Enable = User.Acl["JHSchool.Teacher.Ribbon0010"].Executable;
            rbItem["刪除"].Click += delegate
            {
                if (SelectedList.Count == 1)
                {
                    JHSchool.Data.JHTeacherRecord thRec = JHSchool.Data.JHTeacher.SelectByID(SelectedList[0].ID);
                    thRec.Status = K12.Data.TeacherRecord.TeacherStatus.刪除;

                    string msg = string.Format("確定要刪除「{0}」?", thRec.Name);
                    if (FISCA.Presentation.Controls.MsgBox.Show(msg, "刪除教師", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        JHSchool.Data.JHTeacher.Update(thRec);
                        Teacher.Instance.SyncDataBackground(thRec.ID);
                        PermRecLogProcess prlp = new PermRecLogProcess();
                        prlp.SaveLog("學籍.教師", "刪除教師", "刪除教師,姓名:" + thRec.Name);
                    }
                    else
                    {
                        return;
                    }
                }
            };


            #endregion

            #region RibbonBar 教師/匯入匯出
            rbItem = Teacher.Instance.RibbonBarItems["資料統計"];

            rbItem["匯出"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯出"].Image = Properties.Resources.Export_Image;
            rbItem["匯出"]["匯出教師基本資料"].Enable = User.Acl["JHSchool.Teacher.Ribbon0020"].Executable;
            rbItem["匯出"]["匯出教師基本資料"].Click += delegate
            {
                new JHSchool.TeacherExtendControls.Ribbon.TeacherExportWizard().ShowDialog();
            };

            rbItem["匯入"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯入"].Image = Properties.Resources.Import_Image;
            rbItem["匯入"]["匯入教師基本資料"].Enable = User.Acl["JHSchool.Teacher.Ribbon0030"].Executable;
            rbItem["匯入"]["匯入教師基本資料"].Click += delegate
            {
                new JHSchool.TeacherExtendControls.Ribbon.TeacherImportWizard().ShowDialog();
            };

            #endregion

            //報表,是以常態呈現
            rbItem["報表"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["報表"].Image = Properties.Resources.paste_64;
            rbItem["報表"].SupposeHasChildern = true;

            #region RibbonBar 教師/指定
            rbItem = Teacher.Instance.RibbonBarItems["指定"];
            //rbItem["類別"].Image = InternalExtendControls.Tagging.Resources.ctxTag_Image;
            //rbItem["類別"].Size = RibbonBarButton.MenuButtonSize.Medium;
            //rbItem["類別"].SupposeHasChildern = true;
            //rbItem["類別"].PopupOpen += new EventHandler<PopupOpenEventArgs>(
            //    new TaggingMenu("JHSchool.Teacher.Ribbon0040", "JHSchool.Teacher.Ribbon0050").MenuOpen);

            //rbItem = Teacher.Instance.RibbonBarItems["指定"];
            //rbItem["授課"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["授課"].Image = TeacherExtendControls.Ribbon.Resources.btnAddTeacher_Image;
            //rbItem["授課"].Click += delegate
            //{

            //};
            #endregion

            #region RibbonBar 教師/統計報表
            //rbItem = Teacher.Instance.RibbonBarItems["統計報表"];
            //rbItem["報表"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["報表"].Image = TeacherExtendControls.Ribbon.Resources.btnReport_Image;
            //rbItem["報表"].Click += delegate
            //{

            //};
            #endregion

            #region RibbonBar 教師/其它
            //rbItem = Teacher.Instance.RibbonBarItems["其它"];
            //rbItem["修改歷程"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["修改歷程"].Image = TeacherExtendControls.Ribbon.Resources.btnHistory_Image;
            //rbItem["修改歷程"].Click += delegate
            //{

            //};
            #endregion

            ListPaneField idField = new ListPaneField("ID");
            idField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                e.Value = e.Key;
            };
            //this.AddListPaneField(idField);

            ListPaneField nameField = new ListPaneField("姓名");
            nameField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                e.Value = Items[e.Key].Name;
            };
            AddListPaneField(nameField);

            ListPaneField nicknameField = new ListPaneField("暱稱");
            nicknameField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                e.Value = Items[e.Key].Nickname;
            };
            AddListPaneField(nicknameField);

            ListPaneField TeacherLoginName = new ListPaneField("登入帳號");
            TeacherLoginName.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                e.Value = Items[e.Key].TALoginName;
            };
            AddListPaneField(TeacherLoginName);

            ListPaneField genderField = new ListPaneField("性別");
            genderField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                e.Value = Items[e.Key].Gender;
            };
            AddListPaneField(genderField);


            ListPaneField superviseClassField = new ListPaneField("帶班班級");
            superviseClassField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                var superviseClass = "";
                foreach (var item in Class.Instance.GetTecaherSupervisedClass(Items[e.Key]))
                {
                    superviseClass += (superviseClass == "" ? "" : "、") + item.Name;
                }

                e.Value = superviseClass;
            };
            Teacher.Instance.AddListPaneField(superviseClassField);

            // 加入身分證號,聯絡電話的權限管理
            ListPaneField IDNumberField = new ListPaneField("身分證號");
            IDNumberField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                e.Value = Items[e.Key].IDNumber;
            };
            if (User.Acl["Teacher.Field.身分證號"].Executable)
            {
                Present.AddListPaneField(IDNumberField);
            }

            Catalog ribbonField = RoleAclSource.Instance["教師"]["清單欄位"];
            ribbonField.Add(new RibbonFeature("Teacher.Field.身分證號", "身分證號"));

            ListPaneField telField = new ListPaneField("聯絡電話");
            telField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                e.Value = Items[e.Key].ContactPhone;
            };
            if (User.Acl["Teacher.Field.聯絡電話"].Executable)
            {
                Present.AddListPaneField(telField);
            }

            ribbonField = RoleAclSource.Instance["教師"]["清單欄位"];
            ribbonField.Add(new RibbonFeature("Teacher.Field.聯絡電話", "聯絡電話"));

            //Teacher.Instance.AddView(new JHSchool.TeacherExtendControls.SubjectView());
            Teacher.Instance.AddView(new JHSchool.TeacherExtendControls.SuperviseView());
            //Teacher.Instance.AddView(new JHSchool.TeacherExtendControls.CategoryView());
            Present.NavPaneContexMenu.GetChild("重新整理").Click += delegate { this.SyncAllBackground(); };

            // Teacher.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<TeacherExtendControls.BaseInfoItem>());

            #region 教師基本資料(20140502)
            ITeacherDatailtemAPI BaseItem = FISCA.InteractionService.DiscoverAPI <ITeacherDatailtemAPI>();
            if (BaseItem != null)
            {
                Teacher.Instance.AddDetailBulider(BaseItem.CreateBasicInfo());
            }
            else
            {
                Teacher.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <JHSchool.TeacherExtendControls.BaseInfoItem>());
            }
            #endregion


            // Teacher.Instance.AddDetailBulider(new ContentItemBulider<TeacherExtendControls.BaseInfoItem>());
//            Teacher.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<TeacherExtendControls.TeachStudentItem>());

            // 教師帶班班級
            Teacher.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <JHSchool.TeacherExtendControls.TeachStudentItem>());

            //電子報表(因相關功能未完成先註)
            //Teacher.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<TeacherExtendControls.ElectronicPaperPalmerworm>());
            Teacher.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider <TeacherExtendControls.TeachCourseItem>());

            //K12.Teacher.Instance.AddView(new ShowAllStudentsView());
            //Teacher.Instance.RequiredDescription += delegate(object sender, RequiredDescriptionEventArgs e)
            //{
            //    var teacherRec = Teacher.Instance.Items[e.PrimaryKey];
            //    e.Result = teacherRec.Name + ( string.IsNullOrEmpty(teacherRec.Nickname) ? "" : "(" + teacherRec.Nickname + ")" );
            //};

            #region 教師篩選功能



            //private void CreateFilterItem(string name)
            //{
            //FilterMenu[name].AutoCheckOnClick = true;
            //FilterMenu[name].AutoCollapseOnClick = false;

            //FilterMenu[name].Checked = preference.GetBoolean(name, false);
            //FilterMenu[name].Click += delegate
            //{
            //    FillFilter();
            //    preference.SetBoolean(name, FilterMenu[name].Checked);

            //    preference.SaveAsync();
            //};
            //}

            #endregion

            #region 增加導師搜尋條件鈕

            ConfigData cd = User.Configuration["TeacherSearchOptionPreference"];

            SearchTeacherName = SearchConditionMenu["姓名"];
            SearchTeacherName.AutoCheckOnClick    = true;
            SearchTeacherName.AutoCollapseOnClick = false;
            SearchTeacherName.Checked             = cd.GetBoolean("SearchTeacherName", true);
            SearchTeacherName.Click += delegate
            {
                cd.SetBoolean("SearchTeacherName", SearchTeacherName.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchTeacherRefId = SearchConditionMenu["身分證號"];
            SearchTeacherRefId.AutoCheckOnClick    = true;
            SearchTeacherRefId.AutoCollapseOnClick = false;
            SearchTeacherRefId.Checked             = cd.GetBoolean("SearchTeacherRefId", true);
            SearchTeacherRefId.Click += delegate
            {
                cd.SetBoolean("SearchTeacherRefId", SearchTeacherRefId.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchTeacherLoginID = SearchConditionMenu["登入帳號"];
            SearchTeacherLoginID.AutoCheckOnClick    = true;
            SearchTeacherLoginID.AutoCollapseOnClick = false;
            SearchTeacherLoginID.Checked             = cd.GetBoolean("SearchTeacherLoginID", true);
            SearchTeacherLoginID.Click += delegate
            {
                cd.SetBoolean("SearchTeacherLoginID", SearchTeacherLoginID.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            Present.Search += new EventHandler <SearchEventArgs>(Teacher_Search);



            #endregion

            //由類別模組提供
            //Present.SetDescriptionPaneBulider(new DescriptionPaneBulider<JHSchool.TeacherExtendControls.TeacherDescription>());

            #region 註冊權限管理
            Catalog ribbon = RoleAclSource.Instance["教師"]["功能按鈕"];
            ribbon.Add(new RibbonFeature("JHSchool.Teacher.Ribbon0000", "新增教師資料"));
            ribbon.Add(new RibbonFeature("JHSchool.Teacher.Ribbon0010", "刪除教師資料"));
            ribbon.Add(new RibbonFeature("JHSchool.Teacher.Ribbon0020", "匯出教師資料"));
            ribbon.Add(new RibbonFeature("JHSchool.Teacher.Ribbon0030", "匯入教師資料"));
            //ribbon.Add(new RibbonFeature("JHSchool.Teacher.Ribbon0040", "指定教師類別"));
            //ribbon.Add(new RibbonFeature("JHSchool.Teacher.Ribbon0050", "管理教師類別清單"));

            Catalog detail = RoleAclSource.Instance["教師"]["資料項目"];
            detail.Add(new DetailItemFeature(typeof(TeacherExtendControls.BaseInfoItem)));
            detail.Add(new DetailItemFeature(typeof(TeacherExtendControls.TeachStudentItem)));
            //電子報表(因相關功能未完成先註)
            //detail.Add(new DetailItemFeature(typeof(TeacherExtendControls.ElectronicPaperPalmerworm)));
            detail.Add(new DetailItemFeature(typeof(TeacherExtendControls.TeachCourseItem)));
            #endregion

            // 建立篩選
            foreach (string each in AllStatus)
            {
                CreateFilterItem(each);
            }

            bool havedef = false;
            foreach (string each in AllStatus)
            {
                havedef |= FilterMenu[each].Checked;
            }

            if (!havedef)
            {
                FilterMenu["一般"].Checked = true;
            }


            MotherForm.AddPanel(K12.Presentation.NLDPanels.Teacher);
            _Initilized = true;
            UseFilter   = true;

            FillFilter();
        }
Exemplo n.º 10
0
        static public void Main()
        {
            #region Init UDT
            ConfigData cd = K12.Data.School.Configuration["秩序比賽模組載入設定"];

            bool   checkUDT = false;
            string name     = "秩序比賽UDT是否已載入";

            //如果尚無設定值,預設為
            if (string.IsNullOrEmpty(cd[name]))
            {
                cd[name] = "false";
            }

            //檢查是否為布林
            bool.TryParse(cd[name], out checkUDT);

            if (!checkUDT) //
            {
                AccessHelper access = new AccessHelper();
                access.Select <UDT.Admin>("UID = '00000'");
                access.Select <UDT.CheckItem>("UID = '00000'");
                access.Select <UDT.Period>("UID = '00000'");
                access.Select <UDT.Scorer>("UID = '00000'");
                access.Select <UDT.ScoreSheet>("UID = '00000'");
                access.Select <UDT.SemesterStats>("UID = '00000'");
                access.Select <UDT.SemesterRank>("UID = '00000'");
                access.Select <UDT.SnapshotScoreSheet>("UID = '00000'");
                access.Select <UDT.WeeklyRank>("UID = '00000'");
                access.Select <UDT.WeeklyStats>("UID = '00000'");

                cd[name] = "true";
                cd.Save();
            }
            #endregion

            #region Init Admin Role

            CreateMoudulAdmin();

            #endregion

            bool isAdmin = DAO.Actor.Instance.CheckAdmin();

            #region 秩序競賽

            // 秩序競賽模組頁面
            DisciplineCompetitionPanel panel = new DisciplineCompetitionPanel();
            MotherForm.AddPanel(DisciplineCompetitionPanel.Instance);

            MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["人員設定"].Image          = Properties.Resources.foreign_language_config_64;
            MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["人員設定"].Size           = RibbonBarButton.MenuButtonSize.Large;
            MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["評分設定"].Image          = Properties.Resources.presentation_a_config_64;
            MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["評分設定"].Size           = RibbonBarButton.MenuButtonSize.Large;
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["報表"].Image     = Properties.Resources.Report;
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["報表"].Size      = RibbonBarButton.MenuButtonSize.Large;
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["管理評分紀錄"].Image = Properties.Resources.blacklist_zoom_128;
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["管理評分紀錄"].Size  = RibbonBarButton.MenuButtonSize.Large;
            MotherForm.RibbonBarItems["秩序競賽", "排名作業"]["計算排名"].Image          = Properties.Resources.calc_fav_64;
            MotherForm.RibbonBarItems["秩序競賽", "排名作業"]["計算排名"].Size           = RibbonBarButton.MenuButtonSize.Large;

            #region 設定管理員
            {
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["人員設定"]["設定管理員"].Enable = Permissions.設定管理員權限;
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["人員設定"]["設定管理員"].Click += delegate
                {
                    if (isAdmin)
                    {
                        (new frmSetAdmin()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 設定評分員
            {
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["人員設定"]["設定評分員"].Enable = Permissions.設定評分員權限;
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["人員設定"]["設定評分員"].Click += delegate
                {
                    if (isAdmin)
                    {
                        (new frmSetScorer()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 設定評分時段
            {
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["評分設定"]["設定評分時段"].Enable = Permissions.設定評分時段權限;
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["評分設定"]["設定評分時段"].Click += delegate
                {
                    if (isAdmin)
                    {
                        (new frmSetScorePeriod()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 設定評分項目
            {
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["評分設定"]["設定評分項目"].Enable = Permissions.設定評分項目權限;
                MotherForm.RibbonBarItems["秩序競賽", "基本設定"]["評分設定"]["設定評分項目"].Click += delegate
                {
                    if (isAdmin)
                    {
                        (new frmSetCheckItem()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 管理評分紀錄
            {
                MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["管理評分紀錄"].Enable = Permissions.管理評分紀錄權限;
                MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["管理評分紀錄"].Click += delegate
                {
                    if (isAdmin)
                    {
                        (new frmScoreSheet()).ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                    }
                };
            }
            #endregion

            #region 計算週排名
            MotherForm.RibbonBarItems["秩序競賽", "排名作業"]["計算排名"]["計算週排名"].Enable = Permissions.計算週排名權限;
            MotherForm.RibbonBarItems["秩序競賽", "排名作業"]["計算排名"]["計算週排名"].Click += delegate
            {
                if (isAdmin)
                {
                    (new frmWeeklyScore()).ShowDialog();
                }
                else
                {
                    MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                }
            };
            #endregion

            #region 計算學期排名
            MotherForm.RibbonBarItems["秩序競賽", "排名作業"]["計算排名"]["計算學期排名"].Enable = Permissions.計算學期排名權限;
            MotherForm.RibbonBarItems["秩序競賽", "排名作業"]["計算排名"]["計算學期排名"].Click += delegate
            {
                if (isAdmin)
                {
                    (new frmSemesterScore()).ShowDialog();
                }
                else
                {
                    MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                }
            };
            #endregion

            #region 週排名報表
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["報表"]["週排名報表"].Enable = Permissions.週排名報表權限;
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["報表"]["週排名報表"].Click += delegate
            {
                if (isAdmin)
                {
                    (new frmWeeklyRankReport()).ShowDialog();
                }
                else
                {
                    MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                }
            };
            #endregion

            #region 學期排名報表
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["報表"]["學期排名報表"].Enable = Permissions.學期排名報表權限;
            MotherForm.RibbonBarItems["秩序競賽", "評分管理 / 統計報表"]["報表"]["學期排名報表"].Click += delegate
            {
                if (isAdmin)
                {
                    (new frmSemesterRankReport()).ShowDialog();
                }
                else
                {
                    MsgBox.Show("此帳號沒有秩序競賽管理權限!");
                }
            };
            #endregion

            #region  限管理

            Catalog detail = new Catalog();
            detail = RoleAclSource.Instance["秩序競賽"]["功能按鈕"];
            detail.Add(new RibbonFeature(Permissions.設定管理員, "設定管理員"));
            detail.Add(new RibbonFeature(Permissions.設定評分員, "設定評分員"));
            detail.Add(new RibbonFeature(Permissions.設定評分時段, "設定評分時段"));
            detail.Add(new RibbonFeature(Permissions.設定評分項目, "設定評分項目"));
            detail.Add(new RibbonFeature(Permissions.管理評分紀錄, "管理評分紀錄"));
            detail.Add(new RibbonFeature(Permissions.計算週排名, "計算週排名"));
            detail.Add(new RibbonFeature(Permissions.計算學期排名, "計算學期排名"));
            detail.Add(new RibbonFeature(Permissions.週排名報表, "週排名報表"));
            detail.Add(new RibbonFeature(Permissions.學期排名報表, "學期排名報表"));
            #endregion

            #endregion
        }
Exemplo n.º 11
0
        public void SetupPresentation()
        {
            Class.Instance.RibbonBarItems["編輯"].Index   = 0;
            Class.Instance.RibbonBarItems["資料統計"].Index = 1;
            Class.Instance.RibbonBarItems["指定"].Index   = 2;
            Class.Instance.RibbonBarItems["教務"].Index   = 3;
            Class.Instance.RibbonBarItems["學務"].Index   = 4;

            #region RibbonBar 班級/編輯
            RibbonBarItem rbItem = Class.Instance.RibbonBarItems["編輯"];
            rbItem["新增"].Size   = RibbonBarButton.MenuButtonSize.Large;
            rbItem["新增"].Enable = User.Acl["JHSchool.Class.Ribbon0000"].Executable;
            rbItem["新增"].Image  = ClassExtendControls.Ribbon.Resources.btnAddClass;
            rbItem["新增"].Click += delegate
            {
                new JHSchool.ClassExtendControls.Ribbon.AddClass().ShowDialog();
            };

            rbItem["刪除"].Size   = RibbonBarButton.MenuButtonSize.Large;
            rbItem["刪除"].Image  = ClassExtendControls.Ribbon.Resources.btnDeleteClass;
            rbItem["刪除"].Enable = User.Acl["JHSchool.Class.Ribbon0010"].Executable;
            rbItem["刪除"].Click += delegate
            {
                if (SelectedList.Count == 1)
                {
                    JHSchool.Data.JHClassRecord record = JHSchool.Data.JHClass.SelectByID(SelectedList[0].ID);
                    string msg;
                    // 當有學生
                    if (record.Students.Count > 0)
                    {
                        msg = string.Format("確定要刪除「{0}」?班上" + record.Students.Count + "位學生將移到未分年級未分班級.", record.Name);
                    }
                    else
                    {
                        msg = string.Format("確定要刪除「{0}」?", record.Name);
                    }

                    if (FISCA.Presentation.Controls.MsgBox.Show(msg, "刪除班級", MessageBoxButtons.YesNo) == DialogResult.Yes)
                    {
                        JHSchool.Data.JHClassRecord classRec = JHSchool.Data.JHClass.SelectByID(record.ID);

                        PermRecLogProcess prlp = new PermRecLogProcess();
                        prlp.SaveLog("學籍.班級", "刪除班級", "刪除班級資料,班級名稱:" + classRec.Name);
                        JHSchool.Data.JHClass.Delete(classRec);
                        Class.Instance.SyncDataBackground(record.ID);
                    }
                    else
                    {
                        return;
                    }
                }
            };
            #endregion

            #region RibbonBar 學生/匯入匯出

            rbItem             = Class.Instance.RibbonBarItems["資料統計"];
            rbItem["匯出"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯出"].Image = Properties.Resources.Export_Image;
            rbItem["匯出"]["匯出班級基本資料"].Enable = User.Acl["JHSchool.Class.Ribbon0030"].Executable;
            rbItem["匯出"]["匯出班級基本資料"].Click += delegate
            {
                new JHSchool.ClassExtendControls.Ribbon.ClassExportWizard().ShowDialog();
            };

            rbItem["匯入"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["匯入"].Image = Properties.Resources.Import_Image;
            rbItem["匯入"]["匯入班級基本資料"].Enable = User.Acl["JHSchool.Class.Ribbon0020"].Executable;
            rbItem["匯入"]["匯入班級基本資料"].Click += delegate
            {
                new JHSchool.ClassExtendControls.Ribbon.ClassImportWizard().ShowDialog();
            };
            #endregion

            //報表,是以常態呈現
            rbItem["報表"].Size  = RibbonBarButton.MenuButtonSize.Large;
            rbItem["報表"].Image = Properties.Resources.paste_64;
            rbItem["報表"].SupposeHasChildern = true;

            #region RibbonBar 班級/學務作業
            //rbItem = Class.Instance.RibbonBarItems["學務作業"];
            //rbItem["德行加減分"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["德行加減分"].Image = ClassExtendControls.Ribbon.Resources.btnAdjust_Image;
            //rbItem["德行加減分"].Click += delegate
            //{

            //};

            //rbItem["文字評量"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["文字評量"].Click += delegate
            //{

            //};
            #endregion

            #region RibbonBar 班級/教務作業
            //rbItem = Class.Instance.RibbonBarItems["教務作業"];
            //rbItem["班級升級"].Image = ClassExtendControls.Ribbon.Resources.btnUpgrade_Image;
            //rbItem["班級升級"].Click += delegate
            //{

            //};
            #endregion

            #region RibbonBar 班級/指定
            rbItem = Class.Instance.RibbonBarItems["指定"];
            //rbItem["類別"].Image = InternalExtendControls.Tagging.Resources.ctxTag_Image;
            //rbItem["類別"].Size = RibbonBarButton.MenuButtonSize.Medium;
            //rbItem["類別"].SupposeHasChildern = true;
            //rbItem["類別"].PopupOpen += new EventHandler<PopupOpenEventArgs>(
            //    new TaggingMenu("JHSchool.Class.Ribbon0040", "JHSchool.Class.Ribbon0050").MenuOpen);

            //rbItem = Class.Instance.RibbonBarItems["指定"];
            //rbItem["學生"].Size = RibbonBarButton.MenuButtonSize.Small;
            //rbItem["學生"].Image = ClassExtendControls.Ribbon.Resources.btnAssignStudent_Image;
            //rbItem["學生"].Click += delegate
            //{

            //};

            //rbItem["課程規劃"].Size = RibbonBarButton.MenuButtonSize.Small;
            //rbItem["課程規劃"].Image = ClassExtendControls.Ribbon.Resources.btnPlan_Image;
            //rbItem["課程規劃"].Click += delegate
            //{

            //};

            //rbItem["計算規則"].Size = RibbonBarButton.MenuButtonSize.Small;
            //rbItem["計算規則"].Image = ClassExtendControls.Ribbon.Resources.btnCalcRule_Image;
            //rbItem["計算規則"].Click += delegate
            //{

            //};
            #endregion

            #region RibbonBar 班級/統計報表0
            //rbItem = Class.Instance.RibbonBarItems["統計報表"];
            //rbItem["統計"].Image = ClassExtendControls.Ribbon.Resources.btnStatistics_Image;
            //rbItem["統計"].Click += delegate
            //{

            //};

            //rbItem["報表"].Image = ClassExtendControls.Ribbon.Resources.btnReport_Image;
            //rbItem["報表"].Click += delegate
            //{

            //};
            #endregion

            #region RibbonBar 班級/其它
            //rbItem = Class.Instance.RibbonBarItems["其它"];
            //rbItem["修改歷程"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["修改歷程"].Image = ClassExtendControls.Ribbon.Resources.btnHistory_Image;
            //rbItem["修改歷程"].Click += delegate
            //{

            //};

            //rbItem["問卷"].Size = RibbonBarButton.MenuButtonSize.Large;
            //rbItem["問卷"].Image = ClassExtendControls.Ribbon.Resources.btnSurvey_Image;
            //rbItem["問卷"].Click += delegate
            //{

            //};
            #endregion

            //ListPaneField idField = new ListPaneField("ID");
            //idField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            //{
            //    e.Value = e.Key;
            //};

            //#region 排序班級ID
            //idField.CompareValue += delegate(object sender, CompareValueEventArgs e)
            //{
            //    int x, y;

            //    if (!int.TryParse(e.Value1.ToString(), out x))
            //        x = int.MaxValue;

            //    if (!int.TryParse(e.Value2.ToString(), out y))
            //        y = int.MaxValue;

            //    e.Result = x.CompareTo(y);
            //};
            //#endregion
            //this.AddListPaneField(idField);

            ListPaneField gradeYearField = new ListPaneField("年級");
            gradeYearField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].GradeYear;
                }
            };
            this.AddListPaneField(gradeYearField);


            ListPaneField nameField = new ListPaneField("名稱");
            nameField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].Name;
                }
            };

            this.AddListPaneField(nameField);

            ListPaneField classTeacherField = new ListPaneField("班導師");
            classTeacherField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    if (Items[e.Key].Teacher != null)
                    {
                        e.Value = Items[e.Key].Teacher.FullName;
                    }
                }
            };
            this.AddListPaneField(classTeacherField);

            ListPaneField classStudentCountField = new ListPaneField("人數");
            classStudentCountField.CompareValue += new EventHandler <CompareValueEventArgs>(class_CompareValue);
            classStudentCountField.GetVariable  += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].Students.Count;
                }
            };
            this.AddListPaneField(classStudentCountField);


            ListPaneField classIndexField = new ListPaneField("排列序號");
            classIndexField.CompareValue += new EventHandler <CompareValueEventArgs>(class_CompareValue);
            classIndexField.GetVariable  += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    if (Items[e.Key].DisplayOrder != "")
                    {
                        e.Value = Items[e.Key].DisplayOrder;
                    }
                    else
                    {
                        e.Value = "";
                    }
                }
            };
            this.AddListPaneField(classIndexField);

            ListPaneField classNamingRuleField = new ListPaneField("班級命名規則");
            classNamingRuleField.GetVariable += delegate(object sender, GetVariableEventArgs e)
            {
                if (Items[e.Key] != null)
                {
                    e.Value = Items[e.Key].NamingRule;
                }
            };
            this.AddListPaneField(classNamingRuleField);

            //Class.Instance.AddView(new AllItemView());

            Class.Instance.AddView(new JHSchool.StudentExtendControls.Class_View());
            //Class.Instance.AddView(new JHSchool.ClassExtendControls.SubjectView()); //由類別模組提供

            // 班級基本資料
            Class.Instance.AddDetailBulider(new FISCA.Presentation.DetailBulider <JHSchool.ClassExtendControls.ClassBaseInfoItem>());

            //Class.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<ClassExtendControls.ClassBaseInfoItem>());

            Present.NavPaneContexMenu.GetChild("重新整理").Click += delegate { this.SyncAllBackground(); };

            //Class.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<ClassExtendControls.ClassStudentItem>());
            //電子報表(因相關功能未完成先註)
            //Class.Instance.AddDetailBulider(new JHSchool.Legacy.ContentItemBulider<ClassExtendControls.ElectronicPaperPalmerworm>());

            //Class.Instance.AddDetailBulider(new JHSchool.CriticalSection.Test_classInfo());

            #region 註冊權限管理
            Catalog ribbon = RoleAclSource.Instance["班級"]["功能按鈕"];
            ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0000", "新增班級"));
            ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0010", "刪除班級"));
            ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0020", "匯入班級資料"));
            ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0030", "匯出班級資料"));
            //ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0040", "指定班級類別"));
            //ribbon.Add(new RibbonFeature("JHSchool.Class.Ribbon0050", "管理班級類別清單"));

            Catalog detail = RoleAclSource.Instance["班級"]["資料項目"];
            detail.Add(new DetailItemFeature(typeof(ClassExtendControls.ClassBaseInfoItem)));
            //電子報表(因相關功能未完成先註)
            //detail.Add(new DetailItemFeature(typeof(ClassExtendControls.ElectronicPaperPalmerworm)));
            #endregion

            #region 增加班級搜尋條件鈕

            ConfigData cd = User.Configuration["ClassSearchOptionPreference"];

            SearchClassName = SearchConditionMenu["班級名稱"];
            SearchClassName.AutoCheckOnClick    = true;
            SearchClassName.AutoCollapseOnClick = false;
            SearchClassName.Checked             = cd.GetBoolean("SearchClassName", true);
            SearchClassName.Click += delegate
            {
                cd.SetBoolean("SearchClassName", SearchClassName.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            SearchClassTeacher = SearchConditionMenu["班級導師"];
            SearchClassTeacher.AutoCheckOnClick    = true;
            SearchClassTeacher.AutoCollapseOnClick = false;
            SearchClassTeacher.Checked             = cd.GetBoolean("SearchClassTeacher", true);
            SearchClassTeacher.Click += delegate
            {
                cd.SetBoolean("SearchClassTeacher", SearchClassTeacher.Checked);
                BackgroundWorker async = new BackgroundWorker();
                async.DoWork += delegate(object sender, DoWorkEventArgs e) { (e.Argument as ConfigData).Save(); };
                async.RunWorkerAsync(cd);
            };

            Present.Search += new EventHandler <SearchEventArgs>(Class_Search);

            #endregion

            //由類別模組提供
            //Present.SetDescriptionPaneBulider(new DescriptionPaneBulider<JHSchool.ClassExtendControls.ClassDescription>());

            MotherForm.AddPanel(K12.Presentation.NLDPanels.Class);
            _Initilized = true;
            FillFilter();
        }
        static public void Main()
        {
            // 匯入驗證規則
            FactoryProvider.FieldFactory.Add(new EquipmentFieldValidatorFactory());
            FactoryProvider.RowFactory.Add(new EquipmentRowValidatorFactory());

            #region Init UDT
            {
                ConfigData cd = K12.Data.School.Configuration["設備預約模組載入設定Version_1008"];

                bool   checkUDT = false;
                string name     = "設備預約UDT是否已載入";

                //如果尚無設定值,預設為
                if (string.IsNullOrEmpty(cd[name]))
                {
                    cd[name] = "false";
                }

                //檢查是否為布林
                bool.TryParse(cd[name], out checkUDT);

                if (!checkUDT)
                {
                    AccessHelper access = new AccessHelper();
                    access.Select <UDT.Equipment>("UID = '00000'");
                    access.Select <UDT.EquipmentUnit>("UID = '00000'");
                    access.Select <UDT.EquipmentUnitAdmin>("UID = '00000'");
                    access.Select <UDT.EquipmentApplication>("UID = '00000'");
                    access.Select <UDT.EquipmentApplicationDetail>("UID = '00000'");
                    access.Select <UDT.EquipmentIOHistory>("UID = '00000'");

                    cd[name] = "true";
                    cd.Save();
                }
            }
            #endregion

            #region 建立設備預約模組管理者專用角色
            {
                // 如果管理者角色不存在,建立角色並取回角色ID
                if (!DAO.Role.CheckIsRoleExist(_roleAdminName))
                {
                    _roleAdminID = DAO.Role.InsertRole(_roleAdminName, "", _permission);
                }
                else // 更新角色權限
                {
                    DAO.Role.UpdateRole(_roleAdminID);
                }
            }
            #endregion

            #region 建立設備預約專用腳色
            {
                // 如果專用角色不存在,建立角色並取回角色ID
                if (!DAO.Role.CheckIsRoleExist(_roleName))
                {
                    _roleID = DAO.Role.InsertRole(_roleName, "", _permission);
                }
                else // 更新角色權限
                {
                    DAO.Role.UpdateRole(_roleID);
                }
            }
            #endregion

            // 取得登入帳號與身分
            Actor actor = Actor.Instance;

            // 建立設備預約分頁
            MotherForm.AddPanel(BookingEquipmentAdmin.Instance);

            #region 設備預約
            {
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Size     = RibbonBarButton.MenuButtonSize.Medium;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Image    = Properties.Resources.meeting_config_64;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Size    = RibbonBarButton.MenuButtonSize.Medium;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Image   = Properties.Resources.foreign_language_config_64;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Size       = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Image      = Properties.Resources.shopping_cart_config_64;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"].Image        = Properties.Resources.Export_Image;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"].Image        = Properties.Resources.Import_Image;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"].Image        = Properties.Resources.Report;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Size   = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Image  = Properties.Resources.barcode_zoom_128;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Size  = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Image = Properties.Resources.barcode_ok_128;

                #region 設定管理單位
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Enable = Permissions.設定管理單位權限;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定管理單位"].Click += delegate
                {
                    if (actor.isSysAdmin())
                    {
                        ManagementUnit form = new ManagementUnit();
                        form.ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有設定設備管理單位權限");
                    }
                };
                #endregion

                #region 設定單位管理員
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Enable = Permissions.設定單位管理員權限;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設定單位管理員"].Click += delegate
                {
                    if (actor.isSysAdmin())
                    {
                        SetUnitAdmin form = new SetUnitAdmin();
                        form.ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有設定設備單位管理員權限");
                    }
                };
                #endregion

                #region 設備管理
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Enable = Permissions.管理設備權限;
                MotherForm.RibbonBarItems["設備預約", "基本設定"]["設備管理"].Click += delegate
                {
                    if (actor.isSysAdmin() || actor.isUnitAdmin())
                    {
                        ManageEquipment form = new ManageEquipment();
                        form.ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有管理設備權限");
                    }
                };
                #endregion

                #region 資料統計

                #region 匯出設備清單
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"]["匯出設備清單"].Enable = Permissions.匯出設備清單權限;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯出"]["匯出設備清單"].Click += delegate
                {
                    if (actor.isSysAdmin() || actor.isUnitAdmin())
                    {
                        ExportEquipmentForm form = new ExportEquipmentForm();
                        form.ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有匯出設備清單權限");
                    }
                };
                #endregion

                #region 匯入設備清單
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"]["匯入設備清單"].Enable = Permissions.匯入設備清單權限;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["匯入"]["匯入設備清單"].Click += delegate
                {
                    if (actor.isSysAdmin() || actor.isUnitAdmin())
                    {
                        new ImportEquipmentData().Execute();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有匯入設備清單權限");
                    }
                };
                #endregion

                #region 統計設備使用狀況
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"]["統計設備使用狀況"].Enable = Permissions.統計設備使用狀況權限;
                MotherForm.RibbonBarItems["設備預約", "資料統計"]["報表"]["統計設備使用狀況"].Click += delegate
                {
                    if (actor.isSysAdmin() || actor.isUnitAdmin())
                    {
                        StatisticalTableForm form = new StatisticalTableForm();
                        form.ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有列印報表權限");
                    }
                };
                #endregion

                #endregion

                #region 查詢設備出借紀錄
                {
                    MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Enable = Permissions.查詢出借紀錄權限;
                    MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["查詢出借紀錄"].Click += delegate
                    {
                        if (actor.isSysAdmin() || actor.isUnitAdmin())
                        {
                            (new frmSearchApplication()).ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有設備出借權限");
                        }
                    };
                }
                #endregion

                #region 設備出借/歸還
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Enable = Permissions.設備出借歸還權限;
                MotherForm.RibbonBarItems["設備預約", "設備出借作業"]["設備出借/歸還"].Click += delegate
                {
                    if (actor.isSysAdmin() || actor.isUnitAdmin())
                    {
                        BorrowEquipmentForm form = new BorrowEquipmentForm();
                        form.ShowDialog();
                    }
                    else
                    {
                        MsgBox.Show("此帳號沒有設備出借權限");
                    }
                };
                #endregion
            }
            #endregion

            #region  限管理
            Catalog detail = new Catalog();
            detail = RoleAclSource.Instance["設備預約"]["功能按鈕"];
            detail.Add(new RibbonFeature(Permissions.管理單位, "設定管理單位"));
            detail.Add(new RibbonFeature(Permissions.設備單位管理員, "設定設備單位管理員"));
            detail.Add(new RibbonFeature(Permissions.管理設備, "管理設備"));
            detail.Add(new RibbonFeature(Permissions.匯出設備清單, "匯出設備清單"));
            detail.Add(new RibbonFeature(Permissions.匯入設備清單, "匯入設備清單"));
            detail.Add(new RibbonFeature(Permissions.統計設備使用狀況, "統計設備使用狀況"));
            detail.Add(new RibbonFeature(Permissions.設備出借歸還, "設備出借歸還"));
            detail.Add(new RibbonFeature(Permissions.查詢出借紀錄, "查詢出借紀錄"));
            #endregion
        }
Exemplo n.º 13
0
        static public void Main()
        {
            // Init 會議室預約模組Panel
            BookingRoomAdmin ba = new BookingRoomAdmin();

            MotherForm.AddPanel(BookingRoomAdmin.Instance);

            #region Init UDT

            ConfigData cd       = K12.Data.School.Configuration["場地預約模組載入設定"];
            bool       checkUDT = false;
            string     name     = "場地預約UDT是否已載入";

            //如果尚無設定值,預設為
            if (string.IsNullOrEmpty(cd[name]))
            {
                cd[name] = "false";
            }

            //檢查是否為布林
            bool.TryParse(cd[name], out checkUDT);

            if (!checkUDT)
            {
                AccessHelper access = new AccessHelper();
                access.Select <UDT.MeetingRoom>("UID = '00000'");
                access.Select <UDT.MeetingRoomEquipment>("UID = '00000'");
                access.Select <UDT.MeetingRoomUnit>("UID = '00000'");
                access.Select <UDT.MeetingRoomUnitAdmin>("UID = '00000'");
                access.Select <UDT.MeetingRoomSystemAdmin>("UID = '00000'");
                access.Select <UDT.MeetingRoomApplication>("UID = '00000'");
                access.Select <UDT.MeetingRoomApplicationDetail>("UID = '00000'");

                cd[name] = "true";
                cd.Save();
            }

            #endregion

            #region Init Role
            {
                #region 建立會議室預約模組管理者專用角色
                if (!DAO.Role.CheckRoleIsExist(_roleAdminName))
                {
                    _roleAdminID = DAO.Role.InsertRole(_roleAdminName); // 建立角色
                }
                else
                {
                    DAO.Role.UpdateRole(_roleAdminID); // 更新角色
                }

                #endregion

                #region 建立會議室預約專用角色
                if (!DAO.Role.CheckRoleIsExist(_roleName))
                {
                    _roleID = DAO.Role.InsertRole(_roleName); // 建立角色
                }
                else
                {
                    DAO.Role.UpdateRole(_roleID);  // 更新角色
                }
                #endregion
            }
            #endregion

            #region 匯入的驗證規則
            {
                FactoryProvider.FieldFactory.Add(new MeetingRoomFieldValidatorFactory());
                FactoryProvider.RowFactory.Add(new MeetingRoomRowValidatorFactory());
            }
            #endregion

            #region 會議室預約
            {
                // 取得登入帳號身分
                Actor actor = Actor.Instance;

                MotherForm.RibbonBarItems["會議室預約", "基本設定"]["會議室管理"].Size      = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["會議室預約", "基本設定"]["會議室管理"].Image     = Properties.Resources.architecture_config_64;
                MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定管理單位"].Size     = RibbonBarButton.MenuButtonSize.Medium;
                MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定管理單位"].Image    = Properties.Resources.meeting_config_64;
                MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定單位管理員"].Size    = RibbonBarButton.MenuButtonSize.Medium;
                MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定單位管理員"].Image   = Properties.Resources.foreign_language_config_64;
                MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯出"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯出"].Image        = Properties.Resources.Export_Image;
                MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯入"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯入"].Image        = Properties.Resources.Import_Image;
                MotherForm.RibbonBarItems["會議室預約", "資料統計"]["報表"].Size         = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["會議室預約", "資料統計"]["報表"].Image        = Properties.Resources.Report;
                MotherForm.RibbonBarItems["會議室預約", "會議室預約作業"]["審核預約紀錄"].Size  = RibbonBarButton.MenuButtonSize.Large;
                MotherForm.RibbonBarItems["會議室預約", "會議室預約作業"]["審核預約紀錄"].Image = Properties.Resources.document_ok_64;

                #region 會議室管理
                {
                    MotherForm.RibbonBarItems["會議室預約", "基本設定"]["會議室管理"].Enable = Permissions.管理會議室權限;
                    MotherForm.RibbonBarItems["會議室預約", "基本設定"]["會議室管理"].Click += delegate
                    {
                        if (actor.isSysAdmin() || actor.isUnitAdmin() || actor.isUnitBoss())
                        {
                            MeetingRoomManagement form = new MeetingRoomManagement();
                            form.ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有管理會議室權限!");
                        }
                    };
                }
                #endregion

                #region 設定管理單位
                {
                    MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定管理單位"].Enable = Permissions.設定會議室管理單位權限;
                    MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定管理單位"].Click += delegate
                    {
                        if (actor.isSysAdmin())
                        {
                            ManageUnitForm form = new ManageUnitForm();
                            form.ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有設定會議室管理單位權限");
                        }
                    };
                }
                #endregion

                #region 設定單位管理員
                {
                    MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定單位管理員"].Enable = Permissions.設定單位管理員權限;
                    MotherForm.RibbonBarItems["會議室預約", "基本設定"]["設定單位管理員"].Click += delegate
                    {
                        if (actor.isSysAdmin())
                        {
                            ManageUnitAdminForm form = new ManageUnitAdminForm();
                            form.ShowDialog();
                        }
                        else if (actor.isUnitBoss())
                        {
                            ManageUnitAdminForm form = new ManageUnitAdminForm();
                            form.ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有設定單位管理員權限");
                        }
                    };
                }
                #endregion

                #region 匯出場地清單
                {
                    MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯出"]["會議室清單"].Enable = Permissions.匯出會議室清單權限;
                    MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯出"]["會議室清單"].Click += delegate
                    {
                        if (actor.isSysAdmin() || actor.isUnitBoss() || actor.isUnitAdmin())
                        {
                            ExportMeetingRoomForm form = new ExportMeetingRoomForm();
                            form.ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有使用權限!");
                        }
                    };
                }
                #endregion

                #region 匯入場地清單
                {
                    MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯入"]["會議室清單"].Enable = Permissions.匯入會議室清單權限;
                    MotherForm.RibbonBarItems["會議室預約", "資料統計"]["匯入"]["會議室清單"].Click += delegate
                    {
                        if (actor.isSysAdmin() || actor.isUnitBoss() || actor.isUnitAdmin())
                        {
                            new ImportMeetingRoomData().Execute();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有使用權限!");
                        }
                    };
                }
                #endregion

                #region 統計場地使用狀況
                {
                    MotherForm.RibbonBarItems["會議室預約", "資料統計"]["報表"]["統計會議室使用狀況"].Enable = Permissions.統計會議室使用狀況權限;
                    MotherForm.RibbonBarItems["會議室預約", "資料統計"]["報表"]["統計會議室使用狀況"].Click += delegate
                    {
                        if (actor.isSysAdmin() || actor.isUnitBoss() || actor.isUnitAdmin())
                        {
                            StatisticalReportForm form = new StatisticalReportForm();
                            form.ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有使用權限!");
                        }
                    };
                }
                #endregion

                #region 審核作業
                {
                    MotherForm.RibbonBarItems["會議室預約", "會議室預約作業"]["審核預約紀錄"].Enable = Permissions.審核作業權限;
                    MotherForm.RibbonBarItems["會議室預約", "會議室預約作業"]["審核預約紀錄"].Click += delegate
                    {
                        if (actor.isSysAdmin() || actor.isUnitBoss() || actor.isUnitAdmin())
                        {
                            ReviewForm form = new ReviewForm();
                            form.ShowDialog();
                        }
                        else
                        {
                            MsgBox.Show("此帳號沒有使用權限!");
                        }
                    };
                }
                #endregion

                #region  限管理
                Catalog detail = new Catalog();
                detail = RoleAclSource.Instance["會議室預約"]["功能按鈕"];
                detail.Add(new RibbonFeature(Permissions.會議室管理單位, "設定會議室管理單位"));
                detail.Add(new RibbonFeature(Permissions.管理會議室, "管理會議室"));
                //detail.Add(new RibbonFeature(Permissions.系統管理員,"系統管理員")); ---已廢除此功能
                detail.Add(new RibbonFeature(Permissions.單位管理員, "設定單位管理員"));
                detail.Add(new RibbonFeature(Permissions.審核作業, "審核作業"));
                detail.Add(new RibbonFeature(Permissions.匯入會議室清單, "匯入會議室清單"));
                detail.Add(new RibbonFeature(Permissions.匯出會議室清單, "匯出會議室清單"));
                detail.Add(new RibbonFeature(Permissions.統計會議室使用狀況, "統計會議室使用狀況"));
                #endregion
            }
            #endregion
        }
Exemplo n.º 14
0
        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 + "」個社團");
            };
        }