public void StoreFile_MoveFile_MovedFileShouldNotExistsAndSettingFileShouldExists()
        {
            // Arrange
            var settings = new DiskStorageSettings
            {
                FileName = Path.Combine(_tempPathName, "DiskStorageTest_MovedFile.txt")
            };

            var logger = new Mock <ILogger>();

            var diskStorage = new DiskStorage(settings, logger.Object);

            // Create file
            var fileToMoveFileName = Path.Combine(_tempPathName, "DiskStorageTest_FileToMove.txt");
            var fileStream         = File.Create(fileToMoveFileName);

            // Write string to file
            const string testString = "Test string\r\nIn 2 lines.";

            fileStream.Write(Encoding.UTF8.GetBytes(testString));
            fileStream.Seek(0, SeekOrigin.Begin);

            // Act
            diskStorage.Store(fileStream, DateTime.MinValue, DateTime.MinValue);

            // Assert
            Assert.False(File.Exists(fileToMoveFileName));
            Assert.True(File.Exists(settings.FileName));
            Assert.Equal(testString, File.ReadAllText(settings.FileName));


            // Cleanup
            File.Delete(settings.FileName);
        }
        public void StoreFile_FileAlreadyExists_ShouldCreateFileWithProgressiveName()
        {
            // Arrange
            var settings = new DiskStorageSettings
            {
                FileName = Path.Combine(_tempPathName, "DiskStorageTest_AlreadyExistFileName.txt")
            };
            var fileName = Path.Combine(_tempPathName, "DiskStorageTest_AlreadyExistFileName (1).txt");

            var logger = new Mock <ILogger>();

            var diskStorage = new DiskStorage(settings, logger.Object);

            var fileStream = File.Create(settings.FileName);

            // Act
            diskStorage.Store(fileStream, DateTime.MinValue, DateTime.MinValue);

            // Assert
            Assert.True(File.Exists(fileName));

            // Cleanup
            fileStream.Dispose();
            File.Delete(settings.FileName);
            File.Delete(fileName);
        }
Example #3
0
        private Product CreateCupCake()
        {
            var p = new Product();

            p.Sku                         = "SAMPLE002";
            p.ProductName                 = "Cup Cake Sample";
            p.Featured                    = true;
            p.IsSearchable                = true;
            p.ImageFileSmall              = "CupCake.jpg";
            p.ImageFileMedium             = "CupCake.jpg";
            p.ImageFileSmallAlternateText = "Cup Cake Sample SAMPLE002";
            p.InventoryMode               = ProductInventoryMode.AlwayInStock;
            p.LongDescription             =
                "Savor this sweet treat from our famous collection of sample items. This product is not for sale and is a demonstration of how items could appear in your store";
            p.MetaDescription = "Vanilla Cup Cake with Rich Frosting";
            p.MetaKeywords    = "cup,cake,cupcake,valentine,small,treats,baked goods";
            p.MetaTitle       = "Vanilla Cup Cake with Rich Frosting";
            p.SitePrice       = 1.99m;
            p.Status          = ProductStatus.Active;
            p.UrlSlug         = "cup-cake-sample";
            CatalogServices.ProductsCreateWithInventory(p, true);

            DiskStorage.CopyDemoProductImage(p.StoreId, p.Bvin, p.ImageFileSmall);

            return(p);
        }
        public void StoreFile_CreateFileWithDateAndTimestampPlaceholders_FileNameShouldMatch()
        {
            // Arrange
            const string startDatePlaceholder = "{StartDate:yyyyMMdd}";
            const string endDatePlaceholder   = "{EndDate:yyyyMMdd}";
            const string datePlaceHolder      = "{date:yyyyMMdd}";
            const string timestampPlaceHolder = "{timestamp:yyyyMMdd}";
            var          settings             = new DiskStorageSettings
            {
                FileName = Path.Combine(_tempPathName, $"DiskStorageTest_NewFile_{startDatePlaceholder}_{endDatePlaceholder}_{datePlaceHolder}_{timestampPlaceHolder}.txt")
            };

            var logger = new Mock <ILogger>();

            var diskStorage = new DiskStorage(settings, logger.Object);


            var stream = new MemoryStream();

            // Act
            diskStorage.Store(stream, DateTime.Today.AddDays(-2), DateTime.Today.AddDays(-1));

            // Assert
            var correctFileName = settings.FileName
                                  .Replace(startDatePlaceholder, DateTime.Today.AddDays(-2).ToString("yyyyMMdd"))
                                  .Replace(endDatePlaceholder, DateTime.Today.AddDays(-1).ToString("yyyyMMdd"))
                                  .Replace(datePlaceHolder, DateTime.Now.ToString("yyyyMMdd"))
                                  .Replace(timestampPlaceHolder, DateTime.Now.ToString("yyyyMMdd"));

            Assert.True(File.Exists(correctFileName));

            // Cleanup
            File.Delete(correctFileName);
        }
