Пример #1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is OrderFulfillmentShipmentDetails other &&
                   ((Recipient == null && other.Recipient == null) || (Recipient?.Equals(other.Recipient) == true)) &&
                   ((Carrier == null && other.Carrier == null) || (Carrier?.Equals(other.Carrier) == true)) &&
                   ((ShippingNote == null && other.ShippingNote == null) || (ShippingNote?.Equals(other.ShippingNote) == true)) &&
                   ((ShippingType == null && other.ShippingType == null) || (ShippingType?.Equals(other.ShippingType) == true)) &&
                   ((TrackingNumber == null && other.TrackingNumber == null) || (TrackingNumber?.Equals(other.TrackingNumber) == true)) &&
                   ((TrackingUrl == null && other.TrackingUrl == null) || (TrackingUrl?.Equals(other.TrackingUrl) == true)) &&
                   ((PlacedAt == null && other.PlacedAt == null) || (PlacedAt?.Equals(other.PlacedAt) == true)) &&
                   ((InProgressAt == null && other.InProgressAt == null) || (InProgressAt?.Equals(other.InProgressAt) == true)) &&
                   ((PackagedAt == null && other.PackagedAt == null) || (PackagedAt?.Equals(other.PackagedAt) == true)) &&
                   ((ExpectedShippedAt == null && other.ExpectedShippedAt == null) || (ExpectedShippedAt?.Equals(other.ExpectedShippedAt) == true)) &&
                   ((ShippedAt == null && other.ShippedAt == null) || (ShippedAt?.Equals(other.ShippedAt) == true)) &&
                   ((CanceledAt == null && other.CanceledAt == null) || (CanceledAt?.Equals(other.CanceledAt) == true)) &&
                   ((CancelReason == null && other.CancelReason == null) || (CancelReason?.Equals(other.CancelReason) == true)) &&
                   ((FailedAt == null && other.FailedAt == null) || (FailedAt?.Equals(other.FailedAt) == true)) &&
                   ((FailureReason == null && other.FailureReason == null) || (FailureReason?.Equals(other.FailureReason) == true)));
        }
Пример #2
0
 public CancelEventArgs(Transaction tran, CancelStatus status, CancelReason cancelReason)
 {
     this.Account      = tran.Owner;
     this.Tran         = tran;
     this.Status       = status;
     this.CancelReason = cancelReason;
 }
Пример #3
0
        private OrderMatchingResult CancelOrder(OrderId orderId, CancelReason cancelReason)
        {
            if (_currentOrders.TryGetValue(orderId, out Order order))
            {
                var quantityCancel = order.OpenQuantity;
                var orderCost      = order.Cost;
                _book.RemoveOrder(order);
                _currentOrders.Remove(orderId);
                if (order.IsTip)
                {
                    if (_currentIcebergOrders.TryGetValue(orderId, out Iceberg iceBergOrder))
                    {
                        quantityCancel += iceBergOrder.TotalQuantity;
                        _currentIcebergOrders.Remove(orderId);
                    }
                }

                if (order.CancelOn > 0)
                {
                    RemoveGoodTillDateOrder(order.CancelOn, order.OrderId);
                }

                _tradeListener?.OnCancel(orderId, quantityCancel, orderCost, cancelReason);
                return(OrderMatchingResult.CancelAcepted);
            }
            return(OrderMatchingResult.OrderDoesNotExists);
        }
