internal void AddTransferCash(double value, DateTime date, Account accOut, Account accIn) { var transfer = new TransferCash(date, accOut, accIn, value); Transfers.Add(transfer); transfer.Move(value); SaveAccounts(); SaveTransfers(); }
/// <summary> /// This endpoint shows deposits and withdrawals in the supported currencies. /// When deposits show as Advanced or Complete they are available for trading. /// This endpoint does not currently show cancelled advances, returned outgoing wires or ACH transactions, admin credits and debits, or other exceptional transaction circumstances. /// </summary> /// <param name="timeframe">time frame interval (optional): default "1d"</param> /// <param name="since">return committed data since given time (milli-seconds) (optional): default 0</param> /// <param name="limits">You can set the maximum number of transactions you want to get with this parameter</param> /// <param name="args">Add additional attributes for each exchange</param> /// <returns></returns> public override async Task <Transfers> FetchAllTransfers(string timeframe = "1d", long since = 0, int limits = 20, Dictionary <string, object> args = null) { var _result = new Transfers(); var _markets = await publicApi.LoadMarkets(); if (_markets.success == true) { privateClient.ExchangeInfo.ApiCallWait(TradeType.Private); var _params = privateClient.MergeParamsAndArgs(args); // This endpoint shows deposits and withdrawals in the supported currencies. // When deposits show as Advanced or Complete they are available for trading. // This endpoint does not currently show cancelled advances, returned outgoing wires or ACH transactions, // admin credits and debits, or other exceptional transaction circumstances. var _json_value = await privateClient.CallApiPost1Async($"/v1/transfers", _params); #if DEBUG _result.rawJson = _json_value.Content; #endif var _json_result = privateClient.GetResponseMessage(_json_value.Response); if (_json_result.success == true) { var _json_data = privateClient.DeserializeObject <List <GTransferItem> >(_json_value.Content); { var _transfers = _json_data .Where(t => t.timestamp >= since) .OrderByDescending(t => t.timestamp) .Take(limits); foreach (var _t in _transfers) { if (String.IsNullOrEmpty(_t.transactionId) == true) { _t.transactionId = (_t.timestamp * 1000).ToString(); } if (_t.transactionType == TransactionType.Deposit) { _t.toAddress = "undefined"; } _result.result.Add(_t); } } } _result.SetResult(_json_result); } else { _result.SetResult(_markets); } return(_result); }
public void Refresh() { if (Transfers != null) { Transfers.Clear(); } OnLoadData(); }
public string Delete(string AreaId) { //int num = saBll.Delete("AREA_ID='" + AreaId + "'"); SetArea sa = saBll.GetSetAreaDataById(AreaId); Transfers.ClintSendCommData(1107, "36", "", sa.Area_Terno + "&", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""); System.Threading.Thread.Sleep(1000); return("删除成功"); }
public ServerEditViewModel(ITabController tabController, ServerData data) : base(tabController) { Name = data.Code; CurrentServerData = data; TransportDictionary dic = new TransportDictionary(); Transfers = dic.Transfers.ToArray(); SelectedTransfer = Transfers.FirstOrDefault(x => x.Name == data.Protocol); OnPropertyChanged(nameof(Transfers)); }
public virtual void Commit() { Logs?.Commit(); CareAddrs?.Commit(); CareAssets?.Commit(); CareEvents?.Commit(); Transfers?.Commit(); BlockNumber?.Commit(); TransferBlockNumberList?.Commit(); }
public void AbortAllTransfers() { lock (_transferLock) { foreach (var transfer in Transfers.ToArray()) //Get an array copy as we'll be modifying the collection { transfer.RequestAbort(); } } }
protected DataTransferBase() { mainBase = new gDataTransfer(); ServiceWrapperDictionary[mainBaseType] = mainBase; applications = new Applications(); transfers = new Transfers(); }
public int UserBalance(User user) { if (user == null) { throw new Exception("No user is set"); } int balanceCredit = Transfers.Where(x => x.PayeeId == user.Id).Sum(x => x.Amount); int balanceDebit = Transfers.Where(x => x.PayerId == user.Id).Sum(x => x.Amount); return(balanceCredit - balanceDebit); }
public void Clearup() { var toClear = Transfers.Where(x => x.Transfer.Status == StatusType.Completed).Select(x => x.Transfer.TransferID).ToList(); if (!toClear.Any()) { return; } CancelTransfers(toClear); }
public static void TestGetTransfers() { Console.Write("Testing GetTransfers w/ Valid Key: "); Transfers transfers = API.GetTransfers(GOOD_KEY); ASSERT(transfers.IsValid, transfers); Console.Write("Testing GetTransfers w/ Invalid Key: "); transfers = API.GetTransfers(BAD_KEY); ASSERT(!transfers.IsValid, transfers); }
public async Task <IActionResult> Create([Bind("Id,Name,From,To")] Transfers transfers) { if (ModelState.IsValid) { _context.Add(transfers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(transfers)); }
public TransactionRequest AddTransfer(string address, ulong value) { Transfers ??= new List <TransferDto>(); Transfers.Add(new TransferDto { Address = address, Value = value, }); return(this); }
public string UserNameResponses(int id, Transfers transfers) { if (transfers.account_from == id) { return($"{transfers.transfer_id} \t {(FromTo)transfers.transfer_type_id}: {TransferService.GetUserById(transfers.account_to).Username} \t {transfers.Amount:c}"); } else { return($"{transfers.transfer_id} \t {(FromTo)transfers.transfer_type_id}: {TransferService.GetUserById(transfers.account_from).Username} \t {transfers.Amount:c}"); } }
public bool TransferRequest(Transfers transfer) { if (transfer.Amount <= accountDAO.GetBalance(transfer.AccountFrom)) { return(transfersDAO.TransferRequest(transfer)); } else { return(false); } }
private void AddDownloadHandle(TransferHandle h) { Invoke(() => Transfers.Add(h)); h.TransferEnded += (s1, e1) => { if (Transfers.All(t => t.Progress >= 100)) { Status = ConnectivityStatus.Online; } }; }
public bool ApproveRequest(int statusSelection, Transfers transfers) { RestRequest request = new RestRequest(API_BASE_URL + "transfer/" + statusSelection); client.Authenticator = new JwtAuthenticator(UserService.GetToken()); request.AddJsonBody(transfers); IRestResponse response = client.Put(request); CheckResponse(response); return(true); }
private Transfers GetTransfersFromReader(SqlDataReader reader) { Transfers t = new Transfers() { TransferId = Convert.ToInt32(reader["transfer_id"]), AccountFrom = Convert.ToInt32(reader["account_from"]), AccountTo = Convert.ToInt32(reader["account_to"]), Amount = Convert.ToDecimal(reader["amount"]), }; return(t); }
private DownloadTransfer GetCachedTransfer(string transferId, bool throwExceptionIfNotFound) { DownloadTransfer transfer; var status = Transfers.TryGetValue(transferId, out transfer); if (!status && throwExceptionIfNotFound) { throw new UnknownTransferException(String.Format("Unknown transfer ID: {0}.", transferId)); } return(transfer); }
public void ShuffleTransfers(IEnumerable <TransferBase> newOrder) { lock (_transferLock) { var newSet = newOrder.Union(Transfers); if (Transfers.Count() != newSet.Count()) { throw new ArgumentException("newOrder does not include all of the existing transfers"); } Transfers = new ObservableCollection <TransferBase>(newSet); } }
public ActionResult Edit([Bind(Include = "Id,TransferDate,AccountFrom,AccountTo,Amount")] Transfers transfers) { if (ModelState.IsValid) { db.Entry(transfers).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountFrom = new SelectList(db.Accounts, "Id", "AccountName", transfers.AccountFrom); ViewBag.AccountTo = new SelectList(db.Accounts, "Id", "AccountName", transfers.AccountTo); return(View(transfers)); }
private void ExecuteclearCompleted() { foreach (var item in Transfers.ToList()) { var queue = item.Value.Queue; if (queue.Progress == 100 || !queue.Running) { Transfers.Remove(item); } } }
private void ExecutePauseTransfer(string id) { if (transferClient == null) { return; } Transfer transfer = Transfers.Single(i => i.Value.Id == id).Value; var queue = transfer.Queue; queue.Client.PauseTransfer(queue); }
/// <summary> /// currency별 출금 리스트 조회 /// </summary> /// <param name="currency_name">base coin or quote coin name</param> /// <param name="timeframe">time frame interval (optional): default "1d"</param> /// <param name="since">return committed data since given time (milli-seconds) (optional): default 0</param> /// <param name="limits">You can set the maximum number of transactions you want to get with this parameter</param> /// <param name="args">Add additional attributes for each exchange</param> /// <returns></returns> public override async ValueTask <Transfers> FetchTransfersAsync(string currency_name, string timeframe = "1d", long since = 0, int limits = 20, Dictionary <string, object> args = null) { var _result = new Transfers(); var _currency_id = await publicApi.LoadCurrencyIdAsync(currency_name); if (_currency_id.success == true) { privateClient.ExchangeInfo.ApiCallWait(TradeType.Private); var _timestamp = privateClient.ExchangeInfo.GetTimestamp(timeframe); var _timeframe = privateClient.ExchangeInfo.GetTimeframe(timeframe); var _params = new Dictionary <string, object>(); { _params.Add("currency", _currency_id.result); _params.Add("limit", limits); privateClient.MergeParamsAndArgs(_params, args); } var _json_value = await privateClient.CallApiGet1Async("/withdraws", _params); #if RAWJSON _result.rawJson = _json_value.Content; #endif var _json_result = privateClient.GetResponseMessage(_json_value.Response); if (_json_result.success == true) { var _json_data = privateClient.DeserializeObject <List <UTransferItem> >(_json_value.Content); { var _transfers = _json_data .Where(t => t.timestamp >= since) .OrderByDescending(t => t.timestamp) .Take(limits); foreach (var _t in _transfers) { _result.result.Add(_t); } } } _result.SetResult(_json_result); } else { _result.SetResult(_currency_id); } return(_result); }
public ActionResult EditUserForm(UserInfo ui, string oldname) { if (ui.RoleId == null || ui.RoleId == "") { return(JavaScript("editFormError('用户角色不能为空');")); } if (ui.EnterId != null && ui.EnterId != "") { DeptInfo di = deptInfoBll.GetDeptInfo(ui.EnterId); ui.UserDeptcode = di.Businessdivisioncode; } else { return(JavaScript("editFormError('所属企业不正确或者为空');")); } ui.UserFunct = "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"; string[] arr = ui.UserFunct.Split(','); if (ui.UserFunct1 == "InstallCar") { arr[19] = "1"; } if (ui.UserFunct2 == "SendCmd") { arr[18] = "1"; } ui.UserFunct = string.Join(",", arr); if (ui.UserLname != oldname) { UserInfoBLL userbll = new UserInfoBLL(); ui.UserLname = ui.UserLname.Trim(); UserInfo uiObj = userbll.GetUserByLName(ui, out uiObj); if (uiObj != null) { return(JavaScript("editFormError('该用户名已经存在');")); } } int k = userInfoBll.Update(ui); new LogMessage().Save("ID:" + ui.UserId + "。"); if (k > 0) { //刷新用户 Transfers.ClintSendCommData(1160, "1108", "", "", "", "", "", "", "", "", "", "1", "1", "", "", "", "", "", ""); return(JavaScript("editFormSucceed();")); } else { return(JavaScript("editFormError();")); } }
/// <summary> /// Get a history of all of your wallet transactions (deposits, withdrawals, PNL). /// </summary> /// <param name="currency"></param> /// <param name="count">Number of results to fetch.</param> /// <param name="start">Starting point for results.</param> /// <returns></returns> public async ValueTask <Transfers> GetWalletHistory(string currency, long count, long start = 0) { var _result = new Transfers(); var _params = new Dictionary <string, object>(); { _params.Add("currency", currency); if (count > 0) { _params.Add("count", count); } _params.Add("offset", start); } var _response = await privateClient.CallApiGet2Async("/api/v2/private/get_transfers", _params); if (_response != null) { #if RAWJSON _result.rawJson = _response.Content; #endif if (_response.IsSuccessful == true) { var _transfer = privateClient.DeserializeObject <DRResults <DTransfer> >(_response.Content); if (_transfer.result.count > 0) { foreach (var _t in _transfer.result.data) { _result.result.Add(new TransferItem { amount = _t.amount, confirmations = 0, currency = _t.currency, isCompleted = _t.state == "confirmed", timestamp = _t.timestamp, toAddress = _t.toAddress, transactionType = TransactionType.Transfer }); } _result.SetSuccess(); } } else { var _message = privateClient.GetResponseMessage(_response); _result.SetFailure(_message.message); } } return(_result); }
private void TransferClient_Stopped(object sender, TransferQueue queue) { var keyValuePair = Transfers.Single(i => i.Value.Id == queue.Id.ToString()); keyValuePair.Value.State = TransferState.Stopped; if (transferClient == null) { return; } ProgressOverall = transferClient.GetOverallProgress(); }
public static Transaction makeTransferTransaction(string tokentype, string fromaddress, string toaddress, string value, string privatekey) { var state = new State(); state.from = fromaddress; state.to = toaddress; var valueToSend = BigInteger.Parse(value).ToString(); state.value = valueToSend; var transfer = new Transfers(); var states = new List <State>(); states.Add(state); transfer.states = states; var contract = new Contract(); contract.address = ONT_CONTRACT; contract.method = "transfer"; contract.args = transfer.serialize(); var tx = new Transaction(); tx.version = 0x00; tx.type = Crypto.HexToInteger(Common.Enums.TxType.Invoke); tx.nonce = Crypto.ByteArrayToHexString(Crypto.GetSecureRandomByteArray(4)); //inovke var code = ""; //TODO: change with token type code += contract.serialize(); var vmcode = new VmCode(); vmcode.code = code; vmcode.vmType = VmType.NativeVM; var invokeCode = new InvokeCode(); invokeCode.code = vmcode; tx.payload = invokeCode; if (privatekey != null) { tx = signTransaction(tx, privatekey); } return(tx); }
private TransferBase GetFirstTransfer(bool preferCurrentTransfer = false) { lock (_transferLock) //Acquire the transfer lock { if (preferCurrentTransfer) { return(Transfers.Where(x => (x.Status != Interfaces.TransferStatus.Blocked)).FirstOrDefault()); } else { return(Transfers.Where(x => (x.Status != Interfaces.TransferStatus.Blocked) || (x.CanCopy)).FirstOrDefault()); } } }
// GET: Transfers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Transfers transfers = db.Transfers.Find(id); if (transfers == null) { return(HttpNotFound()); } return(View(transfers)); }
public virtual void CheckTransfers(Transfers trans) { trans.CheckTransfers(); }
public static void ShowResults(string title, Transfers[] transactions) { var count = 0; ShowHeader(title, transactions.Count()); foreach (var trans in transactions) { Console.WriteLine( "{0} {1} {2} {3}", trans.SourceAccountNumber.PadRight(16), trans.DestinationAccountNumber.PadRight(16), trans.TransactionTypeId, trans.Amount.ToString("C") ); count += 1; if (count > 5) { Console.WriteLine(); return; } } Console.WriteLine(); }
public static void GoofyCreateAndTansferCoin_SouldHaveValidCoin() { //Arrange var goofySignature = new Signature(256); Global.GoofyPk = goofySignature.PublicKey; var destiny = new Signature(256); var goofyTransInfo = new TransferInfoCreateCoin(destiny.PublicKey, Counter.Coin); var transHashed = new TransferHashed(goofyTransInfo); var goofyList = new TransferListCreateCoin(transHashed); //Act var trans = new Transfers(transHashed, goofyList); //Assert try { if (!trans.isChainNotNull()) throw new Exception("Transfer chain be informed."); if (!trans.isInfoNotNull()) throw new Exception("Transfer informations must be informed."); if (!((TransferInfoCreateCoin)trans.Info).isValidCoinId()) throw new Exception("Coin id greater than 0."); if (!((TransferInfoCreateCoin)trans.Info).isDestinyPkNotNull()) throw new Exception("Destiny public key must be informed."); if (!trans.isHashNotNull()) throw new Exception("Transfer hash must be informed."); if (!trans.isValidHash()) throw new Exception("Invalid transfer hash."); //valid virtua method + all the balidations above trans.CheckTransfer(); } catch (Exception e) { Console.WriteLine(e.Message); } }
public void AddTransfer(Transfers trans) { CheckTransfers(trans); wallet.Add(trans); }