Beispiel #1
0
        private void button_Notice_Click(object sender, EventArgs e)
        {
            Page0_Notice.BringToFront();

            MySqlConnection myConnection = new MySqlConnection(connectionString);

            myConnection.Open();

            NoticeInfoDAC dac = new NoticeInfoDAC(myConnection);

            dac.SelectTimeASC();

            NoticeGrid.DataSource = dac.SelectTimeASC().Tables["Notice"];
            NoticeGrid.Columns[0].MinimumWidth = 80;
            NoticeGrid.Columns[1].MinimumWidth = 180;
            NoticeGrid.Columns[2].MinimumWidth = NoticeGrid.Width - 345;
        }   //공지사항
Beispiel #2
0
        }   // O

        private void NoticeSend_Click(object sender, EventArgs e)
        {
            MySqlConnection myConnection = null;

            try
            {
                NoticeInfo item = new NoticeInfo();
                item.공지사항 = NoticeNote.Text;
                item.날짜   = DateTime.Now;
                item.작성ID = User.Text;

                myConnection = new MySqlConnection(connectionString);

                myConnection.Open();

                NoticeInfoDAC dac = new NoticeInfoDAC(myConnection);
                dac.Insert(item);

                NoticeGrid.DataSource = dac.SelectTimeASC().Tables["Notice"];
                NoticeGrid.Columns[0].MinimumWidth = 80;
                NoticeGrid.Columns[1].MinimumWidth = 180;
                NoticeGrid.Columns[2].MinimumWidth = NoticeGrid.Width - 345;

                myConnection.Close();
            }
            catch (MySqlException)
            {
                MessageBox.Show("공지사항을 입력해주세요.");
            }
            finally
            {
                if (myConnection != null && myConnection.State == System.Data.ConnectionState.Open)
                {
                    myConnection.Close();
                }
            }
            NoticeNote.Clear();
        }                                                              // O