private void MoveToArchive(TransmittalVM trans) { var file = trans.File; file.MoveTo(ArchivePath(file)); _ui.Send(x => Archive.Add(file.Name), null); if (Archive.Count > MAX_ARCHIVE) { _ui.Send(x => Archive.RemoveAt(0), null); } //OnGoing.Remove(trans); _ui.Send(x => OnGoing.Remove(trans), null); //Pending.Remove(file); _ui.Send(x => Pending.Remove(file), null); }
private void SetReady() { // ReSendPendingRpc foreach (var rpc in Pending.Values) { if (NotAutoResend.ContainsKey(rpc)) { continue; } if (rpc.Send(_Leader?.Socket)) { // 这里发送失败,等待新的 LeaderIs 通告再继续。 Pending.TryRemove(rpc, out var _); } } }
public Task <T> ConsumeAsync(CancellationToken cancellationToken = default) { if (cancellationToken.IsCancellationRequested) { return(Task.FromCanceled <T>(cancellationToken)); } if (_disposeToken.IsDisposed) { return(Task.FromCanceled <T>(_disposeToken.CancellationToken)); } Pending pending; TaskCompletionSource <T> pendingTcs; lock (_syncObj) { Debug.Assert(_pendingTasks.Count == 0 || _firstAvailablePriority == _maxPriority); if (_firstAvailablePriority < _maxPriority) { var queue = _queues[_firstAvailablePriority]; var result = queue[0]; queue.RemoveAt(0); if (queue.Count == 0) { do { _firstAvailablePriority++; } while (_firstAvailablePriority < _maxPriority && _queues[_firstAvailablePriority].Count == 0); } return(Task.FromResult(result)); } pendingTcs = new TaskCompletionSource <T>(TaskCreationOptions.RunContinuationsAsynchronously); pending = new Pending(pendingTcs, _syncObj); _pendingTasks.Enqueue(pending); } RegisterCancellation(_disposeToken.CancellationToken, pending, pendingTcs); if (cancellationToken.CanBeCanceled) { RegisterCancellation(cancellationToken, pending, pendingTcs); } return(pendingTcs.Task); }
SendForWait <TArgument, TResult>( Rpc <TArgument, TResult> rpc, bool autoResend = true, int timeout = -1) where TArgument : Bean, new() where TResult : Bean, new() { if (timeout < 0) { timeout = RaftConfig.AppendEntriesTimeout + 1000; } var future = new TaskCompletionSource <Rpc <TArgument, TResult> >(); if (autoResend) { var tmp = _Leader; if (null != tmp && tmp.IsHandshakeDone && rpc.Send(tmp.Socket, (p) => SendForWaitHandle(future, rpc), timeout)) { return(future); } rpc.ResponseHandle = (p) => SendForWaitHandle(future, rpc); rpc.Timeout = timeout; Pending.TryAdd(rpc, rpc); return(future); } // 记录不要自动发送的请求。 NotAutoResend[rpc] = rpc; if (false == rpc.Send(_Leader?.Socket, (p) => { NotAutoResend.TryRemove(p, out var _); return(SendForWaitHandle(future, rpc)); }, timeout)) { future.TrySetException(new Exception("Send Failed.")); } ; return(future); }
/// <summary> /// Sends a <see cref="IOperation" /> to the Couchbase Server using the Memcached protocol using async/await. /// </summary> /// <param name="operation">The <see cref="IOperation" /> to send.</param> /// /// <param name="tcs">The <see cref="TaskCompletionSource{T}"/> the represents the task to await on.</param> /// <param name="cts">The <see cref="CancellationTokenSource"/> for cancellation.</param> /// <returns> /// An <see cref="Task{IOperationResult}" /> object representing the asynchronous operation. /// </returns> public override async Task <IOperationResult> SendWithRetryAsync(IOperation operation, TaskCompletionSource <IOperationResult> tcs = null, CancellationTokenSource cts = null) { tcs = tcs ?? new TaskCompletionSource <IOperationResult>(); cts = cts ?? new CancellationTokenSource(OperationLifeSpan); var parentSpan = Tracer.StartParentSpan(operation, ConfigInfo.BucketName); try { operation.Completed = CallbackFactory.CompletedFuncWithRetryForMemcached( this, Pending, ClusterController, tcs, cts.Token); Pending.TryAdd(operation.Opaque, operation); IServer server; var attempts = 0; while ((server = GetServer(operation.Key)) == null) { if (attempts++ > 10) { throw new TimeoutException("Could not acquire a server."); } await Task.Delay((int)Math.Pow(2, attempts)).ContinueOnAnyContext(); } await server.SendAsync(operation).ContinueOnAnyContext(); } catch (Exception e) { tcs.TrySetResult(new OperationResult { Id = operation.Key, Exception = e, Status = ResponseStatus.ClientFailure }); } finally { parentSpan.Finish(); } return(await tcs.Task.ContinueOnAnyContext()); }
public static Map <ByteString, BigInteger> StructForeach() { var a1 = new Pending(); a1.user = "******"; a1.amount = 1; var a2 = new Pending(); a2.user = "******"; a2.amount = 2; Pending[] list = new Pending[] { a1, a2 }; Map <ByteString, BigInteger> result = new Map <ByteString, BigInteger>(); foreach (var item in list) { result[item.user] = item.amount; } return(result); }
private void Button_Click(object sender, RoutedEventArgs e) { string content = (sender as Button).Content.ToString(); // Tab Logic if (content.Equals("Home")) { Home home = new Home(); this.NavigationService.Navigate(home); } else if (content.Equals("Upload")) { Upload upload = new Upload(); this.NavigationService.Navigate(upload); } else { Pending pending = new Pending(); this.NavigationService.Navigate(pending); } }
public FriendModel GetUserById(string userId) { Func <FriendModel, bool> predicate = user => user.Id.Equals(userId); var result = Friends.FirstOrDefault(predicate); if (result == null) { result = Pending.FirstOrDefault(predicate); } if (result == null) { result = Blocked.FirstOrDefault(predicate); } if (result == null) { result = Requested.FirstOrDefault(predicate); } return(result); }
private async void Button_Clicked(object sender, EventArgs e) { try { MaterialControls control = new MaterialControls(); control.ShowLoading("Registrando"); string date = fech.Date.ToString("yy/MM/dd"); string hora = Convert.ToString(hour.Time); Pending pacientes = new Pending(); pacientes.fecha = date; pacientes.hora = hora; pacientes.idpaciente = Convert.ToInt32(id); pacientes.idempleado = ids; pacientes.tipo = 2; HttpClient client = new HttpClient(); string controlador = "/Api/pending_quotes/create.php"; client.BaseAddress = new Uri(baseurl); string json = JsonConvert.SerializeObject(pacientes); var content = new StringContent(json, Encoding.UTF8, "application/json"); var response = await client.PostAsync(controlador, content); if (response.IsSuccessStatusCode) { control.ShowAlert("Enviado!!", "Exito", "Ok"); } else { control.ShowAlert("Ocurrio un error al registrar!!", "Error", "Ok"); } } catch (Exception ex) { await DisplayAlert("Ocurrio un error", "Error: " + ex, "Ok"); } }
public ShardManager(IRequestRepo repo) { var httpsettings = repo.HttpSettings; _metaServer = new Cached <ServerRequestResult>(old => { Logger.Debug("Requesting new meta server"); var server = new MobMetaServerRequest(httpsettings).MakeRequestAsync().Result; return(server); }, value => TimeSpan.FromSeconds(MetaServerExpiresSec)); BannedShards = new Cached <List <ShardInfo> >(old => new List <ShardInfo>(), value => TimeSpan.FromMinutes(2)); //CachedShards = new Cached<Dictionary<ShardType, ShardInfo>>(old => new ShardInfoRequest(httpsettings, auth).MakeRequestAsync().Result.ToShardInfo(), // value => TimeSpan.FromSeconds(ShardsExpiresInSec)); CachedShards = new Cached <Dictionary <ShardType, ShardInfo> >(old => repo.GetShardInfo1(), value => TimeSpan.FromSeconds(ShardsExpiresInSec)); DownloadServersPending = new Pending <Cached <ServerRequestResult> >(8, () => new Cached <ServerRequestResult>(old => { var server = new GetServerRequest(httpsettings).MakeRequestAsync().Result; Logger.Debug($"Download server changed to {server.Url}"); return(server); }, value => TimeSpan.FromSeconds(DownloadServerExpiresSec) )); WeblinkDownloadServersPending = new Pending <Cached <ServerRequestResult> >(8, () => new Cached <ServerRequestResult>(old => { var server = new WeblinkGetServerRequest(httpsettings).MakeRequestAsync().Result; Logger.Debug($"weblink Download server changed to {server.Url}"); return(server); }, value => TimeSpan.FromSeconds(DownloadServerExpiresSec) )); }
/// <summary> /// Sends a <see cref="IOperation" /> to the Couchbase Server using the Memcached protocol using async/await. /// </summary> /// <param name="operation">The <see cref="IOperation" /> to send.</param> /// <param name="tcs">The <see cref="TaskCompletionSource{T}"/> the represents the task to await on.</param> /// <param name="cts">The <see cref="CancellationTokenSource"/> for cancellation.</param> /// <returns> /// An <see cref="Task{IOperationResult}" /> object representing the asynchronous operation. /// </returns> public override Task <IOperationResult> SendWithRetryAsync(IOperation operation, TaskCompletionSource <IOperationResult> tcs = null, CancellationTokenSource cts = null) { tcs = tcs ?? new TaskCompletionSource <IOperationResult>(); cts = cts ?? new CancellationTokenSource(OperationLifeSpan); try { var keyMapper = ConfigInfo.GetKeyMapper(); var vBucket = (IVBucket)keyMapper.MapKey(operation.Key); operation.VBucket = vBucket; operation.Completed = CallbackFactory.CompletedFuncWithRetryForCouchbase( this, Pending, ClusterController, tcs, cts.Token); Pending.TryAdd(operation.Opaque, operation); IServer server; var attempts = 0; while ((server = vBucket.LocatePrimary()) == null) { if (attempts++ > 10) { throw new TimeoutException("Could not acquire a server."); } Thread.Sleep((int)Math.Pow(2, attempts)); } server.SendAsync(operation).ConfigureAwait(false); } catch (Exception e) { tcs.TrySetResult(new OperationResult { Exception = e, Status = ResponseStatus.ClientFailure }); } return(tcs.Task); }
public ActionResult AddToQueue(int copyId, int bookId) { try { if (!IsLogged()) { return(RedirectToAction("Login", "Account")); } using (ISession session = database.MakeSession()) { var copy = session.Get <Copy>(copyId); var reader = GetReader(session); var timeLimit = 3; //@TODO zmienic na pobieranie z limitow~!!!! var checkPending = session.QueryOver <Pending>().Where(Restrictions.Eq("Copy.Id", copyId)).List(); var pending = new Pending() { Copy = copy, Reader = reader, DateFrom = DateTime.Today.ToString("dd.MM.yyyy"), DateTo = DateTime.Today.AddDays(timeLimit).ToString("dd.MM.yyyy") }; using (ITransaction transaction = session.BeginTransaction()) { session.SaveOrUpdate(pending); session.Flush(); transaction.Commit(); } } return(RedirectToAction("Details", new { id = bookId, added = true })); } catch (Exception) { return(RedirectToAction("Index")); } }
protected void btnAgentProvider_Click(object sender, EventArgs e) { User u = Profile.AccountInfo; Company c = u.Company; if (string.IsNullOrEmpty(c.Regcode) || string.IsNullOrEmpty(c.Orgcode) || string.IsNullOrEmpty(c.Phone)) { throw new HHException(ExceptionType.OperationError, "操作失败,进行申请前请进入【公司信息】页完善公司相关信息,包括【联系电话】,【组织结构代码】,【工商注册号】等。"); } else { Pending p = new Pending(); p.CompanyID = c.CompanyID; switch ((sender as Button).PostBackUrl) { case "#Agent": p.CompanyType = CompanyType.Agent | c.CompanyType; break; case "#Provider": p.CompanyType = CompanyType.Provider | c.CompanyType; break; } p.CreateTime = DateTime.Now; p.CreateUser = u.UserID; p.DenyReason = string.Empty; p.Status = PendingStatus.Pending; p.UpdateTime = DateTime.Now; p.UpdateUser = u.UserID; bool r = Pendings.PendingAdd(p); if (r) { BindCompanyType(); } else { throw new HHException(ExceptionType.OperationError, "操作失败,申请过程中发生了错误,请联系管理员!"); } } }
void BindCompanyType() { if (Profile.AccountInfo.UserType == UserType.InnerUser) { mbNC.ShowMsg("内部用户无法查看客户状态!", System.Drawing.Color.Red); pnlManager.Visible = false; } else { mbNC.HideMsg(); User u = Profile.AccountInfo; AdaptButton(u.Company.CompanyType); ltComType.Text = GetCompantType(u.Company.CompanyType); Pending pend = Pendings.PendingGet(u.CompanyID); if (pend == null) { ltPendingCom.Text = "--"; } else { ltPendingCom.Text = GetCompantType(pend.CompanyType); ltStatus.Text = GetStatus(pend.Status); if (pend.Status == PendingStatus.Deny && !string.IsNullOrEmpty(pend.DenyReason)) { ltDenyUser.Text = "<span style='color:#ff0000'>" + Users.GetUser(pend.UpdateUser).DisplayName + ": </span>" + pend.DenyReason; } if (pend.Status == PendingStatus.Pending) { btnAgent.Visible = false; btnProvider.Visible = false; } } } }
/// <summary> /// 发送Rpc请求。 /// 如果 autoResend == true,那么总是返回成功。内部会在需要的时候重发请求。 /// 如果 autoResend == false,那么返回结果表示是否成功。 /// </summary> /// <typeparam name="TArgument"></typeparam> /// <typeparam name="TResult"></typeparam> /// <param name="rpc"></param> /// <param name="handle"></param> /// <param name="autoResend"></param> /// <param name="timeout"></param> /// <returns></returns> public bool Send <TArgument, TResult>( Rpc <TArgument, TResult> rpc, Func <Protocol, int> handle, bool autoResend = true, int timeout = -1) where TArgument : Bean, new() where TResult : Bean, new() { if (timeout < 0) { timeout = RaftConfig.AppendEntriesTimeout + 1000; } if (autoResend) { var tmp = _Leader; if (null != tmp && tmp.IsHandshakeDone && rpc.Send(tmp.Socket, handle, timeout)) { return(true); } rpc.ResponseHandle = handle; rpc.Timeout = timeout; Pending.TryAdd(rpc, rpc); return(true); } // 记录不要自动发送的请求。 NotAutoResend[rpc] = rpc; return(rpc.Send(_Leader?.Socket, (p) => { NotAutoResend.TryRemove(p, out var _); return handle(p); }, timeout)); }
public Task Import(Stream xmlData, bool append) { return(Task.Run(() => { var import = EntitySerializer.Deserialize <ToDoItem[]>(xmlData); if (append) { _db.Todo.Save(import); } else { _db.Todo.DeleteAll(); _db.Todo.Save(import); } _application.CurrentDispatcher.Invoke(() => { Pending.Clear(); Pending.AddRange(_db.Todo.GetUncompleted()); Completed.Clear(); Completed.AddRange(_db.Todo.GetCompleteded()); }); })); }
/// <summary> /// 写待办信息 /// </summary> /// <param name="actorID">参与者</param> /// <param name="executeContext"></param> public void WritePending(string actorID, ExecutingContext executeContext) { var node = GetCurrentNode(executeContext.Instance.InstanceID); string cateCode = (String)executeContext.Data.CateCode; string instanceID = (String)executeContext.Instance.InstanceID; Category model = new CategoryService().Query() .FirstOrDefault(cate => cate.NID == cateCode); Pending entry = new Pending { NID = Guid.NewGuid().ToString(), ActorID = actorID, InstanceID = instanceID, NodeID = node.NID, Url = model.Url, CreateDateTime = DateTime.Now, NodeName = node.Name, CateCode = cateCode, CateName = model.Name }; CommandBus.Dispatch <Pending>(new CreatePending(), entry); }
private void RemoveUserFromMemory(FriendModel user) { if (Friends.Contains(user)) { Friends.Remove(user); UserFriendsUpdatedEvent?.Invoke(); } if (Pending.Contains(user)) { Pending.Remove(user); PendingUsersUpdatedEvent?.Invoke(); } if (Requested.Contains(user)) { Requested.Remove(user); RequestedUsersUpdatedEvent?.Invoke(); } if (Blocked.Contains(user)) { Blocked.Remove(user); BlockedUsersUpdatedEvent?.Invoke(); } }
/// <summary> /// Sends a <see cref="IOperation{T}" /> to the Couchbase Server using the Memcached protocol using async/await. /// </summary> /// <typeparam name="T">The Type of the body of the request.</typeparam> /// <param name="operation">The <see cref="IOperation{T}" /> to send.</param> /// <param name="tcs">The <see cref="TaskCompletionSource{T}"/> the represents the task to await on.</param> /// <param name="cts">The <see cref="CancellationTokenSource"/> for cancellation.</param> /// <returns> /// An <see cref="Task{IOperationResult}" /> object representing the asynchronous operation. /// </returns> public override Task <IOperationResult <T> > SendWithRetryAsync <T>(IOperation <T> operation, TaskCompletionSource <IOperationResult <T> > tcs = null, CancellationTokenSource cts = null) { tcs = tcs ?? new TaskCompletionSource <IOperationResult <T> >(); cts = cts ?? new CancellationTokenSource(OperationLifeSpan); try { operation.Completed = CallbackFactory.CompletedFuncWithRetryForMemcached( this, Pending, ClusterController, tcs, cts.Token); Pending.TryAdd(operation.Opaque, operation); IServer server; var attempts = 0; while ((server = GetServer(operation.Key)) == null) { if (attempts++ > 10) { throw new TimeoutException("Could not acquire a server."); } Thread.Sleep((int)Math.Pow(2, attempts)); } server.SendAsync(operation).ConfigureAwait(false); } catch (Exception e) { tcs.TrySetResult(new OperationResult <T> { Id = operation.Key, Exception = e, Status = ResponseStatus.ClientFailure }); } return(tcs.Task); }
void BindCompany() { int comId = int.Parse(Request.QueryString["CompanyID"]); int pId = int.Parse(Request.QueryString["PendingID"]); btnUpdateQualify.PostBackUrl = "CompanyQualify.aspx?ID=" + comId; btnUpdateDeposit.PostBackUrl = "CompanyDeposit.aspx?ID=" + comId; btnUpdateCredit.PostBackUrl = "CompanyCredit.aspx?ID=" + comId; Company c = Companys.GetCompany(comId); ltCompanyName.Text = c.CompanyName; ltAddress.Text = c.Address; ltFax.Text = c.Fax; ltOrgCode.Text = c.Orgcode; ltPhone.Text = c.Phone; ltRegCode.Text = c.Regcode; try { ltRegion.Text = Areas.GetArea(c.CompanyRegion).RegionName; } catch { ltRegion.Text = "--"; } ltRemark.Text = c.Remark; if (!string.IsNullOrEmpty(c.Website)) { ltWebSite.Text = "<a href='" + c.Website + "' target='_blank'>" + c.Website + "</a>"; } else { ltWebSite.Text = "--"; } ltZipCode.Text = c.Zipcode; ltCompanyType.Text = GetCompanyType(c.CompanyType); Pending p = Pendings.PendingGetById(pId); ltPendingType.Text = GetCompanyType(p.CompanyType); }
public ShardManager(HttpCommonSettings httpsettings, IAuth auth) { _metaServer = new Cached <Requests.WebBin.MobMetaServerRequest.Result>(old => { Logger.Debug("Requesting new meta server"); var server = new Requests.WebBin.MobMetaServerRequest(httpsettings).MakeRequestAsync().Result; return(server); }, value => TimeSpan.FromSeconds(MetaServerExpiresSec)); BannedShards = new Cached <List <ShardInfo> >(old => new List <ShardInfo>(), value => TimeSpan.FromMinutes(2)); CachedShards = new Cached <Dictionary <ShardType, ShardInfo> >(old => new ShardInfoRequest(httpsettings, auth).MakeRequestAsync().Result.ToShardInfo(), value => TimeSpan.FromSeconds(ShardsExpiresInSec)); DownloadServersPending = new Pending <Cached <Requests.WebBin.ServerRequest.Result> >(8, () => new Cached <Requests.WebBin.ServerRequest.Result>(old => { var server = new Requests.WebBin.GetServerRequest(httpsettings).MakeRequestAsync().Result; Logger.Debug($"Download server changed to {server.Url}"); return(server); }, value => TimeSpan.FromSeconds(DownloadServerExpiresSec) )); WeblinkDownloadServersPending = new Pending <Cached <Requests.WebBin.ServerRequest.Result> >(8, () => new Cached <Requests.WebBin.ServerRequest.Result>(old => { var server = new Requests.WebBin.WeblinkGetServerRequest(httpsettings).MakeRequestAsync().Result; Logger.Debug($"weblink Download server changed to {server.Url}"); return(server); }, value => TimeSpan.FromSeconds(DownloadServerExpiresSec) )); }
private static List<Pending> GetPendingDocuments(DateTime initialDate, DateTime finalDate, bool receivables) { List<Pending> output = new List<Pending>(); if (!InitializeCompany()) return output; StdBELista pendingDocumentsQuery = PriEngine.Engine.Consulta( "SELECT ValorPendente, Moeda, TipoDoc, Entidade, TipoEntidade, Estado, DataVenc, DataDoc " + "FROM Pendentes " + "WHERE TipoEntidade = " + (receivables ? "'C'" : "'F'") + " AND DataDoc >= '" + initialDate.ToString("yyyyMMdd") + "' AND DataDoc <= '" + finalDate.ToString("yyyyMMdd") + "' " + "ORDER BY DataDoc" ); while (!pendingDocumentsQuery.NoFim()) { Pending pendingDocument = new Pending(); pendingDocument.PendingValue = new Money(pendingDocumentsQuery.Valor("ValorPendente"), pendingDocumentsQuery.Valor("Moeda")); pendingDocument.DocumentDate = pendingDocumentsQuery.Valor("DataDoc"); pendingDocument.DocumentType = pendingDocumentsQuery.Valor("TipoDoc"); pendingDocument.DueDate = pendingDocumentsQuery.Valor("DataVenc"); pendingDocument.Entity = pendingDocumentsQuery.Valor("Entidade"); pendingDocument.EntityType = pendingDocumentsQuery.Valor("TipoEntidade"); pendingDocument.State = pendingDocumentsQuery.Valor("Estado"); output.Add(pendingDocument); pendingDocumentsQuery.Seguinte(); } return output; }
public void WriteKey(string key) { Write(key); _output.Write(": "); _pending = Pending.None; }
public void Write(bool value) { WritePending(); _output.Write(value ? "true" : "false"); _pending = Pending.CommaNewLineAndIndent; }
internal override void MapResponse(Element response) { base.MapResponse(response); string category = response.GetValue <string>("TableCategory") ?? ""; if (category == null) { category = LastCategory; } var fieldValues = new Dictionary <string, string>(); foreach (Element field in response.GetAll("Field")) { fieldValues.Add(field.GetValue <string>("Key"), field.GetValue <string>("Value")); } if (category.EndsWith("SUMMARY", StringComparison.OrdinalIgnoreCase)) { var summary = new SummaryResponse { SummaryType = MapSummaryType(category), Count = fieldValues.GetValue <int>("Count"), Amount = fieldValues.GetAmount("Amount"), TotalAmount = fieldValues.GetAmount("Total Amount"), AuthorizedAmount = fieldValues.GetAmount("Authorized Amount"), AmountDue = fieldValues.GetAmount("Balance Due Amount"), }; if (category.Contains("APPROVED")) { if (Approved == null) { Approved = new Dictionary <SummaryType, SummaryResponse>(); } Approved.Add(summary.SummaryType, summary); } else if (category.StartsWith("PENDING")) { if (Pending == null) { Pending = new Dictionary <SummaryType, SummaryResponse>(); } Pending.Add(summary.SummaryType, summary); } else if (category.StartsWith("DECLINED")) { if (Declined == null) { Declined = new Dictionary <SummaryType, SummaryResponse>(); } Declined.Add(summary.SummaryType, summary); } } else if (category.EndsWith("RECORD", StringComparison.OrdinalIgnoreCase)) { TransactionSummary trans; if (category.Equals(LastCategory, StringComparison.OrdinalIgnoreCase)) { trans = LastTransactionSummary; } else { trans = new TransactionSummary { TransactionId = fieldValues.GetValue <string>("TransactionId"), OriginalTransactionId = fieldValues.GetValue <string>("OriginalTransactionId"), TransactionDate = fieldValues.GetValue <string>("TransactionTime").ToDateTime(), TransactionType = fieldValues.GetValue <string>("TransactionType"), MaskedCardNumber = fieldValues.GetValue <string>("MaskedPAN"), CardType = fieldValues.GetValue <string>("CardType"), CardEntryMethod = fieldValues.GetValue <string>("CardAcquisition"), AuthCode = fieldValues.GetValue <string>("ApprovalCode"), IssuerResponseCode = fieldValues.GetValue <string>("ResponseCode"), IssuerResponseMessage = fieldValues.GetValue <string>("ResponseText"), HostTimeout = (bool)fieldValues.GetBoolean("HostTimeOut"), // BaseAmount - Not doing this one TaxAmount = fieldValues.GetAmount("TaxAmount"), GratuityAmount = fieldValues.GetAmount("TipAmount"), Amount = fieldValues.GetAmount("RequestAmount"), AuthorizedAmount = fieldValues.GetAmount("Authorized Amount"), AmountDue = fieldValues.GetAmount("Balance Due Amount") }; } if (!(category.Equals(LastCategory))) { if (category.StartsWith("APPROVED")) { var summary = Approved[SummaryType.Approved]; summary.Transactions.Add(trans); } else if (category.StartsWith("PENDING")) { var summary = Pending[SummaryType.Pending]; summary.Transactions.Add(trans); } else if (category.StartsWith("DECLINED")) { var summary = Declined[SummaryType.Declined]; summary.Transactions.Add(trans); } } LastTransactionSummary = trans; } LastCategory = category; }
public abstract bool PendingAdd(Pending pending);
private static void RegisterCancellation(CancellationToken cancellationToken, Pending pending, TaskCompletionSource <T> pendingTcs) => cancellationToken .Register(CancelCallback, new CancelState(pending, cancellationToken), useSynchronizationContext: false) .UnregisterOnCompletion(pendingTcs.Task);
private static void Usage () { Console.WriteLine ("brief"); Console.WriteLine (""); { #pragma warning disable 219 Reset Dummy = new Reset (); #pragma warning restore 219 Console.Write ("{0}reset ", UsageFlag); Console.WriteLine (); Console.WriteLine (" Delete all test profiles"); } { #pragma warning disable 219 Device Dummy = new Device (); #pragma warning restore 219 Console.Write ("{0}device ", UsageFlag); Console.Write ("[{0}] ", Dummy.DeviceID.Usage (null, "id", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceDescription.Usage (null, "dd", UsageFlag)); Console.Write ("[{0}] ", Dummy.Default.Usage ("default", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Create new device profile"); } { #pragma warning disable 219 Personal Dummy = new Personal (); #pragma warning restore 219 Console.Write ("{0}personal ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage (null, "portal", UsageFlag)); Console.Write ("[{0}] ", Dummy.Description.Usage (null, "pd", UsageFlag)); Console.Write ("[{0}] ", Dummy.Next.Usage ("next", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceNew.Usage ("new", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceUDF.Usage ("dudf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceID.Usage ("did", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceDescription.Usage ("dd", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Create new personal profile"); } { #pragma warning disable 219 Register Dummy = new Register (); #pragma warning restore 219 Console.Write ("{0}register ", UsageFlag); Console.Write ("[{0}] ", Dummy.UDF.Usage (null, "udf", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage (null, "portal", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Register the specified profile at a new portal"); } { #pragma warning disable 219 Sync Dummy = new Sync (); #pragma warning restore 219 Console.Write ("{0}sync ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Synchronize local copies of Mesh profiles with the server"); } { #pragma warning disable 219 Escrow Dummy = new Escrow (); #pragma warning restore 219 Console.Write ("{0}escrow ", UsageFlag); Console.Write ("[{0}] ", Dummy.Quorum.Usage ("quorum", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Shares.Usage ("shares", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Create a set of key escrow shares"); } { #pragma warning disable 219 Export Dummy = new Export (); #pragma warning restore 219 Console.Write ("{0}export ", UsageFlag); Console.Write ("[{0}] ", Dummy.File.Usage (null, "file", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Export the specified profile data to the specified file"); } { #pragma warning disable 219 Import Dummy = new Import (); #pragma warning restore 219 Console.Write ("{0}import ", UsageFlag); Console.Write ("[{0}] ", Dummy.File.Usage (null, "file", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Import the specified profile data to the specified file"); } { #pragma warning disable 219 List Dummy = new List (); #pragma warning restore 219 Console.Write ("{0}list ", UsageFlag); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" List all profiles on the local machine"); } { #pragma warning disable 219 Dump Dummy = new Dump (); #pragma warning restore 219 Console.Write ("{0}dump ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Describe the specified profile"); } { #pragma warning disable 219 Pending Dummy = new Pending (); #pragma warning restore 219 Console.Write ("{0}pending ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Get list of pending connection requests"); } { #pragma warning disable 219 Connect Dummy = new Connect (); #pragma warning restore 219 Console.Write ("{0}connect ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage (null, "portal", UsageFlag)); Console.Write ("[{0}] ", Dummy.PIN.Usage ("pin", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceNew.Usage ("new", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceUDF.Usage ("dudf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceID.Usage ("did", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.DeviceDescription.Usage ("dd", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Connect to an existing profile registered at a portal"); } { #pragma warning disable 219 Accept Dummy = new Accept (); #pragma warning restore 219 Console.Write ("{0}accept ", UsageFlag); Console.Write ("[{0}] ", Dummy.DeviceUDF.Usage (null, "udf", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Accept a pending connection"); } { #pragma warning disable 219 Complete Dummy = new Complete (); #pragma warning restore 219 Console.Write ("{0}complete ", UsageFlag); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Complete a pending connection request"); } { #pragma warning disable 219 Password Dummy = new Password (); #pragma warning restore 219 Console.Write ("{0}password ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add a web application profile to a personal profile"); } { #pragma warning disable 219 AddPassword Dummy = new AddPassword (); #pragma warning restore 219 Console.Write ("{0}pwadd ", UsageFlag); Console.Write ("[{0}] ", Dummy.Site.Usage (null, "site", UsageFlag)); Console.Write ("[{0}] ", Dummy.Username.Usage (null, "user", UsageFlag)); Console.Write ("[{0}] ", Dummy.Password.Usage (null, "password", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add password entry"); } { #pragma warning disable 219 GetPassword Dummy = new GetPassword (); #pragma warning restore 219 Console.Write ("{0}pwget ", UsageFlag); Console.Write ("[{0}] ", Dummy.Site.Usage (null, "site", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Lookup password entry"); } { #pragma warning disable 219 DeletePassword Dummy = new DeletePassword (); #pragma warning restore 219 Console.Write ("{0}pwdelete ", UsageFlag); Console.Write ("[{0}] ", Dummy.Site.Usage (null, "site", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Delete password entry"); } { #pragma warning disable 219 DumpPassword Dummy = new DumpPassword (); #pragma warning restore 219 Console.Write ("{0}pwdump ", UsageFlag); Console.Write ("[{0}] ", Dummy.JSON.Usage (null, "json", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Describe password entry"); } { #pragma warning disable 219 Mail Dummy = new Mail (); #pragma warning restore 219 Console.Write ("{0}mail ", UsageFlag); Console.Write ("[{0}] ", Dummy.address.Usage (null, "address", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add a mail application profile to a personal profile"); } { #pragma warning disable 219 SSH Dummy = new SSH (); #pragma warning restore 219 Console.Write ("{0}ssh ", UsageFlag); Console.Write ("[{0}] ", Dummy.Host.Usage (null, "host", UsageFlag)); Console.Write ("[{0}] ", Dummy.Client.Usage (null, "client", UsageFlag)); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Add a ssh application profile to a personal profile"); } } // Usage
public virtual void Pending ( Pending Options ) { char UsageFlag = '-'; { #pragma warning disable 219 Pending Dummy = new Pending (); #pragma warning restore 219 Console.Write ("{0}pending ", UsageFlag); Console.Write ("[{0}] ", Dummy.Portal.Usage ("portal", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.UDF.Usage ("udf", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Verbose.Usage ("verbose", "value", UsageFlag)); Console.Write ("[{0}] ", Dummy.Report.Usage ("report", "value", UsageFlag)); Console.WriteLine (); Console.WriteLine (" Get list of pending connection requests"); } Console.WriteLine (" {0}\t{1} = [{2}]", "String", "Portal", Options.Portal); Console.WriteLine (" {0}\t{1} = [{2}]", "String", "UDF", Options.UDF); Console.WriteLine (" {0}\t{1} = [{2}]", "Flag", "Verbose", Options.Verbose); Console.WriteLine (" {0}\t{1} = [{2}]", "Flag", "Report", Options.Report); Console.WriteLine ("Not Yet Implemented"); }
private static void Handle_Pending ( Shell Dispatch, string[] args, int index) { Pending Options = new Pending (); var Registry = new Goedel.Registry.Registry (); Options.Portal.Register ("portal", Registry, (int) TagType_Pending.Portal); Options.UDF.Register ("udf", Registry, (int) TagType_Pending.UDF); Options.Verbose.Register ("verbose", Registry, (int) TagType_Pending.Verbose); Options.Report.Register ("report", Registry, (int) TagType_Pending.Report); #pragma warning disable 162 for (int i = index; i< args.Length; i++) { if (!IsFlag (args [i][0] )) { throw new System.Exception ("Unexpected parameter: " + args[i]);} string Rest = args [i].Substring (1); TagType_Pending TagType = (TagType_Pending) Registry.Find (Rest); // here have the cases for what to do with it. switch (TagType) { case TagType_Pending.Portal : { int OptionParams = Options.Portal.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.Portal.Parameter (args[i]); } } break; } case TagType_Pending.UDF : { int OptionParams = Options.UDF.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.UDF.Parameter (args[i]); } } break; } case TagType_Pending.Verbose : { int OptionParams = Options.Verbose.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.Verbose.Parameter (args[i]); } } break; } case TagType_Pending.Report : { int OptionParams = Options.Report.Tag (Rest); if (OptionParams>0 && ((i+1) < args.Length)) { if (!IsFlag (args [i+1][0] )) { i++; Options.Report.Parameter (args[i]); } } break; } default : throw new System.Exception ("Internal error"); } } #pragma warning restore 162 Dispatch.Pending (Options); }
/// <summary> /// /// </summary> /// <param name="Options">Command line parameters</param> public override void Pending(Pending Options) { SetReporting(Options.Report, Options.Verbose); GetProfile(Options.Portal, Options.UDF); GetMeshClient(); Utils.NYI(); }
public abstract bool PendingUpdate(Pending pending);
private void WriteStart(char c) { WritePending(); _output.Write(c); _pending = Pending.NewLineAndIndent; _indent++; }
protected virtual void Dispose(bool _) { Active = null; Pending.Dispose(); }
private void WriteEnd(char c) { _pending = Pending.NewLineAndIndent; _indent--; WritePending(); _output.Write(c); _pending = Pending.CommaNewLineAndIndent; }
public void Write(int value) { WritePending(); _output.Write(value.ToString(CultureInfo.InvariantCulture)); _pending = Pending.CommaNewLineAndIndent; }
public JsonWriter(TextWriter output) { _output = output; _pending = Pending.None; }
public void Write(string value) { WritePending(); _output.Write('"'); _output.Write(EscapeString(value)); _output.Write('"'); _pending = Pending.CommaNewLineAndIndent; }
public CancelState(Pending pending, CancellationToken cancellationToken) { Pending = pending; CancellationToken = cancellationToken; }