public ActionResult _TeamLeaderFilledEmployeeDailyStatusReportDetails(long EmployeeId = 0, long TeamLeaderId = 0) { ViewBag.Class = "display-hide"; if (TeamLeaderId == 0 && UserManager.user.roleType == roleTypeModel.TeamLeader) { TeamLeaderId = UserManager.user.UserId; } List <EmployeeTotalWorkingHoursReportDomainModel> listDailyStatusReportsByTeamLeader = new List <EmployeeTotalWorkingHoursReportDomainModel>(); var client = new HttpClient(); client.BaseAddress = new Uri(HttpContext.Request.Url.AbsoluteUri); var res = client.GetAsync(BaseURL + "/api/EmployeeDailyStatusReport/GetEmployeeReportFilledByTeamLeaderAccToEmployeeId?TLEmployeeId=" + TeamLeaderId + "&EmployeeId=" + EmployeeId).Result; if (res.StatusCode == HttpStatusCode.OK) { var contents = res.Content.ReadAsStringAsync().Result; var response = JsonConvert.DeserializeObject <List <EmployeeTotalWorkingHoursReportDomainModel> >(contents); listDailyStatusReportsByTeamLeader = response; if (listDailyStatusReportsByTeamLeader != null && listDailyStatusReportsByTeamLeader.Count > 0) { listDailyStatusReportsByTeamLeader.ForEach(s => s.listEmployeeDailyReportDetails.ForEach(r => r.CreatedDateStr = r.CreatedDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture))); if (listDailyStatusReportsByTeamLeader[0].listEmployeeDailyReportDetails.Count > 0) { GetEmployeeDailyStatusReportDomainModel obj = listDailyStatusReportsByTeamLeader[0].listEmployeeDailyReportDetails[0]; if (obj != null) { ViewBag.EmpInfo = obj.EmployeeName + " " + obj.DepartmentName + " " + obj.DesignationName; } } } } return(PartialView(listDailyStatusReportsByTeamLeader)); }
public ActionResult _EmployeeReporting(long EmployeeId, string StartDate, string EndDate) { List <EmployeeTotalWorkingHoursReportDomainModel> listEmployeeTotalWorkingHoursReport = new List <EmployeeTotalWorkingHoursReportDomainModel>(); if (EmployeeId > 0) { DateTime date = DateTime.Now; if (!string.IsNullOrWhiteSpace(StartDate)) { date = DateTime.ParseExact(StartDate, "dd/MM/yyyy", null); StartDate = date.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture); } if (!string.IsNullOrWhiteSpace(EndDate)) { date = DateTime.ParseExact(EndDate, "dd/MM/yyyy", null); EndDate = date.ToString("yyyy/MM/dd", CultureInfo.InvariantCulture); } long DepartmentId = 0; var client = new HttpClient(); client.BaseAddress = new Uri(HttpContext.Request.Url.AbsoluteUri); var result = client.GetAsync(BaseURL + "/api/Management/GetEmployeeDataById?UserId=" + EmployeeId).Result; if (result.StatusCode == HttpStatusCode.OK) { var contents = result.Content.ReadAsStringAsync().Result; var Response = new JavaScriptSerializer().Deserialize <EmployeeModel>(contents); if (Response != null && Response.UserId > 0) { DepartmentId = Response.DepartmentId; } } var res = client.GetAsync(BaseURL + "/api/EmployeeDailyStatusReport/GetEmployeeTotalWorkingHoursReport?DepartmentId=" + DepartmentId + "&EmployeeId=" + EmployeeId + "&StartDate=" + StartDate + "&EndDate=" + EndDate).Result; if (res.StatusCode == HttpStatusCode.OK) { var contents = res.Content.ReadAsStringAsync().Result; var response = JsonConvert.DeserializeObject <List <EmployeeTotalWorkingHoursReportDomainModel> >(contents); listEmployeeTotalWorkingHoursReport = response; if (listEmployeeTotalWorkingHoursReport != null && listEmployeeTotalWorkingHoursReport.Count > 0) { listEmployeeTotalWorkingHoursReport.ForEach(s => s.listEmployeeDailyReportDetails.ForEach(r => r.CreatedDateStr = r.CreatedDate.ToString("dd/MM/yyyy", CultureInfo.InvariantCulture))); listEmployeeTotalWorkingHoursReport.ForEach(s => s.listEmployeeDailyReportDetails.ForEach(r => r.Time = r.ReportDate.ToShortTimeString())); GetEmployeeDailyStatusReportDomainModel obj = listEmployeeTotalWorkingHoursReport[0].listEmployeeDailyReportDetails[0]; if (obj != null) { ViewBag.EmpInfo = obj.EmployeeName + " " + obj.DepartmentName + " " + obj.DesignationName; } } } ViewBag.EmployeeId = EmployeeId; } return(PartialView(listEmployeeTotalWorkingHoursReport)); }