public void LoadBackup(AssessTrackModelClassesDataContext dataContext, string filename) { using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required,TimeSpan.MaxValue)) { try { XElement root = XElement.Load(filename); //Deserialize and insert the backup items dataContext.Log = new StreamWriter(@"C:\inetpub\wwwroot\HNK\linqlog.txt"); foreach (XElement item in root.Elements()) { IBackupItem importedItem = BackupItemFactory.CreateBackupItem(item.Name.ToString()); importedItem.Deserialize(item); importedItem.Insert(dataContext); items.Add(importedItem); } dataContext.SubmitChanges(); transaction.Complete(); } catch (RuleViolationException rve) { throw; } catch (SqlException sqlEx) { throw; } } }
public void Insert(AssessTrackModelClassesDataContext dc) { MembershipCreateStatus status; Membership.CreateUser(Username, Password, Email, "question", "answer", true, MembershipID, out status); if (status == MembershipCreateStatus.DuplicateUserName) { Username = Username + "-old"; Membership.CreateUser(Username, Password, Email, "question", "answer", true, MembershipID, out status); } if (status != MembershipCreateStatus.Success) throw new Exception("Failed to create user " + Username + "."); }
public List<Response> GetFullResponseList(Guid? AnswerID) { if (AnswerID == null) throw new ArgumentNullException("AnswerID"); AssessTrackModelClassesDataContext dc = new AssessTrackModelClassesDataContext(); DataLoadOptions options = new DataLoadOptions(); options.LoadWith<Answer>(answer => answer.Responses); options.LoadWith<Answer>(answer => answer.Question); options.LoadWith<Response>(response => response.SubmissionRecord); options.LoadWith<SubmissionRecord>(submission => submission.Profile); options.LoadWith<SubmissionRecord>(submission => submission.Assessment); dc.LoadOptions = options; Answer _answer = (from ans in dc.Answers where ans.AnswerID == AnswerID.Value select ans).First(); return _answer.Responses.ToList(); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.Questions.InsertOnSubmit(this); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.CourseTermMembers.InsertOnSubmit(this); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.Profiles.InsertOnSubmit(this); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.sp_AddAssessmentTag(TagID, AssessmentID); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.SubmissionRecords.InsertOnSubmit(this); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.sp_AddQuestionTag(TagID, QuestionID); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.AssessmentTypes.InsertOnSubmit(this); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.AnswerKeys.InsertOnSubmit(this); }
public void Insert(AssessTrackModelClassesDataContext dc) { dc.sp_AddAnswerTag(TagID, AnswerID); }