Example #1
0
        /// <summary>
        /// Muestra la ventana detalle en modo edit
        /// </summary>
        /// <history>
        /// [emoguel] 14/04/2016 Created
        /// </history>
        private void Cell_DoubleClick(object sender, RoutedEventArgs e)
        {
            RefundType          refunType           = (RefundType)dgrRefundTypes.SelectedItem;
            frmRefundTypeDetail frmRefundTypeDetail = new frmRefundTypeDetail();

            frmRefundTypeDetail.Owner         = this;
            frmRefundTypeDetail.enumMode      = EnumMode.Edit;
            frmRefundTypeDetail.oldRefundType = refunType;
            if (frmRefundTypeDetail.ShowDialog() == true)
            {
                int nIndex = 0;
                List <RefundType> lstRefundTypes = (List <RefundType>)dgrRefundTypes.ItemsSource;
                if (ValidateFilter(frmRefundTypeDetail.refundType))                         //Validamos que cumpla con los filtros actuales
                {
                    ObjectHelper.CopyProperties(refunType, frmRefundTypeDetail.refundType); //Actualizamos los datos
                    lstRefundTypes.Sort((x, y) => string.Compare(x.rfN, y.rfN));            //ordenamos la lista
                    nIndex = lstRefundTypes.IndexOf(refunType);                             //Obtenemos la posición del registro
                }
                else
                {
                    lstRefundTypes.Remove(refunType);                           //Quitamos el registro de la lista
                }
                dgrRefundTypes.Items.Refresh();                                 //Actualizamos la lista
                GridHelper.SelectRow(dgrRefundTypes, nIndex);                   //Seleccionamos el registro
                StatusBarReg.Content = lstRefundTypes.Count + " Refund Types."; //Actualizamos el contador
            }
        }
