public IActionResult GetFeedbackStats([FromBody] ReportRequestModel feedbackRequestModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            FeedbackReportModel feedbackModel;

            try
            {
                Guid userUUID = Guid.Parse(HttpContext.User.Claims.Where(w => w.Type == "UserUUID").Select(x => x.Value).FirstOrDefault());

                Repository rep         = new Repository();
                string     officerCode = rep.GetLoginNameByUserUUID(userUUID);

                feedbackModel = _imisModules.GetReportModule().GetReportLogic().GetFeedbackStats(feedbackRequestModel, officerCode);
            }
            catch (ValidationException e)
            {
                throw new BusinessException(e.Message);
            }

            if (feedbackModel == null)
            {
                return(NotFound());
            }

            return(Ok(feedbackModel));
        }
        public IActionResult GetEnrolmentStats([FromBody] ReportRequestModel enrolmentRequestModel)
        {
            if (!ModelState.IsValid)
            {
                var error = ModelState.Values.FirstOrDefault().Errors.FirstOrDefault().ErrorMessage;
                return(BadRequest(new { error_occured = true, error_message = error }));
            }

            EnrolmentReportModel enrolmentModel;

            try
            {
                Guid userUUID = Guid.Parse(HttpContext.User.Claims.Where(w => w.Type == "UserUUID").Select(x => x.Value).FirstOrDefault());

                Repository rep         = new Repository();
                string     officerCode = rep.GetLoginNameByUserUUID(userUUID);

                enrolmentModel = _imisModules.GetReportModule().GetReportLogic().GetEnrolmentStats(enrolmentRequestModel, officerCode);
            }
            catch (ValidationException e)
            {
                throw new BusinessException(e.Message);
            }

            if (enrolmentModel == null)
            {
                return(NotFound());
            }

            return(Ok(enrolmentModel));
        }
        public JsonResult GetReport(ReportRequestModel reportRequestModel)
        {
            var reportResponseModel = ReportService.GetAttendanceReport(reportRequestModel);

            //TODO pass ORgID to db
            var sessionUserName = User.Identity.GetUserName();
            var filteredRows    = new List <Row>();

            if (User.IsInRole("Student") || ((User.IsInRole("Staff") && reportRequestModel.Category == "Staff")))
            {
                //List<Row> filteredRows = (from row in reportResponseModel.Rows let rowUserName = row.RowCells[row.RowCells.Count - 1] where !String.IsNullOrEmpty(rowUserName) && !String.IsNullOrEmpty(sessionUserName) && (rowUserName.ToLower() == sessionUserName.ToLower()) select row).ToList();
                foreach (var row in reportResponseModel.Rows)
                {
                    var rowUserName = row.RowCells[row.RowCells.Count - 1];
                    if (!String.IsNullOrEmpty(rowUserName) && !String.IsNullOrEmpty(sessionUserName) && (rowUserName.ToLower() == sessionUserName.ToLower()))
                    {
                        filteredRows.Add(row);
                    }
                }
                reportResponseModel.Rows = filteredRows;
            }
            return(new JsonResult {
                Data = reportResponseModel, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
Esempio n. 4
0
        public IActionResult GetRenewalStats([FromBody] ReportRequestModel renewalRequestModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            RenewalReportModel renewalModel;

            try
            {
                Guid userUUID = Guid.Parse(HttpContext.User.Claims.Where(w => w.Type == "UserUUID").Select(x => x.Value).FirstOrDefault());

                Repository rep         = new Repository();
                string     officerCode = rep.GetLoginNameByUserUUID(userUUID);

                renewalModel = _imisModules.GetReportModule().GetReportLogic().GetRenewalStats(renewalRequestModel, officerCode);
            }
            catch (ValidationException e)
            {
                return(BadRequest(new { error = new { message = e.Message, value = e.Value } }));
            }

            if (renewalModel == null)
            {
                return(NotFound());
            }

            return(Ok(renewalModel));
        }
 public ReportRequestBuilder(string reportId)
 {
     ReportRequest = new ReportRequestModel
     {
         ReportId = reportId
     };
 }
Esempio n. 6
0
        public IList <PosOrderInfoModel> GetPosOrderInfoByFranchiseAndDate(ReportRequestModel requestModelTime)
        {
            var query = DbEntities.ViewPosOrderInfo.AsQueryable();

            if (requestModelTime.Id != EntityConstants.NULL_VALUE)
            {
                query = query.Where(e => e.FranchiseId == requestModelTime.Id);
            }

            if (requestModelTime.SecondId != EntityConstants.NULL_VALUE)
            {
                query = query.Where(e => e.FranchiseStoreId == requestModelTime.SecondId);
            }

            var startDate = requestModelTime.StartCalculatedDate;
            var endDate   = requestModelTime.EndCalculatedDate.AddDays(1);

            query = query.Where(e => e.FirstDatetime >= startDate && e.FirstDatetime < endDate);

            return(query.Select(e => new PosOrderInfoModel
            {
                ItemId = e.ItemId,
                Name = e.Name,
                OrderToStoreId = e.OrderToStoreId,
                Price = e.Price
            }).ToList());
        }
Esempio n. 7
0
        public IQueryable <Revenue> GetRevenuesByDateRange(ReportRequestModel model)
        {
            var fromDate = model.ReportFromDate.Date;
            var toDate   = model.ReportToDate.Date.AddDays(1).AddSeconds(-1);

            return(_db.Revenues.Where(x => x.Created >= fromDate && x.Created <= toDate).AsQueryable());
        }
Esempio n. 8
0
        public async Task <ReportListModel> GetTransactionReportAsync([FromBody] ReportRequestModel request)
        {
            var filter = await FilterByPartnerAsync(request.PartnerId);

            if (filter.IsEmptyResult)
            {
                return(new ReportListModel
                {
                    Items = new List <ReportItemModel>(),
                    PagedResponse = new PagedResponseModel(request.CurrentPage, 0)
                });
            }

            var requestModel = new TransactionReportByTimeRequest()
            {
                CurrentPage     = request.CurrentPage,
                PageSize        = request.PageSize,
                From            = request.From.Date,
                To              = request.To.Date.AddDays(1).AddMilliseconds(-1),
                TransactionType = request.TransactionType,
                Status          = request.Status,
            };
            var clientResult = await _reportClient.Api.FetchReportAsync(requestModel, filter.PartnerIds);

            return(new ReportListModel
            {
                Items = _mapper.Map <List <ReportItemModel> >(clientResult.TransactionReports),
                PagedResponse = new PagedResponseModel(request.CurrentPage, clientResult.TotalCount)
            });
        }
        public ActionResult SearchByFranchiseAndDate(ReportRequestModel reportRequest)
        {
            var response = new ResponseMessageModel {
                HasError = false
            };

            try
            {
                if (User.IsInRole(RoleConstants.STORE_MANAGER))
                {
                    reportRequest.Id       = EntityConstants.NULL_VALUE;
                    reportRequest.SecondId = EntityConstants.NULL_VALUE;
                    using (var repository = new AccountRepository())
                    {
                        reportRequest.ListStoresIds = repository.GetStoresIdsByUser(User.Identity.GetUserId());
                    }
                }

                IReportService reportService = new ReportService();
                response.Data = reportService.GetClientOrderInfoByFranchiseAndDate(reportRequest);
            }
            catch (Exception ex)
            {
                SharedLogger.LogError(ex);
                response.HasError = true;
            }
            return(Json(response));
        }
Esempio n. 10
0
        public EnrolmentReportModel GetEnrolmentStats(ReportRequestModel enrolmentRequestModel, string officerCode)
        {
            EnrolmentReportModel response;

            response = reportRepository.GetEnrolmentStats(enrolmentRequestModel, officerCode);

            return(response);
        }
Esempio n. 11
0
        public FeedbackReportModel GetFeedbackStats(ReportRequestModel feedbackRequestModel, string officerCode)
        {
            FeedbackReportModel response;

            response = reportRepository.GetFeedbackStats(feedbackRequestModel, officerCode);

            return(response);
        }
Esempio n. 12
0
        public RenewalReportModel GetRenewalStats(ReportRequestModel renewalRequestModel, string officerCode)
        {
            RenewalReportModel response;

            response = reportRepository.GetRenewalStats(renewalRequestModel, officerCode);

            return(response);
        }
Esempio n. 13
0
        public IQueryable <HddInfo> GetCasesByDateRange(ReportRequestModel model)
        {
            var stateDate = model.ReportFromDate.Date;
            var endDate   = model.ReportToDate.Date.AddDays(1).AddSeconds(-1);

            var queryable = _db.HddInfos.Where(x => x.Created >= stateDate && x.Created <= endDate).AsQueryable();

            return(queryable);
        }
Esempio n. 14
0
        public ExpenseReportViewModel GetExpenseReport(ReportRequestModel model)
        {
            var expenses = _expense.GetExpensesByDateRange(model).ToList();

            var totalExpense = expenses.Sum(x => x.Amount);

            var viewModels = new ExpenseReportViewModel(expenses, totalExpense);

            return(viewModels);
        }
 public FilterReportsPopPage()
 {
     InitializeComponent();
     _apiServices = new RestApi();
     _baseUrl     = Settings.Url + Domain.UpdatePINApiConstant;
     _objPINUpdateRequestModel  = new PINUpdateRequestModel();
     _objPINUpdateResponseModel = new PINUpdateResponseModel();
     _objReportRequestModel     = new ReportRequestModel();
     _objHeaderModel            = new HeaderModel();
 }
Esempio n. 16
0
        public App()
        {
            InitializeComponent();
            Settings.Url           = Domain.Url;
            _objReportRequestModel = new ReportRequestModel();
            // NavigationPage  = new  NavigationPage(new EditProfilePage());
            SetMainpage();
            // MainPage = NavigationPage;
            DetailPage = new HomePage();

            //var rs=Application.Current.Resources["xyzfield"];
        }
Esempio n. 17
0
 public IHttpActionResult Post([FromBody] ReportRequestModel request)
 {
     try
     {
         return(Ok(Reports.SalesByAgentsRegions.Report(request.StartDate, request.EndDate)));
     }
     catch (Exception ex)
     {
         Logger.Log(ex.Message);
         return(BadRequest(ex.Message));
     }
 }
        /// <summary>
        ///		Obtiene la solicitud de informe
        /// </summary>
        internal ReportRequestModel GetReportRequest()
        {
            ReportRequestModel request = new ReportRequestModel();

            // Asigna el código de informe
            request.ReportId = ReportViewModel.Report.Id;
            // Obtiene las columnas de dimensión y de expresión
            request.Dimensions.AddRange(GetRequestDimensions(Children));
            request.Expressions.AddRange(GetRequestExpressions(Children));
            // Devuelve la solicitud
            return(request);
        }
        /// <summary>
        ///		Obtiene las consultas de dimensión solicitadas
        /// </summary>
        private List <QueryModel> GetDimensionQueries(ReportRequestModel request)
        {
            List <QueryModel> queries = new List <QueryModel>();

            // Obtiene las consultas de las dimensiones
            foreach (DimensionRequestModel dimensionRequested in request.Dimensions)
            {
                queries.Add(new QueryDimensionGenerator(this).GetQuery(dimensionRequested));
            }
            // Devuelve las consultas
            return(queries);
        }
Esempio n. 20
0
        public DiscountReportViewModel GetDiscountReport(ReportRequestModel model)
        {
            var cases = _case.GetCasesByDateRange(model).ToList();

            var totalDiscountPercent = cases.Sum(x => x.DiscountPercent);

            var totalDiscountAmount = cases.Sum(x => x.DiscountAmount);


            var viewModel = new DiscountReportViewModel(cases, totalDiscountPercent, totalDiscountAmount);

            return(viewModel);
        }
Esempio n. 21
0
        public IHttpActionResult Post([FromBody] ReportRequestModel request)
        {
            try
            {
                return(Ok(Reports.InvoicesReview.Report(request.Id, request.StartDate, request.EndDate)));
            }

            catch (Exception ex)
            {
                Logger.Log(ex.Message);
                return(BadRequest(ex.Message));
            }
        }
Esempio n. 22
0
        public async Task <IActionResult> RequestReport()
        {
            var result = await _contactDetailManager.GetContactDetailsAsync();

            if (result.IsSuccess)
            {
                ReportRequestModel reportRequestModel = new ReportRequestModel();
                reportRequestModel.ContactDetails = result.Data.ToList();
                _messageBrokerHelper.QueueMessage(reportRequestModel);
                return(Ok(Messages.ReportRequestCreated));
            }
            return(BadRequest(new { Message = result.Message }));
        }
Esempio n. 23
0
        /// <summary>
        ///		Obtiene la respuesta a una consulta sobre un informe
        /// </summary>
        internal string GetResponse(ReportRequestModel request)
        {
            ReportModel report = SearchReport(request.ReportId);

            // Procesa el informe con la solicitud
            if (report == null)
            {
                throw new Models.Exceptions.ReportingException($"Cant find the report {request.ReportId}");
            }
            else
            {
                return(new Queries.ReportQueryGenerator(Manager.Schema, report, request).GetSql());
            }
        }
Esempio n. 24
0
        public static ReportResponseModel GetAttendanceReport(ReportRequestModel requestModel)
        {
            DataSet ds = new DataSet("TimeRanges");
            var     reportResponseModel = new ReportResponseModel();

            using (var con = new SqlConnection(ConnectionString))
            {
                con.Open();
                var sqlComm = new SqlCommand("GetAttendanceReport", con)
                {
                    CommandType = CommandType.StoredProcedure
                };
                sqlComm.Parameters.AddWithValue("@name", requestModel.Name);
                sqlComm.Parameters.AddWithValue("@class", requestModel.StudentClass);
                sqlComm.Parameters.AddWithValue("@section", requestModel.Section);
                sqlComm.Parameters.AddWithValue("@fromDate", requestModel.DtFrom);
                sqlComm.Parameters.AddWithValue("@toDate", requestModel.DtTo);
                sqlComm.Parameters.AddWithValue("@category", requestModel.Category);
                SqlDataAdapter da = new SqlDataAdapter {
                    SelectCommand = sqlComm
                };
                da.Fill(ds);
                //sqlComm.ExecuteReader();
                sqlComm.ExecuteNonQuery();
                con.Close();
                if (ds.Tables.Count > 0)
                {
                    reportResponseModel.Columns = new List <string>();
                    foreach (DataColumn column in ds.Tables[0].Columns)
                    {
                        reportResponseModel.Columns.Add(column.ColumnName);
                    }
                    reportResponseModel.Rows = new List <Row>();
                    foreach (DataRow dataRow in ds.Tables[0].Rows)
                    {
                        var row = new Row();
                        row.RowCells = new List <string>();
                        foreach (var cells in dataRow.ItemArray)
                        {
                            row.RowCells.Add(cells.ToString());
                        }
                        reportResponseModel.Rows.Add(row);
                    }
                }
            }
            return(reportResponseModel);
        }
Esempio n. 25
0
        public IHttpActionResult Post([FromBody] ReportRequestModel request)
        {
            try
            {
                if (Identity.HasNotAccess(request.Id))
                {
                    return(Unauthorized());
                }
                return(Ok(Reports.SalesByRegion.Report(request.StartDate, request.EndDate, request.Id)));
            }

            catch (Exception ex)
            {
                Logger.Log(ex.Message);
                return(BadRequest(ex.Message));
            }
        }
        public ActionResult SearchByFranchiseAndDate(ReportRequestModel reportRequest)
        {
            var response = new ResponseMessageModel {
                HasError = false
            };

            try
            {
                IReportService reportService = new ReportService();
                response.Data = reportService.GetClientOrderInfoByFranchiseAndDate(reportRequest);
            }
            catch (Exception ex)
            {
                SharedLogger.LogError(ex);
                response.HasError = true;
            }
            return(Json(response));
        }
        public ActionResult SearchDaysByRange(ReportRequestModel reportRequest)
        {
            var response = new ResponseMessageModel {
                HasError = false
            };

            try
            {
                IReportService reportService = new ReportService();
                response.Data = reportService.GetDailySaleInfo(reportRequest.StartCalculatedDate, reportRequest.EndCalculatedDate);
            }
            catch (Exception ex)
            {
                SharedLogger.LogError(ex);
                response.HasError = true;
            }
            return(Json(response));
        }
Esempio n. 28
0
        public List <UploadModel> ApprovedItems(ReportRequestModel model)
        {
            var result = new List <UploadModel>();

            try
            {
                result = Connection.UploadModels.Where(x => (x.IsBatchApproved && !x.IsDeleted) &&
                                                       (model.SolId == null || x.SolId.Equals(model.SolId, StringComparison.InvariantCultureIgnoreCase)) &&
                                                       (x.DateCreated >= model.FromDate && x.DateCreated <= model.ToDate)
                                                       ).Take(model.Preview ? 15 : 1000000).ToList();
            }
            catch (Exception ex)
            {
                Logger.Error("ApprovedItems|| Error", ex);
            }

            return(result);
        }
Esempio n. 29
0
 public HomePage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     _apiServices                  = new RestApi();
     _baseUrl                      = Settings.Url + Domain.AppointmentApiConstant;
     _baseUrlPrescription          = Settings.Url + Domain.PrescriptionApiConstant;
     _baseUrlReports               = Settings.Url + Domain.ReportApiConstant;
     _objAppointmentResponseModel  = new AppointmentResponseModel();
     _objAppointmentRequestModel   = new AppointmentRequestModel();
     _objPrescriptionRequestModel  = new PrescriptionRequestModel();
     _objPrescriptionResponseModel = new PrescriptionResponseModel();
     _objReportRequestModel        = new ReportRequestModel();
     _objReportResponseModel       = new ReportResponseModel();
     _objHeaderModel               = new HeaderModel();
     //App.DetailPage = this;
     _objHeaderModel.OTPToken = Settings.TokenCode;
 }
Esempio n. 30
0
        public EnrolmentReportModel GetEnrolmentStats(ReportRequestModel enrolmentRequestModel, string officerCode)
        {
            EnrolmentReportModel response = new EnrolmentReportModel();

            try
            {
                using (var imisContext = new ImisDB())
                {
                    var submitted = (from FP in imisContext.TblFromPhone
                                     join O in imisContext.TblOfficer on FP.OfficerCode equals O.Code
                                     where FP.DocType == "E" &&
                                     FP.LandedDate >= enrolmentRequestModel.FromDate &&
                                     FP.LandedDate <= enrolmentRequestModel.ToDate &&
                                     O.ValidityTo == null &&
                                     FP.OfficerCode == officerCode
                                     select new { FromPhone = FP, Officer = O })
                                    .ToList();

                    var assigned = (from S in submitted
                                    from P in imisContext.TblPhotos
                                    where P.ValidityTo == null &&
                                    P.PhotoFileName == S.FromPhone.DocName &&
                                    P.OfficerId == S.Officer.OfficerId
                                    select S)
                                   .ToList();

                    response = new EnrolmentReportModel()
                    {
                        TotalSubmitted = submitted.Select(x => x.FromPhone).Count(),
                        TotalAssigned  = assigned.Count(),
                    };
                }

                return(response);
            }
            catch (SqlException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw e;
            }
        }