Пример #4
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is TerminalRefund other &&
                   ((Id == null && other.Id == null) || (Id?.Equals(other.Id) == true)) &&
                   ((RefundId == null && other.RefundId == null) || (RefundId?.Equals(other.RefundId) == true)) &&
                   ((PaymentId == null && other.PaymentId == null) || (PaymentId?.Equals(other.PaymentId) == true)) &&
                   ((OrderId == null && other.OrderId == null) || (OrderId?.Equals(other.OrderId) == true)) &&
                   ((AmountMoney == null && other.AmountMoney == null) || (AmountMoney?.Equals(other.AmountMoney) == true)) &&
                   ((Reason == null && other.Reason == null) || (Reason?.Equals(other.Reason) == true)) &&
                   ((DeviceId == null && other.DeviceId == null) || (DeviceId?.Equals(other.DeviceId) == true)) &&
                   ((DeadlineDuration == null && other.DeadlineDuration == null) || (DeadlineDuration?.Equals(other.DeadlineDuration) == true)) &&
                   ((Status == null && other.Status == null) || (Status?.Equals(other.Status) == true)) &&
                   ((CancelReason == null && other.CancelReason == null) || (CancelReason?.Equals(other.CancelReason) == true)) &&
                   ((CreatedAt == null && other.CreatedAt == null) || (CreatedAt?.Equals(other.CreatedAt) == true)) &&
                   ((UpdatedAt == null && other.UpdatedAt == null) || (UpdatedAt?.Equals(other.UpdatedAt) == true)));
        }
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }

            if (obj == this)
            {
                return(true);
            }

            return(obj is OrderFulfillmentPickupDetails other &&
                   ((Recipient == null && other.Recipient == null) || (Recipient?.Equals(other.Recipient) == true)) &&
                   ((ExpiresAt == null && other.ExpiresAt == null) || (ExpiresAt?.Equals(other.ExpiresAt) == true)) &&
                   ((AutoCompleteDuration == null && other.AutoCompleteDuration == null) || (AutoCompleteDuration?.Equals(other.AutoCompleteDuration) == true)) &&
                   ((ScheduleType == null && other.ScheduleType == null) || (ScheduleType?.Equals(other.ScheduleType) == true)) &&
                   ((PickupAt == null && other.PickupAt == null) || (PickupAt?.Equals(other.PickupAt) == true)) &&
                   ((PickupWindowDuration == null && other.PickupWindowDuration == null) || (PickupWindowDuration?.Equals(other.PickupWindowDuration) == true)) &&
                   ((PrepTimeDuration == null && other.PrepTimeDuration == null) || (PrepTimeDuration?.Equals(other.PrepTimeDuration) == true)) &&
                   ((Note == null && other.Note == null) || (Note?.Equals(other.Note) == true)) &&
                   ((PlacedAt == null && other.PlacedAt == null) || (PlacedAt?.Equals(other.PlacedAt) == true)) &&
                   ((AcceptedAt == null && other.AcceptedAt == null) || (AcceptedAt?.Equals(other.AcceptedAt) == true)) &&
                   ((RejectedAt == null && other.RejectedAt == null) || (RejectedAt?.Equals(other.RejectedAt) == true)) &&
                   ((ReadyAt == null && other.ReadyAt == null) || (ReadyAt?.Equals(other.ReadyAt) == true)) &&
                   ((ExpiredAt == null && other.ExpiredAt == null) || (ExpiredAt?.Equals(other.ExpiredAt) == true)) &&
                   ((PickedUpAt == null && other.PickedUpAt == null) || (PickedUpAt?.Equals(other.PickedUpAt) == true)) &&
                   ((CanceledAt == null && other.CanceledAt == null) || (CanceledAt?.Equals(other.CanceledAt) == true)) &&
                   ((CancelReason == null && other.CancelReason == null) || (CancelReason?.Equals(other.CancelReason) == true)) &&
                   ((IsCurbsidePickup == null && other.IsCurbsidePickup == null) || (IsCurbsidePickup?.Equals(other.IsCurbsidePickup) == true)) &&
                   ((CurbsidePickupDetails == null && other.CurbsidePickupDetails == null) || (CurbsidePickupDetails?.Equals(other.CurbsidePickupDetails) == true)));
        }
Пример #6
0
 /// <summary>
 /// 如果AmendedSource存在,则取消.如果AmendedOrder为IFDone单, 则取消该Transaction所对应的Done单
 /// </summary>
 internal void CancelAmendedAndDoneTransactions(CancelReason cancelType = CancelReason.OtherReason)
 {
     Logger.InfoFormat("CancelAmendedAndDoneTransactions tranId = {0}, subType = {1}", _tran.Id, _tran.SubType);
     this.CancelAmendedIfTransaction(cancelType);
     this.CanceAmendedDoneTransactions(cancelType);
     this.ChangeSubType();
 }
