예제 #1
0
        private void Update_Click(object sender, EventArgs e)
        {
            if (this.dgvData.SelectedRows.Count == 0)
            {
                System.Windows.Forms.MessageBox.Show("請先選擇科目。");
                return;
            }

            try
            {
                frmSubjectCreator  frm     = new frmSubjectCreator("修改科目");
                UDT.Subject        record  = this.dgvData.SelectedRows[0].Tag as UDT.Subject;
                List <UDT.Subject> records = new List <UDT.Subject>();
                records.Add(record);

                Event.DeliverActiveRecord.RaiseSendingEvent(this, new Event.DeliverActiveRecordEventArgs(records));
                frm.ShowDialog();

                if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    this.InitSubject();
                }
            }
            catch (Exception ex)
            {
                MsgBox.Show(ex.Message);
            }
        }
예제 #2
0
        private void Addd_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.cboSchoolYear.Text) || string.IsNullOrEmpty(this.cboSemester.Text))
            {
                MsgBox.Show("請先選擇「學年度」與「學期」。");
                return;
            }

            frmSubjectCreator frm = new frmSubjectCreator("新增科目", this.cboSchoolYear.Text, this.cboSemester.Text);

            frm.ShowDialog();

            if (frm.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                this.InitSubject();
            }
        }