Exemple #1
0
        public HttpResponseMessage GetSheetById(int timesheetid)//timesheet id
        {
            HttpResponseMessage response = null;

            try
            {
                if (timesheetid != 0)
                {
                    TimeSheetModel record = TimeSheetRepo.GetSheetById(timesheetid);
                    if (record != null)
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", record));
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_901", "Invalid", "TimeSheet doesnot exists!"));
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            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);
        }
Exemple #2
0
        public HttpResponseMessage EditTimeSheetRecord(Timesheet sheetdetails)
        {
            HttpResponseMessage response = null;

            try
            {
                if (sheetdetails != null)
                {
                    if (TimeSheetRepo.GetSheetById(sheetdetails.id) != null)
                    {
                        TimeSheetRepo.UpdateTimeSheetRecord(sheetdetails);
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", "TimeSheet updated Succesfully"));
                    }
                    else
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_901", "Invalid", "TimeSheet doesnot exists!"));
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            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);
        }
Exemple #3
0
        public HttpResponseMessage AddTimeSheetRecord(List <Timesheet> sheetrecord)
        {
            HttpResponseMessage response = null;

            try
            {
                if (sheetrecord != null)
                {
                    TimeSheetRepo.AddTimeSheetRecord(sheetrecord);
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "TimeSheet added Succesfully", "TimeSheet added Succesfully"));
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            catch (DbEntityValidationException DBexception)
            {
                Debug.WriteLine(DBexception.Message);
                Debug.WriteLine(DBexception.GetBaseException());
                response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_190", "Mandatory fields missing", DBexception.Message));
            }
            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);
        }
Exemple #4
0
        public HttpResponseMessage GetSheetByEmpId(int employee_id)//e_id employee_id
        {
            HttpResponseMessage response = null;

            try
            {
                if (employee_id != 0)
                {
                    //int emp_status = EmployeeRepo.GetEmployeeStatusByID(e_id);
                    //if (emp_status == 1)
                    //{
                    List <TimeSheetModel> record_list = TimeSheetRepo.GetSheetByEmpId(employee_id);
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", record_list));
                    //}
                    //else
                    //{
                    //    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_103", "Invalid", "Invalid Employee ID"));
                    //}
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            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);
        }
Exemple #5
0
        public HttpResponseMessage GetSheetByProjId(int project_id)//p_id project_id
        {
            HttpResponseMessage response = null;

            try
            {
                if (project_id != 0)
                {
                    List <TimeSheetModel> record_list = TimeSheetRepo.GetSheetByProjId(project_id);
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_001", "Success", record_list));
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, new EMSResponseMessage("EMS_102", "Invalid Input", "Please check input Json"));
                }
            }
            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);
        }