示例#1
0
        private void 수정ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StudentInfoInsUpForm frm = new StudentInfoInsUpForm(StudentInfoInsUpForm.EditMode.Update);

            try
            {
                Student stu;
                stu.ID          = StudentGrid[0, StudentGrid.CurrentRow.Index].Value.ToString();
                stu.Name        = StudentGrid[1, StudentGrid.CurrentRow.Index].Value.ToString();
                stu.Phone       = StudentGrid[2, StudentGrid.CurrentRow.Index].Value.ToString();
                stu.Email       = StudentGrid[3, StudentGrid.CurrentRow.Index].Value.ToString();
                frm.StudentInfo = stu;

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    StudentInfoDAC stdDB = new StudentInfoDAC();
                    stdDB.Update(frm.StudentInfo);
                    stdDB.Dispose();
                    LoadStudentGridData();
                    LoadStudentInfoData();
                    LoadStudentImage();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
示例#2
0
        private void BtnCreate_Click(object sender, EventArgs e)
        {
            StudentInfoInsUpForm frm = new StudentInfoInsUpForm(StudentInfoInsUpForm.EditMode.Input);

            try
            {
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    StudentInfoDAC stdDB = new StudentInfoDAC();
                    stdDB.Insert(frm.StudentInfo);
                    stdDB.Dispose();
                    MaterialMessageBox.Show("신규등록이 완료되었습니다.", "확인", MessageBoxButtons.OK);
                    LoadStudentGridData();
                    LoadStudentInfoData();
                    LoadStudentImage();
                    LoadStudentDetailInfoData();
                }
            }
            catch (Exception err)
            {
                MetroFramework.MetroMessageBox.Show(this, err.Message, "경고");
            }
        }