public static void AddRecord(DateTime _date, Guid _userId, int _siteId, int _chartId) { PCMSofCCDataContext db = new PCMSofCCDataContext(); var newRecord = new Record { Date = _date.Date, UserId = _userId, SiteId = _siteId, ChartId = _chartId }; db.Record.InsertOnSubmit(newRecord); var entries = from belong in db.EntryBelongToChart where belong.ChartId == _chartId select belong.ScoreEntry; foreach (var entry in entries) { var newRecordEntry = new RecordEntry { Record = newRecord, ScoreEntry = entry, }; db.RecordEntry.InsertOnSubmit(newRecordEntry); } db.SubmitChanges(); }
partial void DeleteRecordEntry(RecordEntry instance);
partial void UpdateRecordEntry(RecordEntry instance);
partial void InsertRecordEntry(RecordEntry instance);
private void detach_RecordEntry(RecordEntry entity) { this.SendPropertyChanging(); entity.ScoreEntry = null; }
private void attach_RecordEntry(RecordEntry entity) { this.SendPropertyChanging(); entity.Record = this; }