Example #1
0
        static public void Main()
        {
            //1秒
            Framework.Program.Initial();
            //FISCA.Presentation.MotherForm.PreferenceProvider = new PresentationPreference();

            //學校組態基本上就是儲存在 App.Configuration 之中。
            School.Configuration = new School.SchoolConfigRedirect(Framework.App.Configuration);

            //電子報表
            SmartSchool.ePaper.DispatcherProvider.Register("ischool", new DispatcherImp(), true);

            Class.Instance.SyncAllBackground();
            Class.Instance.WaitLoadingComplete();
            Student.Instance.SyncAllBackground();
            Student.Instance.WaitLoadingComplete();
            Teacher.Instance.SyncAllBackground();
            Teacher.Instance.WaitLoadingComplete();
            Course.Instance.SyncAllBackground();
            Course.Instance.WaitLoadingComplete();

            //K12.Student.Instance.AddView(new ShowAllStudentsView());
            //1.1 秒
            Student.Instance.SetupPresentation();
            Class.Instance.SetupPresentation();
            Teacher.Instance.SetupPresentation();
            Course.Instance.SetupPresentation(); //課程的類別已調整
            //K12.Course.Instance.AddView(new ShowAllStudentsView());

            //設定 ASPOSE 元件的 License。
            System.IO.Stream stream = new System.IO.MemoryStream(Resources.Aspose_Total);

            stream.Seek(0, System.IO.SeekOrigin.Begin);
            new Aspose.Words.License().SetLicense(stream);
            stream.Seek(0, System.IO.SeekOrigin.Begin);

            // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法,
            //另外詢問耀明後,補充此段程式碼Aspose 已在別的地方做認證,不需要重覆做。

            //new Aspose.Cells.License().SetLicense(stream);


            stream.Seek(0, System.IO.SeekOrigin.Begin);
            new Aspose.BarCode.License().SetLicense(stream);
            stream.Seek(0, System.IO.SeekOrigin.Begin);
            new Aspose.Pdf.License().SetLicense(stream);

            FISCA.LogAgent.ApplicationLog.Log("[特殊歷程]", "登入", string.Format("使用者{0}已登入系統", FISCA.Authentication.DSAServices.UserAccount));

            // 變更使用者密碼
            FISCA.Presentation.MotherForm.StartMenu["安全性"].BeginGroup     = true;
            FISCA.Presentation.MotherForm.StartMenu["安全性"].Image          = Properties.Resources.foreign_key_lock_64;
            FISCA.Presentation.MotherForm.StartMenu["安全性"]["變更密碼"].Enable = User.Acl["StartButton0004"].Executable;
            FISCA.Presentation.MotherForm.StartMenu["安全性"]["變更密碼"].Click += delegate
            {
                JHSchool.UserInfoManager uim = new UserInfoManager();
                uim.ShowDialog();
            };

            // 管理學校基本資料
            FISCA.Presentation.MotherForm.StartMenu["管理學校基本資料"].Image  = Properties.Resources.school_fav_64;
            FISCA.Presentation.MotherForm.StartMenu["管理學校基本資料"].Enable = User.Acl["StartButton0003"].Executable;
            FISCA.Presentation.MotherForm.StartMenu["管理學校基本資料"].Click += delegate
            {
                JHSchool.SchoolInfoMangement sim = new SchoolInfoMangement();
                sim.ShowDialog();
            };

            Framework.Security.RoleAclSource.Instance["系統"].Add(new Framework.Security.RibbonFeature("StartButton0003", "管理學校基本資料"));
            Framework.Security.RoleAclSource.Instance["系統"].Add(new Framework.Security.RibbonFeature("StartButton0004", "變更密碼"));

            FISCA.Presentation.MotherForm.StartMenu["重新登入"].Image      = Properties.Resources.world_upload_64;
            FISCA.Presentation.MotherForm.StartMenu["重新登入"].BeginGroup = true;
            FISCA.Presentation.MotherForm.StartMenu["重新登入"].Click     += new EventHandler(Restart_Click);

            //設定畫面選取Count
            SelectedListChanged();


            // 學生>班級資訊覆寫
            IClassBaseInfoItemAPI item = FISCA.InteractionService.DiscoverAPI <IClassBaseInfoItemAPI>();

            if (item != null)
            {
                Class.Instance.AddDetailBulider(item.CreateBasicInfo());
            }
            else
            {
                Class.Instance.AddDetailBulider(new DetailBulider <JHSchool.ClassExtendControls.ClassBaseInfoItem>());
            }

            //new K12.General.Feedback.NewsNotice();

            //Student.Instance.RibbonBarItems["測試"]["測Tag"].Click += delegate
            //{
            //    Tag.Instance.SyncAllBackground();
            //    Framework.FISCA.Presentation.Controls.MsgBox.Show(Tag.Instance.Items.Count.ToString());

            //    foreach (TagRecord ech in Tag.Instance.Items.GetStudentTags())
            //        Console.WriteLine(ech.FullName);
            //};

            //StudentTag.Instance.ItemLoaded += delegate
            //{
            //    Framework.FISCA.Presentation.Controls.MsgBox.Show(StudentTag.Instance.Items.Count.ToString());
            //};

            //ClassTag.Instance.ItemLoaded += delegate
            //{
            //    Framework.FISCA.Presentation.Controls.MsgBox.Show(ClassTag.Instance.Items.Count.ToString());
            //};

            //TeacherTag.Instance.ItemLoaded += delegate
            //{
            //    Framework.FISCA.Presentation.Controls.MsgBox.Show(TeacherTag.Instance.Items.Count.ToString());
            //};

            //CourseTag.Instance.ItemLoaded += delegate
            //{
            //    Framework.FISCA.Presentation.Controls.MsgBox.Show(CourseTag.Instance.Items.Count.ToString());
            //};

            //StudentTag.Instance.SyncAllBackground();
            //ClassTag.Instance.SyncAllBackground();
            //TeacherTag.Instance.SyncAllBackground();
            //CourseTag.Instance.SyncAllBackground();

            //Student.Instance.SelectedListChanged += delegate
            //{
            //    if (Student.Instance.SelectedList.Count > 0)
            //    {
            //        Framework.FISCA.Presentation.Controls.MsgBox.Show(Student.Instance.SelectedList[0].GetTags().Count.ToString());
            //    }
            //};
        }