Пример #7
0
 internal void Cancel(CancelReason cancelReason, ExecuteContext context = null)
 {
     if (this.Owner.OrderType == iExchange.Common.OrderType.Limit)
     {
         this.Account.RemovePendingConfirmLimitOrder(this);
     }
     this.Phase = OrderPhase.Canceled;
     this.ChangeToDeleted();
     this.CancelReason = cancelReason;
     DB.DBMapping.OrderDeletedReason model = OrderDeletedReasonRepository.Default.GetReasonModel(cancelReason);
     if (model != null)
     {
         this.CancelReasonId = model.ID;
         if (cancelReason == iExchange.Common.CancelReason.MarginIsNotEnough)
         {
             if (context == null)
             {
                 this.CancelReasonDesc = string.Format("balance:{0},necessary:{1},equity:{2}", this.Account.Balance, this.Account.Necessary, this.Account.Equity);
             }
             else
             {
                 this.CancelReasonDesc = string.Format("balance:{0},necessary:{1},equity:{2}", context.ExecutedInfo.Balance, context.ExecutedInfo.Necessary, context.ExecutedInfo.Equity);
             }
         }
         else
         {
             this.CancelReasonDesc = model.ReasonDesc;
         }
     }
 }
Пример #8
0
        public HttpResponseMessage Delete(string id, int organizationId, CancelReason cancelReason, string cancelText)
        {
            OrganizationId = organizationId;
            try
            {
                if (UserIsAdminOfOrganization)
                {
                    var customerService = new StripeCustomerService();
                    StripeSubscription stripeSubscription = customerService.CancelSubscription(id);    // you can optionally pass cancelAtPeriodEnd instead of immediately cancelling

                    var organization = this.organizationService.Get(organizationId);
                    organization.Subscription.Status            = SubscriptionStatus.INACTIVE;
                    organization.Subscription.CustomerBillingId = id;
                    organization.Subscription.CancelReason      = cancelReason;

                    this.subscriptionService.SaveSubscription(organization);
                    emailHelper.SendCancelNotice(id, organizationId, System.Enum.GetName(typeof(CancelReason), cancelReason), cancelText);
                    return(Request.CreateResponse(HttpStatusCode.Accepted));
                }
            }
            catch (StripeException ex)
            {
                emailHelper.SendStripeError(ex);
            }
            catch (Exception e)
            {
                emailHelper.SendErrorEmail(e);
            }
            return(Request.CreateResponse(HttpStatusCode.BadRequest));
        }
Пример #9
0
 private InputResult(ResultMode result, TInput value, string keyword, AcceptReason acceptReason, CancelReason cancelReason)
 {
     Result       = result;
     Value        = value;
     Keyword      = keyword;
     AcceptReason = acceptReason;
     CancelReason = cancelReason;
 }
Пример #10
0
 public TransactionError Cancel(Token token, Guid accountId, Guid tranId, CancelReason cancelReason)
 {
     return(this.CallByRead(() =>
     {
         var account = GetAccount(accountId);
         return account.Cancel(token, tranId, cancelReason);
     },
                            () => TransactionError.RuntimeError));
 }
Пример #11
0
        internal void Cancel(CancelReason cancelType, ExecuteContext context = null)
        {
            this.CancelOrders(cancelType, context);
            if (this.DoneCondition)

            {
                this.CancelService.CancelDoneTrans(cancelType);
            }
        }
Пример #12
0
 private void CancelOrders(CancelReason cancelType, ExecuteContext context)
 {
     foreach (var order in this.Orders)
     {
         if (order.CanCancel)
         {
             order.Cancel(cancelType, context);
         }
     }
 }
