/// <summary> /// 삭제 버튼 클릭 이벤트 /// 1. DB에 있는 SetMemberText Class의 Property들에 TextBox의 내용 담는다. /// 2. DB의 DeleteMember()에 SetMemberText st 선언을 담아서 메서드 수행 /// 3. 결과값 bool타입으로 받아서 true = 삭제 완료 / false = 삭제 불가 메세지 출력 /// 4. 삭제 완료시 SetData()를 통해 DataGridView에 변경된 내용 다시 출력 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnDelete_Click(object sender, EventArgs e) { try { frmDelete frm = new frmDelete(); if (frm.ShowDialog() == DialogResult.OK) { MemberDB db = new MemberDB(); SetMemberText st = new SetMemberText(txtID.Text, txtName.Text, rbtnGenderM.Tag.ToString(), txtNum.Text, txtPostalCode.Text, txtPriAddress.Text, txtDetAddress.Text, txtSchool.Text, txtGrade.Text, dtpBirth.Value, txtlessonCode.Text, dtpRegDate.Value, txtPPNum.Text, txtNs.Text, txtAntecedent.Text); bool bFlag; bFlag = db.DeleteMember(st); if (bFlag) { MessageBox.Show("정보 삭제가 완료되었습니다."); SetData(); } else { MessageBox.Show("형식을 잘못 입력하였거나 빈 항목이 있습니다."); } db.Dispose(); } else { frm.Close(); } } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// Class 폼 로드시 /// 1. DataGridView에 Column 추가 /// 2. SetData()호출 => LoadClassData() 호출 /// 3. DB에 있는 LoadClassData()에서 Binding 할 Data 가져오기 /// 4. ComboBox에 공통코드(LessonType) 추가 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmClass_Load(object sender, EventArgs e) { try { CommonUtil.SetInitGridView(classDataGridView); CommonUtil.AddGridTextColumn(classDataGridView, "강의", "lessonCode", 50); //index[0] CommonUtil.AddGridTextColumn(classDataGridView, "강의명", "lessonName", 80); //1 CommonUtil.AddGridTextColumn(classDataGridView, "클래스", "classDistribution", 60); //2 CommonUtil.AddGridTextColumn(classDataGridView, "직원ID", "staffID", 70); //3 CommonUtil.AddGridTextColumn(classDataGridView, "강의 시작일", "lessonStartDate", 100); //4 CommonUtil.AddGridTextColumn(classDataGridView, "강의 종료일", "lessonEndDate", 100); //5 CommonUtil.AddGridTextColumn(classDataGridView, "강의 시작시간", "lessonStartTime", 100); //6 CommonUtil.AddGridTextColumn(classDataGridView, "강의 종료시간", "lessonEndTime", 100); //7 CommonUtil.AddGridTextColumn(classDataGridView, "강의료", "lessonAmount", 100); //8 CommonUtil.AddGridTextColumn(classDataGridView, "특이사항", "lessonNsReport", 10, false); //9 this.classDataGridView.Font = new Font("나눔바른고딕", 10, FontStyle.Regular); SetData(); string[] codes = { "LessonType" }; MemberDB db = new MemberDB(); DataSet ds = db.GetCommonCode(codes); CommonUtil.BindingComboBox(comboBox1, ds.Tables["LessonType"], "Code", "Name"); CommonUtil.BindingComboBox(cbClass, ds.Tables["LessonType"], "Code", "Name"); SetMemberText st = new SetMemberText(comboBox1.Text); } catch (Exception err) { MessageBox.Show(err.Message); } }
private void frmMembership_Load(object sender, EventArgs e) { string[] codes = { "JOB" }; MemberDB db = new MemberDB(); DataSet ds = db.GetCommonCode(codes); CommonUtil.BindingComboBox(cboJob, ds.Tables["JOB"], "Code", "Name"); SetMemberText st = new SetMemberText(cboJob.Text); }
/// <summary> /// 1. DB에 있는 LoadMemberData() 호출 /// 2. DataTable에 담아 DataView로 /// 3. DataGridView의 DataSource를 Dataview로 /// </summary> private void SetData() { try { MemberDB db = new MemberDB(); DataTable dt = db.LoadMemberData(); db.Dispose(); DataView dataView = new DataView(dt); memberDataGridView.DataSource = dataView; } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// 새로고침 버튼 클릭 이벤트 /// 1. ComboBox1 의 내용을 담아서 DB의 LoadClass() 수행 /// 2. ComboBox1의 내용을 쿼리문 where절에 담아서 정보 다시 출력 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRenew_Click(object sender, EventArgs e) { try { MemberDB db = new MemberDB(); DataTable dt = db.LoadClass(comboBox1.Text); db.Dispose(); DataView dataView = new DataView(dt); memberDataGridView.DataSource = dataView; } catch (Exception err) { MessageBox.Show(err.Message); } }
/// <summary> /// Attendance_Load 폼 로드시 /// 1. DataGridView에 Column 추가 /// 2. SetData()호출 => LoadCounselingData() 호출 /// 3. DB에 있는 LoadCounselingData()에서 Binding 할 Data 가져오기 /// 4. 공통 코드 가져오는 메서드 GetCommonCode() /// 5. BindingComboBox()로 콤보박스에 공통코드 바인딩 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frnAttendance_Load(object sender, EventArgs e) { try { DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn(); col.Name = "chk"; col.HeaderText = ""; col.Width = 30; AttDataGridView.Columns.Add(col); Point headerCellLocation = AttDataGridView.GetCellDisplayRectangle(0, -1, true).Location; //헤더부분의 체크박스 headerCheckBox.Location = new Point(headerCellLocation.X + 8, headerCellLocation.Y + 2); headerCheckBox.Size = new Size(18, 18); headerCheckBox.BackColor = Color.Transparent; headerCheckBox.Click += HeaderCheckBox_Click; AttDataGridView.Controls.Add(headerCheckBox); //3 CommonUtil.SetInitGridView(AttDataGridView); CommonUtil.AddGridTextColumn(AttDataGridView, "출결 번호", "attendanceNum", 70, false); //index[1] CommonUtil.AddGridTextColumn(AttDataGridView, "학생ID", "stuID", 65); //index[2] CommonUtil.AddGridTextColumn(AttDataGridView, "이름", "stuName", 65); //3 CommonUtil.AddGridTextColumn(AttDataGridView, "강의코드", "lessonCode", 70); //4 CommonUtil.AddGridTextColumn(AttDataGridView, "출결날짜", "attendanceDate", 100); //5 CommonUtil.AddGridTextColumn(AttDataGridView, "입실 시간", "enteringTime", 100); //6 CommonUtil.AddGridTextColumn(AttDataGridView, "퇴실 시간", "entranceTime", 100); //7 CommonUtil.AddGridTextColumn(AttDataGridView, "지각 여부", "lateness", 75); //8 CommonUtil.AddGridTextColumn(AttDataGridView, "결석 여부", "absence", 75); //9 CommonUtil.AddGridTextColumn(AttDataGridView, "조퇴 여부", "early_Leave", 75); //10 CommonUtil.AddGridTextColumn(AttDataGridView, "기록사항", "recordContent", 10, false); //11 this.AttDataGridView.Font = new Font("나눔바른고딕", 10, FontStyle.Regular); SetData(); string[] codes = { "LessonType" }; MemberDB db = new MemberDB(); DataSet ds = db.GetCommonCode(codes); CommonUtil.BindingComboBox(comboBox1, ds.Tables["LessonType"], "lessonCode", "Code"); SetMemberText st = new SetMemberText(comboBox1.Text); } catch (Exception err) { throw err; } }
/// <summary> /// Member 폼 로드시 /// 1. DataGridView에 Column 추가 /// 2. SetData()호출 => LoadMemberData() 호출 /// 3. DB에 있는 LoadMemberData()에서 Binding 할 Data 가져오기 /// 4. ComboBox에 공통코드(ClassType) 추가 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMember_Load(object sender, EventArgs e) { try { CommonUtil.SetInitGridView(memberDataGridView); CommonUtil.AddGridTextColumn(memberDataGridView, "학생ID", "stuID", 100); //index[0] CommonUtil.AddGridTextColumn(memberDataGridView, "이름", "stuName", 100); //1 CommonUtil.AddGridTextColumn(memberDataGridView, "번호", "phNum", 170); //2 CommonUtil.AddGridTextColumn(memberDataGridView, "학교", "school", 120); //3 CommonUtil.AddGridTextColumn(memberDataGridView, "학년", "class", 80); //4 CommonUtil.AddGridTextColumn(memberDataGridView, "수강코드", "lessonCode", 170); //5 CommonUtil.AddGridTextColumn(memberDataGridView, "성별", "stuGender", 10, false); //6 CommonUtil.AddGridTextColumn(memberDataGridView, "우편번호", "postalCode", 10, false); //7 CommonUtil.AddGridTextColumn(memberDataGridView, "기본주소", "priAddress", 10, false); //8 CommonUtil.AddGridTextColumn(memberDataGridView, "상세주소", "detAddress", 10, false); //9 CommonUtil.AddGridTextColumn(memberDataGridView, "생년월일", "birth", 10, false); //10 CommonUtil.AddGridTextColumn(memberDataGridView, "수강등록일", "regDate", 10, false); //11 CommonUtil.AddGridTextColumn(memberDataGridView, "보호자번호", "pPNum", 10, false); //12 CommonUtil.AddGridTextColumn(memberDataGridView, "특이사항", "nsReport", 10, false); //13 CommonUtil.AddGridTextColumn(memberDataGridView, "삭제여부", "deleted", 10, false); //14 CommonUtil.AddGridTextColumn(memberDataGridView, "선행여부", "antecedent", 10, false); //15 CommonUtil.AddGridTextColumn(memberDataGridView, "학생사진", "stuPic", 10, false); //16 this.memberDataGridView.Font = new Font("나눔바른고딕", 10, FontStyle.Regular); SetData(); string[] codes = { "ClassType" }; MemberDB db = new MemberDB(); DataSet ds = db.GetCommonCode(codes); CommonUtil.BindingComboBox(comboBox1, ds.Tables["ClassType"], "lessonCode", "Name"); SetMemberText st = new SetMemberText(comboBox1.Text); } catch (Exception err) { MessageBox.Show(err.Message); } }