Exemplo n.º 1
0
        public HttpResponseMessage DeleteEmployeeProjectRoleAssignmnet(int employee_id, int project_id, int role_id)
        {
            HttpResponseMessage response = null;

            try
            {
                if (employee_id != 0 && project_id != 0 && role_id != 0)
                {
                    Project_role project_role = ProjectRepo.GetAssignedEmployeebyid(employee_id, project_id, role_id);
                    if (project_role != null)
                    {
                        ProjectRepo.DeleteEmployeeProjectRoleAssignmnet(project_role);
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Employee deleted from the given project", "Employee deleted from the given project"));
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Failure : check employe id, role id and project id", "Failure : check employe id, role id and project id"));
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json, Project details and employee status"));
                }
            }
            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);
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetAssignedEmployeebyid(int employee_id, int project_id, int role_id)
        {
            HttpResponseMessage response = null;

            try
            {
                if (employee_id != 0 && project_id != 0 && role_id != 0)
                {
                    Project_role project_role = ProjectRepo.GetAssignedEmployeebyid(employee_id, project_id, role_id);
                    if (project_role != null)
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", project_role));
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "failure : Given employee is not specifically assigned to the role in that project", "Given employee is not specifically assigned to the role in that project"));
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Please check input Json, Project details and employee status", "Please check input Json, Project details and employee status"));
                }
            }
            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);
        }