Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool chkHasClassName = false;
            if (txtName.Text.Trim() == "")
                return;

            List<K12.Data.ClassRecord> AllClassRecs = K12.Data.Class.SelectAll();
            foreach (K12.Data.ClassRecord cr in AllClassRecs)
                if (cr.Name == txtName.Text)
                {
                    MessageBox.Show("班級名稱重複");
                    return;
                }

            PermRecLogProcess prlp = new PermRecLogProcess();
            K12.Data.ClassRecord classRec = new K12.Data.ClassRecord();
            classRec.Name = txtName.Text;
            string ClassID = K12.Data.Class.Insert(classRec);

            Class.Instance.SyncDataBackground(ClassID);

            if (chkInputData.Checked == true)
            {
                Class.Instance.PopupDetailPane(ClassID);
                Class.Instance.SyncDataBackground(ClassID);
            }

            prlp.SaveLog("學籍.班級", "新增班級", "新增班級,名稱:" + txtName.Text);
            this.Close();
        }
Beispiel #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                return;
            }

            string Msg = "轉學生請利用「異動作業>轉入作業」或是「線上轉學」功能。若是以此「新增」功能新增學生,必須透過「調整班級」功能調整學生班級,且需要輸入編班委員會會議日期,並將傳送至局端備查。請確認是否新增學生?";

            if (FISCA.Presentation.Controls.MsgBox.Show(Msg, "新增學生", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == System.Windows.Forms.DialogResult.Yes)
            {
                K12.Data.StudentRecord studRec = new K12.Data.StudentRecord();
                studRec.Name = txtName.Text;
                string            StudentID = K12.Data.Student.Insert(studRec);
                PermRecLogProcess prlp      = new PermRecLogProcess();
                if (chkInputData.Checked == true)
                {
                    if (StudentID != "")
                    {
                        JHSchool.Student.Instance.PopupDetailPane(StudentID);
                        JHSchool.Student.Instance.SyncDataBackground(StudentID);
                    }
                }
                JHSchool.Student.Instance.SyncDataBackground(StudentID);

                prlp.SaveLog("學籍.學生", "新增學生", "新增學生姓名:" + txtName.Text);
            }
            this.Close();
        }
