public IActionResult EmployeeDashboard(int PersonId) { HttpResponseMessage response = _service.GetResponse(ApiUrl + "api/Dashboard/Employee/" + PersonId); string stringData = response.Content.ReadAsStringAsync().Result; Employee_Dashboard dashboard = JsonConvert.DeserializeObject <Employee_Dashboard>(stringData); return(Json(dashboard)); }
public Employee_Dashboard GetEmployeeDashboard(int TenantId, int PersonId) { Employee_Dashboard Model = new Employee_Dashboard(); Model.SP_EmployeeDashboardCount = new SP_EmployeeDashboardCount(); Model.SP_EmployeeDashboards = new List <SP_EmployeeDashboard>(); var param = new SqlParameter("@PersonId", PersonId); string usp = "LMS.usp_GetEmployeeDashboardDetails @PersonId"; Model.SP_EmployeeDashboards = _dbContext._sp_EmployeeDashboard.FromSql(usp, param).ToList(); usp = "LMS.usp_GetEmployeeDashboardCountDetails @PersonId"; Model.SP_EmployeeDashboardCount = _dbContext._sp_EmployeeDashboardcount.FromSql(usp, param).FirstOrDefault(); usp = "LMS.usp_GetEmployeeLeavesData @PersonId"; Model.SP_EmployeeLeaveRequest = _dbContext._sp_EmployeeLeaveRequest.FromSql(usp, param).ToList(); return(Model); }
public IActionResult GetEmployeeDashboard([FromRoute] int PersonId) { Person person = _repository.Employee.FindByCondition(x => x.Id == PersonId); if (person.IsOnProbation == true) { int probationPeriod = person.PropbationPeriodInMonth.GetValueOrDefault(); DateTime joinDate = person.JoinDate; DateTime probationEndDate = joinDate.AddMonths(probationPeriod); if (probationEndDate.Date < DateTime.Now.Date) { person.IsOnProbation = false; person.PropbationPeriodInMonth = null; _repository.Employee.UpdateAndSave(person); } } Employee_Dashboard dashboard = _repository.Dashboard.GetEmployeeDashboard(TenantId, PersonId); return(Ok(dashboard)); }
public float GetAvailableLeaves(int PersonId, int LeaveId) { float n; bool isPaid = LeaveId == 0 ? true : _dbContext.LeaveCredit.Include(x => x.LeaveRule).Where(x => x.Id == LeaveId).FirstOrDefault().LeaveRule.IsPaid; if (isPaid == true) { //n = _dbContext.LeaveCredit.Where(x => x.PersonId == PersonId && x.Id == LeaveId).Select(x => x.Available).FirstOrDefault(); Employee_Dashboard Model = new Employee_Dashboard(); Model.SP_EmployeeDashboardCount = new SP_EmployeeDashboardCount(); Model.SP_EmployeeDashboards = new List <SP_EmployeeDashboard>(); var param = new SqlParameter("@PersonId", PersonId); string usp = "LMS.usp_GetEmployeeDashboardCountDetails @PersonId"; Model.SP_EmployeeDashboardCount = _dbContext._sp_EmployeeDashboardcount.FromSql(usp, param).FirstOrDefault(); n = Model.SP_EmployeeDashboardCount.AvailableLeaves; } else { n = -2; } return(n); }