Exemplo n.º 1
0
        public HttpResponseMessage GetDashboardDetails(int employee_id)
        {
            HttpResponseMessage response = null;

            try
            {
                if (employee_id != 0)
                {
                    Dictionary <string, object> result_set = new Dictionary <string, object>();
                    result_set.Add("Available_CL_EL", LeaveRepo.GetLeaveAvailableDashboard(employee_id));
                    result_set.Add("Reporties_Pending_Leave", LeaveRepo.GetRequestByRoleId(employee_id).Count);
                    result_set.Add("Approved_Leave_Application", LeaveRepo.GetApprovedLeaveDashboard(employee_id));
                    result_set.Add("Pending_Leave_Application", LeaveRepo.GetPendingLeaves(employee_id));
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", result_set));
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_103", "Invalid Request", "Invalid id"));
                }
            }
            catch (Exception exception)
            {
                Debug.WriteLine(exception.Message);
                Debug.WriteLine(exception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_101", "Application Error", exception.Message));
            }
            return(response);
        }