Example #2
0
        public CellCommentManager Validate(SheetHelper sheet)
        {
            //int t1 = Environment.TickCount;
            _valid_factory.UpdateUnique = new UpdateUniqueRowValidator(_context, sheet);

            // 2018/4/17 穎驊註解,因應客服#5944 反應,檢查匯入班級機制,發現其驗證規則為抓取Severice 回傳的xml
            // 經過與恩正、均泰、耀明的討論後,決定將舊的程式碼註解,將其設定存在程式碼中(JH_C_ImportValidatorRule),直接抓取使用,方便日後維護。
            //XmlElement xmlRule = _context.DataSource.GetValidateFieldRule();

            //2018/12/21 穎驊 完成高雄項目 [10-03][??] 局端夠查詢學校班級有調整”導師”的功能
            // 有載入高雄自動編班模組的 , 其匯入規則 載Local 的設定KH版本(班級名稱、班導師 不得空白)
            XmlElement xmlRule;

            IClassBaseInfoItemAPI item = FISCA.InteractionService.DiscoverAPI <IClassBaseInfoItemAPI>();

            if (item != null)
            {
                //讀取XML欄位描述
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(Properties.Resources.JH_C_ImportValidatorRule_KH);
                xmlRule = doc.DocumentElement;
            }
            else
            {
                //讀取XML欄位描述
                XmlDocument doc = new XmlDocument();
                doc.LoadXml(Properties.Resources.JH_C_ImportValidatorRule);
                xmlRule = doc.DocumentElement;
            };

            _validator.InitFromXMLNode(xmlRule);

            //Console.WriteLine("初始化 Validator時間:{0}", Environment.TickCount - t1);

            _validator.ErrorCaptured += new DocumentValidate.ErrorCapturedEventHandler(validator_ErrorCaptured);
            _validator.AutoCorrect   += new DocumentValidate.AutoCorrectEventHandler(validator_AutoCorrect);

            _sheetSource = new SheetRowSource(sheet, _context);
            int progress = 0, firstRow = sheet.FirstDataRowIndex, maxRow = sheet.MaxDataRowIndex;

            for (int rowIndex = firstRow; rowIndex <= maxRow; rowIndex++)
            {
                _sheetSource.BindRow(rowIndex);
                _validator.ValidateRow(_sheetSource);

                Application.DoEvents();

                //回報進度。
                if (((++progress) % ProgressStep) == 0)
                {
                    if (ProgressChanged != null)
                    {
                        int percentage = progress * 100 / (maxRow - firstRow);
                        ProgressUserState userState = new ProgressUserState();
                        ProgressChanged(this, new ProgressChangedEventArgs(percentage, userState));

                        if (userState.Cancel)
                        {
                            return(_comments);
                        }
                    }
                }
            }
            ProgressChanged(this, new ProgressChangedEventArgs(100, new ProgressUserState()));

            _validator.ErrorCaptured -= new DocumentValidate.ErrorCapturedEventHandler(validator_ErrorCaptured);
            _validator.AutoCorrect   -= new DocumentValidate.AutoCorrectEventHandler(validator_AutoCorrect);

            if (_context.CurrentMode == ImportMode.Update)
            {
                CellCommentManager comments = _valid_factory.UpdateUnique.CheckUpdateResult();
                _comments.MergeFrom(comments);
            }

            //foreach (CellComment each in _comments)
            //    Console.WriteLine(string.Format("{0}:{1} {2} Msg:{3}",
            //        each.RowIndex, each.ColumnIndex, each.BestComment, each.BestComment.Comment));

            return(_comments);
        }