Example #2
0
        /// <summary>
        /// Valida que un objeto refund type cumpla con los filtros actuales
        /// </summary>
        /// <param name="refundType">Objeto a validar</param>
        /// <returns>True. Si cumple | False. No cumple</returns>
        /// <history>
        /// [emoguel] created 14/04/2016
        /// </history>
        private bool ValidateFilter(RefundType refundType)
        {
            if (_nStatus != -1)//Filtro por estatus
            {
                if (refundType.rfA != Convert.ToBoolean(_nStatus))
                {
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(_refundTypeFilter.rfID))//filtro por ID
            {
                if (_refundTypeFilter.rfID != refundType.rfID)
                {
                    return(false);
                }
            }

            if (!string.IsNullOrWhiteSpace(_refundTypeFilter.rfN))//Filtro por descripción
            {
                if (!refundType.rfN.Contains(_refundTypeFilter.rfN, StringComparison.OrdinalIgnoreCase))
                {
                    return(false);
                }
            }

            return(true);
        }
 public SubscriptionResponse Terminate(string sUUID, RefundType eRefundType)
 {
     IRestRequest request = this.CreateRequest(this.Resource + "/{UUID}/terminate?refund={refund}", Method.PUT);
     request.AddUrlSegment("UUID", sUUID);
     request.AddUrlSegment("refund", eRefundType.ToString().ToLowerInvariant());
     return this.ExecuteRequest<SubscriptionResponse>(request).Data;
 }
Example #4
0
 public OperationResult Insert(RefundTypeVM model)
 {
     try
     {
         RefundType refund = _RefundTypeRepository.Entities.FirstOrDefault(c => c.RefundTypeCode == model.RefundTypeCode.Trim());
         if (refund != null)
         {
             return(new OperationResult(OperationResultType.Warning, "数据库中已经存在相同的报销事项,请修改后重新提交!"));
         }
         if (model.RefundTypeName == null || model.RefundTypeName.Trim() == "")
         {
             return(new OperationResult(OperationResultType.Warning, "报销事项不能为空,请修改后重新提交!"));
         }
         var entity = new RefundType
         {
             RefundTypeCode = model.RefundTypeCode,
             RefundTypeName = model.RefundTypeName,
             UpdateDate     = DateTime.Now
         };
         _RefundTypeRepository.Insert(entity);
         return(new OperationResult(OperationResultType.Success, "新增数据成功!"));
     }
     catch (Exception ex)
     {
         return(new OperationResult(OperationResultType.Error, "新增数据失败,数据库插入数据时发生了错误!"));
     }
 }
Example #5
0
        public SubscriptionResponse Terminate(string sUUID, RefundType eRefundType)
        {
            IRestRequest request = this.CreateRequest(this.Resource + "/{UUID}/terminate?refund={refund}", Method.PUT);

            request.AddUrlSegment("UUID", sUUID);
            request.AddUrlSegment("refund", eRefundType.ToString().ToLowerInvariant());
            return(this.ExecuteRequest <SubscriptionResponse>(request).Data);
        }
Example #6
0
 public RefundType FirstRefundType()
 {
     var firstRefundType = new RefundType
     {
         RefundTyped = 1,
         RefundTypedValue = "Transaction"
     };
     return firstRefundType;
 }
Example #7
0
 public RefundType SecondRefundType()
 {
     var secondRefundType = new RefundType
     {
         RefundTyped = 1,
         RefundTypedValue = "Subscription"
     };
     return secondRefundType;
 }
        /// <summary>
        /// Immediately terminate the subscription and issue a refund.  The refund can be for the full amount
        /// or prorated until its paid-thru date.  If you need to refund a specific amount, please issue a
        /// refund against the individual transaction instead.
        /// </summary>
        /// <param name="accountCode">Subscriber's Account Code</param>
        /// <param name="refundType"></param>
        public static void RefundSubscription(string accountCode, RefundType refundType)
        {
            string refundTypeParameter = refundType.ToString().ToLower();

            string refundUrl = String.Format("{0}?refund={1}",
                                             SubscriptionUrl(accountCode),
                                             refundTypeParameter);

            RecurlyClient.PerformRequest(RecurlyClient.HttpRequestMethod.Delete, refundUrl);
        }
Example #9
0
        public static string EnumToString(this RefundType type)
        {
            switch (type)
            {
            case RefundType.Full: return("FULL");

            case RefundType.Partial: return("PARTIAL");

            default: throw new ArgumentOutOfRangeException();
            }
        }
        /// <summary>
        /// 统计退款数量,按类型统计
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public int CountRefundOrder(RefundType type)
        {
            using (var dbContext = new OrderProcessDbContext())
            {
                Expression <Func <ViewOrderRefund, bool> > expression =
                    l => l.OrderStatus != OrderStatus.Deleted &&
                    l.RefundStatus == RefundStatus.Applying && l.RefundType == type;

                return(dbContext.ViewOrderRefunds.Where(expression).Count());
            }
        }
Example #11
0
 public OperationResult Delete(RefundType model)
 {
     try
     {
         model.UpdateDate = DateTime.Now;
         _RefundTypeRepository.Delete(model);
         return(new OperationResult(OperationResultType.Success, "更新数据成功!"));
     }
     catch
     {
         return(new OperationResult(OperationResultType.Error, "更新数据失败!"));
     }
 }
Example #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RefundCreate" /> class.
 /// </summary>
 /// <param name="externalId">The external id helps to identify duplicate calls to the refund service. As such the external ID has to be unique per transaction. (required).</param>
 /// <param name="type">type (required).</param>
 public RefundCreate(string externalId, RefundType type)
 {
     // to ensure "externalId" is required (not null)
     if (externalId == null)
     {
         throw new InvalidDataException("externalId is a required property for RefundCreate and cannot be null");
     }
     this.ExternalId = externalId;
     // to ensure "type" is required (not null)
     if (type == null)
     {
         throw new InvalidDataException("type is a required property for RefundCreate and cannot be null");
     }
     this.Type = type;
 }
        public NameValueCollection RefundTransaction(string transactionId, RefundType refundType = RefundType.Full, decimal amount = 0, string description = null, CurrencyCodeType currencyCodeType = CurrencyCodeType.USD)
        {
            var request = getQueryWithCredentials();
            request["METHOD"] = "RefundTransaction";
            request["TRANSACTIONID"] = transactionId;
            if (refundType == RefundType.Full)
            {
                return request;
            }

            request["REFUNDTYPE"] = "Partial";
            request["AMT"] = amount.ToString();
            request["CURRENCYCODE"] = currencyCodeType.ToString();
            request["NOTE"] = description;
            return request;
        }
Example #14
0
 public OperationResult Update(RefundTypeVM model)
 {
     try
     {
         RefundType refund = _RefundTypeRepository.Entities.FirstOrDefault(c => c.RefundTypeCode == model.RefundTypeCode.Trim());
         if (refund == null)
         {
             throw new Exception();
         }
         refund.RefundTypeName = model.RefundTypeName;
         refund.RefundTypeCode = model.RefundTypeCode;
         refund.UpdateDate     = DateTime.Now;
         _RefundTypeRepository.Update(refund);
         return(new OperationResult(OperationResultType.Success, "更新数据成功!"));
     }
     catch
     {
         return(new OperationResult(OperationResultType.Error, "更新数据失败!"));
     }
 }
Example #15
0
        /// <summary>
        /// Abre la ventana detalle en modo add
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 14/04/2016
        /// </history>
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            frmRefundTypeDetail frmRefundTypeDetail = new frmRefundTypeDetail();

            frmRefundTypeDetail.Owner    = this;
            frmRefundTypeDetail.enumMode = EnumMode.Add;
            if (frmRefundTypeDetail.ShowDialog() == true)
            {
                RefundType refundType = frmRefundTypeDetail.refundType;
                if (ValidateFilter(refundType))//Validamos si cumple con los filtros actualess
                {
                    List <RefundType> lstRefundTypes = (List <RefundType>)dgrRefundTypes.ItemsSource;
                    lstRefundTypes.Add(refundType);                                //Agregamos el registro a la lista
                    lstRefundTypes.Sort((x, y) => string.Compare(x.rfN, y.rfN));   //ordenamos la lista
                    int nIndex = lstRefundTypes.IndexOf(refundType);               //Obtenemos la posicion del registro
                    dgrRefundTypes.Items.Refresh();                                //Actualizamos la vista del grid
                    GridHelper.SelectRow(dgrRefundTypes, nIndex);                  //Seleccionamos el registro
                    StatusBarReg.Content = lstRefundTypes.Count + " Refun Types."; //Actualizamos el contador
                }
            }
        }
