Ejemplo n.º 1
0
        private void bttnTeacherSend_Click(object sender, EventArgs e)
        {
            if (tNoticeSubtxt.Text != "")
            {
                if (bttnTeacherSend.Text == "Update")
                {
                    string sub = tNoticeSubtxt.Text;
                    notice.DeleteNotice(sub);
                    bttnTeacherSend.Text = "Send";
                }
                DateTime thisDay           = DateTime.Today;
                string   dateOnly          = thisDay.ToString("g");
                string   noticeSub         = tNoticeSubtxt.Text;
                string   NoticeDescription = txtTDescription.Text;
                string   sendTo            = "Student";


                teacherDataAccess.SetTeacherNotice("Teacher", sendTo, dateOnly, "Teacher", noticeSub, NoticeDescription);
                dataGridView1.DataSource = teacherDataAccess.getNoticeList();
            }
            else
            {
                MessageBox.Show("Fill Rquired Box");
            }
        }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 0)
            {
                comboBox1.SelectedItem   = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
                adminNoticeSubtxt.Text   = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();
                txtAdminDescription.Text = dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString();

                bttnAdminSend.Text = "Update";
                //new frmUpdateNoticeAdmin().Show();
            }
            else if (e.ColumnIndex == 1)
            {
                string noticeSub = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();
                noticeDataAccess.DeleteNotice(noticeSub);
                dataGridView1.Rows.RemoveAt(e.RowIndex);
            }
        }