Example #5
0
        private bool Save()
        {
            var result = false;

            HccApp.CurrentStore.Settings.UseLogoImage = chkUseLogoImage.Checked;
            HccApp.CurrentStore.Settings.FriendlyName = txtSiteName.Text.Trim();
            HccApp.CurrentStore.Settings.LogoText     = txtLogoText.Text.Trim();

            result = true;

            if (!string.IsNullOrEmpty(ucStoreLogo.FileName))
            {
                var fileName = Path.GetFileNameWithoutExtension(ucStoreLogo.FileName);
                var ext      = Path.GetExtension(ucStoreLogo.FileName);

                fileName = Text.CleanFileName(fileName);

                if (DiskStorage.UploadStoreImage(HccApp.CurrentStore, ucStoreLogo.TempImagePath, ucStoreLogo.FileName))
                {
                    HccApp.CurrentStore.Settings.LogoImage = fileName + ext;
                }
            }

            HccApp.CurrentStore.Settings.ForceAdminSSL = chkUseSSL.Checked;

            HccApp.UpdateCurrentStore();

            return(result);
        }
Example #6
0
        public ActionResult Upload()
        {
            var path = Request.Form["path"] ?? string.Empty;

            path = DiskStorage.FileManagerCleanPath(path);

            try
            {
                for (var i = 0; i < Request.Files.Count; i++)
                {
                    var file = Request.Files[i];
                    if (file.ContentLength > 0)
                    {
                        var completeFileName = file.FileName;
                        var nameSmall        = Path.GetFileName(completeFileName);
                        var fullPathAndName  = path + "\\" + nameSmall;
                        DiskStorage.FileManagerCreateFile(HccApp.CurrentStore.Id, fullPathAndName, file);
                    }
                }
            }
            catch (Exception ex)
            {
                FlashFailure(ex.Message);
                EventLog.LogEvent(ex);
            }

            var destination = Url.Content("~/DesktopModules/Hotcakes/API/mvc/filemanager?path=" + path);

            return(new RedirectResult(destination));
        }
Example #7
0
        partial void SyncNotes(NSObject sender)
        {
            var          dest_manifest_path = Path.Combine(settings.syncURL, "manifest.xml");
            SyncManifest dest_manifest;

            if (!File.Exists(dest_manifest_path))
            {
                using (var output = new FileStream(dest_manifest_path, FileMode.Create)) {
                    SyncManifest.Write(new SyncManifest(), output);
                }
            }
            using (var input = new FileStream(dest_manifest_path, FileMode.Open)) {
                dest_manifest = SyncManifest.Read(input);
            }
            var dest_storage = new DiskStorage(settings.syncURL);
            var dest_engine  = new Engine(dest_storage);

            var client       = new FilesystemSyncClient(NoteEngine, manifestTracker.Manifest);
            var server       = new FilesystemSyncServer(dest_engine, dest_manifest);
            var sync_manager = new SyncManager(client, server);

            sync_manager.DoSync();
            RefreshNotesWindowController();
            // write back the dest manifest
            using (var output = new FileStream(dest_manifest_path, FileMode.Create)) {
                SyncManifest.Write(dest_manifest, output);
            }
        }
