public void WizardValidationNonExistingSelectedPage()
        {
            using (var systemUnderTest = new ExportWizard())
            {
                systemUnderTest.ExportConfigFileLocation = "TestData\\ExportConfig.json";
                var actual = systemUnderTest.WizardValidation(string.Empty);

                actual.Should().BeTrue();
            }
        }
        public void WizardValidationExecuteExport()
        {
            using (var systemUnderTest = new ExportWizard())
            {
                systemUnderTest.ExportConfigFileLocation = "TestData\\ExportConfig.json";
                var actual = systemUnderTest.WizardValidation("executeExport");

                actual.Should().BeTrue();
            }
        }
        // 實作匯出
        public override void InitializeExport(ExportWizard wizard)
        {
            wizard.ExportableFields.AddRange(ExportItemList);
            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                // 透過學生編號取得UDT兄弟姊妹資訊
                AccessHelper         accessHelper      = new AccessHelper();
                string               qry               = "ref_student_id IN(" + string.Join(",", e.List.ToArray()) + ")";
                List <SiblingRecord> SiblingRecordList = accessHelper.Select <SiblingRecord>(qry);

                // 填入資料
                foreach (SiblingRecord sr in SiblingRecordList)
                {
                    // 填入資料
                    RowData row = new RowData();
                    row.ID = sr.StudnetID.ToString();

                    foreach (string field in e.ExportFields)
                    {
                        // 檢查需要匯出欄位
                        if (wizard.ExportableFields.Contains(field))
                        {
                            switch (field)
                            {
                            case "兄弟姊妹姓名":
                                row.Add(field, sr.SiblingName);
                                break;

                            case "稱謂":
                                row.Add(field, sr.SiblingTitle);
                                break;

                            case "生日":
                                row.Add(field, sr.Birthday.ToShortDateString());
                                break;

                            case "學校名稱":
                                row.Add(field, sr.SchoolName);
                                break;

                            case "班級名稱":
                                row.Add(field, sr.ClassName);
                                break;

                            case "備註":
                                row.Add(field, sr.Remark);
                                break;
                            }
                        }
                    }
                    e.Items.Add(row);
                }
            };
        }
        public void WizardValidationExportConfigIsNull()
        {
            using (var systemUnderTest = new ExportWizard())
            {
                systemUnderTest.ExportConfigFileLocation = null;

                var actual = systemUnderTest.WizardValidation("exportConfig");

                actual.Should().BeTrue();
                systemUnderTest.ExportSchemaFileLocation.Should().BeNullOrEmpty();
                systemUnderTest.SaveExportLocation.Should().BeNullOrEmpty();
                systemUnderTest.BatchSize.Should().Be(5000);
                systemUnderTest.ExportInactiveRecordsChecked.Should().BeFalse();
            }
        }
        public void WizardValidationExportConfig()
        {
            using (var systemUnderTest = new ExportWizard())
            {
                systemUnderTest.ExportConfigFileLocation = "TestData\\ExportConfig.json";

                var actual = systemUnderTest.WizardValidation("exportConfig");

                actual.Should().BeTrue();

                systemUnderTest.ExportSchemaFileLocation.Should().EndWith("TestData\\usersettingsschema.xml");
                systemUnderTest.SaveExportLocation.Should().EndWith("TestData");
                systemUnderTest.BatchSize.Should().Be(500);
                systemUnderTest.ExportInactiveRecordsChecked.Should().BeTrue();
            }
        }
Exemple #6
0
 /// <summary>
 /// 開始一個新的匯入作業
 /// </summary>
 /// <param name="wizard">處理這次匯入的精靈</param>
 public abstract void InitializeExport(ExportWizard wizard);