Example #1
0
        public string Delete_PhanQuyen(Cls_PhanQuyen pq)
        {
            string strMessage = string.Empty;
            using (SqlConnection conn = new SqlConnection(strConnection))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("delete Tb_PhanQuyen where MaPQ=@MAPQ", conn);
                cmd.Parameters.AddWithValue("@MAPQ", pq.mapq);

                int result = cmd.ExecuteNonQuery();
                if (result == 1)
                {
                    strMessage = pq.mapq + " đã delete thành công!";
                }
                else
                {
                    strMessage = pq.mapq + " delete không thành công!";
                }
                conn.Close();
            }
            return strMessage;
        }
Example #2
0
        public string Add_PhanQuyen(Cls_PhanQuyen pq)
        {
            string strMessage = string.Empty;
            using (SqlConnection conn = new SqlConnection(strConnection))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand("insert into Tb_PhanQuyen (MaPQ,TenPQ) values(@MAPQ,@TENPQ)", conn);
                cmd.Parameters.AddWithValue("@MAPQ", pq.mapq);
                cmd.Parameters.AddWithValue("@TENPQ", pq.tenpq);

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