コード例 #1
0
        public string deleteString(string courseId, string user)
        {
            if (courseId == null || courseId.Length <= 0)
            {
                return("courseIdNull");
            }
            if (user == null || user.Length <= 0)
            {
                return("userNull");
            }
            string response = "";

            try
            {
                courseDelete del = new courseDelete();
                del.courseId = new Guid(courseId);
                del.user     = new Guid(user);
                response     = delete(del);
            }
            catch
            {
                response = "Error";
            }

            return(response);
        }
コード例 #2
0
        public string delete(courseDelete use)
        {
            SqlConnection con = new SqlConnection(data);
            SqlCommand    cmd = new SqlCommand("DELETE FROM courseData WHERE courseId = @courseId", con);

            cmd.Parameters.AddWithValue("@courseId", use.courseId);
            string response = "Success";

            con.Open();
            try
            {
                cmd.ExecuteNonQuery();
            }
            catch (SqlException ex)
            {
                response = ex.ToString();
                con.Close();
                return(response);
            }
            con.Close();

            try
            {
                parentDeleteAll pare = new parentDeleteAll();
                pare.courseId = use.courseId;
                pare.user     = use.user;
                IparentClient client = new IparentClient();
                response = client.deleteAll(pare);
            }
            catch (Exception ex)
            {
                response = ex.ToString();
            }

            return(response);
        }