Example #8
0
        private bool UpdatePayment(long paymentId)
        {
            var aff     = HccApp.ContactServices.Affiliates.FindByAffiliateId(txtAffiliateID.Text);
            var payment = HccApp.ContactServices.AffiliatePayments.Find(paymentId);

            if (aff != null)
            {
                payment.AffiliateId    = aff.Id;
                payment.PaymentAmount  = decimal.Parse(txtAmount.Text);
                payment.PaymentDateUtc = DateTime.UtcNow;
                payment.Notes          = txtMemo.Text;

                if (fuAttachment.HasFile)
                {
                    payment.FileName = DiskStorage.UploadPaymanentsAttachment(HccApp.CurrentStore.Id,
                                                                              fuAttachment.PostedFile);
                }

                Payments = new List <AffiliatePayment> {
                    payment
                };
                return(true);
            }
            ucMessageBox.ShowError("Affiliate ID is invalid.");
            return(false);
        }
Example #9
0
        private void LoadWishList()
        {
            var w        = HccApp.CatalogServices.WishListItems.FindByCustomerIdPaged(CustomerId, 1, 100);
            var products = new List <Product>();

            foreach (var item in w)
            {
                var n = HccApp.CatalogServices.Products.FindWithCache(item.ProductId);

                n.ImageFileSmall = DiskStorage.ProductImageUrlSmall(
                    HccApp,
                    n.Bvin,
                    n.ImageFileSmall,
                    Request.IsSecureConnection);
                products.Add(n);
            }

            if (products.Count > 0)
            {
                WishList.Visible    = true;
                WishList.DataSource = products;
                WishList.DataBind();
            }
            else
            {
                lblNoWishListItems.Visible = true;
            }
        }
Example #10
0
        public AvatarControllerTests()
        {
            _connection = new SqliteConnection("Data Source=:memory:");

            _connection.Open();

            var options = new DbContextOptionsBuilder <MobicloneContext>().UseSqlite(_connection).Options;

            _context = new MobicloneContext(options);

            var hash = new Bcrypt();

            var configuration = new ConfigurationBuilder().AddJsonFile("appsettings.Test.json").Build();

            _accessor = new HttpContextAccessor
            {
                HttpContext = new DefaultHttpContext()
            };

            var auth = new Jwt(_context, hash, configuration, _accessor);

            var storage = new DiskStorage(configuration);

            _controller = new AvatarController(_context, auth, storage);

            _context.Database.EnsureCreated();
        }
        public void StoreFile_CreateFileFromStream_FileShouldExists()
        {
            // Arrange
            var settings = new DiskStorageSettings
            {
                FileName = Path.Combine(_tempPathName, "DiskStorageTest_NewFile.txt")
            };

            var logger = new Mock <ILogger>();

            var diskStorage = new DiskStorage(settings, logger.Object);


            var stream = new MemoryStream();

            const string testString = "Test string\r\nIn 2 lines.";

            stream.Write(Encoding.UTF8.GetBytes(testString));
            stream.Seek(0, SeekOrigin.Begin);

            // Act
            diskStorage.Store(stream, DateTime.MinValue, DateTime.MinValue);

            // Assert
            Assert.True(File.Exists(settings.FileName));
            Assert.Equal(testString, File.ReadAllText(settings.FileName));


            // Cleanup
            File.Delete(settings.FileName);
        }
        private void LoadCategory(SingleCategoryViewModel model, string categoryId)
        {
            var c = HccApp.CatalogServices.Categories.Find(categoryId);

            if (c != null)
            {
                var catSnapshot = new CategorySnapshot(c);
                var destination = UrlRewriter.BuildUrlForCategory(catSnapshot);

                var imageUrl = DiskStorage.CategoryIconUrl(HccApp,
                                                           c.Bvin,
                                                           c.ImageUrl,
                                                           Request.IsSecureConnection);
                model.IconUrl = ImageHelper.SafeImage(imageUrl);

                model.LinkUrl       = destination;
                model.AltText       = c.MetaTitle;
                model.Name          = c.Name;
                model.LocalCategory = catSnapshot;

                if (c.SourceType == CategorySourceType.CustomLink)
                {
                    model.OpenInNewWindow = c.CustomPageOpenInNewWindow;
                }
            }
        }
        /// <summary>
        ///     Save file
        /// </summary>
        /// <param name="storeId">Store unique identifier</param>
        /// <param name="fileid">File unique identifier</param>
        /// <param name="fileName">File Name</param>
        /// <param name="stream">File stream instance</param>
        /// <returns>Returs true if file saved successfully</returns>
        public static bool SaveFile(long storeId, string fileid, string fileName, FileStream stream)
        {
            var diskFileName = fileid + "_" + fileName + ".config";

            DiskStorage.FileVaultUpload(storeId, diskFileName, stream);
            return(true);
        }
        /// <summary>
        ///     Save file
        /// </summary>
        /// <param name="storeId">Store unique identifier</param>
        /// <param name="fileId">File unique identifier</param>
        /// <param name="fileName">File name</param>
        /// <param name="fileData">File byte array</param>
        /// <returns>Returns true if the file saved successfully</returns>
        public static bool SaveFile(long storeId, string fileId, string fileName, byte[] fileData)
        {
            var diskFileName = fileId + "_" + fileName + ".config";

            DiskStorage.FileVaultUpload(storeId, diskFileName, fileData);
            return(true);
        }