Example #16
0
        /// <summary>
        /// Llena el grid de Refund Types
        /// </summary>
        /// <param name="refundType">objeto a seleccionar</param>
        /// <history>
        /// [emoguel[] created 14/04/2016
        /// </history>
        private async void LoadRefundTypes(RefundType refundType = null)
        {
            try
            {
                status.Visibility = Visibility.Visible;
                int nIndex = 0;
                List <RefundType> lstRefundTypes = await BRRefundTypes.GetRefundTypes(_nStatus, _refundTypeFilter);

                dgrRefundTypes.ItemsSource = lstRefundTypes;
                if (lstRefundTypes.Count > 0 && refundType != null)
                {
                    refundType = lstRefundTypes.Where(rf => rf.rfID == refundType.rfID).FirstOrDefault();
                    nIndex     = lstRefundTypes.IndexOf(refundType);
                }
                GridHelper.SelectRow(dgrRefundTypes, nIndex);
                StatusBarReg.Content = lstRefundTypes.Count + " Refund Types.";
                status.Visibility    = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                UIHelper.ShowMessage(ex);
            }
        }
 public PaypalRefundResponse RefundTransaction(string transactionId, RefundType refundType = RefundType.Full, decimal amount = 0, string description = null, CurrencyCodeType currencyCodeType = CurrencyCodeType.USD)
 {
     var response = sendToPayPal(_requestBuilder.RefundTransaction(transactionId, refundType, amount, description, currencyCodeType));
     return _responseParser.RefundTransaction(response);
 }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="nextRenewalDate"></param>
 public void Terminate(RefundType refund)
 {
     Client.PerformRequest(Client.HttpRequestMethod.Put, UrlPrefix + System.Uri.EscapeUriString(this.Uuid) + "/terminate?refund=" +
         refund.ToString(),
          new Client.ReadXmlDelegate(this.ReadXml));
 }
 /// <summary>
 /// Terminates the subscription immediately.
 /// </summary>
 /// <param name="refund"></param>
 public void Terminate(RefundType refund)
 {
     Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,
                                    UrlPrefix + Uri.EscapeUriString(Uuid) + "/terminate?refund=" + refund.ToString().EnumNameToTransportCase(),
                                    ReadXml);
 }
Example #20
0
        /// <summary>
        /// Actualiza los registros del grid
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        /// <history>
        /// [emoguel] created 14/04/2016
        /// </history>
        private void btnRef_Click(object sender, RoutedEventArgs e)
        {
            RefundType refundType = (RefundType)dgrRefundTypes.SelectedItem;

            LoadRefundTypes(refundType);
        }
 /// <summary>
 /// Terminates the subscription immediately.
 /// </summary>
 /// <param name="refund"></param>
 public void Terminate(RefundType refund)
 {
     Client.Instance.PerformRequest(Client.HttpRequestMethod.Put,
         UrlPrefix + Uri.EscapeUriString(Uuid) + "/terminate?refund=" + refund.ToString().EnumNameToTransportCase(),
         ReadXml);
 }
