Beispiel #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);
            }
        }
Beispiel #2
0
        private void LoadStudentImage()
        {
            try
            {
                StudentInfoDAC stdDB = new StudentInfoDAC();

                string image = stdDB.GetImage(txtStudentID.Text);
                if (image == "" || image == null)
                {
                    pictureBox1.Image = null;
                    return;
                }
                Image img;

                img = Image.FromFile(Application.StartupPath.Replace("\\", "/") + "/" + image);

                pictureBox1.Image    = img;
                pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
                stdDB.Dispose();
            }
            catch
            {
                return;
            }
        }
Beispiel #3
0
        private void LoadStudentGridData()
        {
            StudentInfoDAC stdDB = new StudentInfoDAC();
            DataSet        ds    = stdDB.GetAll();

            StudentGrid.DataSource = ds.Tables[0];
            stdDB.Dispose();
        }
        private void LoadStudentGridData()
        {
            StudentInfoDAC DAC = new StudentInfoDAC();
            DataSet        ds  = DAC.GetIDName();

            StudentGrid.DataSource = ds.Tables[0];
            DAC.Dispose();
        }
Beispiel #5
0
        private void BtnSaveFile_Click(object sender, EventArgs e)
        {
            if (pictureBox1.Image == null)
            {
                MaterialMessageBox.Show("저장하실 이미지 정보를 입력하여 주십시오", "오류", MessageBoxButtons.OK);
                return;
            }
            //Cursor currentCursor = this.Cursor;
            string destFile  = string.Empty;
            string sPath     = string.Empty;
            string sFileName = string.Empty;
            string sExt      = string.Empty;

            try
            {
                //this.Cursor = Cursors.WaitCursor;
                StudentInfoDAC stdDB     = new StudentInfoDAC();
                string         localFile = pictureBox1.Tag.ToString().Replace("\\", "/");
                sPath     = string.Format("studentImage/{0}/", txtStudentID.Text);
                sExt      = localFile.Substring(localFile.LastIndexOf("."));
                sFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + txtStudentID.Text + sExt;

                DirectoryInfo di = new DirectoryInfo(sPath);
                if (di.Exists == false)
                {
                    di.Create();
                }
                // 현재 exe가 실행중인 경로에 생성
                destFile = Path.Combine(Environment.CurrentDirectory.Replace("\\", "/"), sPath, sFileName);
                File.Copy(pictureBox1.Tag.ToString(), destFile, true);

                stdDB.SaveImageFile(sPath, sFileName, txtStudentID.Text);
                stdDB.Dispose();
                MaterialMessageBox.Show("사진저장 완료", "확인", MessageBoxButtons.OK);
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
            finally
            {
                //this.Cursor = currentCursor;
            }
        }
Beispiel #6
0
        private void 삭제ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string msg = string.Format("{0} 학생을 삭제하시겠습니까?",
                                       StudentGrid[1, StudentGrid.CurrentRow.Index].Value.ToString());

            try
            {
                if (MaterialMessageBox.Show(msg, "삭제확인", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string         stuID = StudentGrid[0, StudentGrid.CurrentRow.Index].Value.ToString();
                    StudentInfoDAC stdDB = new StudentInfoDAC();
                    stdDB.Delete(stuID);
                    stdDB.Dispose();
                    LoadStudentGridData();
                    LoadStudentInfoData();
                    LoadStudentImage();
                }
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }
Beispiel #7
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, "경고");
            }
        }