Example #1
0
 private void PrepareExportRollBack(AdvExportInfo info)
 {
     exportInfo.Title = Title;
     exportInfo.Description = Description;
     exportInfo.Price = Price;
 }
Example #2
0
        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;
        }
Example #3
0
        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;
        }
Example #4
0
        public void ExportRollBack()
        {
            if (exportInfo == null) return;

            Title = exportInfo.Title;
            Description = exportInfo.Description;
            Price = exportInfo.Price;

            exportInfo = null;
        }