Example #3
0
        private void ExportClass_Load(object sender, EventArgs e)
        {
            //XmlElement element = SmartSchool.Feature.Class.ClassBulkProcess.GetExportDescription();
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(Properties.Resources.JH_C_ExportDescription);
            XmlElement element = doc.DocumentElement;

            #region XML內容

            /*	<FieldDescription>
             *                          <Field DisplayText="班級系統編號" Name="ID" ReadOnly="True" />
             *                          <Field DisplayText="班級名稱" Name="ClassName" ShiftCheckable="True" />
             *                          <Field DisplayText="班導師" Name="TeacherName" ShiftCheckable="True" />
             *                          <Field DisplayText="年級" Name="GradeYear" ShiftCheckable="True" />
             *                          <Field DisplayText="科別" Name="DepartmentName" ShiftCheckable="True" />
             *                          <Field DisplayText="課程規劃" Name="GraduationPlan" ShiftCheckable="True" />
             *                          <Field DisplayText="計算規則" Name="CalculationRule" ShiftCheckable="True" />
             *                          <Field DisplayText="排列序號" Name="DisplayOrder" ShiftCheckable="True" />
             *                          <Field DisplayText="班級名稱規則" Name="NamingRule" ShiftCheckable="True" />
             *                  </FieldDescription>
             */



            #endregion

            BaseFieldFormater formater = new BaseFieldFormater();
            //將資料格式化,並組成集合
            FieldCollection collection = formater.Format(element);

            // 2018/12/21 穎驊 因應高雄項目 [10-03][??] 局端夠查詢學校班級有調整”導師”的功能
            // 讓匯出的說明,班導師也納入 必填欄位
            // 但蠻無言的, 原來的必填欄位居然只是這樣填寫List...
            // 有載入高雄自動編班模組的 , 其匯入規則 載Local 的設定(班導師必填)
            // 其餘的學校 依然為舊做法,自Service 載匯入規則資料

            List <string> list;

            IClassBaseInfoItemAPI ClassBaseInfoItem = FISCA.InteractionService.DiscoverAPI <IClassBaseInfoItemAPI>();
            if (ClassBaseInfoItem != null)
            {
                list = new List <string>(new string[] { "班級系統編號", "班級名稱", "班導師" });
            }
            else
            {
                list = new List <string>(new string[] { "班級系統編號", "班級名稱" });
            }

            //將集合內容,逐一填入使用者勾選清單中(Tag放置一份field),預設為(true)
            foreach (Field field in collection)
            {
                ListViewItem item = listView.Items.Add(field.DisplayText);
                if (list.Contains(field.DisplayText))
                {
                    item.ForeColor = Color.Red;
                }
                item.Tag     = field;
                item.Checked = true;
            }
        }
Example #4
0
        private void wpSelectFileAndAction_NextButtonClick(object sender, CancelEventArgs e)
        {
            try
            {
                e.Cancel = true;

                Context.SourceFile = txtSourceFile.Text;
                if (string.IsNullOrEmpty(Context.SourceFile))
                {
                    FISCA.Presentation.Controls.MsgBox.Show("您必須選擇匯入來源檔案。");
                    return;
                }

                if (!File.Exists(Context.SourceFile))
                {
                    FISCA.Presentation.Controls.MsgBox.Show("您指定的來源檔案並不存在。");
                    return;
                }

                if (Context.CurrentMode == ImportMode.None)
                {
                    FISCA.Presentation.Controls.MsgBox.Show("您必須決定一種匯入方式。");
                    return;
                }

                lblCollectMsg.Text = "讀取匯入規格描述資訊…";
                pProgram.Visible   = true;
                pUser.Visible      = false;
                Application.DoEvents();

                XmlElement fieldData;

                //2018/12/21 穎驊 完成高雄項目 [10-03][??] 局端夠查詢學校班級有調整”導師”的功能
                // 有載入高雄自動編班模組的 , 其匯入規則 載Local 的設定(班導師必填)
                // 其餘的學校 依然為舊做法,自Service 載匯入規則資料
                IClassBaseInfoItemAPI item = FISCA.InteractionService.DiscoverAPI <IClassBaseInfoItemAPI>();
                if (item != null)
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(Properties.Resources.JH_C_BulkDescription);

                    fieldData = doc.DocumentElement;
                }
                else
                {
                    fieldData = Context.DataSource.GetImportFieldList();
                }

                Context.SupportFields    = ImportFieldCollection.CreateFieldsFromXml(fieldData);
                Context.UpdateConditions = ImportCondition.CreateConditionFromXml(fieldData, Context.SupportFields);

                e.Cancel = false;
            }
            catch (Exception ex)
            {
                FISCA.Presentation.Controls.MsgBox.Show(ex.Message);
            }
            finally
            {
                pProgram.Visible = false;
                pUser.Visible    = true;
            }
        }