Beispiel #1
0
        private void textBox8_TextChanged(object sender, EventArgs e)
        {
            NhanvienDataContext db = new NhanvienDataContext();
            var q = db.NHANVIENs.Where(p => p.HOTEN.Contains(textBox8.Text)).Select(p => new { p.MANV, p.HOTEN, p.NGAYSINH, p.DIACHI, p.DIENTHOAI, p.HSLUONG, p.MADONVI });

            dataGridView1.DataSource = q;
        }
Beispiel #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            NhanvienDataContext db = new NhanvienDataContext();
            var q = db.NHANVIENs.Select(p => new { p.MANV, p.HOTEN, p.NGAYSINH, p.DIACHI, p.DIENTHOAI, p.HSLUONG, p.MADONVI }).OrderByDescending(p => p.HOTEN);

            dataGridView1.DataSource = q;
        }
Beispiel #3
0
        private void button3_Click(object sender, EventArgs e)
        {
            int dongchon           = dataGridView1.CurrentCell.RowIndex;
            NhanvienDataContext db = new NhanvienDataContext();
            NHANVIEN            q  = db.NHANVIENs.Single(p => Convert.ToString(p.MANV) == dataGridView1.Rows[dongchon].Cells["MANV"].Value.ToString());

            db.NHANVIENs.DeleteOnSubmit(q);
            db.SubmitChanges();
            load();
        }
Beispiel #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            NhanvienDataContext db = new NhanvienDataContext();
            var q   = db.NHANVIENs.Select(p => new { p.MANV, p.HOTEN, p.NGAYSINH, p.DIACHI, p.DIENTHOAI, p.HSLUONG, p.MADONVI, LUONG = p.HSLUONG * 1490000 });
            var sum = db.NHANVIENs.Sum(p => p.HSLUONG * 1490000);
            var c   = db.DONVIs.Select(k => new { k.MADONVI });

            dataGridView1.DataSource = q;
            comboBox1.ValueMember    = "MADONVI";
            comboBox1.DataSource     = c;
            textBox7.Text            = sum.ToString();
        }
Beispiel #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            int dongchon           = dataGridView1.CurrentCell.RowIndex;
            NhanvienDataContext db = new NhanvienDataContext();
            NHANVIEN            q  = db.NHANVIENs.Single(p => p.MANV == Convert.ToInt32(textBox1.Text));

            q.MANV      = Convert.ToInt32(textBox1.Text);
            q.HOTEN     = textBox2.Text;
            q.NGAYSINH  = textBox3.Text;
            q.DIACHI    = textBox4.Text;
            q.DIENTHOAI = textBox5.Text;
            q.HSLUONG   = Convert.ToDouble(textBox6.Text);
            q.MADONVI   = Convert.ToInt32(comboBox1.Text);
            db.SubmitChanges();
            load();
        }
Beispiel #6
0
        private void button1_Click(object sender, EventArgs e)
        {
            NhanvienDataContext db = new NhanvienDataContext();
            NHANVIEN            dv = new NHANVIEN();

            dv.MANV      = Convert.ToInt32(textBox1.Text);
            dv.HOTEN     = textBox2.Text;
            dv.NGAYSINH  = textBox3.Text;
            dv.DIACHI    = textBox4.Text;
            dv.DIENTHOAI = textBox5.Text;
            dv.HSLUONG   = Convert.ToDouble(textBox6.Text);
            dv.MADONVI   = Convert.ToInt32(comboBox1.Text);
            db.NHANVIENs.InsertOnSubmit(dv);
            db.SubmitChanges();
            load();
        }