コード例 #1
0
ファイル: HQController.cs プロジェクト: ttcp112/FJ
        public List <SelectListItem> ListTaxXero(string StoreId = "", string AppId = "", string ApiURL = "")
        {
            //get list tax from xero
            List <SelectListItem> Tax             = new List <SelectListItem>();
            TaxXeroFactory        _factoryTaxXero = new TaxXeroFactory();

            try
            {
                TaxXeroRequestModels item = new TaxXeroRequestModels();
                item.StoreId           = StoreId; //Commons.XeroStoreId;
                item.AppRegistrationId = AppId;   //Commons.XeroRegistrationAppId;
                item.ApiURL            = ApiURL;
                var data = _factoryTaxXero.GetTaxXero(item);
                if (data != null && data.Any())
                {
                    foreach (var tax in data)
                    {
                        Tax.Add(new SelectListItem
                        {
                            Value = tax.TaxType,
                            Text  = tax.Name
                        });
                    }
                }
            }
            catch (Exception ex) { }
            return(Tax);
        }
コード例 #2
0
        public List <TaxXeroModels> GetTaxXero(TaxXeroRequestModels item)
        {
            List <TaxXeroModels> listdata = new List <TaxXeroModels>();

            try
            {
                var     result = (ResponseApiModels)ApiResponseXero.Post <ResponseApiModels>(item.ApiURL + "/" + Commons.XeroApi_GetTax, null, item);
                dynamic data   = result;
                if (data.Success)
                {
                    var lstZ       = data.RawData;
                    var lstContent = JsonConvert.SerializeObject(lstZ);
                    listdata = JsonConvert.DeserializeObject <List <TaxXeroModels> >(lstContent);
                }

                return(listdata);
            }
            catch (Exception e)
            {
                _logger.Error("GetTaxXero_GetList: " + e);
                return(listdata);
            }
        }