Exemplo n.º 1
0
        private void button4_Click(object sender, EventArgs e)
        {
            QLNvDBDataContext db = new QLNvDBDataContext();
            var q = db.DONVIs.Select(p => new { p.MADONVI, p.TENDONVI, p.DIENTHOAI }).OrderByDescending(p => p.TENDONVI);

            dataGridView1.DataSource = q;
        }
Exemplo n.º 2
0
        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            QLNvDBDataContext db = new QLNvDBDataContext();
            var q = db.DONVIs.Where(p => p.TENDONVI.Contains(textBox3.Text)).Select(p => new { p.MADONVI, p.TENDONVI, p.DIENTHOAI });

            dataGridView1.DataSource = q;
        }
Exemplo n.º 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            QLNvDBDataContext db = new QLNvDBDataContext();
            var q = db.DONVIs.Select(p => new { p.MADONVI, p.TENDONVI, p.DIENTHOAI });

            dataGridView1.DataSource = q;
        }
Exemplo n.º 4
0
        public void load()
        {
            QLNvDBDataContext db = new QLNvDBDataContext();
            var q = db.DONVIs.Select(p => new { p.MADONVI, p.TENDONVI, p.DIENTHOAI });

            dataGridView1.DataSource = q;
        }
Exemplo n.º 5
0
        private void button2_Click(object sender, EventArgs e)
        {
            int dongchon         = dataGridView1.CurrentCell.RowIndex;
            QLNvDBDataContext db = new QLNvDBDataContext();
            DONVI             q  = db.DONVIs.Single(p => Convert.ToString(p.MADONVI) == dataGridView1.Rows[dongchon].Cells["MADONVI"].Value.ToString());

            db.DONVIs.DeleteOnSubmit(q);
            db.SubmitChanges();
            load();
        }
Exemplo n.º 6
0
        private void button6_Click(object sender, EventArgs e)
        {
            int dongchon         = dataGridView1.CurrentCell.RowIndex;
            QLNvDBDataContext db = new QLNvDBDataContext();
            DONVI             q  = db.DONVIs.Single(p => Convert.ToString(p.MADONVI) == dataGridView1.Rows[dongchon].Cells["MADONVI"].Value.ToString());

            q.MADONVI   = Convert.ToInt32(textBox1.Text);
            q.TENDONVI  = textBox2.Text;
            q.DIENTHOAI = textBox4.Text;
            db.SubmitChanges();
            load();
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            QLNvDBDataContext db = new QLNvDBDataContext();
            DONVI             dv = new DONVI();

            dv.MADONVI   = Convert.ToInt32(textBox1.Text);
            dv.TENDONVI  = textBox2.Text;
            dv.DIENTHOAI = textBox4.Text;
            db.DONVIs.InsertOnSubmit(dv);
            db.SubmitChanges();
            load();
        }