Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            int tongluong = 0;

            if (tbxluong.Text == null || numericUpDownsogio.Value == 0)
            {
                MessageBox.Show("Bạn chưa chọn nhân viên để tính lương");
            }
            else
            {
                tongluong = int.Parse(tbxluong.Text) * (int)numericUpDownsogio.Value;
            }
            tbxtongluong.Text = tongluong.ToString();
            TBL_TINHLUONG_1 a = new TBL_TINHLUONG_1();

            a.MANV     = tbxmanhanvien.Text;
            a.LUONG    = int.Parse(tbxtongluong.Text);
            a.NGAYNHAN = dateTimePicker1.Value;
            a.CHUCVU   = tbxchucvu.Text;
            Table <TBL_TINHLUONG_1> b = db.GetTable <TBL_TINHLUONG_1>();

            b.InsertOnSubmit(a);
            db.SubmitChanges();
            loaddatagridview();
        }
Пример #2
0
        private void adddatagridview()
        {
            Table <TBL_TINHLUONG_1> tbtinhluong = db.GetTable <TBL_TINHLUONG_1>();
            TBL_TINHLUONG_1         a           = new TBL_TINHLUONG_1();

            a.MANV     = tbxmanhanvien.Text;
            a.CHUCVU   = tbxchucvu.Text;
            a.LUONG    = int.Parse(tbxluong.Text);
            a.NGAYNHAN = dateTimePicker1.Value;
            tbtinhluong.InsertOnSubmit(a);
            db.SubmitChanges();
        }
Пример #3
0
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0 && e.ColumnIndex <= 4)
     {
         if (e.ColumnIndex == 5)
         {
             TBL_TINHLUONG_1 a = new TBL_TINHLUONG_1();
             a       = db.TBL_TINHLUONG_1s.Single(p => p.MANV.Equals(dataGridView1.Rows[e.RowIndex].Cells[1]));
             a.LUONG = int.Parse(tbxluong.Text);
             db.SubmitChanges();
             loaddatagridview();
         }
         else
         if (e.ColumnIndex == 6)
         {
             TBL_TINHLUONG_1 a = new TBL_TINHLUONG_1();
             a = db.TBL_TINHLUONG_1s.Single(p => p.MANV.Equals(dataGridView1.Rows[e.RowIndex].Cells[1]));
             db.TBL_TINHLUONG_1s.DeleteOnSubmit(a);
             db.SubmitChanges();
             MessageBox.Show("Xóa thành công");
             loaddatagridview();
         }
     }
 }
 partial void DeleteTBL_TINHLUONG_1(TBL_TINHLUONG_1 instance);
 partial void UpdateTBL_TINHLUONG_1(TBL_TINHLUONG_1 instance);
 partial void InsertTBL_TINHLUONG_1(TBL_TINHLUONG_1 instance);