コード例 #1
0
        private void xoaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MonHoc mh = new MonHoc();

            string mamh = dataGridView1.CurrentRow.Cells[0].Value.ToString();

            mh = db.MonHocs.Where(t => t.MaMonHoc == mamh).FirstOrDefault();

            db.MonHocs.DeleteOnSubmit(mh);

            db.SubmitChanges();

            var monhocss = from mh1 in db.MonHocs select mh1;

            dataGridView1.DataSource = monhocss;
        }
コード例 #2
0
        private void themToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (txtMaMonHoc.Text == "" || txtTenMonHoc.Text == "")
            {
                MessageBox.Show("Bạn chua nhạp đủ");
            }
            MonHoc mh = new MonHoc();

            mh.MaMonHoc  = txtMaMonHoc.Text;
            mh.TenMonHoc = txtTenMonHoc.Text;

            db.MonHocs.InsertOnSubmit(mh);
            db.SubmitChanges();
            var monhocss = from mh1 in db.MonHocs select mh1;

            dataGridView1.DataSource = monhocss;
        }
コード例 #3
0
        private void suaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MonHoc mh = new MonHoc();

            string mamh = dataGridView1.CurrentRow.Cells[0].Value.ToString();

            mh = db.MonHocs.Where(t => t.MaMonHoc == mamh).FirstOrDefault();
            if (mh != null)
            {
                mh.MaMonHoc  = txtMaMonHoc.Text;
                mh.TenMonHoc = txtTenMonHoc.Text;

                db.SubmitChanges();
            }
            else
            {
                MessageBox.Show("Khong ton tai");
            }


            var monhocss = from mh1 in db.MonHocs select mh1;

            dataGridView1.DataSource = monhocss;
        }
コード例 #4
0
 partial void DeleteMonHoc(MonHoc instance);
コード例 #5
0
 partial void UpdateMonHoc(MonHoc instance);
コード例 #6
0
 partial void InsertMonHoc(MonHoc instance);