public void Create(DonorGivingModel donorGiving) { if (!UpdateDatabase) { var first = GetAll().OrderByDescending(e => e.DonorGivingID).FirstOrDefault(); var id = (first != null) ? first.DonorGivingID : 0; GetAll().Insert(0, donorGiving); } 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.Add(entity); entities.SaveChanges(); donorGiving.DonorGivingID = entity.DonorGivingID; } }
public void Create(CallLogModel callLog) { if (!UpdateDatabase) { var first = GetAll().OrderByDescending(e => e.StudentID).FirstOrDefault(); var id = (first != null) ? first.StudentID : 0; GetAll().Insert(0, callLog); } 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 = callLog.CallEnd; 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.Add(entity); entities.SaveChanges(); callLog.CallID = entity.CallID; } }
public static void ClockIn(string UserID) { try { TimeEntry t = new TimeEntry(); t.UserID = UserID; t.EntryDate = DateTime.Now.Date; t.StartTime = RoundToNearestMinute(DateTime.Now); db.TimeEntries.Add(t); db.SaveChanges(); } catch (Exception ex) { string err = ex.Message; } }
public void Create(SchoolModel school, string userId) { if (!UpdateDatabase) { var first = GetAll().OrderByDescending(e => e.SchoolID).FirstOrDefault(); var id = (first != null) ? first.SchoolID : 0; school.SchoolID = id + 1; GetAll().Insert(0, school); } else { var entity = new School(); 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 = DateTime.Now; entity.CreateBy = userId; entities.Schools.Add(entity); entities.SaveChanges(); school.SchoolID = entity.SchoolID; } }
public void Update(TimeEntryModel timeEntry) { if (!UpdateDatabase) { var target = One(e => e.TimeEntryID == timeEntry.TimeEntryID); if (target != null) { target.TimeEntryID = timeEntry.TimeEntryID; target.UserID = timeEntry.UserID; target.EntryDate = timeEntry.EntryDate; target.StartTime = timeEntry.StartTime; if (timeEntry.StartTime != null && timeEntry.EndTime != null) { target.EndTime = (timeEntry.StartTime).Value.Date.Add(timeEntry.EndTime.Value.TimeOfDay); } else { target.EndTime = timeEntry.EndTime; } target.IsLocked = timeEntry.IsLocked; target.IsDeleted = timeEntry.IsDeleted; target.PayrollDate = timeEntry.PayrollDate; } } else { var entity = entities.TimeEntries.Find(timeEntry.TimeEntryID); entity.TimeEntryID = timeEntry.TimeEntryID; entity.UserID = timeEntry.UserID; entity.EntryDate = timeEntry.EntryDate; entity.StartTime = timeEntry.StartTime; entity.EndTime = GetEndTime(timeEntry.EndTime, timeEntry.StartTime, timeEntry.UserID); entity.IsLocked = timeEntry.IsLocked; entity.IsDeleted = timeEntry.IsDeleted; entity.PayrollDate = timeEntry.PayrollDate; entities.SaveChanges(); } }
public void Create(StudentModel student, string userId) { if (!UpdateDatabase) { var first = GetAll().OrderByDescending(e => e.StudentID).FirstOrDefault(); var id = (first != null) ? first.StudentID : 0; GetAll().Insert(0, student); } else { var entity = new Student(); entity.StudentID = student.StudentID; entity.CodeName = student.CodeName.ToUpper(); 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 = DateTime.Now; entity.CreateBy = userId; entity.StudentOptOut = student.StudentOptOut; entity.GuardianOptOut = student.GuardianOptOut; entities.Students.Add(entity); entities.SaveChanges(); student.StudentID = entity.StudentID; } }
public void Create(DonorModel donor) { if (!UpdateDatabase) { var first = GetAll().OrderByDescending(e => e.DonorID).FirstOrDefault(); var id = (first != null) ? first.DonorID : 0; GetAll().Insert(0, donor); } 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.Add(entity); entities.SaveChanges(); donor.DonorID = entity.DonorID; } }