示例#1
0
        public int ProcessDocument()
        {
            AccessHelper helper = new AccessHelper(); //helper物件用來取得ischool相關資料。

            mdoc = new Document();                    //產生新的文件,用來合併每位學生的懲戒通知單
            mdoc.Sections.Clear();                    //先將新文件的節做清除

            //判斷是否要使用預設的樣版或是自訂樣版
            if (mPreference.UseDefaultTemplate)
            {
                template = new DisciplineNotificationTemplate(new MemoryStream(Properties.Resources.獎懲通知單_住址位移));
            }
            else
            {
                template = new DisciplineNotificationTemplate(mPreference.CustomizeTemplate);
            }

            template.ProcessDocument();

            List <StudentRecord> students = new List <StudentRecord>();

            if (IsClass)
            {
                foreach (ClassRecord crecord in helper.ClassHelper.GetSelectedClass())
                {
                    students.AddRange(crecord.Students);
                }
            }
            else
            {
                students.AddRange(helper.StudentHelper.GetSelectedStudent());
            }

            //填入獎懲資訊
            helper.StudentHelper.FillReward(students);

            //填入連絡資訊
            helper.StudentHelper.FillContactInfo(students);

            //填入家長資訊
            helper.StudentHelper.FillParentInfo(students);

            //循訪每位學生記錄,並建立ActivityNotificationDocument物件來產生報表
            foreach (StudentRecord student in students)
            {
                ISchoolDocument studentdoc = new DisciplineNotificationDocument(student, mconfig, template);

                //將單一學生的每月生活通知單加入到主要的報表當中
                if (studentdoc.ProcessDocument() > 0)
                {
                    mdoc.Sections.Add(mdoc.ImportNode(studentdoc.Document.Sections[0], true));
                }
            }

            return(0);
        }
示例#2
0
 public DisciplineNotificationDocument(StudentRecord student, DisciplineNotificationConfig config, DisciplineNotificationTemplate template)
 {
     mstudent  = student;
     mconfig   = config;
     mtemplate = template;
 }