private ReturnMethod validateReturn(PurchaseDetails purchaseDetail) { //Stored Procedure to validate ReturnMethod returnMethod = Repository.Instance.ValidateReturn(purchaseDetail, _context.Database.GetDbConnection().ConnectionString); return(returnMethod); }
protected virtual IDictionary <string, string> GetParameters(PaymentRequest paymentRequest) { var currency = paymentRequest.Amount.CurrencyIsoCode; // For dynamics, we have to call the extension method as a normal method. ReturnMethod rm = EnumExtensions.ParseReturnMethodThrowExceptionOnFailure(paymentRequest.PaymentMethod .DynamicProperty <string>().ReturnMethod); PaymentAction pa = EnumExtensions.ParsePaymentActionThrowExceptionOnFailure(paymentRequest.PaymentMethod .DynamicProperty <string>().PaymentAction); var dict = new Dictionary <string, string> { { "upload", "1" }, { "cmd", "_cart" }, { "business", paymentRequest.PaymentMethod.DynamicProperty <string>().Business }, { "return", new Uri(AbsoluteUrlService.GetAbsoluteUrl(paymentRequest.PaymentMethod.DynamicProperty <string>() .Return)) .AddOrderGuidParameter( paymentRequest.Payment.PurchaseOrder).ToString() }, { "rm", ((int)rm).ToString() }, // Vendor code to identify Ucommerce { "bn", "Ucommerce_SP" }, { "currency_code", currency }, { "no_shipping", "1" }, { "paymentaction", pa.ToString().ToLower() }, { "cancel_return", AbsoluteUrlService.GetAbsoluteUrl(paymentRequest.PaymentMethod.DynamicProperty <string>() .CancelReturn) }, { "notify_url", CallbackUrl.GetCallbackUrl(paymentRequest.PaymentMethod.DynamicProperty <string>().NotifyUrl, paymentRequest.Payment) }, { "invoice", paymentRequest.Payment.ReferenceId }, { "item_name_1", string.Join(", ", paymentRequest.Payment.PurchaseOrder.OrderLines.Select(x => x.ProductName)) }, { "amount_1", paymentRequest.Payment.Amount.ToInvariantString() }, { "quantity_1", "1" } }; return(dict); }
public ReturnMethod ValidateReturn(PurchaseDetails purchaseDetails, string connectionString) { ReturnMethod returnMethod = ReturnMethod.NoReturnType; SqlConnection connection = null; try { using (connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlCommand command = connection.CreateCommand()) { command.CommandText = "ValidateReturn"; command.CommandType = CommandType.StoredProcedure; command.Parameters.Add(new SqlParameter("@purchaseId", purchaseDetails.PurchaseId)); command.Parameters.Add(new SqlParameter("@returnQuantity", purchaseDetails.Quantity)); command.Parameters.Add(new SqlParameter("@purchaseDetailId", purchaseDetails.Id)); using (SqlDataReader rdr = command.ExecuteReader()) { while (rdr.Read()) { if (!string.IsNullOrEmpty(rdr["ReturnMethod"].ToString())) { returnMethod = (ReturnMethod)(int.Parse(rdr["ReturnMethod"].ToString())); } } } } } } catch (SqlException sqlEx) { } catch (Exception ex) { } finally { if (connection != null && connection.State == ConnectionState.Open) { connection.Close(); } } return(returnMethod); }
public static ITimeSeries <double> FirstDifference(this ITimeSeries <double> timeseries, ReturnMethod method = ReturnMethod.Geometric) { if (method == ReturnMethod.Arithmetic) { var res = from cur in timeseries.Skip(1) select new TSDataPoint <double>(cur.Date, cur.Value / timeseries[(from prev in timeseries where prev.Date < cur.Date select prev.Date).Max()] - 1); return(TimeSeriesFactory <double> .Create(res, timeseries.Name, timeseries.IntegrationOrder - 1, timeseries.Frequency)); } else { var res = from cur in timeseries.Skip(1) select new TSDataPoint <double>(cur.Date, Math.Log(cur.Value / timeseries[(from prev in timeseries where prev.Date < cur.Date select prev.Date).Max()])); return(TimeSeriesFactory <double> .Create(res, timeseries.Name, timeseries.IntegrationOrder - 1, timeseries.Frequency)); } }