public static int SaveUpdateItemAndAttributes(ItemsInfo.ItemSaveBasicInfo itemObj, AspxCommonInfo aspxCommonObj) { bool isModified = false; bool updateFlag = false; int storeId = aspxCommonObj.StoreID; int portalId = aspxCommonObj.PortalID; string culture = aspxCommonObj.CultureName; string userName = aspxCommonObj.UserName; if (itemObj.ItemId > 0) { isModified = true; updateFlag = true; } 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.ItemMediumThumbnailImageHeight, storeId, portalId, culture)); int itemMediumThumbNailWidth = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemMediumThumbnailImageWidth, storeId, portalId, culture)); int itemSmallThumbNailHeight = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemSmallThumbnailImageHeight, storeId, portalId, culture)); int itemSmallThumbNailWidth = Convert.ToInt32(ssc.GetStoreSettingsByKey(StoreSetting.ItemSmallThumbnailImageWidth, storeId, portalId, culture)); int _attributeID = 0; int _inputTypeID = 0; int _ValidationTypeID = 8; int _GroupID = 0; bool _isIncludeInPriceRule = false; int _displayOrder = 0; bool toInsertIntoDB = true; bool isFormValid = true; string imageVar = string.Empty; int imageCounterFirst = 0; var formVars = JSONHelper.Deserialise<List<AspxNameValue>>(itemObj.FormVars); ItemInformationDetailsInfo itemInfo = new ItemInformationDetailsInfo(); ItemSetting itemSettings = new ItemSetting(); itemSettings = itemObj.Settings; itemInfo.NewFromDate = "1900/01/01"; itemInfo.NewToDate = "2999/12/30"; itemInfo.FeaturedFrom = "1900/01/01"; itemInfo.FeaturedTo = "2999/12/30"; itemInfo.SpecialFrom = "1900/01/01"; itemInfo.SpecialTo = "2999/12/30"; itemInfo.SpecialPriceFrom = "1900/01/01"; itemInfo.SpecialPriceTo = "2999/12/30"; itemInfo.IsManageInventory = itemSettings.IsManageInventory; itemInfo.IsUsedStoreSetting = itemSettings.IsUsedStoreSetting; itemInfo.MinCartQuantity = itemSettings.MinCartQuantity; itemInfo.MaxCartQuantity = itemSettings.MaxCartQuantity; itemInfo.LowStockQuantity = itemSettings.LowStockQuantity; itemInfo.OutOfStockQuantity = itemSettings.OutOfStockQuantity; List<ItemAttributeDetailsInfo> listItemAttributes = new List<ItemAttributeDetailsInfo>(); bool hasSystemAttributesOnly = true; string attributeIDs = "1,2,3,4,5,6,7,8,9,10,11,13,14,15,19,20,23,24,25,26,27,28,29,30,31,32,33,34,44,45,46,47,48"; for (int i = 0; i < formVars.Count; i++) { string attribValue = formVars[i].value; //string jsonResult = formVars[i].name.Replace('%', '_'); string jsonResult = formVars[i].name.Replace('-', ' '); string[] jsonVar = jsonResult.Split('_'); FormValidation formValidation = new FormValidation(); ItemAttributeDetailsInfo itemAttribute = new ItemAttributeDetailsInfo(); if (jsonVar.Length > 1) { _attributeID = Int32.Parse(jsonVar[0]); _inputTypeID = Int32.Parse(jsonVar[1]); _ValidationTypeID = Int32.Parse(jsonVar[2]); _GroupID = Int32.Parse(jsonVar[4]); _isIncludeInPriceRule = bool.Parse(jsonVar[5]); _displayOrder = Int32.Parse(jsonVar[6]); itemAttribute.AttributeID = _attributeID; itemAttribute.InputTypeID = _inputTypeID; itemAttribute.ValidationTypeID = _ValidationTypeID; itemAttribute.GroupID = _GroupID; itemAttribute.IsIncludeInPriceRule = _isIncludeInPriceRule; itemAttribute.DisplayOrder = _displayOrder; if (_attributeID > 48) { if (hasSystemAttributesOnly) { hasSystemAttributesOnly = false; } } if (_attributeID == 4) { itemInfo.SKU = formVars[i].value; } else if (_attributeID == 19) { itemInfo.ActiveFrom = formVars[i].value; } else if (_attributeID == 20) { itemInfo.ActiveTo = formVars[i].value; } else if (_attributeID == 23) { itemInfo.HidePrice = Convert.ToBoolean(formVars[i].value); } else if (_attributeID == 24) { itemInfo.HideInRSSFeed = Convert.ToBoolean(formVars[i].value); } else if (_attributeID == 25) { itemInfo.HideToAnonymous = Convert.ToBoolean(formVars[i].value); } else if (_attributeID == 1) { itemInfo.Name = formVars[i].value; } else if (_attributeID == 2) { itemInfo.Description = formVars[i].value; } else if (_attributeID == 3) { itemInfo.ShortDescription = formVars[i].value; } else if (_attributeID == 5) { itemInfo.Weight = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 6) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.NewFromDate =itemInfo.NewFromDate; } else { itemInfo.NewFromDate = formVars[i].value; } } else if (_attributeID == 7) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.NewToDate = itemInfo.NewToDate; } else { itemInfo.NewToDate = formVars[i].value; } } else if (_attributeID == 8) { itemInfo.Price = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 9) { itemInfo.MetaTitle = formVars[i].value; } else if (_attributeID == 10) { itemInfo.MetaKeyword = formVars[i].value; } else if (_attributeID == 11) { itemInfo.MetaDescription = formVars[i].value; } else if (_attributeID == 13 && formVars[i].value != "") { itemInfo.ListPrice = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 14) { itemInfo.VisibilityOptionValueID = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 15) { itemInfo.Quantity = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 26) { itemInfo.IsFeaturedOptionValueID = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 27) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.FeaturedFrom = itemInfo.FeaturedFrom; } else { itemInfo.FeaturedFrom = formVars[i].value; } } else if (_attributeID == 28) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.FeaturedTo = itemInfo.FeaturedTo; } else { itemInfo.FeaturedTo = formVars[i].value; } } else if (_attributeID == 29) { itemInfo.IsSpecialOptionValueID = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 30) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.SpecialFrom = itemInfo.SpecialFrom; } else { itemInfo.SpecialFrom = formVars[i].value; } } else if (_attributeID == 31) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.SpecialTo = itemInfo.SpecialTo; } else { itemInfo.SpecialTo = formVars[i].value; } } else if (_attributeID == 32 && formVars[i].value != "") { itemInfo.Length = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 33 && formVars[i].value != "") { itemInfo.Height = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 34 && formVars[i].value != "") { itemInfo.Width = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 35) { itemInfo.IsPromo = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 37) { itemInfo.ServiceDuration = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 44 && formVars[i].value != "") { itemInfo.CostPrice = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 45 && formVars[i].value != "") { itemInfo.SpecialPrice = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 46) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.SpecialPriceFrom = itemInfo.SpecialPriceFrom; } else { itemInfo.SpecialPriceFrom = formVars[i].value; } } else if (_attributeID == 47) { if (formVars[i].value == "" || formVars[i].value == null) { itemInfo.SpecialPriceTo = itemInfo.SpecialPriceTo; } else { itemInfo.SpecialPriceTo = formVars[i].value; } } else if (_attributeID == 48 && formVars[i].value != "") { itemInfo.ManufacturerPrice = Convert.ToDecimal(formVars[i].value); } } if (_attributeID == 37) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.IntValue = int.Parse(formVars[i].value); listItemAttributes.Add(itemAttribute); } else { isFormValid = false; break; } } else if (_attributeID == 35) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.OptionValues = formVars[i].value; listItemAttributes.Add(itemAttribute); } else { isFormValid = false; break; } } if (_attributeID > 48) { if (_inputTypeID == 1) { if (_ValidationTypeID == 3) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.DecimalValue = decimal.Parse(formVars[i].value); } else { isFormValid = false; break; } } else if (_ValidationTypeID == 5) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.IntValue = int.Parse(formVars[i].value); } else { isFormValid = false; break; } } else { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.NvarcharValue = formVars[i].value; } else { isFormValid = false; break; } } } else if (_inputTypeID == 2) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.TextValue = formVars[i].value; } else { isFormValid = false; break; } } else if (_inputTypeID == 3) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { if (!string.IsNullOrEmpty(formVars[i].value)) { itemAttribute.DateValue = DateTime.Parse(formVars[i].value); } } else { isFormValid = false; break; } } else if (_inputTypeID == 4) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { if (!string.IsNullOrEmpty(attribValue)) { itemAttribute.BooleanValue = (formVars[i].value == "1" || formVars[i].value.ToLower() == "true") ? true : false; } else { itemAttribute.BooleanValue = false; } } else { isFormValid = false; break; } } else if (_inputTypeID == 5 || _inputTypeID == 6 || _inputTypeID == 9 || _inputTypeID == 10 || _inputTypeID == 11 || _inputTypeID == 12) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.OptionValues = formVars[i].value; } else { isFormValid = false; break; } } else if (_inputTypeID == 7) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.DecimalValue = decimal.Parse(formVars[i].value); } else { isFormValid = false; break; } } else if (_inputTypeID == 8) { if (imageCounterFirst % 2 == 0) { toInsertIntoDB = false; if (!string.IsNullOrEmpty(formVars[i].value) && formVars[i].value.ToLower() != "undefined") { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { imageVar = attribValue; } else { isFormValid = false; break; } } else { imageVar = ""; } } else { toInsertIntoDB = true; if (attribValue != imageVar) { //_imageVar = _imageVar.Replace("../", ""); imageVar = imageVar.Replace("/", "\\"); //attribValue = attribValue.Replace("../", ""); attribValue = attribValue.Replace("/", "\\"); string tempFolder = @"Upload\temp"; FileHelperController fileObj = new FileHelperController(); attribValue = fileObj.MoveFileToModuleFolder(tempFolder, attribValue, imageVar, itemLargeThumbNailHeight, itemLargeThumbNailWidth, itemMediumThumbNailHeight, itemMediumThumbNailWidth, itemSmallThumbNailHeight, itemSmallThumbNailWidth, @"Modules\AspxCommerce\AspxItemsManagement\uploads\", itemObj.ItemId, "item_"); itemAttribute.FileValue = attribValue.Replace(@"Modules\AspxCommerce\AspxItemsManagement\uploads\", " "); } else { itemAttribute.FileValue = attribValue.Replace(@"Modules\AspxCommerce\AspxItemsManagement\uploads\", " "); } } imageCounterFirst++; } if (toInsertIntoDB) { listItemAttributes.Add(itemAttribute); } } } if (isFormValid) { string groupPrices = GetItemGroupPriceInString(itemObj.GroupPrice, itemObj.ItemId); itemObj.ItemId = AspxItemMgntProvider.SaveUpdateItemAttributes(itemObj, aspxCommonObj, true, isModified, itemInfo, listItemAttributes, attributeIDs, hasSystemAttributesOnly, updateFlag, groupPrices); } else { throw new Exception("Form is not valid one"); } return itemObj.ItemId; }
public static int SaveUpdateItemAndAttributes(ItemsInfo.ItemSaveBasicInfo itemObj, AspxCommonInfo aspxCommonObj) { bool isModified = false; bool updateFlag = false; int storeId = aspxCommonObj.StoreID; int portalId = aspxCommonObj.PortalID; string culture = aspxCommonObj.CultureName; string userName = aspxCommonObj.UserName; if (itemObj.ItemId > 0) { isModified = true; updateFlag = true; } 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)); int _attributeID = 0; int _inputTypeID = 0; int _ValidationTypeID = 8; int _GroupID = 0; bool _isIncludeInPriceRule = false; int _displayOrder = 0; bool toInsertIntoDB = true; bool isFormValid = true; string imageVar = string.Empty; int imageCounterFirst = 0; var formVars = JSONHelper.Deserialise <List <AspxNameValue> >(itemObj.FormVars); ItemInformationDetailsInfo itemInfo = new ItemInformationDetailsInfo(); itemInfo.NewFromDate = "1900/01/01"; itemInfo.NewToDate = "2999/12/30"; itemInfo.FeaturedFrom = "1900/01/01"; itemInfo.FeaturedTo = "2999/12/30"; itemInfo.SpecialFrom = "1900/01/01"; itemInfo.SpecialTo = "2999/12/30"; List <ItemAttributeDetailsInfo> listItemAttributes = new List <ItemAttributeDetailsInfo>(); bool hasSystemAttributesOnly = true; string attributeIDs = "1,2,3,4,5,6,7,8,9,10,11,13,14,15,19,20,23,24,25,26,27,28,29,30,31,32,33,34"; for (int i = 0; i < formVars.Count; i++) { string attribValue = formVars[i].value; //string jsonResult = formVars[i].name.Replace('%', '_'); string jsonResult = formVars[i].name.Replace('-', ' '); string[] jsonVar = jsonResult.Split('_'); FormValidation formValidation = new FormValidation(); ItemAttributeDetailsInfo itemAttribute = new ItemAttributeDetailsInfo(); if (jsonVar.Length > 1) { _attributeID = Int32.Parse(jsonVar[0]); _inputTypeID = Int32.Parse(jsonVar[1]); _ValidationTypeID = Int32.Parse(jsonVar[2]); _GroupID = Int32.Parse(jsonVar[4]); _isIncludeInPriceRule = bool.Parse(jsonVar[5]); _displayOrder = Int32.Parse(jsonVar[6]); itemAttribute.AttributeID = _attributeID; itemAttribute.InputTypeID = _inputTypeID; itemAttribute.ValidationTypeID = _ValidationTypeID; itemAttribute.GroupID = _GroupID; itemAttribute.IsIncludeInPriceRule = _isIncludeInPriceRule; itemAttribute.DisplayOrder = _displayOrder; if (_attributeID > 43) { if (hasSystemAttributesOnly) { hasSystemAttributesOnly = false; } } if (_attributeID == 4) { itemInfo.SKU = formVars[i].value; } else if (_attributeID == 19) { itemInfo.ActiveFrom = formVars[i].value; } else if (_attributeID == 20) { itemInfo.ActiveTo = formVars[i].value; } else if (_attributeID == 23) { itemInfo.HidePrice = Convert.ToBoolean(formVars[i].value); } else if (_attributeID == 24) { itemInfo.HideInRSSFeed = Convert.ToBoolean(formVars[i].value); } else if (_attributeID == 25) { itemInfo.HideToAnonymous = Convert.ToBoolean(formVars[i].value); } else if (_attributeID == 1) { itemInfo.Name = formVars[i].value; } else if (_attributeID == 2) { itemInfo.Description = formVars[i].value; } else if (_attributeID == 3) { itemInfo.ShortDescription = formVars[i].value; } else if (_attributeID == 5) { itemInfo.Weight = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 6) { itemInfo.NewFromDate = formVars[i].value; } else if (_attributeID == 7) { itemInfo.NewToDate = formVars[i].value; } else if (_attributeID == 8) { itemInfo.Price = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 9) { itemInfo.MetaTitle = formVars[i].value; } else if (_attributeID == 10) { itemInfo.MetaKeyword = formVars[i].value; } else if (_attributeID == 11) { itemInfo.MetaDescription = formVars[i].value; } else if (_attributeID == 13 && formVars[i].value != "") { itemInfo.ListPrice = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 14) { itemInfo.VisibilityOptionValueID = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 15) { itemInfo.Quantity = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 26) { itemInfo.IsFeaturedOptionValueID = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 27) { itemInfo.FeaturedFrom = formVars[i].value; } else if (_attributeID == 28) { itemInfo.FeaturedTo = formVars[i].value; } else if (_attributeID == 29) { itemInfo.IsSpecialOptionValueID = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 30) { itemInfo.SpecialFrom = formVars[i].value; } else if (_attributeID == 31) { itemInfo.SpecialTo = formVars[i].value; } else if (_attributeID == 32) { itemInfo.Length = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 33) { itemInfo.Height = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 34) { itemInfo.Width = Convert.ToDecimal(formVars[i].value); } else if (_attributeID == 35) { itemInfo.IsPromo = Convert.ToInt32(formVars[i].value); } else if (_attributeID == 37) { itemInfo.ServiceDuration = Convert.ToInt32(formVars[i].value); } } if (_attributeID == 37) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.IntValue = int.Parse(formVars[i].value); listItemAttributes.Add(itemAttribute); } else { isFormValid = false; break; } } else if (_attributeID == 35) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.OptionValues = formVars[i].value; listItemAttributes.Add(itemAttribute); } else { isFormValid = false; break; } } if (_attributeID > 43) { if (_inputTypeID == 1) { if (_ValidationTypeID == 3) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.DecimalValue = decimal.Parse(formVars[i].value); } else { isFormValid = false; break; } } else if (_ValidationTypeID == 5) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.IntValue = int.Parse(formVars[i].value); } else { isFormValid = false; break; } } else { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.NvarcharValue = formVars[i].value; } else { isFormValid = false; break; } } } else if (_inputTypeID == 2) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.TextValue = formVars[i].value; } else { isFormValid = false; break; } } else if (_inputTypeID == 3) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { if (!string.IsNullOrEmpty(formVars[i].value)) { itemAttribute.DateValue = DateTime.Parse(formVars[i].value); } } else { isFormValid = false; break; } } else if (_inputTypeID == 4) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { if (!string.IsNullOrEmpty(attribValue)) { itemAttribute.BooleanValue = (formVars[i].value == "1" || formVars[i].value.ToLower() == "true") ? true : false; } else { itemAttribute.BooleanValue = false; } } else { isFormValid = false; break; } } else if (_inputTypeID == 5 || _inputTypeID == 6 || _inputTypeID == 9 || _inputTypeID == 10 || _inputTypeID == 11 || _inputTypeID == 12) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.OptionValues = formVars[i].value; } else { isFormValid = false; break; } } else if (_inputTypeID == 7) { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { itemAttribute.DecimalValue = decimal.Parse(formVars[i].value); } else { isFormValid = false; break; } } else if (_inputTypeID == 8) { if (imageCounterFirst % 2 == 0) { toInsertIntoDB = false; if (!string.IsNullOrEmpty(formVars[i].value) && formVars[i].value.ToLower() != "undefined") { if (formValidation.ValidateValue(formVars[i].name, _ValidationTypeID, formVars[i].value)) { imageVar = attribValue; } else { isFormValid = false; break; } } else { imageVar = ""; } } else { toInsertIntoDB = true; if (attribValue != imageVar) { //_imageVar = _imageVar.Replace("../", ""); imageVar = imageVar.Replace("/", "\\"); //attribValue = attribValue.Replace("../", ""); attribValue = attribValue.Replace("/", "\\"); string tempFolder = @"Upload\temp"; FileHelperController fileObj = new FileHelperController(); attribValue = fileObj.MoveFileToModuleFolder(tempFolder, attribValue, imageVar, itemLargeThumbNailSize, itemMediumThumbNailSize, itemSmallThumbNailSize, @"Modules\AspxCommerce\AspxItemsManagement\uploads\", itemObj.ItemId, "item_"); itemAttribute.FileValue = attribValue.Replace(@"Modules\AspxCommerce\AspxItemsManagement\uploads\", " "); } else { itemAttribute.FileValue = attribValue.Replace(@"Modules\AspxCommerce\AspxItemsManagement\uploads\", " "); } } imageCounterFirst++; } if (toInsertIntoDB) { listItemAttributes.Add(itemAttribute); } } } if (isFormValid) { itemObj.ItemId = AspxItemMgntProvider.SaveUpdateItemAttributes(itemObj, aspxCommonObj, true, isModified, itemInfo, listItemAttributes, attributeIDs, hasSystemAttributesOnly, updateFlag); } else { throw new Exception("Form is not valid one"); } return(itemObj.ItemId); }