public void UpdateSponsorSimple1(SponsorListCodeCampYearResult sponsorListCodeCampYearResult) { var meta = new CodeCampDataContext(); var rec = (from data in meta.SponsorListCodeCampYear where data.Id == sponsorListCodeCampYearResult.Id select data).First(); if (rec != null) { rec.TableRequired = sponsorListCodeCampYearResult.TableRequired; rec.AttendeeBagItem = sponsorListCodeCampYearResult.AttendeeBagItem; rec.ItemSentToFoothill = sponsorListCodeCampYearResult.ItemSentToFoothill; rec.ItemsShippingDescription = sponsorListCodeCampYearResult.ItemsShippingDescription; rec.NoteFromCodeCamp = sponsorListCodeCampYearResult.NoteFromCodeCamp; rec.Comments = sponsorListCodeCampYearResult.Comments; meta.SubmitChanges(); } }
// public override void Insert(LoadResult result) // { // base.Insert(result); // if (result.Cargos != null && result.Cargos.Count > 0) // { // foreach (CargoResult c in result.Cargos) // { // c.LoadId = result.Id; // CargoManager.I.Insert(c); // } // } // } // // public override void Update(LoadResult result) // { // base.Update(result); // if (result.Cargos != null && result.Cargos.Count > 0) // { // CargoManager.I.Update(result.Cargos); // } // } public void Upsert(AttendeesCodeCampYearResult result) { var meta = new CodeCampDataContext(); var attendeesCodeCampYear = (from data in meta.AttendeesCodeCampYear where data.CodeCampYearId == result.CodeCampYearId && data.AttendeesId == result.AttendeesId select data).SingleOrDefault(); if (attendeesCodeCampYear != null) { attendeesCodeCampYear.AttendSaturday = result.AttendSaturday; attendeesCodeCampYear.AttendSunday = result.AttendSunday; } else { attendeesCodeCampYear = new AttendeesCodeCampYear() { AttendeesId = result.AttendeesId, CodeCampYearId = result.CodeCampYearId, AttendSaturday = result.AttendSaturday, AttendSunday = result.AttendSunday }; meta.AttendeesCodeCampYear.InsertOnSubmit(attendeesCodeCampYear); } meta.SubmitChanges(); }