//==================================================================================// // Remove Prospect Student Transcript. // // // // Removes the prospective student transcript if it is not empty. // //==================================================================================// public static bool RemoveTranscript(int UserId) { try { using (ITintheDTestTableEntities context = new ITintheDTestTableEntities()) { // Put everything we find in the database in the var variable. All the // information will be gotten using the User ID. var UserTranscript = from r in context.ProspectiveStudentTranscripts where r.UserId == UserId select r; // If the user has a transcript then update it. // Otherwise make a new row in the database. if (UserTranscript.Count() > 0 && UserId > 0) { context.DeleteObject(UserTranscript.FirstOrDefault()); } else { return false; } try { context.SaveChanges(); return true; } catch (Exception e) { return false; } } } catch (Exception ex) { string exMessage = ex.Message; return false; } }
//==================================================================================// // Remove Sponsor information // // // // Removes the sponsor information if it is not empty. // // // // Note: If the User ID is -1 then it is being checked out by the user. // // If not then it is being checked by the admin. // //==================================================================================// public static bool RemoveSponsorData(int UserId) { try { using (ITintheDTestTableEntities context = new ITintheDTestTableEntities()) { // Put everything we find in the database in the var variable. All the // information will be gotten using the User ID. var SponsorData = from r in context.ProspectiveCorporateSponsor where r.SponsorId == UserId select r; // If the user has some information then remove it. // Otherwise return false. if (SponsorData.Count() > 0 && UserId > 0) { context.DeleteObject(SponsorData.FirstOrDefault()); } else { return false; } try { context.SaveChanges(); return true; } catch (Exception e) { return false; } } } catch (Exception ex) { string exMessage = ex.Message; return false; } }