public Boolean CreateLeaveInfo(LeaveInfo info) { var remain = new RemainingHourRepository(_dbContext); if (info.EndDateTime == null) { if (remain.ViewHour(info.EmployeeId, info.StartDateTime.Year.ToString(), info.Type) >= info.HoursStartDate) { _dbContext.LeaveInfos.Add(info); _dbContext.SaveChanges(); return(true); } return(false); } else { int totalDays = (info.EndDateTime - info.StartDateTime).Days; int totalHours = (totalDays - 1) * 8 + info.HoursStartDate + info.HoursEndDate; if (remain.ViewHour(info.EmployeeId, info.StartDateTime.Year.ToString(), info.Type) >= totalHours) { _dbContext.LeaveInfos.Add(info); _dbContext.SaveChanges(); return(true); } return(false); } }
public void UpdateEmployeeInfo(EmployeeInfo e) { EmployeeInfo ei; ei = _db.EmployeeInfo.Where(temp => (temp.EmployeeInfoID == e.EmployeeInfoID)).FirstOrDefault(); if (ei != null) { ei.Hobbies = e.Hobbies; ei.ProjectsDone = e.ProjectsDone; ei.Bio = e.Bio; ei.Address = e.Address; ei.Contact = e.Contact; _db.SaveChanges(); } }
public void LeaveApproval(LeaveData l) { LeaveData ld; ld = db.LeaveDatas.Where(temp => temp.EmployeeID == l.EmployeeID).FirstOrDefault(); ld.ApprovalStatus = l.ApprovalStatus; db.SaveChanges(); }
public void LeaveApproval(LeaveData l) { var appDbContext = new LeaveManagementDbContext(); var userStore = new ApplicationUserStore(appDbContext); var userManager = new ApplicationUserManager(userStore); LeaveData ld = _db.LeaveDatas.Where(temp => temp.LeaveID == l.LeaveID).FirstOrDefault(); ld.ApprovedBy = HttpContext.Current.User.Identity.GetUserName(); ld.ApprovalStatus = l.ApprovalStatus; _db.SaveChanges(); }
public void UpdateEmployeeInfo(EmployeeInfo e) { var appDbContext = new LeaveManagementDbContext(); var userStore = new ApplicationUserStore(appDbContext); var userManager = new ApplicationUserManager(userStore); ApplicationUser user = userManager.FindById(e.ApplicationUser.Id); EmployeeInfo ei; ei = _db.EmployeeInfo.Where(temp => temp.EmployeeInfoID == e.EmployeeInfoID).FirstOrDefault(); if (ei != null) { ei.FirstName = e.FirstName; ei.LastName = e.LastName; ei.ProjectsDone = e.ProjectsDone; ei.Address = e.Address; ei.Bio = e.Bio; ei.Hobbies = e.Hobbies; ei.DateOfBirth = e.DateOfBirth; ei.ApplicationUser = user; _db.SaveChanges(); } }
public void CreateEmployeeProfile(Employee e) { db.Employees.Add(e); db.SaveChanges(); }
public void ApplyLeave(LeaveData l) { db.LeaveDatas.Add(l); db.SaveChanges(); }
public void addReportingTo(Reporting reporting) { _dbContext.Reportings.Add(reporting); _dbContext.SaveChanges(); }
public void Add(Employee employee) { _dbContext.Employees.Add(employee); _dbContext.SaveChanges(); }