Ejemplo n.º 1
0
        public string Delete_KhenThuong(Cls_KhenThuong kt)
        {
            string strMessage = string.Empty;
            using (SqlConnection conn = new SqlConnection(strConnection))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("delete Tb_KhenThuong where MaLoai=@MALOAI", conn);
                cmd.Parameters.AddWithValue("@MALOAI", kt.maloai);

                int result = cmd.ExecuteNonQuery();
                if (result == 1)
                {
                    strMessage = kt.maloai + " đã delete thành công!";
                }
                else
                {
                    strMessage = kt.maloai + " delete không thành công!";
                }
                conn.Close();
            }
            return strMessage;
        }
Ejemplo n.º 2
0
        public string Add_KhenThuong(Cls_KhenThuong kt)
        {
            string strMessage = string.Empty;
            using (SqlConnection conn = new SqlConnection(strConnection))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("insert into Tb_KhenThuong (MaLoai,TenLoai) values(@MALOAI,@TENLOAI)", conn);
                cmd.CommandType = CommandType.Text;
                cmd.Parameters.AddWithValue("@MALOAI", kt.maloai);
                cmd.Parameters.AddWithValue("@TENLOAI", kt.tenloai);

                int result = cmd.ExecuteNonQuery();
                if (result == 1)
                {
                    strMessage = kt.maloai + " đã thêm thành công!";
                }
                else
                {
                    strMessage = kt.maloai + " đã thêm không thành công!";
                }
                conn.Close();
            }
            return strMessage;
        }