Beispiel #1
0
        public DPPVATBankExpenditureNoteViewModel GetNoKasBank(long donos)
        {
            var    param          = new StringContent(JsonConvert.SerializeObject(donos), Encoding.UTF8, "application/json");
            string expenditureUri = APIEndpoint.Finance + $"dpp-vat-bank-expenditure-notes/invoice/" + donos;
            //string queryUri = "?dateFrom=" + datefrom + "&dateTo=" + dateTo;

            //string uri = expenditureUri + queryUri;

            IHttpClientService httpClient = (IHttpClientService)serviceProvider.GetService(typeof(IHttpClientService));
            var httpResponse = httpClient.SendAsync(HttpMethod.Get, expenditureUri, param).Result;

            if (httpResponse.IsSuccessStatusCode)
            {
                var content = httpResponse.Content.ReadAsStringAsync().Result;
                Dictionary <string, object> result = JsonConvert.DeserializeObject <Dictionary <string, object> >(content);

                DPPVATBankExpenditureNoteViewModel viewModel;
                if (result.GetValueOrDefault("data") == null)
                {
                    viewModel = new DPPVATBankExpenditureNoteViewModel();
                }
                else
                {
                    viewModel = JsonConvert.DeserializeObject <DPPVATBankExpenditureNoteViewModel>(result.GetValueOrDefault("data").ToString());
                }
                return(viewModel);
            }
            else
            {
                return(new DPPVATBankExpenditureNoteViewModel());
            }
        }
Beispiel #2
0
        public Dictionary <string, object> GetResultFormatterOk(DPPVATBankExpenditureNoteViewModel dPPVATBankExpenditureNoteViewModel)
        {
            var data = dPPVATBankExpenditureNoteViewModel;

            Dictionary <string, object> result =
                new ResultFormatter("1.0", General.OK_STATUS_CODE, General.OK_MESSAGE)
                .Ok(data);

            return(result);
        }
Beispiel #3
0
        public DPPVATBankExpenditureNoteViewModel GetNewData()
        {
            long nowTicks = DateTimeOffset.Now.Ticks;

            var data = new DPPVATBankExpenditureNoteViewModel
            {
                Amount            = 10,
                AmountDetail      = 100,
                ExpenditureDate   = DateTimeOffset.Now,
                DPP               = 100,
                Difference        = 10,
                DeliveryOrdersNo  = "Dono123",
                CurrencyRate      = 10,
                ExpenditureNoteNo = "ExpenditureNoteNo123",
                CategoryName      = "CategoryName",
            };

            return(data);
        }
Beispiel #4
0
        public string GetResultFormatterOkString(DPPVATBankExpenditureNoteViewModel dPPVATBankExpenditureNoteViewModel)
        {
            var result = GetResultFormatterOk(dPPVATBankExpenditureNoteViewModel);

            return(JsonConvert.SerializeObject(result));
        }