Пример #13
0
        public ActionResult Edit([Bind(Include = "Id,Reason")] CancelReason model)
        {
            if (ModelState.IsValid)
            {
                db.Entry(model).State = EntityState.Modified;
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Пример #14
0
        public ActionResult Create([Bind(Include = "Id,Reason")] CancelReason model)
        {
            if (ModelState.IsValid)
            {
                db.CancelReasons.Add(model);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
Пример #15
0
        public override TransactionError Cancel(Transaction tran, CancelReason reason)
        {
            TransactionError error = TransactionError.OK;

            if (!tran.CancelService.CanCancel)
            {
                return(TransactionError.TransactionCannotBeCanceled);
            }
            Logger.InfoFormat("begin in engine cancel tran={0}", tran);
            _cancelBlock.Post(Tuple.Create(tran, reason));
            return(error);
        }
Пример #16
0
        internal void CancelDoneTrans(CancelReason cancelType)
        {
            var doneTrans = _tran.GetDoneTransactions();

            Logger.InfoFormat("CancelDoneTrans tranId = {0} cancelType = {1}, doneTransCount = {2}, account.Id = {3}", _tran.Id, cancelType, doneTrans.Count, _tran.AccountId);
            foreach (var eachDoneTran in doneTrans)
            {
                Logger.InfoFormat("done tran id = {0}, account.id = {1}", eachDoneTran.Id, eachDoneTran.AccountId);
                eachDoneTran.Cancel(cancelType);
                this.Account.InvalidateInstrumentCache(eachDoneTran);
            }
        }
Пример #17
0
 public TransactionError Cancel(Token token, Guid tranID, CancelReason cancelReason)
 {
     try
     {
         return(Global.StateServer.Cancel(token, tranID, cancelReason));
     }
     catch (Exception ex)
     {
         AppDebug.LogEvent("ManagerCallback.Cancel",
                           string.Format("Cancel:Error\r\n{0}", ex.ToString()), EventLogEntryType.Error);
         return(TransactionError.RuntimeError);
     }
 }
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Id = {(Id == null ? "null" : Id == string.Empty ? "" : Id)}");
     toStringOutput.Add($"AmountMoney = {(AmountMoney == null ? "null" : AmountMoney.ToString())}");
     toStringOutput.Add($"ReferenceId = {(ReferenceId == null ? "null" : ReferenceId == string.Empty ? "" : ReferenceId)}");
     toStringOutput.Add($"Note = {(Note == null ? "null" : Note == string.Empty ? "" : Note)}");
     toStringOutput.Add($"DeviceOptions = {(DeviceOptions == null ? "null" : DeviceOptions.ToString())}");
     toStringOutput.Add($"DeadlineDuration = {(DeadlineDuration == null ? "null" : DeadlineDuration == string.Empty ? "" : DeadlineDuration)}");
     toStringOutput.Add($"Status = {(Status == null ? "null" : Status == string.Empty ? "" : Status)}");
     toStringOutput.Add($"CancelReason = {(CancelReason == null ? "null" : CancelReason.ToString())}");
     toStringOutput.Add($"PaymentIds = {(PaymentIds == null ? "null" : $"[{ string.Join(", ", PaymentIds)} ]")}");
     toStringOutput.Add($"CreatedAt = {(CreatedAt == null ? "null" : CreatedAt == string.Empty ? "" : CreatedAt)}");
     toStringOutput.Add($"UpdatedAt = {(UpdatedAt == null ? "null" : UpdatedAt == string.Empty ? "" : UpdatedAt)}");
 }
Пример #19
0
 protected void ToString(List <string> toStringOutput)
 {
     toStringOutput.Add($"Id = {(Id == null ? "null" : Id == string.Empty ? "" : Id)}");
     toStringOutput.Add($"RefundId = {(RefundId == null ? "null" : RefundId == string.Empty ? "" : RefundId)}");
     toStringOutput.Add($"PaymentId = {(PaymentId == null ? "null" : PaymentId == string.Empty ? "" : PaymentId)}");
     toStringOutput.Add($"OrderId = {(OrderId == null ? "null" : OrderId == string.Empty ? "" : OrderId)}");
     toStringOutput.Add($"AmountMoney = {(AmountMoney == null ? "null" : AmountMoney.ToString())}");
     toStringOutput.Add($"Reason = {(Reason == null ? "null" : Reason == string.Empty ? "" : Reason)}");
     toStringOutput.Add($"DeviceId = {(DeviceId == null ? "null" : DeviceId == string.Empty ? "" : DeviceId)}");
     toStringOutput.Add($"DeadlineDuration = {(DeadlineDuration == null ? "null" : DeadlineDuration == string.Empty ? "" : DeadlineDuration)}");
     toStringOutput.Add($"Status = {(Status == null ? "null" : Status == string.Empty ? "" : Status)}");
     toStringOutput.Add($"CancelReason = {(CancelReason == null ? "null" : CancelReason.ToString())}");
     toStringOutput.Add($"CreatedAt = {(CreatedAt == null ? "null" : CreatedAt == string.Empty ? "" : CreatedAt)}");
     toStringOutput.Add($"UpdatedAt = {(UpdatedAt == null ? "null" : UpdatedAt == string.Empty ? "" : UpdatedAt)}");
 }
Пример #20
0
        private void CanceAmendedDoneTransactions(CancelReason cancelType)
        {
            if (_tran.SubType != TransactionSubType.Amend)
            {
                return;
            }
            var doneTrans = this.GetAmendedDoneTrans();

            Logger.InfoFormat("CanceAmendedlDoneTransactions tranId = {0} cancelType = {1}, doneTransCount = {2}, account.id = {3}", _tran.Id, cancelType, doneTrans.Count, _tran.AccountId);
            foreach (var eachDoneTran in doneTrans)
            {
                Logger.InfoFormat("amended done tran id = {0}, account.Id = {1}", eachDoneTran.Id, eachDoneTran.AccountId);
                eachDoneTran.Cancel(cancelType);
                this.Account.InvalidateInstrumentCache(eachDoneTran);
            }
        }
    static void Main(string[] args)
    {
        CancelReason ad = new CancelReason();

        ad.BusinessLineID     = 1;
        ad.CancelReasonCodeID = 2;
        ad.CancelRefund       = "C";
        ad.CompanyID          = 0;
        ad.DBOperation        = 1;
        ad.Description        = "test";
        ad.IsActive           = "Y";
        ad.ReasonCode         = "TestCode";
        ad.UpdateStamp        = new byte[] { 1, 2, 3, 4 };

        DataTable dt = ad.ConvertToDataTable(s => new { s.DBOperation, s.BusinessLineID, s.LoggedInUser }, r => new { Refund = r.CancelRefund, Company = r.CompanyID });
    }
Пример #22
0
        private void ImportCancelReasons(SCMContext ctx, ref IEnumerable <ServiceRequestRecord> data)
        {
            ResetProgress();

            var curList = ctx.CancelReasons.Select(x => x.Reason).ToList();
            var dic     = new Dictionary <string, CancelReason>();
            var objects = data.Select(x => new { Reason = x.Cancel_Reason }).Distinct().Where(x => !string.IsNullOrEmpty(x.Reason)).ToList();

            var objectToAdd = objects.Where(x => !curList.Contains(x.Reason));

            total = objectToAdd.Count();
            foreach (var item in objectToAdd)
            {
                var rec = new CancelReason()
                {
                    Reason = item.Reason
                };
                ctx.CancelReasons.Add(rec);
                ctx.SaveChanges();
                if (!dic.ContainsKey(rec.Reason.ToUpper()))
                {
                    dic.Add(rec.Reason.ToUpper(), rec);
                }

                UpdateProgress();
            }
            foreach (var item in ctx.CancelReasons)
            {
                if (!dic.ContainsKey(item.Reason.ToUpper()))
                {
                    dic.Add(item.Reason.ToUpper(), item);
                }
            }
            foreach (var item in data)
            {
                if (!string.IsNullOrEmpty(item.Cancel_Reason))
                {
                    item.CancelReasonId = dic[item.Cancel_Reason.ToUpper()].Id;
                }
                else
                {
                    item.CancelReasonId = null;
                }
            }

            Progress = 100;
        }
        public ActionResult Cancel([FromRoute] string solId, [FromBody] CancelReason cancelReason)
        {
            if (string.IsNullOrEmpty(solId))
            {
                return(BadRequest());
            }

            // string locationReference = sol.SolLicenceNumber.Substring(sepLicenceNumber.Length);

            string solIdEscaped = solId.Replace("'", "''");

            if (solIdEscaped.Contains("-"))
            {
                solIdEscaped = solIdEscaped.Substring(0, solIdEscaped.IndexOf("-"));
            }
            // get the given sol record.
            MicrosoftDynamicsCRMadoxioSpecialevent record = _dynamicsClient.GetSpecialEventByLicenceNumber(solIdEscaped);

            if (record == null)
            {
                return(NotFound());
            }
            else
            {
                // cancel the record.
                MicrosoftDynamicsCRMadoxioSpecialevent patchRecord = new MicrosoftDynamicsCRMadoxioSpecialevent()
                {
                    Statuscode = 845280000, // Cancel
                    AdoxioCancellationreason = cancelReason?.Reason
                };
                try
                {
                    _dynamicsClient.Specialevents.Update(record.AdoxioSpecialeventid, patchRecord);
                }
                catch (HttpOperationException httpOperationException)
                {
                    _logger.Error(httpOperationException, "Error updating special event record");
                    // fail
                    return(StatusCode(500, "Error updating record."));
                }
            }

            return(Ok());
        }
Пример #24
0
        internal TransactionError Cancel(Token token, Guid tranID, CancelReason cancelReason)
        {
            try
            {
                Guid accountId;
                if (Protocal.Commands.TransactionMapping.Default.GetAccountId(tranID, out accountId))
                {
                    return(this.SystemController.Cancel(token, accountId, tranID, cancelReason));
                }
                else
                {
                    return(TransactionError.TransactionNotExists);
                }
            }
            catch (Exception exception)
            {
                this.HandleInvokeException(exception);

                return(TransactionError.RuntimeError);
            }
        }
Пример #25
0
        private void CancelAmendedIfTransaction(CancelReason cancelType)
        {
            Order amendedOrder = _tran.AmendedOrder;

            if (amendedOrder == null || _tran.SubType != TransactionSubType.Amend)
            {
                return;
            }
            var amendedTran = amendedOrder.Owner;

            amendedTran.ChangePhaseToCancel();
            amendedOrder.Cancel(cancelType);
            Logger.InfoFormat("CancelAmendedIfTransaction tranId = {0}, orderId = {1}, tran.Type = {2}, tran.SubType = {3}, account.id = {4}", amendedTran.Id, amendedOrder.Id, amendedTran.Type, amendedTran.SubType, amendedTran.Owner.Id);
            if (amendedTran.Type == TransactionType.OneCancelOther)
            {
                foreach (Order order in amendedTran.Orders)
                {
                    Logger.InfoFormat("CancelAmendedIfTransaction, account id = {0}, cancel order id = {1}", order.Account.Id, order.Id);
                    order.Cancel(cancelType);
                }
            }
            this.Account.InvalidateInstrumentCache(amendedTran);
        }
Пример #26
0
        internal static Protocal.CancelType ToCancelType(this CancelReason reason)
        {
            Protocal.CancelType result = Protocal.CancelType.None;
            switch (reason)
            {
            case CancelReason.CustomerCanceled:
                result = Protocal.CancelType.CustomerCanceled;
                break;

            case CancelReason.DealerCanceled:
                result = Protocal.CancelType.DealerCanceled;
                break;

            case CancelReason.RiskMonitorCanceled:
                result = Protocal.CancelType.RiskMonitorCanceled;
                break;

            default:
                Logger.WarnFormat("not recognize reason = {0}", reason);
                break;
            }
            return(result);
        }
        private void OnThreadCancel(CancelReason reason)
        {
            if (!IsAnalysisCompleted() && !isDownloadingFile)
            {
                if (lockObject.ExitApplication)
                    System.Environment.Exit(0);
                else
                {
                    ShowSyncMessage(true);
                    btnSyncNow.Enabled = true;

                    if (reason == CancelReason.LOGIN_FAILED)
                    {
                        this.Hide();
                        frmParent.ShowLoginAgainFromSyncMgr();
                    }
                    else if (reason == CancelReason.SERVER_INACCESSIBLE)
                    {
                        // CheckServerStatus();TODO:check for offline (Modified for server status thread)
                    }
                }
            }
        }
Пример #28
0
        public override int GetHashCode()
        {
            int hashCode = 1855433710;

            if (Id != null)
            {
                hashCode += Id.GetHashCode();
            }

            if (RefundId != null)
            {
                hashCode += RefundId.GetHashCode();
            }

            if (PaymentId != null)
            {
                hashCode += PaymentId.GetHashCode();
            }

            if (OrderId != null)
            {
                hashCode += OrderId.GetHashCode();
            }

            if (AmountMoney != null)
            {
                hashCode += AmountMoney.GetHashCode();
            }

            if (Reason != null)
            {
                hashCode += Reason.GetHashCode();
            }

            if (DeviceId != null)
            {
                hashCode += DeviceId.GetHashCode();
            }

            if (DeadlineDuration != null)
            {
                hashCode += DeadlineDuration.GetHashCode();
            }

            if (Status != null)
            {
                hashCode += Status.GetHashCode();
            }

            if (CancelReason != null)
            {
                hashCode += CancelReason.GetHashCode();
            }

            if (CreatedAt != null)
            {
                hashCode += CreatedAt.GetHashCode();
            }

            if (UpdatedAt != null)
            {
                hashCode += UpdatedAt.GetHashCode();
            }

            return(hashCode);
        }
        void fileDownloder_cancelDownloadEvent(CancelReason reason)
        {
            isDownloadingFile = false;

            OnThreadCancel(reason);

            if (reason == CancelReason.INSUFFICIENT_STORAGE)
            {
                ShowInsufficientStorageMessage();
            }
        }
Пример #30
0
 public TransactionError CancelPlace(Guid transactionId, CancelReason cancelReason)
 {
     TransactionError errorCode = TransactionError.OK;
     try
     {
         Token token = new Token(Guid.Empty, UserType.System, AppType.DealingConsole);
         errorCode = this._StateServer.CancelPlace(token, transactionId);
     }
     catch (Exception ex)
     {
         errorCode = TransactionError.NoLinkedServer;
         Logger.TraceEvent(TraceEventType.Error, "ExchangeSystem.CancelPlace Error:\r\n" + ex.ToString());
     }
     return errorCode;
 }
        public static void Serialize(OrderId orderId, Quantity remainingQuantity, Quantity cost, Quantity fee, CancelReason cancelReason, int timeStamp, Span <byte> bytes)
        {
            if (bytes == null)
            {
                throw new ArgumentNullException(nameof(bytes));
            }

            if (bytes.Length < sizeOfMessage)
            {
                throw new ArgumentException(Constant.INVALID_SIZE, nameof(bytes));
            }

            Write(bytes.Slice(messageLengthOffset), sizeOfMessage);
            bytes[messageTypeOffset] = (byte)MessageType.Cancel;
            Write(bytes.Slice(versionOffset), version);
            Write(bytes.Slice(orderIdOffset), orderId);
            Write(bytes.Slice(remainingQuantityOffset), remainingQuantity);
            bytes[cancelReasonOffset] = (byte)cancelReason;
            Write(bytes.Slice(timestampOffset), timeStamp);
            Write(bytes.Slice(costOffset), cost);
            Write(bytes.Slice(feeOffset), fee);
        }
 public static byte[] Serialize(OrderId orderId, Quantity remainingQuantity, Quantity cost, Quantity fee, CancelReason cancelReason, int timeStamp)
 {
     byte[] msg = new byte[sizeOfMessage];
     Write(msg, messageLengthOffset, sizeOfMessage);
     msg[messageTypeOffset] = (byte)MessageType.Cancel;
     Write(msg, versionOffset, version);
     Write(msg, orderIdOffset, orderId);
     Write(msg, remainingQuantityOffset, remainingQuantity);
     msg[cancelReasonOffset] = (byte)cancelReason;
     Write(msg, timestampOffset, timeStamp);
     Write(msg, costOffset, cost);
     Write(msg, feeOffset, fee);
     return(msg);
 }
 void stDownloader_cancelDownloadEvent(CancelReason reason)
 {
     if (this.InvokeRequired)
     {
         this.Invoke((MethodInvoker)delegate
         {
             tmrSwapStatusMessage.Enabled = false;
         });
     }
     else
     {
         tmrSwapStatusMessage.Enabled = false;
     }
     //isAnalysingStructure = false;
     OnThreadCancel(reason);
 }
 private void CancelAndNotify(CancelReason reason)
 {
     LogWrapper.LogMessage("StructureDownloader - CancelAndNotify", "Enter");
     if(cancelDownloadEvent != null)
     {
         cancelDownloadEvent(reason);
     }
     LogWrapper.LogMessage("StructureDownloader - CancelAndNotify", "Leave");
 }
        public override int GetHashCode()
        {
            int hashCode = -657729285;

            if (Recipient != null)
            {
                hashCode += Recipient.GetHashCode();
            }

            if (ExpiresAt != null)
            {
                hashCode += ExpiresAt.GetHashCode();
            }

            if (AutoCompleteDuration != null)
            {
                hashCode += AutoCompleteDuration.GetHashCode();
            }

            if (ScheduleType != null)
            {
                hashCode += ScheduleType.GetHashCode();
            }

            if (PickupAt != null)
            {
                hashCode += PickupAt.GetHashCode();
            }

            if (PickupWindowDuration != null)
            {
                hashCode += PickupWindowDuration.GetHashCode();
            }

            if (PrepTimeDuration != null)
            {
                hashCode += PrepTimeDuration.GetHashCode();
            }

            if (Note != null)
            {
                hashCode += Note.GetHashCode();
            }

            if (PlacedAt != null)
            {
                hashCode += PlacedAt.GetHashCode();
            }

            if (AcceptedAt != null)
            {
                hashCode += AcceptedAt.GetHashCode();
            }

            if (RejectedAt != null)
            {
                hashCode += RejectedAt.GetHashCode();
            }

            if (ReadyAt != null)
            {
                hashCode += ReadyAt.GetHashCode();
            }

            if (ExpiredAt != null)
            {
                hashCode += ExpiredAt.GetHashCode();
            }

            if (PickedUpAt != null)
            {
                hashCode += PickedUpAt.GetHashCode();
            }

            if (CanceledAt != null)
            {
                hashCode += CanceledAt.GetHashCode();
            }

            if (CancelReason != null)
            {
                hashCode += CancelReason.GetHashCode();
            }

            if (IsCurbsidePickup != null)
            {
                hashCode += IsCurbsidePickup.GetHashCode();
            }

            if (CurbsidePickupDetails != null)
            {
                hashCode += CurbsidePickupDetails.GetHashCode();
            }

            return(hashCode);
        }
Пример #36
0
 internal TransactionError Cancel(Token token, Guid tranID, CancelReason cancelReason)
 {
     return Global.StateServer.Cancel(token, tranID, cancelReason);
 }
        public HttpResponseMessage Delete(string id, int organizationId, CancelReason cancelReason, string cancelText)
        {
            OrganizationId = organizationId;
            try
            {
                if (UserIsAdminOfOrganization)
                {

                    var customerService = new StripeCustomerService();
                    StripeSubscription stripeSubscription = customerService.CancelSubscription(id);    // you can optionally pass cancelAtPeriodEnd instead of immediately cancelling 

                    var organization = this.organizationService.Get(organizationId);
                    organization.Subscription.Status = SubscriptionStatus.INACTIVE;
                    organization.Subscription.CustomerBillingId = id;
                    organization.Subscription.CancelReason = cancelReason;

                    this.subscriptionService.SaveSubscription(organization);
                    emailHelper.SendCancelNotice(id, organizationId, System.Enum.GetName(typeof(CancelReason), cancelReason), cancelText);
                    return Request.CreateResponse(HttpStatusCode.Accepted);
                }
            }
            catch (StripeException ex)
            {
                emailHelper.SendStripeError(ex);
            }
            catch (Exception e)
            {
                emailHelper.SendErrorEmail(e);
            }
            return Request.CreateResponse(HttpStatusCode.BadRequest);
        }