public void Update(DonorGivingModel donorGiving) { if (!UpdateDatabase) { var target = One(e => e.DonorGivingID == donorGiving.DonorGivingID); if (target != null) { target.DonorGivingID = donorGiving.DonorGivingID; target.DonorID = donorGiving.DonorID; target.AmountGiven = donorGiving.AmountGiven; target.DateGiven = donorGiving.DateGiven; target.InKind = donorGiving.InKind; target.IsDeleted = donorGiving.IsDeleted; } } else { var entity = new DonorGiving(); entity.DonorGivingID = donorGiving.DonorGivingID; entity.DonorID = donorGiving.DonorID; entity.AmountGiven = donorGiving.AmountGiven; entity.DateGiven = donorGiving.DateGiven; entity.InKind = donorGiving.InKind; entity.IsDeleted = donorGiving.IsDeleted; entities.DonorGivings.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); } }
public void Update(StudentModel student, string userId) { if (!UpdateDatabase) { var target = One(e => e.StudentID == student.StudentID); if (target != null) { target.StudentID = student.StudentID; target.CodeName = student.CodeName.ToUpper(); target.Grade = student.Grade; target.HomeLanguageID = student.HomeLanguageID; target.HomeLanguageOther = student.HomeLanguageOther; target.HasInternet = student.HasInternet; target.SchoolID = student.SchoolID; target.ReferredTypeID = student.ReferredTypeID; target.IsDeleted = student.IsDeleted; target.GuardianContactPhone = student.GuardianContactPhone; target.GuardianContactEmail = student.GuardianContactEmail; target.StudentContactPhone = student.StudentContactPhone; target.StudentFirstName = student.StudentFirstName; target.StudentLastName = student.StudentLastName; target.CreateDate = student.CreateDate; target.CreateBy = student.CreateBy; target.ModifiedDate = DateTime.Now; target.ModifiedBy = userId; target.StudentOptOut = student.StudentOptOut; target.GuardianOptOut = student.GuardianOptOut; } } else { var entity = new Student(); entity.StudentID = student.StudentID; entity.CodeName = student.CodeName; entity.Grade = student.Grade; entity.HomeLanguageID = student.HomeLanguageID; entity.HomeLanguageOther = student.HomeLanguageOther; entity.HasInternet = student.HasInternet; entity.SchoolID = student.SchoolID; entity.ReferredTypeID = student.ReferredTypeID; entity.IsDeleted = student.IsDeleted; entity.GuardianContactNumber = student.GuardianContactPhone; entity.GuardianContactEmail = student.GuardianContactEmail; entity.StudentContactNumber = student.StudentContactPhone; entity.StudentFirstName = student.StudentFirstName; entity.StudentLastName = student.StudentLastName; entity.CreateDate = student.CreateDate; entity.CreateBy = student.CreateBy; entity.ModifiedDate = DateTime.Now; entity.ModifiedBy = userId; entity.StudentOptOut = student.StudentOptOut; entity.GuardianOptOut = student.GuardianOptOut; entities.Students.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); } }
public void Update(DonorModel donor) { if (!UpdateDatabase) { var target = One(e => e.DonorID == donor.DonorID); if (target != null) { target.DonorID = donor.DonorID; target.DonorName = donor.DonorName; target.Amount = donor.Amount; target.Phone = donor.Phone; target.CreateDate = donor.CreateDate; target.Address1 = donor.Address1; target.Address2 = donor.Address2; target.City = donor.City; target.DonorState = donor.DonorState; target.Zip = donor.Zip; target.BusinessName = donor.BusinessName; target.FirstName = donor.FirstName; target.LastName = donor.LastName; target.Title = donor.Title; target.Notes = donor.Notes; target.Email = donor.Email; } } else { var entity = new Donor(); entity.DonorID = donor.DonorID; entity.DonorName = donor.DonorName; entity.Amount = donor.Amount; entity.Phone = donor.Phone; entity.CreateDate = donor.CreateDate; entity.Address1 = donor.Address1; entity.Address2 = donor.Address2; entity.City = donor.City; entity.State = donor.DonorState; entity.Zip = donor.Zip; entity.BusinessName = donor.BusinessName; entity.FirstName = donor.FirstName; entity.LastName = donor.LastName; entity.Title = donor.Title; entity.Notes = donor.Notes; entity.Email = donor.Email; entities.Donors.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); } }
public void Destroy(TimeEntryModel timeEntry) { if (!UpdateDatabase) { var target = GetAll().FirstOrDefault(p => p.TimeEntryID == timeEntry.TimeEntryID); if (target != null) { GetAll().Remove(target); } } else { var target = (from s in entities.TimeEntries where s.TimeEntryID == timeEntry.TimeEntryID select s).FirstOrDefault(); if (target != null) { target.IsDeleted = true; entities.Entry(target).State = System.Data.Entity.EntityState.Modified; entities.SaveChanges(); } } }
public void Update(SchoolModel school, string userId) { if (!UpdateDatabase) { var target = One(e => e.SchoolID == school.SchoolID); if (target != null) { target.SchoolID = school.SchoolID; target.SchoolName = school.SchoolName; target.SchoolTypeID = school.SchoolTypeID; target.Address1 = school.Address1; target.Address2 = school.Address2; target.City = school.City; target.State = school.State; target.Zip = school.Zip; target.CountyID = school.CountyID; target.Phone = school.Phone; target.PrincipalName = school.PrincipalName; target.PrincipalEmail = school.PrincipalEmail; target.PEDS = school.PEDS; target.Census = school.Census; target.PredictedThirdGradeStudents = school.PredictedThirdGradeStudents; target.SchoolBoardDistrict = school.SchoolBoardDistrict; target.CityCouncilDistrict = school.CityCouncilDistrict; target.SonicPartner = school.SonicPartner; target.TitleOneSchool = school.TitleOneSchool; target.AppalachianRegion = school.AppalachianRegion; target.IsDeleted = school.IsDeleted; target.QuadrantID = school.QuadrantID; target.CreateDate = school.CreateDate; target.CreateBy = school.CreateBy; target.ModifiedDate = DateTime.Now; target.ModifiedBy = userId; } } else { var entity = new School(); entity.SchoolID = school.SchoolID; entity.SchoolName = school.SchoolName; entity.SchoolTypeID = school.SchoolTypeID; entity.Address1 = school.Address1; entity.Address2 = school.Address2; entity.City = school.City; entity.State = school.State; entity.Zip = school.Zip; entity.CountyID = school.CountyID; entity.Phone = school.Phone; entity.PrincipalName = school.PrincipalName; entity.PrincipalEmail = school.PrincipalEmail; entity.PEDS = school.PEDS; entity.Census = school.Census; entity.PredictedThirdGradeStudents = school.PredictedThirdGradeStudents; entity.SchoolBoardDistrict = school.SchoolBoardDistrict; entity.CityCouncilDistrict = school.CityCouncilDistrict; entity.SonicPartner = school.SonicPartner; entity.TitleOneSchool = school.TitleOneSchool; entity.AppalachianRegion = school.AppalachianRegion; entity.IsDeleted = school.IsDeleted; entity.QuadrantID = school.QuadrantID; entity.CreateDate = school.CreateDate; entity.CreateBy = school.CreateBy; entity.ModifiedDate = DateTime.Now; entity.ModifiedBy = userId; entities.Schools.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); } }
public void Update(CallLogModel callLog) { if (!UpdateDatabase) { var target = One(e => e.CallID == callLog.CallID); if (target != null) { target.CallID = callLog.CallID; target.StudentID = callLog.StudentID; target.UserID = callLog.UserID; target.LanguageSpokenID = callLog.LanguageSpokenID == 0 ? 1 : callLog.LanguageSpokenID; target.LanguageSpokenOther = callLog.LanguageSpokenOther; target.CallStart = callLog.CallStart; target.CallEnd = GetEndTime(callLog.CallEnd, callLog.CallStart); target.ParentParticipation = callLog.ParentParticipation; target.CallDropped = callLog.CallDropped; target.CallTransferred = callLog.CallTransferred; target.PostTestGiven = callLog.PostTestGiven; target.SubjectID = callLog.SubjectID; target.SkillAssessedNotes = callLog.SkillAssessedNotes; target.SessionEvalNotes = callLog.SessionEvalNotes; target.EvalStartID = callLog.EvalStartID; target.EvalEndID = callLog.EvalEndID; target.Textbook = callLog.Textbook; target.Worksheet = callLog.Worksheet; target.Stoodle = callLog.Stoodle; target.ImageShare = callLog.ImageShare; target.Chat = callLog.Chat; target.GoogleDocs = callLog.GoogleDocs; target.PrizeGiven = callLog.PrizeGiven; target.PrizeID = callLog.PrizeID; target.IsLocked = callLog.IsLocked; target.BeatMath = callLog.BeatMath; target.PrizeStudentName = callLog.PrizeStudentName; target.PrizeTeacherName = callLog.PrizeTeacherName; } } else { var entity = new CallLog(); entity.CallID = callLog.CallID; entity.StudentID = callLog.StudentID; entity.UserID = callLog.UserID; entity.LanguageSpokenID = callLog.LanguageSpokenID == 0 ? 1 : callLog.LanguageSpokenID; entity.LanguageSpokenOther = callLog.LanguageSpokenOther; entity.CallStart = callLog.CallStart; entity.CallEnd = GetEndTime(callLog.CallEnd, callLog.CallStart); entity.ParentParticipation = callLog.ParentParticipation; entity.CallDropped = callLog.CallDropped; entity.CallTransferred = callLog.CallTransferred; entity.PostTestGiven = callLog.PostTestGiven; entity.SubjectID = callLog.SubjectID; entity.SkillAssessedNotes = callLog.SkillAssessedNotes; entity.SessionEvalNotes = callLog.SessionEvalNotes; entity.EvalStartID = callLog.EvalStartID; entity.EvalEndID = callLog.EvalEndID; entity.Textbook = callLog.Textbook; entity.Worksheet = callLog.Worksheet; entity.Stoodle = callLog.Stoodle; entity.ImageShare = callLog.ImageShare; entity.Chat = callLog.Chat; entity.GoogleDocs = callLog.GoogleDocs; entity.PrizeGiven = callLog.PrizeGiven; entity.PrizeID = callLog.PrizeID; entity.IsLocked = callLog.IsLocked; entity.BeatMath = callLog.BeatMath; entity.PrizeStudentName = callLog.PrizeStudentName; entity.PrizeTeacherName = callLog.PrizeTeacherName; entities.CallLogs.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); } }