private void LoadCompetitionData() { CompetitionInfoService dac = new CompetitionInfoService(); DataTable dt1 = dac.GetAll(); CompetitionGrid.DataSource = dt1; dac.Dispose(); }
private void LoadAwardData() { CompetitionInfoService dac = new CompetitionInfoService(); dt = dac.GetAwardByStudent(lblStudentID.Text); AwardGrid.DataSource = dt; dac.Dispose(); this.bindingSource1.DataSource = dt; }
//네비게이터의 저장버튼 private void ToolStripButton1_Click(object sender, EventArgs e) { if (AwardGrid.Rows.Count == 0) { if (string.IsNullOrEmpty(txtAwarddetails.Text) && AwardGrid.Rows.Count > 0) { MaterialMessageBox.Show("수상내역을 입력해주세요.", "경고", MessageBoxButtons.OK); return; } } CompetitionInfoService service = new CompetitionInfoService(); try { DataRow[] insRows = dt.Select(null, null, DataViewRowState.Added); foreach (DataRow dr in insRows) { CompetitionInfoVO item = SetInsertAwardInfoVo(dr); service.Insert(item, lblStudentID.Text); } DataRow[] upsRows = dt.Select(null, null, DataViewRowState.ModifiedCurrent); foreach (DataRow dr in upsRows) { CompetitionInfoVO item = SetAwardInfoVo(dr); service.Update(item, lblStudentID.Text); } DataRow[] delRows = dt.Select(null, null, DataViewRowState.Deleted); foreach (DataRow dr in delRows) { CompetitionInfoVO item = SetDelAwardInfoVo(dr); service.Delete(item, lblStudentID.Text); } MaterialMessageBox.Show("저장완료", "확인", MessageBoxButtons.OK); } catch (InvalidCastException) { MaterialMessageBox.Show("항목을 입력해주세요", "경고", MessageBoxButtons.OK); } catch (Exception err) { MaterialMessageBox.Show(err.Message, "경고", MessageBoxButtons.OK); } finally { service.Dispose(); } }
private void LoadAwardList() { AwardGrid.AutoGenerateColumns = false; AwardGrid.AllowUserToAddRows = false; AwardGrid.SelectionMode = DataGridViewSelectionMode.FullRowSelect; AwardGrid.RowHeadersWidth = 15; AwardGrid.ColumnHeadersHeight = 30; AwardGrid.ColumnHeadersDefaultCellStyle.Font = new Font("Segoe UI", 11.5F); AwardGrid.RowsDefaultCellStyle.Font = new Font("Segoe UI", 9.5F); UtilityClass.AddNewColumnToDataGridView(AwardGrid, "수상코드", "award_id", false, 30); UtilityClass.AddNewColumnToDataGridView(AwardGrid, "대회코드", "competition_id", false, 30); UtilityClass.AddNewColumnToDataGridView(AwardGrid, "대회이름", "comp_name", true, 150); UtilityClass.AddNewColumnToDataGridView(AwardGrid, "대회설명", "comp_details", true, 180); UtilityClass.AddNewColumnToDataGridView(AwardGrid, "수상내역", "award_details", true, 110); UtilityClass.AddNewColumnToDataGridView(AwardGrid, "날짜", "comp_date", true, 90); UtilityClass.AddNewColumnToDataGridView(AwardGrid, "주최", "comp_host", true, 110); CompetitionInfoService dac = new CompetitionInfoService(); DataTable dt = dac.GetAwardByStudent(lblStudentID.Text); AwardGrid.DataSource = dt; AwardGrid.ClearSelection(); dac.Dispose(); }