private void btnTest_Click(object sender, EventArgs e) { string check = "-"; int notiIndex = -1; for (int i = 0; i < dataGridView1.RowCount; i++) { check = dataGridView1.Rows[i].Cells[3].Value.ToString(); if (check == "게시중") { notiIndex = i; break; } } if (notiIndex < 0) { MessageBox.Show("게시중인 공지가 존재하지 않습니다."); return; } FormNotify sub = new FormNotify(); sub.lblSubject.Text = dataGridView1.Rows[notiIndex].Cells[1].Value.ToString(); sub.tbContents.Text = dataGridView1.Rows[notiIndex].Cells[2].Value.ToString(); sub.ckbToday.Enabled = false; sub.ShowDialog(); }
//공지사항 private void Notify() { MariaCRUD m = new MariaCRUD(); string sql = @"select subject, contents from tb_sys_notify where noti_flag = 1 order by noti_dt desc limit 1"; string msg = string.Empty; DataTable table = m.dbDataTable(sql, ref msg); if (msg != "OK") { return; } DataRow[] row = table.Select(); if (row.Length > 0) { string curDT = string.Empty; if (ReadRegistry(ref curDT)) { if (curDT == DateTime.Today.ToString("yyyy-MM-dd")) { return; } } FormNotify sub = new FormNotify(); sub.lblSubject.Text = row[0][0].ToString(); sub.tbContents.Text = row[0][1].ToString(); sub.ShowDialog(); } }