Example #15
0
        public async Task SavesDiffToDataDir(int diffId, DifferenceType type, int offset)
        {
            var content = new DifferenceContent
            {
                Type    = type,
                Details = new[] {
                    new DifferenceDetail {
                        LeftOffset = offset
                    },
                    new DifferenceDetail {
                        RightOffset = offset
                    },
                }
            };
            var expectedFileName = Path.Combine(_DataDir,
                                                string.Concat(diffId.ToString(), ".diff"));

            File.Delete(expectedFileName);

            var storage = new DiskStorage(_Options);
            await storage.SaveDiffAsync(content.InDiffBag(diffId));

            File.ReadAllText(expectedFileName)
            .Should().Be(JsonConvert.SerializeObject(content));
        }
        /// <summary>
        ///     Save file
        /// </summary>
        /// <param name="storeId">Store unique identifier</param>
        /// <param name="fileid">File unique identifer</param>
        /// <param name="fileName">File name</param>
        /// <param name="file"><see cref="HttpPostedFile" /> instance</param>
        /// <returns>Returns true if file saved successfully</returns>
        public static bool SaveFile(long storeId, string fileid, string fileName, HttpPostedFile file)
        {
            var diskFileName = fileid + "_" + fileName + ".config";

            DiskStorage.FileVaultUpload(storeId, diskFileName, file);
            return(true);
        }
Example #17
0
        public async Task LoadsReadyDiffFromDataDir(int diffId, DifferenceType type, int length)
        {
            var content = new DifferenceContent
            {
                Type    = type,
                Details = new[] {
                    new DifferenceDetail {
                        LeftLength = length
                    },
                    new DifferenceDetail {
                        RightLength = length
                    },
                }
            };
            var expectedFileName = Path.Combine(_DataDir,
                                                string.Concat(diffId.ToString(), ".diff"));

            File.WriteAllText(expectedFileName, JsonConvert.SerializeObject(content));
            try
            {
                var storage = new DiskStorage(_Options);
                var(diff, readiness) = await storage.LoadDiffAsync(diffId);

                readiness.Should().Be(DifferenceReadiness.Ready);

                diff.Type.Should().Be(type);
                diff.Details.ShouldAllBeEquivalentTo(content.Details,
                                                     opts => opts.WithStrictOrdering());
            }
            finally
            {
                File.Delete(expectedFileName);
            }
        }
