Exemple #1
0
        public string deleteAll(childDeleteAll use)
        {
            string response = "";

            SqlConnection con = new SqlConnection(data);
            SqlCommand    cmd = new SqlCommand("DELETE FROM CourseChild WHERE parentId = @parentId", con);

            cmd.Parameters.AddWithValue("@parentId", use.parentId);

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

            try
            {
                childReference.childDeleteAll del = new childReference.childDeleteAll();
                del.parentId = use.parentId;
                del.user     = use.user;
                IchildClient child = new IchildClient();
                response = child.deleteAll(del);
            }
            catch (Exception ex)
            {
                response = ex.ToString();
            }

            return(response);
        }