本文整理汇总了C#中Nop.Admin.Models.Orders.RecurringPaymentModel类的典型用法代码示例。如果您正苦于以下问题:C# RecurringPaymentModel类的具体用法?C# RecurringPaymentModel怎么用?C# RecurringPaymentModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RecurringPaymentModel类属于Nop.Admin.Models.Orders命名空间,在下文中一共展示了RecurringPaymentModel类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CancelRecurringPayment
public ActionResult CancelRecurringPayment(int id)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders))
return AccessDeniedView();
var payment = _orderService.GetRecurringPaymentById(id);
if (payment == null)
//No recurring payment found with the specified id
return RedirectToAction("List");
ViewData["selectedTab"] = "history";
try
{
var errors = _orderProcessingService.CancelRecurringPayment(payment);
var model = new RecurringPaymentModel();
PrepareRecurringPaymentModel(model, payment, true);
if (errors.Count > 0)
{
foreach (var error in errors)
ErrorNotification(error, false);
}
else
SuccessNotification(_localizationService.GetResource("Admin.RecurringPayments.Cancelled"), false);
return View(model);
}
catch (Exception exc)
{
//error
var model = new RecurringPaymentModel();
PrepareRecurringPaymentModel(model, payment, true);
ErrorNotification(exc, false);
return View(model);
}
}
示例2: PrepareRecurringPaymentModel
protected virtual void PrepareRecurringPaymentModel(RecurringPaymentModel model,
RecurringPayment recurringPayment)
{
if (model == null)
throw new ArgumentNullException("model");
if (recurringPayment == null)
throw new ArgumentNullException("recurringPayment");
model.Id = recurringPayment.ID;
model.CycleLength = recurringPayment.CycleLength;
model.CyclePeriodId = recurringPayment.CyclePeriodId;
model.CyclePeriodStr = recurringPayment.CyclePeriod.GetLocalizedEnum(_localizationService, _workContext);
model.TotalCycles = recurringPayment.TotalCycles;
model.StartDate = _dateTimeHelper.ConvertToUserTime(recurringPayment.StartDateUtc, DateTimeKind.Utc).ToString();
model.IsActive = recurringPayment.IsActive;
model.NextPaymentDate = recurringPayment.NextPaymentDate.HasValue ? _dateTimeHelper.ConvertToUserTime(recurringPayment.NextPaymentDate.Value, DateTimeKind.Utc).ToString() : "";
model.CyclesRemaining = recurringPayment.CyclesRemaining;
model.InitialOrderId = recurringPayment.InitialOrder.ID;
var customer = recurringPayment.InitialOrder.Customer;
model.CustomerId = customer.ID;
model.CustomerEmail = customer.IsRegistered() ? customer.Email : _localizationService.GetResource("Admin.Customers.Guest");
model.PaymentType = _paymentService.GetRecurringPaymentType(recurringPayment.InitialOrder.PaymentMethodSystemName).GetLocalizedEnum(_localizationService, _workContext);
model.CanCancelRecurringPayment = _orderProcessingService.CanCancelRecurringPayment(_workContext.CurrentCustomer, recurringPayment);
}
示例3: PrepareRecurringPaymentHistoryModel
protected virtual void PrepareRecurringPaymentHistoryModel(RecurringPaymentModel.RecurringPaymentHistoryModel model,
RecurringPaymentHistory history)
{
if (model == null)
throw new ArgumentNullException("model");
if (history == null)
throw new ArgumentNullException("history");
var order = _orderService.GetOrderById(history.OrderId);
model.Id = history.ID;
model.OrderId = history.OrderId;
model.RecurringPaymentId = history.RecurringPaymentId;
model.OrderStatus = order.OrderStatus.GetLocalizedEnum(_localizationService, _workContext);
model.PaymentStatus = order.PaymentStatus.GetLocalizedEnum(_localizationService, _workContext);
model.ShippingStatus = order.ShippingStatus.GetLocalizedEnum(_localizationService, _workContext);
model.CreatedOn = _dateTimeHelper.ConvertToUserTime(history.CreatedOnUtc, DateTimeKind.Utc);
}
示例4: PrepareRecurringPaymentModel
protected void PrepareRecurringPaymentModel(RecurringPaymentModel model,
RecurringPayment recurringPayment, bool includeHistory)
{
if (model == null)
throw new ArgumentNullException("model");
if (recurringPayment == null)
throw new ArgumentNullException("recurringPayment");
model.Id = recurringPayment.Id;
model.CycleLength = recurringPayment.CycleLength;
model.CyclePeriodId = recurringPayment.CyclePeriodId;
model.CyclePeriodStr = recurringPayment.CyclePeriod.GetLocalizedEnum(_localizationService, _workContext);
model.TotalCycles = recurringPayment.TotalCycles;
model.StartDate = _dateTimeHelper.ConvertToUserTime(recurringPayment.StartDateUtc, DateTimeKind.Utc).ToString();
model.IsActive = recurringPayment.IsActive;
model.NextPaymentDate = recurringPayment.NextPaymentDate.HasValue ? _dateTimeHelper.ConvertToUserTime(recurringPayment.NextPaymentDate.Value, DateTimeKind.Utc).ToString() : "";
model.CyclesRemaining = recurringPayment.CyclesRemaining;
model.InitialOrderId = recurringPayment.InitialOrder.Id;
var customer = recurringPayment.InitialOrder.Customer;
model.CustomerId = customer.Id;
model.CustomerEmail = customer.IsGuest() ? _localizationService.GetResource("Admin.Customers.Guest") : customer.Email;
model.PaymentType = _paymentService.GetRecurringPaymentType(recurringPayment.InitialOrder.PaymentMethodSystemName).GetLocalizedEnum(_localizationService, _workContext);
model.CanCancelRecurringPayment = _orderProcessingService.CanCancelRecurringPayment(_workContext.CurrentCustomer, recurringPayment);
if (includeHistory)
foreach (var rph in recurringPayment.RecurringPaymentHistory.OrderBy(x => x.CreatedOnUtc))
{
var rphModel = new RecurringPaymentModel.RecurringPaymentHistoryModel();
PrepareRecurringPaymentHistoryModel(rphModel, rph);
model.History.Add(rphModel);
}
}
示例5: List
public ActionResult List(GridCommand command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders))
return AccessDeniedView();
var payments = _orderService.SearchRecurringPayments(0, 0, null, command.Page - 1, command.PageSize, true);
var gridModel = new GridModel<RecurringPaymentModel>
{
Data = payments.Select(x =>
{
var m = new RecurringPaymentModel();
PrepareRecurringPaymentModel(m, x, false);
return m;
}),
Total = payments.TotalCount,
};
return new JsonResult
{
Data = gridModel
};
}
示例6: Edit
public ActionResult Edit(RecurringPaymentModel model, bool continueEditing)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders))
return AccessDeniedView();
var payment = _orderService.GetRecurringPaymentById(model.Id);
if (payment == null || payment.Deleted)
//No recurring payment found with the specified id
return RedirectToAction("List");
payment.CycleLength = model.CycleLength;
payment.CyclePeriodId = model.CyclePeriodId;
payment.TotalCycles = model.TotalCycles;
payment.IsActive = model.IsActive;
_orderService.UpdateRecurringPayment(payment);
SuccessNotification(_localizationService.GetResource("Admin.RecurringPayments.Updated"));
return continueEditing ? RedirectToAction("Edit", payment.Id) : RedirectToAction("List");
}
示例7: ProcessNextPayment
public ActionResult ProcessNextPayment(int id)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageRecurringPayments))
return AccessDeniedView();
var payment = _orderService.GetRecurringPaymentById(id);
if (payment == null)
//No recurring payment found with the specified id
return RedirectToAction("List");
try
{
_orderProcessingService.ProcessNextRecurringPayment(payment);
var model = new RecurringPaymentModel();
PrepareRecurringPaymentModel(model, payment);
SuccessNotification(_localizationService.GetResource("Admin.RecurringPayments.NextPaymentProcessed"), false);
//selected tab
SaveSelectedTabIndex(persistForTheNextRequest: false);
return View(model);
}
catch (Exception exc)
{
//error
var model = new RecurringPaymentModel();
PrepareRecurringPaymentModel(model, payment);
ErrorNotification(exc, false);
//selected tab
SaveSelectedTabIndex(persistForTheNextRequest: false);
return View(model);
}
}
示例8: List
public ActionResult List(DataSourceRequest command)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageRecurringPayments))
return AccessDeniedView();
var payments = _orderService.SearchRecurringPayments(0, 0, 0, null, command.Page - 1, command.PageSize, true);
var gridModel = new DataSourceResult
{
Data = payments.Select(x =>
{
var m = new RecurringPaymentModel();
PrepareRecurringPaymentModel(m, x);
return m;
}),
Total = payments.TotalCount,
};
return Json(gridModel);
}
示例9: ProcessNextPayment
public ActionResult ProcessNextPayment(int id)
{
if (!_permissionService.Authorize(StandardPermissionProvider.ManageOrders))
return AccessDeniedView();
var payment = _orderService.GetRecurringPaymentById(id);
if (payment == null)
throw new ArgumentException("No recurring payment found with the specified id");
ViewData["selectedTab"] = "history";
try
{
_orderProcessingService.ProcessNextRecurringPayment(payment);
var model = new RecurringPaymentModel();
PrepareRecurringPaymentModel(model, payment, true);
SuccessNotification(_localizationService.GetResource("Admin.RecurringPayments.NextPaymentProcessed"), false);
return View(model);
}
catch (Exception exc)
{
//error
var model = new RecurringPaymentModel();
PrepareRecurringPaymentModel(model, payment, true);
ErrorNotification(exc, false);
return View(model);
}
}