Example #18
0
        private void ux_NewProjectMenu_Click(object sender, EventArgs e)
        {
            if (Project != null)
            {
                var result = MessageBox.Show("Do you want to save changes to the current project?", "Save Changes?", MessageBoxButtons.YesNoCancel);
                if (result == DialogResult.Yes)
                {
                    DiskStorage.SaveToDisk(CurrentProjectFile, Project);
                    Project.Levels.ForEach(l => l.Save());
                }

                if (result == DialogResult.Cancel)
                {
                    return;
                }
            }

            // ask the user to pick a new project file
            var projectNameResult = ux_SaveProjectDialog.ShowDialog();

            if (projectNameResult == DialogResult.OK)
            {
                CurrentProjectFile = ux_SaveProjectDialog.FileName;
            }

            Project = new Project();
        }
Example #19
0
        private bool SaveImages(Category c)
        {
            var result = true;

            // Icon Image Upload
            if (ucIconImage.HasFile)
            {
                var fileName = Text.CleanFileName(Path.GetFileName(ucIconImage.FileName));

                if (DiskStorage.CopyCategoryIcon(HccApp.CurrentStore.Id, c.Bvin, ucIconImage.TempImagePath, fileName))
                {
                    c.ImageUrl = fileName;
                }
                else
                {
                    result = false;
                    ucMessageBox.ShowError("Only .PNG, .JPG, .GIF file types are allowed for icon images");
                }
            }
            else if (ucIconImage.Removed)
            {
                c.ImageUrl = string.Empty;
            }

            return(result);
        }
Example #20
0
        public ActionResult Upload()
        {
            string path = Request.Form["path"] ?? string.Empty;

            path = DiskStorage.FileManagerCleanPath(path);

            try
            {
                for (int i = 0; i < Request.Files.Count; i++)
                {
                    HttpPostedFileBase file = Request.Files[i];
                    if (file.ContentLength > 0)
                    {
                        string completeFileName = file.FileName;
                        string nameSmall        = System.IO.Path.GetFileName(completeFileName);
                        string fullPathAndName  = path + "\\" + nameSmall;
                        DiskStorage.FileManagerCreateFile(MTApp.CurrentStore.Id, fullPathAndName, file);
                    }
                }
            }
            catch (Exception ex)
            {
                FlashFailure(ex.Message);
                MerchantTribe.Commerce.EventLog.LogEvent(ex);
            }

            string destination = Url.Content("~/bvadmin/content/filemanager?path=" + path);

            return(new RedirectResult(destination));
        }
Example #21
0
    private void UpdateLocal(Action <bool> callback)
    {
        try
        {
            var text = DiskStorage.ReadText(LOCAL_LANG_FILE);

            if (string.IsNullOrEmpty(text))
            {
                text = Resources.Load <TextAsset>("Localization").text;
            }

            var json = SimpleJSON.JSON.Parse(text);

            FillLanguages(json);

            if (callback != null)
            {
                callback(false);
            }
        }
        catch
        {
            if (callback != null)
            {
                callback(true);
            }
        }
    }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var item = HccApp.CatalogServices.ProductVariants.Find(EditedVariantId);

            if (item != null)
            {
                cvVariantSku.IsValid = true;
                var prodGuid = DataTypeHelper.BvinToNullableGuid(ProductId);
                if (HccApp.CatalogServices.Products.IsSkuExist(txtVariantSku.Text.Trim(), prodGuid))
                {
                    cvVariantSku.IsValid = false;
                    ShowDialog();
                    return;
                }

                item.Sku = txtVariantSku.Text.Trim();
                var p = item.Price;
                if (decimal.TryParse(txtVariantPrice.Text.Trim(), NumberStyles.Currency, CultureInfo.CurrentCulture,
                                     out p))
                {
                    item.Price = Money.RoundCurrency(p);
                }

                if (ucVariantImage.HasFile)
                {
                    DiskStorage.CopyProductVariantImage(HccApp.CurrentStore.Id, ProductId, item.Bvin,
                                                        ucVariantImage.TempImagePath, ucVariantImage.FileName);
                }

                HccApp.CatalogServices.ProductVariants.Update(item);
            }

            CloseDialog();
            LoadVariants();
        }
