Ejemplo n.º 1
0
        private void btnTongLuong_Click(object sender, EventArgs e)
        {
            Luong temp = new Luong(txtMaNV.Text, txtLuong.Text, txtLuongThuong.Text, txtGhichu.Text, txtSNTC.Text, txtTongLuong.Text);

            ConnectDatabase.TongLuong_NV(temp);
            dgvLuong_CaNhan.DataSource = ConnectDatabase.GetAllLuong_NV();
        }
        public static void SuaLuong_PhongBan(Luong l, ChucVu cv, NhanVien nv)
        {
            //string sql = "UPDATE LUONG set Luong = @luong, LuongThuong=@luongthuong, GhiChu=@ghichu where MaNV=@manv";

            //using (SqlCommand command = new SqlCommand(sql, conn))
            //{
            //    command.Parameters.Add(new SqlParameter("@tencv", cv.Tencv));
            //    command.Parameters.Add(new SqlParameter("@macv", cv.Macv));
            //    command.ExecuteNonQuery();
            //    command.Cancel();
            //}
        }
        public static void TongLuong_NV(Luong luong)
        {
            string sql = "update LUONG set TongLuong = SoNgayTangCa * 50000 + LuongCB + LuongThuong where MaNV = @Manv";

            using (SqlCommand command = new SqlCommand(sql, conn))
            {
                command.Parameters.Add(new SqlParameter("@luongCB", luong.LuongNV1));
                command.Parameters.Add(new SqlParameter("@luongthuong", luong.LuongThuong1));
                command.Parameters.Add(new SqlParameter("@ghichu", luong.Chichu1));
                command.Parameters.Add(new SqlParameter("@SNTC", luong.SoNgayTangCa1));
                command.Parameters.Add(new SqlParameter("@TongLuong", luong.TongLuong1));
                command.Parameters.Add(new SqlParameter("@manv", luong.MaNV1));
                command.ExecuteNonQuery();
                command.Cancel();
            }
        }
        public static void SuaLuong_PB(Luong luong)
        {
            string sql = "UPDATE LUONG set LuongCB=@luongCB, LuongThuong=@luongthuong, GhiChu=@ghichu, SoNgayTangCa = @SNTC, TongLuong = @TongLuong where MaNV=@manv";

            using (SqlCommand command = new SqlCommand(sql, conn))
            {
                command.Parameters.Add(new SqlParameter("@luongCB", luong.LuongNV1));
                command.Parameters.Add(new SqlParameter("@luongthuong", luong.LuongThuong1));
                command.Parameters.Add(new SqlParameter("@ghichu", luong.Chichu1));
                command.Parameters.Add(new SqlParameter("@SNTC", luong.SoNgayTangCa1));
                command.Parameters.Add(new SqlParameter("@TongLuong", luong.TongLuong1));
                command.Parameters.Add(new SqlParameter("@manv", luong.MaNV1));
                command.ExecuteNonQuery();
                command.Cancel();
            }
        }