private void LoadConsultData() { ConsultInfoService dac = new ConsultInfoService(); DataSet ds = dac.GetAll(); ConsultGrid.DataSource = ds.Tables[0]; dac.Dispose(); }
private void LoadData() { ConsultInfoService service = new ConsultInfoService(); dt = service.GetStudentConsult(lblStudentID.Text); ConsultGrid.DataSource = service.GetStudentConsult(lblStudentID.Text); service.Dispose(); //dt = new DataTable(); this.bindingSource1.DataSource = dt; }
private void ToolStripButton1_Click(object sender, EventArgs e) { ConsultInfoService service = new ConsultInfoService(); try { DataRow[] insRows = dt.Select(null, null, DataViewRowState.Added); foreach (DataRow dr in insRows) { ConsultInfoVO item = SetConsultInfoVo1(dr); service.Insert(item, lblStudentID.Text); } DataRow[] upsRows = dt.Select(null, null, DataViewRowState.ModifiedCurrent); foreach (DataRow dr in upsRows) { ConsultInfoVO item = SetConsultInfoVo(dr); service.Update(item, lblStudentID.Text); } DataRow[] delRows = dt.Select(null, null, DataViewRowState.Deleted); foreach (DataRow dr in delRows) { ConsultInfoVO item = SetDelConsultInfoVo(dr); service.Delete(item, lblStudentID.Text); } MaterialMessageBox.Show("저장완료", "확인", MessageBoxButtons.OK); } catch (InvalidCastException) { MaterialMessageBox.Show("항목을 입력해주세요", "경고", MessageBoxButtons.OK); } catch (Exception err2) { MaterialMessageBox.Show(err2.Message, "경고", MessageBoxButtons.OK); } finally { service.Dispose(); } }
private void LoadConsultList() { ConsultGrid.AutoGenerateColumns = false; ConsultGrid.AllowUserToAddRows = false; ConsultGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; ConsultGrid.RowHeadersWidth = 15; ConsultGrid.ColumnHeadersHeight = 30; ConsultGrid.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI", 11.5F); ConsultGrid.RowsDefaultCellStyle.Font = new Font("Segoe UI", 9.5F); ConsultGrid.DefaultCellStyle.WrapMode = DataGridViewTriState.True; ConsultGrid.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; ConsultGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; UtilityClass.AddNewColumnToDataGridView(ConsultGrid, "상담번호", "consult_id", false, 10); UtilityClass.AddNewColumnToDataGridView(ConsultGrid, "상담날짜", "consult_date", true, 100); UtilityClass.AddNewColumnToDataGridView(ConsultGrid, "상담내용", "consult_details", true, 150); UtilityClass.AddNewColumnToDataGridView(ConsultGrid, "조치사항", "others", true, 150); ConsultInfoService service = new ConsultInfoService(); ConsultGrid.DataSource = service.GetStudentConsult(lblStudentID.Text); ConsultGrid.ClearSelection(); service.Dispose(); }