Example #23
0
        protected override object HandleAction(HttpRequest request, HotcakesApplication hccApp)
        {
            if (request.Files.Count > 0)
            {
                var file = request.Files[0];
                var path = DiskStorage.UploadTempImage(hccApp.CurrentStore.Id, file);

                if (!string.IsNullOrEmpty(path))
                {
                    path = "~/" + path.Replace(request.PhysicalApplicationPath, "").Replace("\\", "/");

                    return(new TempImage
                    {
                        FileName = Path.GetFileName(file.FileName),
                        TempFileName = VirtualPathUtility.ToAbsolute(path)
                    });
                }
                return(new TempImage {
                    Message = "Only .PNG, .JPG, .GIF file types are allowed"
                });
            }

            return(new TempImage {
                Message = "Unknonw Error"
            });
        }
Example #24
0
        protected void DoExport(object objConfiguration)
        {
            try
            {
                var conf = objConfiguration as ExportConfiguration;

                HccRequestContext.Current = conf.HccRequestContext;
                DnnGlobal.SetPortalSettings(conf.DnnPortalSettings);
                Factory.HttpContext = conf.HttpContext;
                CultureSwitch.SetCulture(HccApp.CurrentStore, conf.DnnPortalSettings);

                var products = HccApp.CatalogServices.Products.FindByCriteria(conf.Criteria, 1, int.MaxValue,
                                                                              ref RowCount, false);

                var export   = new CatalogExport(HccApp);
                var fileName = string.Format("Hotcakes_Products_{0}_{1:yyyyMMddhhMMss}.xlsx", HccApp.CurrentCustomerId,
                                             DateTime.UtcNow);
                var filePath = DiskStorage.GetStoreDataPhysicalPath(HccApp.CurrentStore.Id, "Exports/" + fileName);
                export.ExportToExcel(products, filePath);

                var pageLink    = DiskStorage.GetHccAdminUrl(HccApp, "catalog/default.aspx", false);
                var mailMessage = new MailMessage(conf.DnnPortalSettings.Email, HccApp.CurrentCustomer.Email);
                mailMessage.IsBodyHtml = true;
                mailMessage.Body       = Localization.GetFormattedString("ExportProductsMailBody", pageLink);
                mailMessage.Subject    = Localization.GetString("ExportProductsMailSubject");
                MailServices.SendMail(mailMessage, HccApp.CurrentStore);
            }
            catch (Exception ex)
            {
                EventLog.LogEvent(ex);
            }
        }
Example #25
0
        public static void AddDummyUserIfRequired(Funq.Container container)
        {
            // create a dummy user
            var fac = container.Resolve <IDbConnectionFactory> ();

            using (var db = fac.OpenDbConnection()) {
                if (db.FirstOrDefault <DBUser> (u => u.Username == "dummy") == null)
                {
                    var user = new DBUser();
                    user.Username = "******";
                    user.CreateCryptoFields("foobar123");
                    user.FirstName                 = "John Dummy";
                    user.LastName                  = "Doe";
                    user.AdditionalData            = "Dummy user that is created when in development mode";
                    user.IsActivated               = true;
                    user.IsVerified                = true;
                    user.Manifest.LastSyncRevision = 0;
                    user.EmailAddress              = "*****@*****.**";
                    db.Insert <DBUser> (user);
                    // insert some sample notes
                    var f   = container.Resolve <DbStorageFactory> ();
                    var key = user.GetPlaintextMasterKey("foobar123");
                    var r   = new RequestingUser {
                        Username            = "******",
                        EncryptionMasterKey = key.ToHexString()
                    };
                    // populate with note test cases taken from Tomdroid
                    // these notes will fail Tomboy...
                    using (var storage = f.GetDbStorage(r)) {
                        var sample_notes = new DiskStorage("../../../sample_notes/");
                        sample_notes.GetNotes().Values.ToList().ForEach(n => storage.SaveNote(n));
                    }
                }
            }
        }
