public object Get(GetBond request) { // Get the contract for the Bond by specifying the bond address var contract = AppServices.web3.Eth.GetContract(AppModelConfig.BOND.abi, AppServices.GetEcosystemAdr(request.ContractAdr).BondContractAdr); // BondListEntry entry = contract.GetFunction("get").CallDeserializingToObjectAsync<BondListEntry>(i).Result; // If no bond hash has been provided as part of the request get the corresponding hash that belongs to the provided idx if (request.Hash.IsEmpty() == true) request.Hash = AppModelConfig.convertToHex(contract.GetFunction("get").CallAsync<byte[]>(request.Idx).Result); // Retrieve the bond details from the Blockchain BondDetail bond = contract.GetFunction("dataStorage").CallDeserializingToObjectAsync<BondDetail>(request.Hash.HexToByteArray()).Result; // Set the bond hash to the requested has as specified in the request bond.Hash = request.Hash; bond.EventLogs = new List<BondEventLog>(); // If bond hash is set retrieve the logs for the bond if (AppModelConfig.isEmptyHash(bond.Hash) == false) { bond.EventLogs = ((BondLogs)this.Get( new GetBondLogs {ContractAdr = request.ContractAdr, Hash = request.Hash})).EventLogs; // Just for the Bond specific event logs reverse the order to have the events in ascending order bond.EventLogs.Reverse(); } // Return the bond return bond; }
public BondDetail getBondDetails(string bond) { bus_Bond bus = new bus_Bond(); BondDetail rs = new BondDetail(); T_BOND_STATIC item = bus.GetBondStaticByCode(bond, "CTCK"); if (item != null && item.BOND_ID > 0) { rs.Bond = item.BOND_CODE; rs.BondName = "Trái phiếu " + item.CUSTOMER_NAME; //List<sp_bond_interest_Result> rsList = bus.getBondInterestList(bond); //if (rsList.Count() > 0) //{ // rs.interestInfo = new InterestInfo[rsList.Count()]; // for (int i = 0;i <rsList.Count(); i++) { // sp_bond_interest_Result re = rsList.ElementAt(i); // InterestInfo inf = new InterestInfo(); // inf.Term = re.TERM.ToString(); // inf.Coupon = re.INTEREST.ToString(); // rs.interestInfo[i] = inf; // } //} } return(rs); }
public BondDetail GetBondDetails(string bond) { BondDetail item = new BondDetail(); try { item = corpBondsRepository.getBondDetails(bond); if (item == null) { var response = new HttpResponseMessage(HttpStatusCode.NotFound) { Content = new StringContent("Không có thông tin chi tiết trái phiếu", System.Text.Encoding.UTF8, "text/plain"), StatusCode = HttpStatusCode.NotFound }; throw new HttpResponseException(response); } } catch (Exception ex) { var response = new HttpResponseMessage(HttpStatusCode.InternalServerError) { Content = new StringContent("Có lỗi xảy ra trong quá trình lấy thông tin", System.Text.Encoding.UTF8, "text/plain"), StatusCode = HttpStatusCode.InternalServerError }; throw new HttpResponseException(response); } return(item); }