public static void SaveAndUpdateItemCostVariantCombination(CostVariantsCombination itemCostVariants, AspxCommonInfo aspxCommonObj, string cvCombinations)
 {
     try
     {
         AspxItemMgntProvider.SaveAndUpdateItemCostVariantCombination(itemCostVariants, aspxCommonObj, cvCombinations);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#2
0
 public static void SaveAndUpdateItemCostVariantCombination(CostVariantsCombination itemCostVariants, AspxCommonInfo aspxCommonObj, string cvCombinations)
 {
     try
     {
         List <KeyValuePair <string, object> > parameterCollection = CommonParmBuilder.GetParamSPUC(aspxCommonObj);
         parameterCollection.Add(new KeyValuePair <string, object>("@ItemID", itemCostVariants.ItemId));
         parameterCollection.Add(new KeyValuePair <string, object>("@VariantOptions", cvCombinations));
         SQLHandler sq = new SQLHandler();
         sq.ExecuteNonQuery("usp_Aspx_SaveAndUpdateItemCostVariantsConfig", parameterCollection);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public string MoveVariantsImageFile(string tempFolder, string destPath, CostVariantsCombination itemCostVariants, AspxCommonInfo aspxCommonObj)
        {
            int storeID, portalID;
            string culture;
            storeID = aspxCommonObj.StoreID;
            portalID = aspxCommonObj.PortalID;
            culture = aspxCommonObj.CultureName;

            StoreSettingConfig ssc = new StoreSettingConfig();
            int itemLargeThumbNailHeight = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemLargeThumbnailImageHeight, storeID, portalID, culture));
            int itemLargeThumbNailWidth = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemLargeThumbnailImageWidth, storeID, portalID, culture));
            int itemMediumThumbNailHeight = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemLargeThumbnailImageHeight, storeID, portalID, culture));
            int itemMediumThumbNailWidth = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemLargeThumbnailImageWidth, storeID, portalID, culture));
            int itemSmallThumbNailHeight = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemLargeThumbnailImageHeight, storeID, portalID, culture));
            int itemSmallThumbNailWidth = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemLargeThumbnailImageWidth, storeID, portalID, culture));

            destPath = destPath.Replace("/", "\\");
            string destinationFolder = HostingEnvironment.MapPath("~/") + destPath;


            string imageFilePathList = string.Empty;
            foreach (var obj in itemCostVariants.VariantOptions)
            {
                if (!string.IsNullOrEmpty(obj.ImageFile))
                {
                    imageFilePathList = obj.ImageFile;

                    string[] sourceFileList = imageFilePathList.Split('@');

                    // To move a file or folder to a new location:
                    if (!Directory.Exists(destinationFolder))
                    {
                        Directory.CreateDirectory(destinationFolder);
                    }
                    for (int i = 0; i < sourceFileList.Length; i++)
                    {
                        string fileExt = sourceFileList[i].Substring(sourceFileList[i].LastIndexOf("."));
                        string fileName = sourceFileList[i];
                        fileName = fileName.Remove(0, 1);
                        string sourceCol = HostingEnvironment.MapPath("~/" + sourceFileList[i]);
                        if (destinationFolder != null)
                        {
                            string destination = Path.Combine(destinationFolder, fileName);
                            if (sourceCol != destination)
                            {
                                if (File.Exists(sourceCol) && !File.Exists(destination))
                                {
                                    if (sourceCol != null) File.Copy(sourceCol, destination);
                                    //image Thumbnails generates here
                                    string vertualUrl0 = destinationFolder + "Large\\";
                                    string vertualUrl1 = destinationFolder + "Medium\\";
                                    string vertualUrl2 = destinationFolder + "Small\\";

                                    if (!Directory.Exists(vertualUrl0))
                                        Directory.CreateDirectory(vertualUrl0);
                                    if (!Directory.Exists(vertualUrl1))
                                        Directory.CreateDirectory(vertualUrl1);
                                    if (!Directory.Exists(vertualUrl2))
                                        Directory.CreateDirectory(vertualUrl2);

                                    vertualUrl0 = vertualUrl0 + fileName;
                                    vertualUrl1 = vertualUrl1 + fileName;
                                    vertualUrl2 = vertualUrl2 + fileName;

                                    string[] imageTypeFiles = new string[] { "jpg", "jpeg", "jpe", "gif", "bmp", "png", "ico" };
                                    bool isValidImage = false;
                                    foreach (string x in imageTypeFiles)
                                    {
                                        if (fileExt.Contains(x))
                                        {
                                            isValidImage = true;
                                            break;
                                        }
                                    }

                                    if (isValidImage)
                                    {
                                        //PictureManager.CreateThmnail(destination, itemLargeThumbNailHeight, itemLargeThumbNailWidth, vertualUrl0);
                                        //PictureManager.CreateThmnail(destination, itemMediumThumbNailHeight, itemMediumThumbNailWidth, vertualUrl1);
                                        //PictureManager.CreateThmnail(destination, itemSmallThumbNailHeight, itemSmallThumbNailWidth, vertualUrl2);
                                    }
                                    else
                                    {
                                        System.IO.File.Copy(destination, vertualUrl0);
                                        System.IO.File.Copy(destination, vertualUrl1);
                                        System.IO.File.Copy(destination, vertualUrl2);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return "sucess";
        }
 public void SaveAndUpdateItemCostVariantCombination(CostVariantsCombination itemCostVariants, AspxCommonInfo aspxCommonObj) // not used in ItemDetailPage
 {
     try
     {
         string cvCombinations = string.Empty;
         foreach (var objCombination in itemCostVariants.VariantOptions)
         {
             cvCombinations += objCombination.CombinationIsActive;
             cvCombinations += "," + objCombination.ImageFile;
             cvCombinations += "," + objCombination.CombinationPriceModifier;
             cvCombinations += "," + objCombination.CombinationPriceModifierType;
             cvCombinations += "," + objCombination.CombinationQuantity;
             cvCombinations += "," + objCombination.CombinationType;
             cvCombinations += "," + objCombination.CombinationValues;
             cvCombinations += "," + objCombination.CombinationValuesName;
             cvCombinations += "," + objCombination.CombinationWeightModifier;
             cvCombinations += "," + objCombination.CombinationWeightModifierType;
             cvCombinations += "," + objCombination.DisplayOrder;
             if (itemCostVariants.VariantOptions.Count - 1 != 0)
                 cvCombinations += "%";
         }
         // cvCombinations = cvCombinations.Replace("Upload/temp/", "Modules/AspxCommerce/AspxItemsManagement/uploads/");
         FileHelperController Fch = new FileHelperController();
         string tempFolder = @"Upload\temp";
         string destPath = @"Modules/AspxCommerce/AspxItemsManagement/uploads/";
         Fch.MoveVariantsImageFile(tempFolder, destPath, itemCostVariants, aspxCommonObj);
         AspxItemMgntController.SaveAndUpdateItemCostVariantCombination(itemCostVariants, aspxCommonObj, cvCombinations);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
示例#5
0
        public string MoveVariantsImageFile(string tempFolder, string destPath, CostVariantsCombination itemCostVariants, AspxCommonInfo aspxCommonObj)
        {
            int    storeID, portalID;
            string culture;

            storeID  = aspxCommonObj.StoreID;
            portalID = aspxCommonObj.PortalID;
            culture  = aspxCommonObj.CultureName;

            StoreSettingConfig ssc      = new StoreSettingConfig();
            int itemLargeThumbNailSize  = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemLargeThumbnailImageSize, storeID, portalID, culture));
            int itemMediumThumbNailSize = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemMediumThumbnailImageSize, storeID, portalID, culture));
            int itemSmallThumbNailSize  = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemSmallThumbnailImageSize, storeID, portalID, culture));

            destPath = destPath.Replace("/", "\\");
            string destinationFolder = HostingEnvironment.MapPath("~/") + destPath;


            string imageFilePathList = string.Empty;

            foreach (var obj in itemCostVariants.VariantOptions)
            {
                if (!string.IsNullOrEmpty(obj.ImageFile))
                {
                    imageFilePathList = obj.ImageFile;

                    string[] sourceFileList = imageFilePathList.Split('@');

                    // To move a file or folder to a new location:
                    if (!Directory.Exists(destinationFolder))
                    {
                        Directory.CreateDirectory(destinationFolder);
                    }
                    for (int i = 0; i < sourceFileList.Length; i++)
                    {
                        string fileExt  = sourceFileList[i].Substring(sourceFileList[i].LastIndexOf("."));
                        string fileName = sourceFileList[i];
                        fileName = fileName.Remove(0, 1);
                        string sourceCol = HostingEnvironment.MapPath("~/" + sourceFileList[i]);
                        if (destinationFolder != null)
                        {
                            string destination = Path.Combine(destinationFolder, fileName);
                            if (sourceCol != destination)
                            {
                                if (File.Exists(sourceCol) && !File.Exists(destination))
                                {
                                    if (sourceCol != null)
                                    {
                                        File.Copy(sourceCol, destination);
                                    }
                                    //image Thumbnails generates here
                                    string vertualUrl0 = destinationFolder + "Large\\";
                                    string vertualUrl1 = destinationFolder + "Medium\\";
                                    string vertualUrl2 = destinationFolder + "Small\\";

                                    if (!Directory.Exists(vertualUrl0))
                                    {
                                        Directory.CreateDirectory(vertualUrl0);
                                    }
                                    if (!Directory.Exists(vertualUrl1))
                                    {
                                        Directory.CreateDirectory(vertualUrl1);
                                    }
                                    if (!Directory.Exists(vertualUrl2))
                                    {
                                        Directory.CreateDirectory(vertualUrl2);
                                    }

                                    vertualUrl0 = vertualUrl0 + fileName;
                                    vertualUrl1 = vertualUrl1 + fileName;
                                    vertualUrl2 = vertualUrl2 + fileName;

                                    string[] imageTypeFiles = new string[]
                                    { "jpg", "jpeg", "jpe", "gif", "bmp", "png", "ico" };
                                    bool isValidImage = false;
                                    foreach (string x in imageTypeFiles)
                                    {
                                        if (fileExt.Contains(x))
                                        {
                                            isValidImage = true;
                                            break;
                                        }
                                    }

                                    if (isValidImage)
                                    {
                                        PictureManager.CreateThmnail(destination, itemLargeThumbNailSize, vertualUrl0);
                                        PictureManager.CreateThmnail(destination, itemMediumThumbNailSize, vertualUrl1);
                                        PictureManager.CreateThmnail(destination, itemSmallThumbNailSize, vertualUrl2);
                                    }
                                    else
                                    {
                                        System.IO.File.Copy(destination, vertualUrl0);
                                        System.IO.File.Copy(destination, vertualUrl1);
                                        System.IO.File.Copy(destination, vertualUrl2);
                                    }
                                }
                            }
                        }
                    }
                }
            }

            return("sucess");
        }
 public static void SaveAndUpdateItemCostVariantCombination(CostVariantsCombination itemCostVariants, AspxCommonInfo aspxCommonObj, string cvCombinations)
 {
     try
     {
         AspxItemMgntProvider.SaveAndUpdateItemCostVariantCombination(itemCostVariants, aspxCommonObj, cvCombinations);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public static void SaveAndUpdateItemCostVariantCombination(CostVariantsCombination itemCostVariants, AspxCommonInfo aspxCommonObj, string cvCombinations)
 {
     try
     {
         List<KeyValuePair<string, object>> parameterCollection = CommonParmBuilder.GetParamSPUC(aspxCommonObj);
         parameterCollection.Add(new KeyValuePair<string, object>("@ItemID", itemCostVariants.ItemId));
         parameterCollection.Add(new KeyValuePair<string, object>("@VariantOptions", cvCombinations));
         SQLHandler sq = new SQLHandler();
         sq.ExecuteNonQuery("usp_Aspx_SaveAndUpdateItemCostVariantsConfig", parameterCollection);
     }
     catch (Exception e)
     {
         throw e;
     }
 }