Example #26
0
        private string ResolveSpecialUrl(string raw)
        {
            // full url
            var tester = raw.Trim().ToLowerInvariant();

            if (tester.StartsWith("http:") || tester.StartsWith("https:") ||
                tester.StartsWith("//"))
            {
                return(raw);
            }

            // tag replaced url {{img}} or {{assets}
            if (tester.StartsWith("{{"))
            {
                return(TagReplacer.ReplaceContentTags(raw, HccApp));
            }

            // app relative url
            if (tester.StartsWith("~"))
            {
                return(ResolveUrl(raw));
            }

            // old style asset
            return(DiskStorage.StoreUrl(
                       HccApp,
                       raw,
                       HccApp.IsCurrentRequestSecure()));
        }
        /// <summary>
        ///     Set parameter values with provided product object
        /// </summary>
        /// <param name="p">Product information.</param>
        /// <param name="hccApp">An instance of the Hotcakes Application context.</param>
        public SingleProductViewModel(Product p, HotcakesApplication hccApp)
        {
            if (p == null)
            {
                throw new ArgumentNullException("Product");
            }
            if (hccApp == null)
            {
                throw new ArgumentNullException("HotcakesApplication");
            }

            UserPrice = hccApp.PriceProduct(p, hccApp.CurrentCustomer, null, hccApp.CurrentlyActiveSales);
            Item      = p;

            ProductLink = UrlRewriter.BuildUrlForProduct(p);
            ImageUrls   = new ProductImageUrls();
            ImageUrls.LoadProductImageUrls(hccApp, p);

            SwatchDisplay = ImageHelper.GenerateSwatchHtmlForProduct(p, hccApp);

#pragma warning disable 0612, 0618
            ImageUrl = DiskStorage.ProductImageUrlSmall(
                hccApp,
                p.Bvin,
                p.ImageFileSmall,
                hccApp.IsCurrentRequestSecure());

            OriginalImageUrl = DiskStorage.ProductImageUrlOriginal(
                hccApp,
                p.Bvin,
                p.ImageFileSmall,
                hccApp.CurrentRequestContext.RoutingContext.HttpContext.Request.IsSecureConnection);
#pragma warning restore 0612, 0618
        }
Example #28
0
 private void LoadImagePreview(Product p)
 {
     ucImageUploadLarge.ImageUrl = DiskStorage.ProductImageUrlMedium(HccApp, p.Bvin, p.ImageFileMedium,
                                                                     HccApp.IsCurrentRequestSecure());
     imgPreviewSmall.ImageUrl = DiskStorage.ProductImageUrlSmall(HccApp, p.Bvin, p.ImageFileSmall,
                                                                 HccApp.IsCurrentRequestSecure());
 }
Example #29
0
 public void Save()
 {
     DiskStorage.SaveToDisk(FilePath, this);
     if (OnPersisted != null)
     {
         OnPersisted(this, EventArgs.Empty);
     }
 }
Example #30
0
        protected string GetVariantImageUrl(IDataItemContainer cont)
        {
            var v = cont.DataItem as Variant;
            var p = _currentProduct;

            return(DiskStorage.ProductVariantImageUrlMedium(HccApp, p.Bvin, p.ImageFileSmall, v.Bvin,
                                                            HccApp.IsCurrentRequestSecure()));
        }