Example #22
0
 /// <summary>
 /// 描述:退班订单交易对象实例化
 /// <para>作    者:瞿琦</para>
 /// <para>创建时间:2018-11-10</para>
 /// </summary>
 /// <param name="refundOrder">退费订单信息</param>
 /// <param name="refundType">退款方式</param>
 public LeaveClassOrderTrade(TblOdrRefundOrder refundOrder, RefundType refundType) : base(refundOrder)
 {
     _refundType = refundType;
 }
        /// <summary>
        /// Immediately terminate the subscription and issue a refund.  The refund can be for the full amount
        /// or prorated until its paid-thru date.  If you need to refund a specific amount, please issue a
        /// refund against the individual transaction instead.
        /// </summary>
        /// <param name="accountCode">Subscriber's Account Code</param>
        /// <param name="refundType"></param>
        public static void RefundSubscription(string accountCode, RefundType refundType)
        {
            string refundUrl = String.Format("{0}?refund={1}",
                SubscriptionUrl(accountCode),
                (refundType == RefundType.Full ? "full" : "partial"));

            RecurlyClient.PerformRequest(RecurlyClient.HttpRequestMethod.Delete, refundUrl);
        }
Example #24
0
 public TransactionResult ProcessRefund(Order order, decimal amount, bool isPartial, RefundType refundType)
 {
     return(ProcessResult(order, TransactionRequestType.Refund, amount, isPartial));
 }
        /// <summary>
        /// Immediately terminate the subscription and issue a refund.  The refund can be for the full amount
        /// or prorated until its paid-thru date.  If you need to refund a specific amount, please issue a
        /// refund against the individual transaction instead.
        /// </summary>
        /// <param name="accountCode">Subscriber's Account Code</param>
        /// <param name="refundType"></param>
        public static void RefundSubscription(string accountCode, RefundType refundType)
        {
            string refundTypeParameter = refundType.ToString().ToLower();

            string refundUrl = String.Format("{0}?refund={1}",
                SubscriptionUrl(accountCode),
                refundTypeParameter);

            RecurlyClient.PerformRequest(RecurlyClient.HttpRequestMethod.Delete, refundUrl);
        }
        /// <summary>
        /// You may remove any stored billing information for an account. If the account has a subscription, the renewal will go into past due unless you update the billing info before the renewal occurs.
        /// </summary>
        /// <param name="refund"></param>
        public bool Terminate(RefundType refund)
        {
            var statusCode = RecurlyClient.PerformRequest(RecurlyClient.HttpRequestMethod.Put,
                                         String.Format(Settings.Default.PathSubscriptionTerminate, Id,
                                                       Enum.GetName(refund.GetType(), refund).ToLower()),
                                                       WriteXml);

            return RecurlyClient.OkOrAccepted(statusCode);
        }
 /// <summary>
 /// Cancels subscription.
 /// </summary>
 /// <param name="uuid">Subscription ID.</param>
 /// <param name="refund">Refund type</param>
 public void TerminateSubscription(string uuid, RefundType refund = RefundType.None)
 {
     ExecuteRequest(new[] { ENDPOINT_POSTFIX, uuid, String.Format("terminate?refund={0}", refund.ToString()) }, Method.PUT);
 }
Example #28
0
        /// <summary>
        /// Obtiene registros del catalogo refundTypes
        /// </summary>
        /// <param name="nStatus">-1 Todos | 0. Inactivos | 1. Activos</param>
        /// <param name="refundType">Objeto con filtros adicionales</param>
        /// <returns>Lista de tipo refund Type</returns>
        /// <history>
        /// [emoguel] created 14/04/2016
        /// [emoguel] modified 28/06/2016 --> Se volvió async
        /// </history>
        public async static Task <List <RefundType> > GetRefundTypes(int nStatus = -1, RefundType refundType = null)
        {
            return(await Task.Run(() =>
            {
                using (var dbContext = new IMEntities(ConnectionHelper.ConnectionString()))
                {
                    var query = from rf in dbContext.RefundTypes
                                select rf;

                    if (nStatus != -1)//Filtro por estatus
                    {
                        bool blnStatus = Convert.ToBoolean(nStatus);
                        query = query.Where(rf => rf.rfA == blnStatus);
                    }

                    if (refundType != null)                              //Validamos si tiene un objeto
                    {
                        if (!string.IsNullOrWhiteSpace(refundType.rfID)) //Filtro por ID
                        {
                            query = query.Where(rf => rf.rfID == refundType.rfID);
                        }

                        if (!string.IsNullOrWhiteSpace(refundType.rfN))//Filtro por estatus
                        {
                            query = query.Where(rf => rf.rfN.Contains(refundType.rfN));
                        }
                    }

                    return query.OrderBy(rf => rf.rfN).ToList();
                }
            }));
        }