private void PrepareExportRollBack(AdvExportInfo info) { exportInfo.Title = Title; exportInfo.Description = Description; exportInfo.Price = Price; }
public AdvExportInfo PrepareExport() { exportInfo = new AdvExportInfo(this); PrepareExportRollBack(exportInfo); ApplyStyle(); ApplyPrice(); PrepareImages(); bool isExpired = IsExpired(); bool productAllow = Product.IsAllowPost(); exportInfo.Close = Published && !isExpired && (!Active || !productAllow); exportInfo.Create = !Published && Active && productAllow; exportInfo.Repost = Published && isExpired; exportInfo.UpdateImages = IsNeedUpdateImages(); exportInfo.UpdateData = IsNeedUpdateData(exportInfo); return exportInfo; }
bool IsNeedUpdateData(AdvExportInfo exportInfo) { var title = exportInfo.Title; var description = exportInfo.Description; var price = exportInfo.Price; bool changedTitle = Title != title; bool changedDescription = Description != description; bool changedPrice = Price != price; bool needUpdate = changedTitle || changedDescription || changedPrice; return needUpdate; }
public void ExportRollBack() { if (exportInfo == null) return; Title = exportInfo.Title; Description = exportInfo.Description; Price = exportInfo.Price; exportInfo = null; }