Example #1
0
        public async Task <ICallReportResponce> FetchReport(string dateFrom, string dateTo)
        {
            var request = new CallReportRequestModel()
            {
                MinDay = dateFrom,
                MaxDay = dateTo
            };
            var service  = new InterpreterService();
            var responce = await service.FetchMonthReport(request);

            return(responce);
        }
        public async Task <FetchABReportResponse> FetchBusinessReport(CallReportRequestModel requestModel)
        {
            FetchABReportResponse fetchABReportResponse = new FetchABReportResponse();

            try
            {
                fetchABReportResponse = await Post <FetchABReportResponse, CallReportRequestModel>(FetchBusinessReportAPI, requestModel);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }

            return(fetchABReportResponse);
        }
Example #3
0
        public async Task <InterpreterCallReportResponce> FetchMonthReport(CallReportRequestModel requestModel)
        {
            var responce = new InterpreterCallReportResponce();

            try
            {
                responce = await Post <InterpreterCallReportResponce, CallReportRequestModel>(FetchMonthReportInterpreterAPI, requestModel);
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.WriteLine(e.Message);
            }

            return(responce);
        }
        public async Task LoadData(String minDay, String maxDay, UserTypes userType)
        {
            IsLoading = true;

            var callLogRequestModel = new CallReportRequestModel();

            callLogRequestModel.MinDay = minDay;
            callLogRequestModel.MaxDay = maxDay;
            FetchABReportResponse response = null;

            switch (userType)
            {
            case UserTypes.Business:
                BusinessService businessService = new BusinessService();
                if (Business != null)
                {
                    callLogRequestModel.ClientBusinessId = int.Parse(Business.ClientBusinessId);
                    response = await businessService.FetchBusinessReport(callLogRequestModel);
                }
                break;

            case UserTypes.Agency:
                AgencyService agencyService = new AgencyService();
                if (Agency != null)
                {
                    callLogRequestModel.AgencyId = int.Parse(Agency.InterpreterBusinessId);
                    response = await agencyService.FetchAgencyReport(callLogRequestModel);
                }
                break;
            }

            var reportInfo      = userType == UserTypes.Agency ? response.AgencyReport : response.BusinessReport;
            var fee             = userType == UserTypes.Agency ? reportInfo.FeeInfos.First().FeePerMinute : reportInfo.BillInfo.First().FeePerMinute;
            var billOrFeeAmount = userType == UserTypes.Agency ? reportInfo.Report.TotalFee : reportInfo.Report.TotalBill;

            TotalCallSeconds   = reportInfo.Report.TotalCall.ToString();
            TotalPausedSeconds = reportInfo.Report.TotalPause.ToString();
            BusinessFee        = fee.ToString();
            TotalBill          = billOrFeeAmount.ToString();

            IsLoading = false;
        }