예제 #1
0
        //[Authorize]
        public HttpResponseMessage Pto(APIEnums.RollupLevel rollupLevel, int employeeId)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            // Work objects //
            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            LifeSpan.DTO.Dashboard.PtoResponse result = new PtoResponse();

            try
            {
                StaffReminders bll = new StaffReminders();

                //result.Ptos = bll.Pto(employeeId);


                // Prepare result output //
                result.DashboardValue = result.Ptos.Count;
                result.RecordCount    = result.Ptos.Count;

                // Return summary only if requested //
                if (rollupLevel == APIEnums.RollupLevel.Summary)
                {
                    result.Ptos.Clear();
                }

                result.Success = true;
            }

            catch (Exception ex)
            {
                result.Success      = false;
                response.StatusCode = HttpStatusCode.BadRequest;
                result.Errors.Add(new Error(Error.ErrorClass.Error, string.Empty, ex.Message, ex));
            }

            stopwatch.Stop();
            result.ExecutionTimeSpan = stopwatch.Elapsed;
            result.TimeStamp         = DateTime.Now;
            response.Content         = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(result), Encoding.UTF8, "application/json");

            return(response);
        }
예제 #2
0
        //[Authorize]
        // data done, poco done, detail form done, need to check filters
        public HttpResponseMessage MissingTherapistEvals(APIEnums.RollupLevel rollupLevel, APIEnums.IncludeAssistant includeAssistant, int employeeId, int schoolYearId)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            // Work objects //
            var response = this.Request.CreateResponse(HttpStatusCode.OK);

            LifeSpan.DTO.Dashboard.MissingReportResponse result = new MissingReportResponse();

            try
            {
                TherapistReports bll = new TherapistReports();

                result.MissingReports = bll.MissingTherapistEvals((includeAssistant == APIEnums.IncludeAssistant.True ? true : false), employeeId, schoolYearId);


                // Prepare result output //
                result.DashboardValue = result.MissingReports.Count;
                result.RecordCount    = result.MissingReports.Count;

                // Return summary only if requested //
                if (rollupLevel == APIEnums.RollupLevel.Summary)
                {
                    result.MissingReports.Clear();
                }

                result.Success = true;
            }

            catch (Exception ex)
            {
                result.Success      = false;
                response.StatusCode = HttpStatusCode.BadRequest;
                result.Errors.Add(new Error(Error.ErrorClass.Error, string.Empty, ex.Message, ex));
            }

            stopwatch.Stop();
            result.ExecutionTimeSpan = stopwatch.Elapsed;
            result.TimeStamp         = DateTime.Now;
            response.Content         = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(result), Encoding.UTF8, "application/json");

            return(response);
        }