Beispiel #3
0
        protected override void DoDelete(JHTagConfigRecord record)
        {
            int use_count = 0;

            foreach (JHCourseTagRecord rec in JHCourseTag.SelectAll())
            {
                if (rec.RefTagID == record.ID)
                {
                    use_count++;
                }
            }


            string msg;

            if (use_count > 0)
            {
                msg = string.Format("目前有「{0}」個課程使用此類別,您確定要刪除此類別嗎?", use_count);
            }
            else
            {
                msg = "您確定要刪除此類別嗎?";
            }

            if (FISCA.Presentation.Controls.MsgBox.Show(msg, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                PermRecLogProcess prlp = new PermRecLogProcess();
                prlp.SaveLog("學籍.類別管理", "類別管理刪除類別", "刪除 " + record.Category + " 類別,名稱:" + record.FullName);
                JHTagConfig.Delete(record);
            }
        }
Beispiel #4
0
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            if (cbxDefault.Checked == false && cbxUserDefine.Checked == false && Student.Instance.SelectedKeys.Count < 1)
            {
                return;
            }

            if (txtCertDoc.Text.Trim() == "" || txtCertNo.Text.Trim() == "")
            {
                if (MessageBox.Show("校內文號輸入不完整,請問是否繼續列印 ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
            }

            if (cbxDefault.Checked)
            {
                isDefalutTemplate = true;
            }
            else
            {
                isDefalutTemplate = false;
            }

            cmdPrint.Enabled = false;
            slm.SetCertDoc(txtCertDoc.Text);
            slm.SetCertNo(txtCertNo.Text);
            slm.SetSemester(School.DefaultSemester, true);

            slm.PrintData(Student.Instance.SelectedKeys, isDefalutTemplate);
            PermRecLogProcess prlp = new PermRecLogProcess();

            prlp.SaveLog("學生.報表", "列印", "列印" + Student.Instance.SelectedKeys.Count + "筆轉學證明書。");
            cmdPrint.Enabled = true;
        }
Beispiel #5
0
        public override void InitializeExport(SmartSchool.API.PlugIn.Export.ExportWizard wizard)
        {
            wizard.ExportableFields.AddRange(DAL.DALTransfer.GetTeacherTagPrefixList(Teacher.Instance.SelectedKeys));

            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                List <DAL.TeacherTagEntity> TeacherTagList = DAL.DALTransfer.GetTeacherTagList(e.List);
                foreach (DAL.TeacherTagEntity ste in TeacherTagList)
                {
                    RowData row = new RowData();
                    row.ID = ste.TeacherID;
                    foreach (string field in e.ExportFields)
                    {
                        if (wizard.ExportableFields.Contains(field))
                        {
                            if (ste.PrefixNameDic.ContainsKey(field))
                            {
                                string str = "";
                                foreach (string strItem in ste.PrefixNameDic[field])
                                {
                                    str += strItem + "、";
                                }
                                str = str.Substring(0, str.Length - 1);
                                row.Add(field, str);
                            }
                        }
                    }
                    e.Items.Add(row);
                }

                PermRecLogProcess prlp = new PermRecLogProcess();
                prlp.SaveLog("教師.匯出類別", "匯出", "共匯出" + TeacherTagList.Count + "筆教師類別資料.");
            };
        }
Beispiel #6
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                return;
            }

            // 檢查教師名稱,驗證方式,姓名+暱稱 不能重複。
            List <JHSchool.Data.JHTeacherRecord> TRecs = JHSchool.Data.JHTeacher.SelectAll();
            Dictionary <string, JHSchool.Data.JHTeacherRecord> checkStr = new Dictionary <string, JHSchool.Data.JHTeacherRecord>();

            foreach (JHSchool.Data.JHTeacherRecord TRec in TRecs)
            {
                checkStr.Add(TRec.Name + TRec.Nickname, TRec);
            }

            string strName = txtName.Text + txtNickName.Text;

            if (checkStr.ContainsKey(strName))
            {
                if (checkStr[strName].Status == K12.Data.TeacherRecord.TeacherStatus.一般)
                {
                    MsgBox.Show("教師姓名:" + txtName.Text + ",已存在系統內,如果要使用相同姓名請加暱稱.");
                    return;
                }

                // 當刪除狀態,修正刪除教師內的暱稱 與 TeacherID
                if (checkStr[strName].Status == K12.Data.TeacherRecord.TeacherStatus.刪除)
                {
                    JHSchool.Data.JHTeacherRecord delRec = checkStr[strName];
                    delRec.Nickname = delRec.ID;
                    JHSchool.Data.JHTeacher.Update(delRec);
                }
            }

            JHSchool.Data.JHTeacherRecord teacherRec = new JHSchool.Data.JHTeacherRecord();
            teacherRec.Name     = txtName.Text;
            teacherRec.Nickname = txtNickName.Text;

            string TeacherID = JHSchool.Data.JHTeacher.Insert(teacherRec);

            Teacher.Instance.SyncDataBackground(TeacherID);

            if (chkInputData.Checked == true)
            {
                if (TeacherID != "")
                {
                    Teacher.Instance.PopupDetailPane(TeacherID);
                    Teacher.Instance.SyncDataBackground(TeacherID);
                }
            }
            PermRecLogProcess prlp = new PermRecLogProcess();

            prlp.SaveLog("學籍.教師", "新增教師", "新增教師,姓名:" + txtName.Text + ",暱稱:" + txtNickName.Text);

            this.Close();
        }
        void _BGWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Student.Instance.SyncAllBackground();
            btnRun.Enabled = true;
            FISCA.Presentation.MotherForm.SetStatusBarMessage("");
            FISCA.Presentation.Controls.MsgBox.Show("產生完成.");
            PermRecLogProcess prlp = new PermRecLogProcess();

            prlp.SaveLog("學籍.學生", "查詢學生地址經緯度", "共查詢" + _StudIDList.Count + "筆學生" + cboAddressType.Text + "經緯度");

            this.Close();
        }
        void bkWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            Workbook wb       = (Workbook)e.Result;
            bool     checklog = false;

            try
            {
                foreach (Worksheet wst in wb.Worksheets)
                {
                    wst.Name += "年級";
                }

                wb.Save(Application.StartupPath + "\\Reports\\班級名條.xls", FileFormatType.Excel2003);
                System.Diagnostics.Process.Start(Application.StartupPath + "\\Reports\\班級名條.xls");
                checklog = true;
            }
            catch
            {
                System.Windows.Forms.SaveFileDialog sd1 = new System.Windows.Forms.SaveFileDialog();
                sd1.Title    = "另存新檔";
                sd1.FileName = "班級名條.xls";
                sd1.Filter   = "Excel檔案 (*.xls)|*.xls|所有檔案 (*.*)|*.*";
                if (sd1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    try
                    {
                        wb.Save(sd1.FileName, FileFormatType.Excel2003);
                        System.Diagnostics.Process.Start(sd1.FileName);
                        checklog = true;
                    }
                    catch
                    {
                        System.Windows.Forms.MessageBox.Show("指定路徑無法存取。", "建立檔案失敗", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                        return;
                    }
                }
            }

            if (checklog)
            {
                string            logClassName = "";
                PermRecLogProcess prlp         = new PermRecLogProcess();
                foreach (List <DAL.ClassStudentEntity> cseLst in GradeClassStudentDic.Values)
                {
                    foreach (DAL.ClassStudentEntity cse in cseLst)
                    {
                        logClassName += cse.ClassName + ",";
                    }
                }

                prlp.SaveLog("學籍.班級名條", "學籍班級.產生班級名條", "產生 " + logClassName + " 班級名條報表");
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            btnExport.Enabled = false;


            Preview();

            if (chkInputData == true)
            {
                string tmpStr = "";
                // getDataGradViewData
                Dictionary <string, string> tmpDocNo = new Dictionary <string, string>();
                foreach (DataGridViewRow dgv in dgGraduateDocNoData.Rows)
                {
                    if (dgv.IsNewRow)
                    {
                        continue;
                    }

                    if (dgv.Cells[6].Value == null)
                    {
                        tmpStr = "";
                    }
                    else
                    {
                        tmpStr = dgv.Cells[6].Value.ToString();
                    }

                    tmpDocNo.Add(dgv.Cells[0].Value.ToString(), tmpStr);
                }

                // 批示填入證書字號
                foreach (StudDiplomaInfoJuniorDiplomaNumber sdi in StudDiplomaInfoJuniorDiplomaNumberList)
                {
                    if (tmpDocNo.ContainsKey(sdi.StudentID))
                    {
                        sdi.GRDocNo = tmpDocNo[sdi.StudentID];
                    }
                }

                //寫入資料庫
                btnSave.Enabled = false;
                setStudDiplomaInfoData();
                PermRecLogProcess prlp = new PermRecLogProcess();
                prlp.SaveLog("教務.產生畢修業證書字號", "新增", "批次產生畢修業證書字號.");
            }
            else
            {
                MessageBox.Show("無法產生資料!");
                btnSave.Enabled = true;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
                return;

            // 檢查教師名稱,驗證方式,姓名+暱稱 不能重複。
            List<K12.Data.TeacherRecord> TRecs = K12.Data.Teacher.SelectAll();
            Dictionary<string, K12.Data.TeacherRecord> checkStr = new Dictionary<string, K12.Data.TeacherRecord>();
            foreach (K12.Data.TeacherRecord TRec in TRecs)
                checkStr.Add(TRec.Name + TRec.Nickname, TRec);

            string strName = txtName.Text + txtNickName.Text;

            if (checkStr.ContainsKey(strName))
            {
                if (checkStr[strName].Status == K12.Data.TeacherRecord.TeacherStatus.一般)
                {
                    MsgBox.Show("教師姓名:" + txtName.Text + ",已存在系統內,如果要使用相同姓名請加暱稱.");
                    return;
                }

                // 當刪除狀態,修正刪除教師內的暱稱 與 TeacherID
                if (checkStr[strName].Status == K12.Data.TeacherRecord.TeacherStatus.刪除)
                {
                    K12.Data.TeacherRecord delRec = checkStr[strName];
                    delRec.Nickname = delRec.ID;
                    K12.Data.Teacher.Update(delRec);
                }
            }

            K12.Data.TeacherRecord teacherRec = new K12.Data.TeacherRecord();
            teacherRec.Name = txtName.Text;
            teacherRec.Nickname = txtNickName.Text;

            string TeacherID = K12.Data.Teacher.Insert(teacherRec);

            Teacher.Instance.SyncDataBackground(TeacherID);

            if (chkInputData.Checked == true)
            {
                if (TeacherID != "")
                {
                    Teacher.Instance.PopupDetailPane(TeacherID);
                    Teacher.Instance.SyncDataBackground(TeacherID);
                }
            }
            PermRecLogProcess prlp = new PermRecLogProcess();
            prlp.SaveLog("學籍.教師", "新增教師", "新增教師,姓名:" + txtName.Text + ",暱稱:" + txtNickName.Text);

            this.Close();
        }
Beispiel #11
0
        private void buttonItem2_CheckedChanged(object sender, EventArgs e)
        {
            var button = (DevComponents.DotNetBar.ButtonItem)sender;

            if (button.Checked)
            {
                var teacherRec = Teacher.Instance.Items[PrimaryKey];
                if (teacherRec != null)
                {
                    if (button.Text != teacherRec.Status)
                    {
                        try
                        {
                            JHSchool.Data.JHTeacherRecord teach = JHSchool.Data.JHTeacher.SelectByID(PrimaryKey);


                            if (K12.Data.TeacherRecord.TeacherStatus.一般.ToString() == button.Text)
                            {
                                teach.Status = K12.Data.TeacherRecord.TeacherStatus.一般;
                            }

                            if (K12.Data.TeacherRecord.TeacherStatus.刪除.ToString() == button.Text)
                            {
                                teach.Status = K12.Data.TeacherRecord.TeacherStatus.刪除;
                            }

                            JHSchool.Data.JHTeacher.Update(teach);

                            PermRecLogProcess prlp = new PermRecLogProcess();
                            prlp.SaveLog("教師", "修改", "修改教師狀態");

                            //Feature.Legacy.EditStudent.ChangeStudentStatus(studentRec.ID, button.Text);
                        }
                        catch (ArgumentException aa)
                        {
                            MessageBox.Show("目前無法移到刪除");
                        }

                        catch
                        {
                            OnPrimaryKeyChanged(new EventArgs());
                            FISCA.Presentation.MotherForm.SetStatusBarMessage("變更狀態失敗,可能發生原因為學號或身分證號在" + button.Text + "敎師中已經存在,請檢查教師資料。");
                            return;
                        }
                        Teacher.Instance.SyncDataBackground(teacherRec.ID);
                        FISCA.Presentation.MotherForm.SetStatusBarMessage("已變更教師狀態。" + DescriptionLabel.Text);
                    }
                }
            }
        }
Beispiel #12
0
        private void wizard1_FinishButtonClick(object sender, CancelEventArgs e)
        {
            if (GetSelectedFields().Count == 0)
            {
                FISCA.Presentation.Controls.MsgBox.Show("必須至少選擇一項匯出欄位!", "欄位空白", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // 2017/8/22 穎驊依據高雄小組專案 [03-05][04+] EXCEL匯入格式可否修正為xlsx也可匯入? 更改為新版 Aspose.Cells_201402 寫法,支援.xlsx 匯出
            saveFileDialog1.Filter   = "Excel (*.xlsx)|*.xlsx|Excel (*.xls)|*.xls|所有檔案 (*.*)|*.*";
            saveFileDialog1.FileName = "匯出學生基本資料";

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                ExportStudentConnector ec = new ExportStudentConnector();
                foreach (StudentRecord student in Student.Instance.SelectedList)
                {
                    ec.AddCondition(student.ID);
                }
                ec.SetSelectedFields(GetSelectedFields());
                ExportTable table = ec.Export();

                ExportOutput output = new ExportOutput();
                output.SetSource(table);
                try
                {
                    output.Save(saveFileDialog1.FileName);
                    PermRecLogProcess prlp = new PermRecLogProcess();
                    prlp.SaveLog("學生.匯出學生基本資料", "批次匯出", "匯出" + Student.Instance.SelectedKeys.Count + "筆學生資料.");
                }
                catch (Exception)
                {
                    FISCA.Presentation.Controls.MsgBox.Show("檔案儲存失敗, 檔案目前可能已經開啟。", "儲存失敗", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (FISCA.Presentation.Controls.MsgBox.Show("檔案存檔完成,是否開啟該檔案", "是否開啟", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        System.Diagnostics.Process.Start(saveFileDialog1.FileName);
                    }
                    catch (Exception ex)
                    {
                        FISCA.Presentation.Controls.MsgBox.Show("開啟檔案發生失敗:" + ex.Message, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                this.Close();
            }
        }
        public override void InitializeExport(SmartSchool.API.PlugIn.Export.ExportWizard wizard)
        {
            wizard.ExportableFields.AddRange(ExportItemList);

            wizard.ExportPackage += delegate(object sender, SmartSchool.API.PlugIn.Export.ExportPackageEventArgs e)
            {
                // 取得畢業相關資訊
                List <JHLeaveInfoRecord> JHLeaveInfoRecordList = JHLeaveIfno.SelectByStudentIDs(e.List);

                foreach (JHLeaveInfoRecord lir in JHLeaveInfoRecordList)
                {
                    RowData row = new RowData();
                    row.ID = lir.RefStudentID;

                    foreach (string field in e.ExportFields)
                    {
                        if (wizard.ExportableFields.Contains(field))
                        {
                            switch (field)
                            {
                            case "畢業學年度":
                                if (lir.SchoolYear.HasValue)
                                {
                                    row.Add(field, lir.SchoolYear.Value.ToString());
                                }
                                break;

                            case "畢業資格":
                                row.Add(field, lir.Reason);
                                break;

                            case "畢業證書字號":
                                row.Add(field, lir.DiplomaNumber);
                                break;

                            case "畢業相關訊息":
                                row.Add(field, lir.Memo);
                                break;
                            }
                        }
                    }
                    e.Items.Add(row);
                }

                PermRecLogProcess prlp = new PermRecLogProcess();
                prlp.SaveLog("學生.匯出畢業資訊", "匯出", "共匯出" + K12.Presentation.NLDPanels.Student.SelectedSource.Count + "筆學生類別資料.");
            };
        }
Beispiel #14
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            LeaveInfoRec.ClassName     = txtClass.Text;
            LeaveInfoRec.DiplomaNumber = txtGDNumber.Text;
            LeaveInfoRec.Memo          = txtMemo.Text;
            LeaveInfoRec.Reason        = cboReason.Text;
            int SchoolYear = 0;

            if (string.IsNullOrEmpty(txtSchoolYear.Text))
            {
                LeaveInfoRec.SchoolYear = null;
            }
            else
            {
                if (int.TryParse(txtSchoolYear.Text, out SchoolYear))
                {
                    LeaveInfoRec.SchoolYear = SchoolYear;
                }
                else
                {
                    epSchoolYear.SetError(txtSchoolYear, "請輸入整數");
                    return;
                }
            }
            JHSchool.Data.JHLeaveIfno.Update(LeaveInfoRec);

            SaveButtonVisible   = false;
            CancelButtonVisible = false;
            //Student.Instance.SyncDataBackground(PrimaryKey);
            //            this._DefaultClass = txtClass.Text;
            this._DefaultGDNumber   = txtGDNumber.Text;
            this._DefaultMemo       = txtMemo.Text;
            this._DefaultSchoolYear = txtSchoolYear.Text;
            this._DefaultReason     = cboReason.Text;

            prlp.SetAfterSaveText("畢業學年度", txtSchoolYear.Text);
            prlp.SetAfterSaveText("畢業資格", cboReason.Text);
            prlp.SetAfterSaveText("畢業證書字號", txtGDNumber.Text);
            prlp.SetAfterSaveText("畢業相關訊息", txtMemo.Text);
            prlp.SetActionBy("學籍", "學生畢業資訊");
            prlp.SetAction("修改學生畢業資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");

            prlp.SaveLog("", "", "student", PrimaryKey);
            // BindDataToForm();
        }
Beispiel #15
0
 private void SetAfterEditLog()
 {
     prlp.SetAfterSaveText("姓名", txtName.Text);
     prlp.SetAfterSaveText("身分證號", txtSSN.Text);
     prlp.SetAfterSaveText("生日", txtBirthDate.Text);
     prlp.SetAfterSaveText("性別", cboGender.Text);
     prlp.SetAfterSaveText("國籍", cboNationality.Text);
     prlp.SetAfterSaveText("出生地", txtBirthPlace.Text);
     prlp.SetAfterSaveText("英文姓名", txtEngName.Text);
     prlp.SetAfterSaveText("登入帳號", txtLoginID.Text);
     prlp.SetAfterSaveText("帳號類型", cboAccountType.Text);
     prlp.SetActionBy("學籍", "學生基本資料");
     prlp.SetAction("修改學生基本資料");
     prlp.SetDescTitle("姓名:" + _StudRec.Name + ",學號:" + _StudRec.StudentNumber + ",");
     prlp.SaveLog("", "", "Student", PrimaryKey);
 }
        protected override void OnSaveButtonClick(EventArgs e)
        {
            _BeforeEnrollmentRecord.School         = txtSchool.Text;
            _BeforeEnrollmentRecord.SchoolLocation = txtSchoolLocation.Text;
            _BeforeEnrollmentRecord.ClassName      = txtClass.Text;
            int intSeatNo;

            if (string.IsNullOrEmpty(txtSeatNo.Text))
            {
                _BeforeEnrollmentRecord.SeatNo = null;
            }
            else
            {
                if (int.TryParse(txtSeatNo.Text, out intSeatNo))
                {
                    _BeforeEnrollmentRecord.SeatNo = intSeatNo;
                }
                else
                {
                    epSeatNo.SetError(txtSeatNo, "請填入數字.");
                    return;
                }
            }


            _BeforeEnrollmentRecord.Memo = txtMemo.Text;

            JHBeforeEnrollment.Update(_BeforeEnrollmentRecord);
            listener.Reset();
            SaveButtonVisible   = false;
            CancelButtonVisible = SaveButtonVisible;

            prlp.SetAfterSaveText("學校名稱", txtSchool.Text);
            prlp.SetAfterSaveText("所在地", txtSchoolLocation.Text);
            prlp.SetAfterSaveText("班級", txtClass.Text);
            prlp.SetAfterSaveText("座號", txtSeatNo.Text);
            prlp.SetAfterSaveText("備註", txtMemo.Text);
            prlp.SetActionBy("學籍", "學生前級畢業資訊");
            prlp.SetAction("修改學生前級畢業資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
            prlp.SaveLog("", "", "student", PrimaryKey);
        }
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            //// [ischoolkingdom] Vicky新增,[11-04][02]在學證明書(英文),新增預設選項
            // 檢查選項是否有設定
            if (cbxDefault_Chi.Checked == false && cbxDefault.Checked == false && cbxUserDefine.Checked == false && Student.Instance.SelectedKeys.Count < 1)
            {
                return;
            }

            if (txtCertDoc.Text.Trim() == "" || txtCertNo.Text.Trim() == "")
            {
                if (MessageBox.Show("校內文號輸入不完整,請問是否繼續列印 ?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) == DialogResult.No)
                {
                    return;
                }
            }

            sascm.SetCertDoc(txtCertDoc.Text);
            sascm.SetCertNo(txtCertNo.Text);

            sascm.SetSemester(School.DefaultSemester, false);

            // [ischoolkingdom] Vicky新增,[11-04][02]在學證明書(英文),新增cbx選項
            isDefaultTemplateChinese = cbxDefault_Chi.Checked;
            if (cbxDefault.Checked || cbxDefault_Chi.Checked)
            {
                isDefaultTemplate = true;
            }
            else
            {
                isDefaultTemplate = false;
            }

            cmdPrint.Enabled = false;
            sascm.PrintData(Student.Instance.SelectedKeys, isDefaultTemplate, isDefaultTemplateChinese);
            PermRecLogProcess prlp = new PermRecLogProcess();

            prlp.SaveLog("學生.報表", "列印", "列印" + Student.Instance.SelectedKeys.Count + "筆在學證明書資料。");

            cmdPrint.Enabled = true;
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
                return;
            K12.Data.StudentRecord studRec = new K12.Data.StudentRecord();
            studRec.Name = txtName.Text;
            string StudentID = K12.Data.Student.Insert(studRec);
            PermRecLogProcess prlp = new PermRecLogProcess();
            if (chkInputData.Checked == true)
            {
                if (StudentID != "")
                {
                    Student.Instance.PopupDetailPane(StudentID);
                    Student.Instance.SyncDataBackground(StudentID);
                }
            }
            Student.Instance.SyncDataBackground(StudentID);

            prlp.SaveLog("學籍.學生", "新增學生", "新增學生姓名:" + txtName.Text);
            this.Close();
        }
        void bwWork_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            List <string> _ExportText = (List <string>)e.Result;

            SaveFileDialog sfd = new SaveFileDialog();

            sfd.Title        = "存檔";
            sfd.FileName     = "教育程度檔";
            sfd.AddExtension = true;
            sfd.Filter       = "文字檔 (*.txt)|*.txt|所有檔案 (*.*)|*.*";

            if (sfd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    // 需要轉換成 Big5
                    //StreamWriter sw = new StreamWriter(sfd.FileName,false,Encoding.GetEncoding(950));
                    StreamWriter sw = new StreamWriter(sfd.FileName, false, Encoding.UTF8);

                    foreach (string str in _ExportText)
                    {
                        sw.WriteLine(str);
                    }
                    sw.Flush();
                    sw.Close();
                    MessageBox.Show("完成.共產生" + _ExportText.Count + "筆學生資料");
                    PermRecLogProcess prlp = new PermRecLogProcess();
                    prlp.SaveLog("學生.學生教育程度資料", "產生", "共產生" + _ExportText.Count + "筆學生教育程度資料.");
                }
                catch
                {
                    MessageBox.Show("指定路徑無法存取。", "建立檔案失敗", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }



            btnExport.Enabled = true;
        }
Beispiel #20
0
        void bkWorkUpgrd_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            PermRecLogProcess prlp = new PermRecLogProcess();

            foreach (DataGridViewRow dgv in dgClassUpgrade.Rows)
            {
                if (dgv.Cells[5].Value != null)
                {
                    prlp.SetBeforeSaveText(dgv.Cells[2].Value.ToString() + "班級名稱", dgv.Cells[2].Value.ToString());
                    prlp.SetAfterSaveText(dgv.Cells[2].Value.ToString() + "班級名稱", dgv.Cells[4].Value.ToString());
                    prlp.SetBeforeSaveText(dgv.Cells[2].Value.ToString() + "班級年級", dgv.Cells[1].Value.ToString());
                    prlp.SetAfterSaveText(dgv.Cells[2].Value.ToString() + "班級年級", dgv.Cells[3].Value.ToString());
                }
            }
            prlp.SetAction("學籍.班級升級");
            prlp.SetActionBy("學籍系統", "班級升級或畢業");
            prlp.SetDescTitle("班級調整:");
            prlp.SaveLog("", "", "", "");

            MessageBox.Show("完成");
            this.Close();
        }
        // 儲存資料
        protected override void  OnSaveButtonClick(EventArgs e)
        {
            _PhoneRecord.Permanent = _PermanentPhone = txtEverPhone.Text;
            _PhoneRecord.Contact   = _ContactPhone = txtContactPhone.Text;
            _PhoneRecord.Cell      = _SMS = txtSMS.Text;
            if (btnOthers.Text.EndsWith("1"))
            {
                _OtherPhone1 = txtOtherPhone.Text;
            }
            if (btnOthers.Text.EndsWith("2"))
            {
                _OtherPhone2 = txtOtherPhone.Text;
            }
            if (btnOthers.Text.EndsWith("3"))
            {
                _OtherPhone3 = txtOtherPhone.Text;
            }

            _PhoneRecord.Phone1 = _OtherPhone1;
            _PhoneRecord.Phone2 = _OtherPhone2;
            _PhoneRecord.Phone3 = _OtherPhone3;

            prlp.SetAfterSaveText("戶籍電話", _PermanentPhone);
            prlp.SetAfterSaveText("聯絡電話", _ContactPhone);
            prlp.SetAfterSaveText("行動電話", _SMS);
            prlp.SetAfterSaveText("其他電話1", _OtherPhone1);
            prlp.SetAfterSaveText("其他電話2", _OtherPhone2);
            prlp.SetAfterSaveText("其他電話3", _OtherPhone3);
            JHSchool.Data.JHPhone.Update(_PhoneRecord);

            prlp.SetActionBy("學籍", "學生電話資訊");
            prlp.SetAction("修改學生電話資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
            Student.Instance.SyncDataBackground(PrimaryKey);
            prlp.SaveLog("", "", "student", PrimaryKey);
            BindDataToForm();
        }
Beispiel #22
0
        /// <summary>
        /// 設定使用者自訂範本
        /// </summary>
        public void SetUserDefineTemplateToSystem()
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title  = "選擇自訂的學生證範本";
            ofd.Filter = "Word檔案 (*.doc)|*.doc";
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    if (Document.DetectFileFormat(ofd.FileName) == LoadFormat.Doc)
                    {
                        FileStream fs = new FileStream(ofd.FileName, FileMode.Open);

                        byte[] tempBuffer = new byte[fs.Length];
                        fs.Read(tempBuffer, 0, tempBuffer.Length);
                        base64    = Convert.ToBase64String(tempBuffer);
                        _isUpload = true;
                        fs.Close();
                        SaveTemplateToSystem();

                        PermRecLogProcess prlp = new PermRecLogProcess();
                        prlp.SaveLog("學生.報表", "上傳", "上傳學生證樣版.");

                        FISCA.Presentation.Controls.MsgBox.Show("上傳成功。");
                    }
                    else
                    {
                        FISCA.Presentation.Controls.MsgBox.Show("上傳檔案格式不符");
                    }
                }
                catch
                {
                    FISCA.Presentation.Controls.MsgBox.Show("指定路徑無法存取。", "開啟檔案失敗", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
        }
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            if (cbxDefault.Checked == false && cbxUserDefine.Checked == false && Student.Instance.SelectedKeys.Count < 1)
            {
                return;
            }

            if (cbxDefault.Checked)
            {
                isDefalutTemplate = true;
            }
            else
            {
                isDefalutTemplate = false;
            }

            cmdPrint.Enabled = false;
            sbtm.PrintData(Student.Instance.SelectedKeys, isDefalutTemplate);
            PermRecLogProcess prlp = new PermRecLogProcess();

            prlp.SaveLog("學生.報表", "列印", "列印" + Student.Instance.SelectedKeys.Count + "筆轉出回條資料。");
            cmdPrint.Enabled = true;
        }
Beispiel #24
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            bool chkHasClassName = false;

            if (txtName.Text.Trim() == "")
            {
                return;
            }

            List <JHSchool.Data.JHClassRecord> AllClassRecs = JHSchool.Data.JHClass.SelectAll();

            foreach (JHSchool.Data.JHClassRecord cr in AllClassRecs)
            {
                if (cr.Name == txtName.Text)
                {
                    MessageBox.Show("班級名稱重複");
                    return;
                }
            }

            PermRecLogProcess prlp = new PermRecLogProcess();

            JHSchool.Data.JHClassRecord classRec = new JHSchool.Data.JHClassRecord();
            classRec.Name = txtName.Text;
            string ClassID = JHSchool.Data.JHClass.Insert(classRec);

            Class.Instance.SyncDataBackground(ClassID);

            if (chkInputData.Checked == true)
            {
                Class.Instance.PopupDetailPane(ClassID);
                Class.Instance.SyncDataBackground(ClassID);
            }

            prlp.SaveLog("學籍.班級", "新增班級", "新增班級,名稱:" + txtName.Text);
            this.Close();
        }
Beispiel #25
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (txtName.Text.Trim() == "")
            {
                return;
            }
            JHSchool.Data.JHStudentRecord studRec = new JHSchool.Data.JHStudentRecord();
            studRec.Name = txtName.Text;
            string            StudentID = JHSchool.Data.JHStudent.Insert(studRec);
            PermRecLogProcess prlp      = new PermRecLogProcess();

            if (chkInputData.Checked == true)
            {
                if (StudentID != "")
                {
                    Student.Instance.PopupDetailPane(StudentID);
                    Student.Instance.SyncDataBackground(StudentID);
                }
            }
            Student.Instance.SyncDataBackground(StudentID);

            prlp.SaveLog("學籍.學生", "新增學生", "新增學生姓名:" + txtName.Text);
            this.Close();
        }
Beispiel #26
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            if (!IsValid())
            {
                FISCA.Presentation.Controls.MsgBox.Show("輸入資料未通過驗證,請修正後再行儲存");
                return;
            }


            _ClassRecord.NamingRule = _NamingRule;

            // 年級
            int GrYear;

            if (int.TryParse(cboGradeYear.Text, out GrYear))
            {
                _ClassRecord.GradeYear = GrYear;
            }
            else
            {
                _ClassRecord.GradeYear = null;
            }

            // 班名轉型
            if (ValidateNamingRule(_NamingRule))
            {
                _ClassRecord.Name = ParseClassName(_NamingRule, GrYear);
            }
            else
            {
                if (ValidClassName(_ClassRecord.ID, txtClassName.Text))
                {
                    _ClassRecord.Name = txtClassName.Text;
                }
                else
                {
                    return;
                }
            }

            _ClassRecord.RefTeacherID = "";
            // 教師
            foreach (KeyValuePair <string, string> val in _TeacherNameDic)
            {
                if (val.Value == cboTeacher.Text)
                {
                    _ClassRecord.RefTeacherID = val.Key;
                }
            }
            _ClassRecord.DisplayOrder = txtSortOrder.Text;

            SaveButtonVisible   = false;
            CancelButtonVisible = false;
            // Log
            prlp.SetAfterSaveText("班級名稱", txtClassName.Text);
            prlp.SetAfterSaveText("班級命名規則", _ClassRecord.NamingRule);
            prlp.SetAfterSaveText("年級", cboGradeYear.Text);
            prlp.SetAfterSaveText("班導師", cboTeacher.Text);
            prlp.SetAfterSaveText("排列序號", txtSortOrder.Text);
            prlp.SetActionBy("學籍", "班級基本資料");
            prlp.SetAction("修改班級基本資料");
            prlp.SetDescTitle("班級名稱:" + _ClassRecord.Name + ",");
            prlp.SaveLog("", "", "class", PrimaryKey);
            JHClass.Update(_ClassRecord);
            Class.Instance.SyncDataBackground(PrimaryKey);
        }
Beispiel #27
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            dgv.EndEdit();

            if (!IsValid())
            {
                return;
            }

            try
            {
                List <HC.JHSCETakeRecord> sceUpdateList = new List <HC.JHSCETakeRecord>();
                List <HC.JHSCETakeRecord> sceInsertList = new List <HC.JHSCETakeRecord>();
                List <HC.JHSCETakeRecord> sceDeleteList = new List <HC.JHSCETakeRecord>();

                bool scattendNeedSave = false;

                foreach (DataGridViewRow row in dgv.Rows)
                {
                    if (row.IsNewRow)
                    {
                        continue;
                    }

                    if ("" + row.Tag == "課程總成績")
                    {
                        #region 課程總成績
                        if ("" + row.Cells[chScore.Index].Value != "" + _scattend.Score)
                        {
                            scattendNeedSave = true;
                            decimal d;
                            if (decimal.TryParse("" + row.Cells[chScore.Index].Value, out d))
                            {
                                _scattend.Score = d;
                            }
                            else
                            {
                                _scattend.Score = null;
                            }
                        }
                        //if ("" + row.Cells[chAssignmentScore.Index].Value != "" + _scattend.Effort)
                        //{
                        //    scattendNeedSave = true;
                        //    int i;
                        //    if (int.TryParse("" + row.Cells[chScore.Index].Value, out i))
                        //        _scattend.Score = i;
                        //    else
                        //        _scattend.Score = null;
                        //}
                        if ("" + row.Cells[chText.Index].Value != _scattend.Text)
                        {
                            scattendNeedSave = true;
                            _scattend.Text   = "" + row.Cells[chText.Index].Value;
                        }
                        #endregion
                    }
                    else if (row.Tag != null)
                    {
                        #region  評量成績記錄的情況
                        HC.JHSCETakeRecord sce = row.Tag as HC.JHSCETakeRecord;

                        if (!string.IsNullOrEmpty("" + row.Cells[chScore.Index].Value))
                        {
                            sce.Score = decimal.Parse("" + row.Cells[chScore.Index].Value);
                        }
                        else
                        {
                            sce.Score = null;
                        }

                        if (!string.IsNullOrEmpty("" + row.Cells[chAssignmentScore.Index].Value))
                        {
                            sce.AssignmentScore = decimal.Parse("" + row.Cells[chAssignmentScore.Index].Value);
                        }
                        else
                        {
                            sce.AssignmentScore = null;
                        }

                        sce.Text = "" + row.Cells[chText.Index].Value;

                        if (!sce.Score.HasValue && !sce.AssignmentScore.HasValue && string.IsNullOrEmpty(sce.Text))
                        {
                            sceDeleteList.Add(sce);
                        }
                        else
                        {
                            sceUpdateList.Add(sce);
                        }
                        #endregion
                    }
                    else
                    {
                        #region 無評量成績記錄的情況
                        bool needsave = false;
                        if (!string.IsNullOrEmpty("" + row.Cells[chScore.Index].Value))
                        {
                            needsave = true;
                        }
                        if (!string.IsNullOrEmpty("" + row.Cells[chAssignmentScore.Index].Value))
                        {
                            needsave = true;
                        }
                        if (!string.IsNullOrEmpty("" + row.Cells[chText.Index].Value))
                        {
                            needsave = true;
                        }
                        if (needsave)
                        {
                            JHSCETakeRecord    jh  = new JHSCETakeRecord();
                            HC.JHSCETakeRecord sce = new HC.JHSCETakeRecord(jh);
                            sce.RefCourseID   = _course.ID;
                            sce.RefExamID     = "" + row.Cells[chExamName.Index].Tag;
                            sce.RefSCAttendID = _scattend != null ? _scattend.ID : "";
                            sce.RefStudentID  = _student.ID;
                            if (!string.IsNullOrEmpty("" + row.Cells[chScore.Index].Value))
                            {
                                sce.Score = decimal.Parse("" + row.Cells[chScore.Index].Value);
                            }
                            else
                            {
                                sce.Score = null;
                            }

                            if (!string.IsNullOrEmpty("" + row.Cells[chAssignmentScore.Index].Value))
                            {
                                sce.AssignmentScore = decimal.Parse("" + row.Cells[chAssignmentScore.Index].Value);
                            }
                            else
                            {
                                sce.AssignmentScore = null;
                            }

                            sce.Text = "" + row.Cells[chText.Index].Value;
                            sceInsertList.Add(sce);
                        }
                        #endregion
                    }
                }

                if (sceUpdateList.Count > 0)
                {
                    JHSCETake.Update(sceUpdateList.AsJHSCETakeRecords());
                }
                if (sceInsertList.Count > 0)
                {
                    JHSCETake.Insert(sceInsertList.AsJHSCETakeRecords());
                }
                if (sceDeleteList.Count > 0)
                {
                    JHSCETake.Delete(sceDeleteList.AsJHSCETakeRecords());
                }

                if (scattendNeedSave)
                {
                    JHSCAttend.Update(_scattend);
                }

                // log 處理
                SetSaveDataToLog();
                prlp.SetActionBy("學生", "評量成績輸入");
                prlp.SetAction("評量成績輸入");
                prlp.SetDescTitle("");
                prlp.SaveLog("", "", "Student", _student.ID);
                SetLoadDataToLog();
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception ex)
            {
                MsgBox.Show("儲存失敗。" + ex.Message);
            }
        }
Beispiel #28
0
        public override void InitializeImport(SmartSchool.API.PlugIn.Import.ImportWizard wizard)
        {
            // 取得學生資料
            Dictionary <string, SHStudentRecord> Students = new Dictionary <string, SHStudentRecord>();



            // 取得異動資料
            Dictionary <string, List <SHUpdateRecordRecord> > UpdateRecs = new Dictionary <string, List <SHUpdateRecordRecord> >();

            wizard.PackageLimit = 3000;
            wizard.ImportableFields.AddRange("班別", "特殊身份代碼", "異動科別", "年級", "異動學號", "異動姓名", "身分證號", "註1", "異動代碼", "異動日期", "原因及事項", "新學號", "更正後資料", "舊班別", "舊科別代碼", "備查日期", "備查文號", "核准日期", "核准文號", "備註");
            wizard.RequiredFields.AddRange("異動代碼", "異動日期");
            wizard.ValidateStart += delegate(object sender, SmartSchool.API.PlugIn.Import.ValidateStartEventArgs e)
            {
                Students.Clear();
                UpdateRecs.Clear();

                // 取得學生資料
                foreach (SHStudentRecord studRec in SHStudent.SelectByIDs(e.List))
                {
                    if (!Students.ContainsKey(studRec.ID))
                    {
                        Students.Add(studRec.ID, studRec);
                    }
                }
                foreach (string str in Students.Keys)
                {
                    List <SHUpdateRecordRecord> UpdRecList = new List <SHUpdateRecordRecord>();
                    UpdateRecs.Add(str, UpdRecList);
                }

                // 取得異動
                MultiThreadWorker <string> loader1 = new MultiThreadWorker <string>();
                loader1.MaxThreads     = 3;
                loader1.PackageSize    = 250;
                loader1.PackageWorker += delegate(object sender1, PackageWorkEventArgs <string> e1)
                {
                    foreach (SHUpdateRecordRecord UpdRec in SHUpdateRecord.SelectByStudentIDs(e.List))
                    {
                        // 過濾非符合標準的異動(目前是學籍)
                        if (!_UpdateCodeList.Contains(UpdRec.UpdateCode))
                        {
                            continue;
                        }

                        if (UpdateRecs.ContainsKey(UpdRec.StudentID))
                        {
                            UpdateRecs[UpdRec.StudentID].Add(UpdRec);
                        }
                    }
                };
                loader1.Run(e.List);
            };

            wizard.ValidateRow += delegate(object sender, SmartSchool.API.PlugIn.Import.ValidateRowEventArgs e)
            {
                int      i = 0;
                DateTime dt;
                // 檢查學生是否存在
                SHStudentRecord studRec = null;
                if (Students.ContainsKey(e.Data.ID))
                {
                    studRec = Students[e.Data.ID];
                }
                else
                {
                    e.ErrorMessage = "沒有這位學生" + e.Data.ID;
                    return;
                }

                // 驗證格式資料
                bool InputFormatPass = true;
                foreach (string field in e.SelectFields)
                {
                    string value = e.Data[field].Trim();
                    //// 驗證$無法匯入
                    //if (value.IndexOf('$') > -1)
                    //{
                    //    e.ErrorFields.Add(field, "儲存格有$無法匯入.");
                    //    break;
                    //}
                    switch (field)
                    {
                    default:
                        break;

                    //// 班別
                    //case "班別": break;
                    //// 特殊身份代碼
                    //case "特殊身份代碼": break;
                    //// 異動科別
                    //case "異動科別": break;
                    //// 年級
                    //case "年級": break;
                    //// 異動學號
                    //case "異動學號": break;
                    //// 異動姓名
                    //case "異動姓名": break;
                    //// 身分證號
                    //case "身分證號": break;
                    //// 註1
                    //case "註1": break;
                    //// 異動種類
                    //case "異動種類": break;
                    // 異動代碼
                    case "異動代碼":
                        if (!_UpdateCodeList.Contains(value))
                        {
                            InputFormatPass &= false;
                            e.ErrorFields.Add(field, "非學籍異動代碼!");
                        }
                        break;

                    // 異動日期(必填)
                    case "異動日期":
                        DateTime dtC1;
                        if (DateTime.TryParse(value, out dtC1))
                        {
                        }
                        else
                        {
                            InputFormatPass &= false;
                            e.ErrorFields.Add(field, "日期錯誤!");
                        }

                        break;

                    case "備查日期":
                    case "核准日期":
                        DateTime dtC2;
                        if (value.Trim() != "")
                        {
                            if (DateTime.TryParse(value, out dtC2))
                            {
                            }
                            else
                            {
                                InputFormatPass &= false;
                                e.ErrorFields.Add(field, "日期錯誤!");
                            }
                        }
                        break;
                        //// 原因及事項
                        //case "原因及事項": break;
                        //// 新學號
                        //case "新學號": break;
                        //// 更正後資料
                        //case "更正後資料": break;
                        //// 舊班別
                        //case "舊班別": break;
                        //// 舊科別代碼
                        //case "舊科別代碼": break;
                        //// 備查日期
                        //case "備查日期":
                        //    break;
                        //// 備查文號
                        //case "備查文號": break;
                        //// 核准日期
                        //case "核准日期": break;
                        //// 核准文號
                        //case "核准文號": break;
                        //// 備註
                        //case "備註": break;
                    }
                }
            };


            wizard.ImportPackage += delegate(object sender, SmartSchool.API.PlugIn.Import.ImportPackageEventArgs e)
            {
                Dictionary <string, List <RowData> > id_Rows = new Dictionary <string, List <RowData> >();
                foreach (RowData data in e.Items)
                {
                    if (!id_Rows.ContainsKey(data.ID))
                    {
                        id_Rows.Add(data.ID, new List <RowData>());
                    }
                    id_Rows[data.ID].Add(data);
                }

                List <SHUpdateRecordRecord> InsertList = new List <SHUpdateRecordRecord>();
                List <SHUpdateRecordRecord> UpdateList = new List <SHUpdateRecordRecord>();

                // 檢查新增或更新方式:
                // 每筆 Key 為:異動日期+異動代碼+原因及事項,如果三者內容相同更新,如果不同就新增。
                foreach (string id in id_Rows.Keys)
                {
                    DateTime dt;

                    // 讀取工作表內資料
                    foreach (RowData data in id_Rows[id])
                    {
                        // 當異動記錄內沒有工作表讀取轉換後學生ID,就跳過。
                        if (!UpdateRecs.ContainsKey(id))
                        {
                            continue;
                        }

                        DateTime.TryParse(data["異動日期"], out dt);

                        // 異動代碼
                        string UpdateCode = string.Empty;
                        if (data.ContainsKey("異動代碼"))
                        {
                            UpdateCode = data["異動代碼"];
                        }

                        // 取得原因及事項
                        string UpdateDesc = string.Empty;
                        if (data.ContainsKey("原因及事項"))
                        {
                            UpdateDesc = data["原因及事項"];
                        }


                        SHUpdateRecordRecord updateRec = null;
                        // 異動日期+異動代碼 (如果相同有當更新,不同就新增)
                        foreach (SHUpdateRecordRecord urr in UpdateRecs[id])
                        {
                            if (UpdateCode == urr.UpdateCode)
                            {
                                DateTime dt1;
                                DateTime.TryParse(urr.UpdateDate, out dt1);
                                if (dt == dt1)
                                {
                                    // 使用原因及事項當作Key
                                    if (UpdateDesc == urr.UpdateDescription)
                                    {
                                        updateRec = urr;
                                    }
                                }
                            }
                        }
                        bool isInsert = true;

                        if (updateRec == null)
                        {
                            updateRec           = new SHUpdateRecordRecord();
                            updateRec.StudentID = id;
                        }
                        else
                        {
                            isInsert = false;
                        }

                        // 這段在做資料填入異動紀錄
                        foreach (string field in e.ImportFields)
                        {
                            string value = data[field].Trim();
                            switch (field)
                            {
                            // 班別
                            case "班別":
                                updateRec.ClassType = value;
                                break;

                            // 特殊身份代碼
                            case "特殊身份代碼":
                                updateRec.SpecialStatus = value;
                                break;

                            // 異動科別
                            case "異動科別":
                                updateRec.Department = value;
                                break;

                            // 年級
                            case "年級":
                                updateRec.GradeYear = value;
                                break;

                            // 異動學號
                            case "異動學號":
                                updateRec.StudentNumber = value;
                                break;

                            // 異動姓名
                            case "異動姓名":
                                updateRec.StudentName = value;
                                break;

                            // 身分證號
                            case "身分證號":
                                updateRec.IDNumber = value;
                                break;

                            // 註1
                            case "註1":
                                updateRec.IDNumberComment = value;
                                break;

                            //// 異動種類
                            //case "異動種類":
                            //    break;
                            // 異動代碼
                            case "異動代碼":
                                updateRec.UpdateCode = value;
                                break;

                            // 異動日期
                            case "異動日期":
                                DateTime dt1;
                                if (DateTime.TryParse(value, out dt1))
                                {
                                    updateRec.UpdateDate = dt1.ToShortDateString();
                                }
                                break;

                            // 原因及事項
                            case "原因及事項":
                                updateRec.UpdateDescription = value;
                                break;

                            // 新學號
                            case "新學號":
                                updateRec.NewStudentNumber = value;
                                break;

                            // 更正後資料
                            case "更正後資料":
                                updateRec.NewData = value;
                                break;

                            // 舊班別
                            case "舊班別":
                                updateRec.OldClassType = value;
                                break;

                            // 舊科別代碼
                            case "舊科別代碼":
                                updateRec.OldDepartmentCode = value;
                                break;

                            // 備查日期
                            case "備查日期":
                                DateTime dt2;
                                if (DateTime.TryParse(value, out dt2))
                                {
                                    updateRec.LastADDate = dt2.ToShortDateString();
                                }
                                break;

                            // 備查文號
                            case "備查文號":
                                updateRec.LastADNumber = value;
                                break;

                            // 核准日期
                            case "核准日期":
                                DateTime dt3;
                                if (DateTime.TryParse(value, out dt3))
                                {
                                    updateRec.ADDate = dt3.ToShortDateString();
                                }
                                break;

                            // 核准文號
                            case "核准文號":
                                updateRec.ADNumber = value;
                                break;

                            // 備註
                            case "備註":
                                updateRec.GraduateComment = value;
                                break;
                            }
                        }


                        if (string.IsNullOrEmpty(updateRec.StudentID) || string.IsNullOrEmpty(updateRec.UpdateDate) || string.IsNullOrEmpty(updateRec.UpdateCode))
                        {
                            continue;
                        }
                        else
                        {
                            if (isInsert)
                            {
                                InsertList.Add(updateRec);
                            }
                            else
                            {
                                UpdateList.Add(updateRec);
                            }
                        }
                    }
                }

                try
                {
                    if (InsertList.Count > 0)
                    {
                        Insert(InsertList);
                    }

                    if (UpdateList.Count > 0)
                    {
                        Update(UpdateList);
                    }

                    PermRecLogProcess prlp = new PermRecLogProcess();
                    prlp.SaveLog("學生.匯入異動", "匯入學籍異動", "匯入學籍異動:共新增" + InsertList.Count + "筆資料,共更新:" + UpdateList.Count + "筆資料");
                    SmartSchool.StudentRelated.Student.Instance.SyncAllBackground();
                }
                catch (Exception ex) { }
            };
        }
Beispiel #29
0
        protected override void OnSaveButtonClick(EventArgs e)
        {
            //// 當輸入沒有 鄰自動補
            //if (!string.IsNullOrEmpty(txtArea.Text))
            //{
            //    if (txtArea.Text.IndexOf("鄰") == -1)
            //        txtArea.Text += "鄰";
            //}

            // 檢查畫面儲存相對應
            if (_address_type == AddressType.Permanent)
            {
                _StudAddressRec.Permanent.ZipCode   = txtZipcode.Text;
                _StudAddressRec.Permanent.County    = cboCounty.Text;
                _StudAddressRec.Permanent.Town      = cboTown.Text;
                _StudAddressRec.Permanent.District  = txtDistrict.Text;
                _StudAddressRec.Permanent.Area      = txtArea.Text;
                _StudAddressRec.Permanent.Detail    = txtDetail.Text;
                _StudAddressRec.Permanent.Longitude = txtLongtitude.Text;
                _StudAddressRec.Permanent.Latitude  = txtLatitude.Text;
            }

            if (_address_type == AddressType.Mailing)
            {
                _StudAddressRec.Mailing.ZipCode   = txtZipcode.Text;
                _StudAddressRec.Mailing.County    = cboCounty.Text;
                _StudAddressRec.Mailing.Town      = cboTown.Text;
                _StudAddressRec.Mailing.District  = txtDistrict.Text;
                _StudAddressRec.Mailing.Area      = txtArea.Text;
                _StudAddressRec.Mailing.Detail    = txtDetail.Text;
                _StudAddressRec.Mailing.Longitude = txtLongtitude.Text;
                _StudAddressRec.Mailing.Latitude  = txtLatitude.Text;
            }

            if (_address_type == AddressType.Other)
            {
                _StudAddressRec.Address1.ZipCode   = txtZipcode.Text;
                _StudAddressRec.Address1.County    = cboCounty.Text;
                _StudAddressRec.Address1.Town      = cboTown.Text;
                _StudAddressRec.Address1.District  = txtDistrict.Text;
                _StudAddressRec.Address1.Area      = txtArea.Text;
                _StudAddressRec.Address1.Detail    = txtDetail.Text;
                _StudAddressRec.Address1.Longitude = txtLongtitude.Text;
                _StudAddressRec.Address1.Latitude  = txtLatitude.Text;
            }

            prlp.SetAfterSaveText("戶籍郵遞區號", _StudAddressRec.Permanent.ZipCode);
            prlp.SetAfterSaveText("戶籍縣市", _StudAddressRec.Permanent.County);
            prlp.SetAfterSaveText("戶籍鄉鎮市區", _StudAddressRec.Permanent.Town);
            prlp.SetAfterSaveText("戶籍村里", _StudAddressRec.Permanent.District);
            prlp.SetAfterSaveText("戶籍鄰", _StudAddressRec.Permanent.Area);
            prlp.SetAfterSaveText("戶籍其它地址", _StudAddressRec.Permanent.Detail);
            prlp.SetAfterSaveText("戶籍經度", _StudAddressRec.Permanent.Longitude);
            prlp.SetAfterSaveText("戶籍緯度", _StudAddressRec.Permanent.Latitude);
            prlp.SetAfterSaveText("聯絡郵遞區號", _StudAddressRec.Mailing.ZipCode);
            prlp.SetAfterSaveText("聯絡縣市", _StudAddressRec.Mailing.County);
            prlp.SetAfterSaveText("聯絡鄉鎮市區", _StudAddressRec.Mailing.Town);
            prlp.SetAfterSaveText("聯絡村里", _StudAddressRec.Mailing.District);
            prlp.SetAfterSaveText("聯絡鄰", _StudAddressRec.Mailing.Area);
            prlp.SetAfterSaveText("聯絡其它地址", _StudAddressRec.Mailing.Detail);
            prlp.SetAfterSaveText("聯絡經度", _StudAddressRec.Mailing.Longitude);
            prlp.SetAfterSaveText("聯絡緯度", _StudAddressRec.Mailing.Latitude);
            prlp.SetAfterSaveText("其它郵遞區號", _StudAddressRec.Address1.ZipCode);
            prlp.SetAfterSaveText("其它縣市", _StudAddressRec.Address1.County);
            prlp.SetAfterSaveText("其它鄉鎮市區", _StudAddressRec.Address1.Town);
            prlp.SetAfterSaveText("其它村里", _StudAddressRec.Address1.District);
            prlp.SetAfterSaveText("其它鄰", _StudAddressRec.Address1.Area);
            prlp.SetAfterSaveText("其它其它地址", _StudAddressRec.Address1.Detail);
            prlp.SetAfterSaveText("其它經度", _StudAddressRec.Address1.Longitude);
            prlp.SetAfterSaveText("其它緯度", _StudAddressRec.Address1.Latitude);

            _errors.Clear();
            JHAddress.Update(_StudAddressRec);
            prlp.SetActionBy("學籍", "學生地址資訊");
            prlp.SetAction("修改學生地址資訊");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");
            prlp.SaveLog("", "", "student", PrimaryKey);
            BindDataToForm();
        }
        public override void InitializeImport(SmartSchool.API.PlugIn.Import.ImportWizard wizard)
        {
            // 取得學生資料
            Dictionary<string, SHStudentRecord> Students = new Dictionary<string, SHStudentRecord>();

            // 取得異動資料
            Dictionary<string, List<SHUpdateRecordRecord>> UpdateRecs = new Dictionary<string, List<SHUpdateRecordRecord>>();
            wizard.PackageLimit = 3000;
            wizard.ImportableFields.AddRange("班別", "特殊身份代碼", "異動科別", "年級", "異動學號", "異動姓名", "身分證號", "註1", "異動代碼", "異動日期", "原因及事項", "新學號", "更正後資料", "舊班別", "舊科別代碼", "備查日期", "備查文號", "核准日期", "核准文號", "備註");
            wizard.RequiredFields.AddRange("異動代碼", "異動日期");
            wizard.ValidateStart += delegate(object sender, SmartSchool.API.PlugIn.Import.ValidateStartEventArgs e)
            {
                Students.Clear();
                UpdateRecs.Clear();

                // 取得學生資料
                foreach (SHStudentRecord studRec in SHStudent.SelectByIDs(e.List))
                    if (!Students.ContainsKey(studRec.ID))
                        Students.Add(studRec.ID, studRec);
                foreach (string str in Students.Keys)
                {
                    List<SHUpdateRecordRecord> UpdRecList = new List<SHUpdateRecordRecord>();
                    UpdateRecs.Add(str, UpdRecList);
                }

                // 取得異動
                MultiThreadWorker<string> loader1 = new MultiThreadWorker<string>();
                loader1.MaxThreads = 3;
                loader1.PackageSize = 250;
                loader1.PackageWorker += delegate(object sender1, PackageWorkEventArgs<string> e1)
                {
                    foreach (SHUpdateRecordRecord UpdRec in SHUpdateRecord.SelectByStudentIDs(e.List))
                    {

                        // 過濾非符合標準的異動(目前是學籍)
                        if(!_UpdateCodeList.Contains(UpdRec.UpdateCode))
                            continue;

                            if (UpdateRecs.ContainsKey(UpdRec.StudentID))
                                UpdateRecs[UpdRec.StudentID].Add(UpdRec);
                    }
                };
                loader1.Run(e.List);
            };

            wizard.ValidateRow += delegate(object sender, SmartSchool.API.PlugIn.Import.ValidateRowEventArgs e)
            {
                int i = 0;
                DateTime dt;
                // 檢查學生是否存在
                SHStudentRecord studRec = null;
                if (Students.ContainsKey(e.Data.ID))
                    studRec = Students[e.Data.ID];
                else
                {
                    e.ErrorMessage = "沒有這位學生" + e.Data.ID;
                    return;
                }

                // 驗證格式資料
                bool InputFormatPass = true;
                foreach (string field in e.SelectFields)
                {
                    string value = e.Data[field].Trim();
                    //// 驗證$無法匯入
                    //if (value.IndexOf('$') > -1)
                    //{
                    //    e.ErrorFields.Add(field, "儲存格有$無法匯入.");
                    //    break;
                    //}
                    switch (field)
                    {
                        default:
                            break;

                        //// 班別
                        //case "班別": break;
                        //// 特殊身份代碼
                        //case "特殊身份代碼": break;
                        //// 異動科別
                        //case "異動科別": break;
                        //// 年級
                        //case "年級": break;
                        //// 異動學號
                        //case "異動學號": break;
                        //// 異動姓名
                        //case "異動姓名": break;
                        //// 身分證號
                        //case "身分證號": break;
                        //// 註1
                        //case "註1": break;
                        //// 異動種類
                        //case "異動種類": break;
                        // 異動代碼
                        case "異動代碼":
                            if (!_UpdateCodeList.Contains(value))
                            {
                                InputFormatPass &= false;
                                e.ErrorFields.Add(field, "非學籍異動代碼!");
                            }
                            break;
                        // 異動日期(必填)
                        case "異動日期":
                            DateTime dtC1;
                            if (DateTime.TryParse(value, out dtC1))
                            { }
                            else
                            {
                                InputFormatPass &= false;
                                e.ErrorFields.Add(field, "日期錯誤!");
                            }

                            break;

                        case "備查日期":
                        case "核准日期":
                            DateTime dtC2;
                            if (value.Trim() != "")
                            {
                                if (DateTime.TryParse(value, out dtC2))
                                { }
                                else
                                {
                                    InputFormatPass &= false;
                                    e.ErrorFields.Add(field, "日期錯誤!");
                                }
                            }
                            break;
                        //// 原因及事項
                        //case "原因及事項": break;
                        //// 新學號
                        //case "新學號": break;
                        //// 更正後資料
                        //case "更正後資料": break;
                        //// 舊班別
                        //case "舊班別": break;
                        //// 舊科別代碼
                        //case "舊科別代碼": break;
                        //// 備查日期
                        //case "備查日期":
                        //    break;
                        //// 備查文號
                        //case "備查文號": break;
                        //// 核准日期
                        //case "核准日期": break;
                        //// 核准文號
                        //case "核准文號": break;
                        //// 備註
                        //case "備註": break;
                    }
                }

            };

            wizard.ImportPackage += delegate(object sender, SmartSchool.API.PlugIn.Import.ImportPackageEventArgs e)
            {
                Dictionary<string, List<RowData>> id_Rows = new Dictionary<string, List<RowData>>();
                foreach (RowData data in e.Items)
                {
                    if (!id_Rows.ContainsKey(data.ID))
                        id_Rows.Add(data.ID, new List<RowData>());
                    id_Rows[data.ID].Add(data);
                }

                List<SHUpdateRecordRecord> InsertList = new List<SHUpdateRecordRecord>();
                List<SHUpdateRecordRecord> UpdateList = new List<SHUpdateRecordRecord>();

                // 檢查新增或更新方式:
                // 每筆 Key 為:異動日期+異動代碼+原因及事項,如果三者內容相同更新,如果不同就新增。
                foreach (string id in id_Rows.Keys)
                {
                    DateTime dt;

                    // 讀取工作表內資料
                    foreach (RowData data in id_Rows[id])
                    {
                        // 當異動記錄內沒有工作表讀取轉換後學生ID,就跳過。
                        if (!UpdateRecs.ContainsKey(id))
                            continue;

                        DateTime.TryParse(data["異動日期"], out dt);

                        // 異動代碼
                        string UpdateCode = string.Empty;
                        if (data.ContainsKey("異動代碼"))
                            UpdateCode = data["異動代碼"];

                        // 取得原因及事項
                        string UpdateDesc = string.Empty;
                        if (data.ContainsKey("原因及事項"))
                            UpdateDesc = data["原因及事項"];

                        SHUpdateRecordRecord updateRec = null;
                        // 異動日期+異動代碼 (如果相同有當更新,不同就新增)
                        foreach (SHUpdateRecordRecord urr in UpdateRecs[id])
                        {
                            if (UpdateCode == urr.UpdateCode)
                            {
                                DateTime dt1;
                                DateTime.TryParse(urr.UpdateDate, out dt1);
                                if (dt == dt1)
                                {
                                    // 使用原因及事項當作Key
                                    if(UpdateDesc == urr.UpdateDescription )
                                        updateRec = urr;
                                }
                            }
                        }
                        bool isInsert = true;

                        if (updateRec == null)
                        {
                            updateRec = new SHUpdateRecordRecord();
                            updateRec.StudentID = id;
                        }
                        else
                            isInsert = false;

                        // 這段在做資料填入異動紀錄
                        foreach (string field in e.ImportFields)
                        {
                            string value = data[field].Trim();
                            switch (field)
                            {
                                // 班別
                                case "班別":
                                    updateRec.ClassType = value;
                                    break;
                                // 特殊身份代碼
                                case "特殊身份代碼":
                                    updateRec.SpecialStatus = value;
                                    break;
                                // 異動科別
                                case "異動科別":
                                    updateRec.Department = value;
                                    break;
                                // 年級
                                case "年級":
                                    updateRec.GradeYear = value;
                                    break;
                                // 異動學號
                                case "異動學號":
                                    updateRec.StudentNumber = value;
                                    break;
                                // 異動姓名
                                case "異動姓名":
                                    updateRec.StudentName = value;
                                    break;
                                // 身分證號
                                case "身分證號":
                                    updateRec.IDNumber = value;
                                    break;
                                // 註1
                                case "註1":
                                    updateRec.IDNumberComment = value;
                                    break;
                                //// 異動種類
                                //case "異動種類":
                                //    break;
                                // 異動代碼
                                case "異動代碼":
                                    updateRec.UpdateCode = value;
                                    break;
                                // 異動日期
                                case "異動日期":
                                    DateTime dt1;
                                    if (DateTime.TryParse(value, out dt1))
                                        updateRec.UpdateDate = dt1.ToShortDateString();
                                    break;
                                // 原因及事項
                                case "原因及事項":
                                    updateRec.UpdateDescription = value;
                                    break;
                                // 新學號
                                case "新學號":
                                    updateRec.NewStudentNumber = value;
                                    break;
                                // 更正後資料
                                case "更正後資料":
                                    updateRec.NewData = value;
                                    break;
                                // 舊班別
                                case "舊班別":
                                    updateRec.OldClassType = value;
                                    break;
                                // 舊科別代碼
                                case "舊科別代碼":
                                    updateRec.OldDepartmentCode = value;
                                    break;
                                // 備查日期
                                case "備查日期":
                                    DateTime dt2;
                                    if (DateTime.TryParse(value,out dt2))
                                        updateRec.LastADDate = dt2.ToShortDateString ();
                                    break;
                                // 備查文號
                                case "備查文號":
                                    updateRec.LastADNumber = value;
                                    break;
                                // 核准日期
                                case "核准日期":
                                    DateTime dt3;
                                    if(DateTime.TryParse(value, out dt3))
                                        updateRec.ADDate = dt3.ToShortDateString();
                                    break;
                                // 核准文號
                                case "核准文號":
                                    updateRec.ADNumber = value;
                                    break;
                                // 備註
                                case "備註":
                                    updateRec.GraduateComment = value;
                                    break;
                            }
                        }

                        if (string.IsNullOrEmpty(updateRec.StudentID) || string.IsNullOrEmpty(updateRec.UpdateDate) || string.IsNullOrEmpty(updateRec.UpdateCode))
                            continue;
                        else
                        {
                            if (isInsert)
                                InsertList.Add(updateRec);
                            else
                                UpdateList.Add(updateRec);
                        }
                    }

                }

                try
                {
                    if (InsertList.Count > 0)
                        Insert(InsertList);

                    if (UpdateList.Count > 0)
                        Update(UpdateList);

                    PermRecLogProcess prlp = new PermRecLogProcess();
                    prlp.SaveLog("學生.匯入異動", "匯入學籍異動", "匯入學籍異動:共新增" + InsertList.Count + "筆資料,共更新:" + UpdateList.Count + "筆資料");
                    SmartSchool.StudentRelated.Student.Instance.SyncAllBackground();
                }
                catch (Exception ex) { }
            };
        }
Beispiel #31
0
        private void btnConfirm_Click(object sender, EventArgs e)
        {
            try
            {
                DialogResult         = DialogResult.None;
                _OldTagRec           = new JHTagConfigRecord();
                _OldTagRec.Prefix    = _current_tag.Prefix;
                _OldTagRec.Name      = _current_tag.Name;
                _OldTagRec.ColorCode = _current_tag.ColorCode;

                _current_tag.Prefix = cboGroups.Text.Trim();
                _current_tag.Name   = txtName.Text.Trim();
                _current_tag.Color  = cpColor.SelectedColor;

                if (string.IsNullOrEmpty(_current_tag.Name))
                {
                    FISCA.Presentation.Controls.MsgBox.Show("您必須輸入類別名稱。");
                    return;
                }

                foreach (JHTagConfigRecord each in JHTagConfig.SelectAll())
                {
                    if (each == _current_tag)
                    {
                        continue;
                    }

                    if (_mode == ManageMode.Insert)
                    {
                        if (_current_tag.FullName == each.FullName && _current_tag.Category.ToUpper() == each.Category.ToUpper())
                        {
                            FISCA.Presentation.Controls.MsgBox.Show("名稱重覆,請選擇其他名稱。");
                            return;
                        }
                    }
                }
                PermRecLogProcess prlp = new PermRecLogProcess();

                if (_mode == ManageMode.Insert)
                {
                    // Log
                    prlp.SaveLog("學籍.類別管理", "類別管理新增類別", "新增 " + _current_tag.Category + " 類別,名稱:" + _current_tag.FullName);

                    JHTagConfig.Insert(_current_tag);
                }
                else
                {
                    // Log
                    bool   checkEdit  = false;
                    string strLogName = "更新 " + _current_tag.Category + " 類別,";
                    if (_OldTagRec.FullName != _current_tag.FullName)
                    {
                        strLogName += "名稱由「" + _OldTagRec.FullName + "」改為「" + _current_tag.FullName + "」,";
                        checkEdit   = true;
                    }
                    if (_OldTagRec.ColorCode != _current_tag.ColorCode)
                    {
                        strLogName += "修改" + _current_tag.FullName + "顏色。";
                        checkEdit   = true;
                    }

                    if (checkEdit)
                    {
                        prlp.SaveLog("學籍.類別管理", "類別管理更新類別", strLogName);
                    }

                    JHTagConfig.Update(_current_tag);
                }

                DialogResult = DialogResult.OK;
            }
            catch (Exception ex)
            {
                FISCA.Presentation.Controls.MsgBox.Show(ex.Message);
                DialogResult = DialogResult.None;
            }
        }
        private void cmdPrint_Click(object sender, EventArgs e)
        {
            if (cbxDefault.Checked == false && cbxUserDefine.Checked == false && Student.Instance.SelectedKeys.Count < 1)
            {
                return;
            }

            if (cbxDefault.Checked)
            {
                isDefalutTemplate = true;
            }
            else
            {
                isDefalutTemplate = false;
            }

            if (chkUseSystemPhoto.Checked)
            {
                isUseSystemPhoto             = true;
                DAL.DALTransfer.UseStudPhotp = true;
            }
            else
            {
                isUseSystemPhoto             = false;
                DAL.DALTransfer.UseStudPhotp = false;
            }

            cmdPrint.Enabled = false;
            bool isPrintFinish = false;

            int LogCot = 0;

            if (_UseModule == UseModuleType.學生)
            {
                isPrintFinish = sidm.PrintData(Student.Instance.SelectedKeys, isDefalutTemplate, isUseSystemPhoto, Student.Instance.SelectedKeys.Count);
                LogCot        = Student.Instance.SelectedKeys.Count;
            }

            if (_UseModule == UseModuleType.班級)
            {
                List <string> StudentIDList = new List <string>();
                foreach (ClassRecord cr in Class.Instance.SelectedList)
                {
                    foreach (StudentRecord studRec in cr.Students.GetStatusStudents("一般"))
                    {
                        StudentIDList.Add(studRec.ID);
                    }

                    foreach (StudentRecord studRec in cr.Students.GetStatusStudents("輟學"))
                    {
                        StudentIDList.Add(studRec.ID);
                    }
                }
                isPrintFinish = sidm.PrintData(StudentIDList, isDefalutTemplate, isUseSystemPhoto, StudentIDList.Count);
                LogCot        = StudentIDList.Count;
            }


            if (isPrintFinish)
            {
                PermRecLogProcess prlp = new PermRecLogProcess();
                prlp.SaveLog("學生.報表", "列印", "列印" + LogCot + "筆學生證資料。");
                cmdPrint.Enabled = true;
            }
        }
Beispiel #33
0
        private void buttonItem2_CheckedChanged(object sender, EventArgs e)
        {
            var button = (DevComponents.DotNetBar.ButtonItem)sender;

            if (button.Checked)
            {
                var studentRec = Student.Instance.Items[PrimaryKey];
                if (studentRec != null)
                {
                    if (button.Text != studentRec.Status)
                    {
                        //if (button.Text == "刪除")
                        //    throw new ArgumentException();

                        try
                        {
                            PermRecLogProcess prlp = new PermRecLogProcess();

                            JHSchool.Data.JHStudentRecord stu = JHSchool.Data.JHStudent.SelectByID(PrimaryKey);
                            prlp.SetBeforeSaveText("學生狀態", stu.Status.ToString());


                            if (K12.Data.StudentRecord.StudentStatus.一般.ToString() == button.Text)
                            {
                                stu.Status = K12.Data.StudentRecord.StudentStatus.一般;
                            }

                            if (K12.Data.StudentRecord.StudentStatus.休學.ToString() == button.Text)
                            {
                                stu.Status = K12.Data.StudentRecord.StudentStatus.休學;
                            }

                            if (K12.Data.StudentRecord.StudentStatus.畢業或離校.ToString() == button.Text)
                            {
                                stu.Status = K12.Data.StudentRecord.StudentStatus.畢業或離校;
                            }

                            if (K12.Data.StudentRecord.StudentStatus.輟學.ToString() == button.Text)
                            {
                                stu.Status = K12.Data.StudentRecord.StudentStatus.輟學;
                            }

                            if (K12.Data.StudentRecord.StudentStatus.刪除.ToString() == button.Text)
                            {
                                stu.Status = K12.Data.StudentRecord.StudentStatus.刪除;
                            }

                            // 檢查同狀態要身分證或學號相同時,無法變更

                            List <string> checkIDNumber = new List <string>();
                            List <string> checkSnum     = new List <string>();

                            foreach (JHSchool.Data.JHStudentRecord studRec in JHSchool.Data.JHStudent.SelectAll())
                            {
                                if (studRec.Status == stu.Status)
                                {
                                    if (!string.IsNullOrEmpty(studRec.StudentNumber))
                                    {
                                        checkSnum.Add(studRec.StudentNumber.Trim());
                                    }
                                    if (!string.IsNullOrEmpty(studRec.IDNumber))
                                    {
                                        checkIDNumber.Add(studRec.IDNumber.Trim());
                                    }
                                }
                            }

                            if (checkSnum.Contains(stu.StudentNumber.Trim()))
                            {
                                MsgBox.Show("在" + stu.Status.ToString() + "狀態學號有重複無法變更.");
                                return;
                            }

                            if (checkIDNumber.Contains(stu.IDNumber.Trim()))
                            {
                                MsgBox.Show("在" + stu.Status.ToString() + "狀態身分證號有重複無法變更.");
                                return;
                            }

                            JHSchool.Data.JHStudent.Update(stu);
                            prlp.SetAfterSaveText("學生狀態", stu.Status.ToString());
                            prlp.SetActionBy("學籍", "學生學生狀態");
                            prlp.SetAction("修改學生學生狀態");
                            prlp.SaveLog("", "", "student", PrimaryKey);


                            //Feature.Legacy.EditStudent.ChangeStudentStatus(studentRec.ID, button.Text);
                        }
                        catch (ArgumentException aa)
                        {
                            MessageBox.Show("目前無法移到刪除");
                        }

                        catch
                        {
                            OnPrimaryKeyChanged(new EventArgs());
                            FISCA.Presentation.MotherForm.SetStatusBarMessage("變更狀態失敗,可能發生原因為學號或身分證號在" + button.Text + "學生中已經存在,請檢查學生資料。");
                            return;
                        }
                        Student.Instance.SyncDataBackground(studentRec.ID);
                        FISCA.Presentation.MotherForm.SetStatusBarMessage("已變更學生狀態。" + DescriptionLabel.Text);
                    }
                }
            }
        }
        // save
        private void SemesterHistoryDetail_SaveButtonClick(object sender, EventArgs e)
        {
            // 資料檢查
            foreach (DataGridViewRow row in dataGridViewX1.Rows)
            {
                if (row.IsNewRow)
                {
                    continue;
                }
                foreach (DataGridViewCell cell in row.Cells)
                {
                    if (cell.ErrorText != "")
                    {
                        MsgBox.Show("資料有疑問無法儲存,請檢查標紅色儲存格.", "儲存失敗", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }
                }
            }

            JHSchool.Data.JHSemesterHistoryRecord updateSemeHsitoryRec = new JHSchool.Data.JHSemesterHistoryRecord();

            updateSemeHsitoryRec.RefStudentID = PrimaryKey;

            foreach (DataGridViewRow row in dataGridViewX1.Rows)
            {
                int SchoolYear = 0, Semester = 0, GradeYear = 0, SchoolDayCount = 0, SeatNo = 0;

                if (row.IsNewRow)
                {
                    continue;
                }
                K12.Data.SemesterHistoryItem shi = new K12.Data.SemesterHistoryItem();

                if (row.Cells[colSchoolYear.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSchoolYear.Index].Value, out SchoolYear);
                }

                if (row.Cells[colSemester.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSemester.Index].Value, out Semester);
                }

                if (row.Cells[colGradeYear.Index] != null)
                {
                    int.TryParse("" + row.Cells[colGradeYear.Index].Value, out GradeYear);
                }

                if (row.Cells[colSchoolDayCount.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSchoolDayCount.Index].Value, out SchoolDayCount);
                }

                if (row.Cells[colSeatNo.Index] != null)
                {
                    int.TryParse("" + row.Cells[colSeatNo.Index].Value, out SeatNo);
                }

                shi.SchoolYear = SchoolYear;
                shi.Semester   = Semester;
                shi.GradeYear  = GradeYear;
                if (row.Cells[colClassName.Index] != null)
                {
                    shi.ClassName = row.Cells[colClassName.Index].Value + "";
                }

                if (SeatNo == 0)
                {
                    shi.SeatNo = null;
                }
                else
                {
                    shi.SeatNo = SeatNo;
                }

                if (row.Cells[colTeacherName.Index] != null)
                {
                    shi.Teacher = row.Cells[colTeacherName.Index].Value + "";
                }

                if (SchoolDayCount == 0)
                {
                    shi.SchoolDayCount = null;
                }
                else
                {
                    shi.SchoolDayCount = SchoolDayCount;
                }

                updateSemeHsitoryRec.SemesterHistoryItems.Add(shi);

                string logIdxStr = shi.SchoolYear + "" + shi.Semester + "_";
                prlp.SetAfterSaveText(logIdxStr + "學年度", shi.SchoolYear + "");
                prlp.SetAfterSaveText(logIdxStr + "學期", shi.Semester + "");
                prlp.SetAfterSaveText(logIdxStr + "年級", shi.GradeYear + "");
                prlp.SetAfterSaveText(logIdxStr + "班級", shi.ClassName);
                prlp.SetAfterSaveText(logIdxStr + "座號", SeatNo + "");
                prlp.SetAfterSaveText(logIdxStr + "班導師", shi.Teacher);
                prlp.SetAfterSaveText(logIdxStr + "上課天數", SchoolDayCount + "");
            }

            JHSchool.Data.JHSemesterHistory.Update(updateSemeHsitoryRec);


            prlp.SetActionBy("學籍", "學生學期對照表");
            prlp.SetAction("修改學生學期對照表");
            JHStudentRecord studRec = JHStudent.SelectByID(PrimaryKey);

            prlp.SetDescTitle("學生姓名:" + studRec.Name + ",學號:" + studRec.StudentNumber + ",");

            prlp.SaveLog("", "", "student", PrimaryKey);

            this.CancelButtonVisible = false;
            this.SaveButtonVisible   = false;
        }