public static int AddItemstoCart(int itemID, decimal itemPrice, int itemQuantity, bool isItemPage, AspxCommonInfo aspxCommonObj) { try { var cartobj = new CartManageSQLProvider(); StoreSettingConfig ssc = new StoreSettingConfig(); if (cartobj.CheckItemCart(itemID, aspxCommonObj.StoreID, aspxCommonObj.PortalID, "0@")) { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamNoCID(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameter.Add(new KeyValuePair <string, object>("Price", itemPrice)); parameter.Add(new KeyValuePair <string, object>("Quantity", itemQuantity)); OracleHandler sqlH = new OracleHandler(); int i; if (isItemPage) { i = sqlH.ExecuteNonQueryAsGivenType <int>("usp_Aspx_CheckCostVariantForItemDetail", parameter, "IsExist"); } else { // i = sqlH.ExecuteNonQueryAsGivenType<int>("usp_Aspx_CheckCostVariantForItem", parameter, "IsExist"); i = sqlH.ExecuteNonQueryAsGivenType <int>("usp_Aspx_CheckCostVariantForIt", parameter, "IsExist"); } return(i); } else { if (bool.Parse(ssc.GetStoreSettingsByKey(StoreSetting.AllowOutStockPurchase, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName))) { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamNoCID(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameter.Add(new KeyValuePair <string, object>("Price", itemPrice)); parameter.Add(new KeyValuePair <string, object>("Quantity", itemQuantity)); parameter.Add(new KeyValuePair <string, object>("isItemPage", isItemPage)); OracleHandler sqlH = new OracleHandler(); int i; if (isItemPage) { i = sqlH.ExecuteNonQueryAsGivenType <int>("usp_Aspx_CheckCostVariantForItemDetail", parameter, "IsExist"); } else { i = sqlH.ExecuteNonQueryAsGivenType <int>("usp_Aspx_CheckCostVariantForIt", parameter, "IsExist"); } //i = sqlH.ExecuteNonQueryAsGivenType<int>("usp_Aspx_CheckCostVariantForItem", parameter, "IsExist"); return(i); } else { return(2); } } } catch (Exception e) { throw e; } }
public static bool CheckReviewByUser(int itemID, AspxCommonInfo aspxCommonObj) { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPU(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); OracleHandler sqlH = new OracleHandler(); //bool isReviewExist= sqlH.ExecuteNonQueryAsGivenType<bool>("usp_Aspx_CheckReviewAlreadyExist", parameter, "IsReviewAlreadyExist"); string isReviewExist = sqlH.ExecuteNonQueryAsGivenType <string>("usp_Aspx_CheckReviewAlreadyExi", parameter, "IsReviewAlreadyExist"); return(Convert.ToBoolean(isReviewExist.ToString())); }
public bool CheckCart(int itemID, int storeID, int portalID, string userName, string cultureName) { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameter.Add(new KeyValuePair <string, object>("StoreID", storeID)); parameter.Add(new KeyValuePair <string, object>("PortalID", portalID)); parameter.Add(new KeyValuePair <string, object>("UserName", userName)); parameter.Add(new KeyValuePair <string, object>("CultureName", cultureName)); OracleHandler sqlH = new OracleHandler(); return(sqlH.ExecuteNonQueryAsGivenType <bool>("usp_Aspx_CheckCart", parameter, "IsExist")); }
//------------------------------Add to Cart-------------------------- public static bool CheckItemCart(int itemID, int storeID, int portalID, string costvarids) { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameter.Add(new KeyValuePair <string, object>("StoreID", storeID)); parameter.Add(new KeyValuePair <string, object>("PortalID", portalID)); parameter.Add(new KeyValuePair <string, object>("iv_ItemCostVariantIDs", costvarids)); OracleHandler sqlH = new OracleHandler(); string isAllowed = sqlH.ExecuteNonQueryAsGivenType <string>("usp_Aspx_CheckCostVarintQuanti", parameter, "IsAllowAddtoCart"); //bool isAllowed = sqlH.ExecuteNonQueryAsGivenType<bool>("[usp_Aspx_CheckCostVarintQuantityInCart]", parameter, "IsAllowAddtoCart"); return(Convert.ToBoolean(isAllowed)); }
public static bool CheckAddressAlreadyExist(AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPSCt(aspxCommonObj); OracleHandler sqlH = new OracleHandler(); bool isExist = sqlH.ExecuteNonQueryAsGivenType <bool>("usp_Aspx_CheckForMultipleAddress", parameter, "IsExist"); return(isExist); } catch (Exception e) { throw e; } }
public static bool CheckIfItemIsGrouped(int itemID, AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSP(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); OracleHandler sqlH = new OracleHandler(); bool isGrouped = sqlH.ExecuteNonQueryAsGivenType <bool>("usp_Aspx_CheckIfGroupedItem", parameter, "IsGrouped"); return(isGrouped); } catch (Exception ex) { throw ex; } }
public static bool CheckUniqueCouponCode(string couponCode, AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPC(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("CouponCode", couponCode)); OracleHandler sqlH = new OracleHandler(); bool isExists = sqlH.ExecuteNonQueryAsGivenType <bool>("dbo.usp_Aspx_CheckUniqueCouponCode", parameter, "IsExist"); return(isExists); } catch (Exception ex) { throw ex; } }
//Cart Item Qty Discount Calculations public static decimal GetDiscountQuantityAmount(AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetFullParam(aspxCommonObj); OracleHandler sqlH = new OracleHandler(); decimal qtyDiscount = sqlH.ExecuteNonQueryAsGivenType <decimal>("usp_Aspx_GetItemQuantityDisc", parameter, "QtyDiscount"); //decimal qtyDiscount= sqlH.ExecuteNonQueryAsGivenType<decimal>("usp_Aspx_GetItemQuantityDiscountAmount", parameter, "QtyDiscount"); return(qtyDiscount); } catch (Exception e) { throw e; } }
public bool CheckCompareItems(int ID, AspxCommonInfo aspxCommonObj, string costVariantValueIDs) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSPUS(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("ItemID", ID)); parameter.Add(new KeyValuePair <string, object>("CostVariantValueIDs", costVariantValueIDs)); OracleHandler sqlH = new OracleHandler(); string isExist = sqlH.ExecuteNonQueryAsGivenType <string>("usp_Aspx_CheckCompareItems", parameter, "IsExist"); return(Convert.ToBoolean(isExist)); } catch (Exception e) { throw e; } }
public static bool CheckItemOutOfStock(int itemID, string costVariantsValueIDs, AspxCommonInfo aspxCommonObj) { try { List <KeyValuePair <string, object> > parameter = CommonParmBuilder.GetParamSP(aspxCommonObj); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameter.Add(new KeyValuePair <string, object>("CostVariantsValueIDs", costVariantsValueIDs)); OracleHandler sqlH = new OracleHandler(); string i = sqlH.ExecuteNonQueryAsGivenType <string>("usp_Aspx_CheckItemOutOfStock", parameter, "IsOutOfStock"); return(Convert.ToBoolean(i)); } catch (Exception ex) { throw ex; } }
//-------------------------Update Customer Account Information---------------------------------------- public static int UpdateCustomer(AspxCommonInfo aspxCommonObj, string firstName, string lastName, string email) { try { List <KeyValuePair <string, object> > parameterCollection = CommonParmBuilder.GetParamSPUCt(aspxCommonObj); parameterCollection.Add(new KeyValuePair <string, object>("FirstName", firstName)); parameterCollection.Add(new KeyValuePair <string, object>("LastName", lastName)); parameterCollection.Add(new KeyValuePair <string, object>("Email", email)); OracleHandler sqlh = new OracleHandler(); int errorCode = sqlh.ExecuteNonQueryAsGivenType <int>("usp_Aspx_UpdateCustomer", parameterCollection, "ErrorCode"); return(errorCode); } catch (Exception) { throw; } }
public static bool CheckOutOfStock(int itemID, int storeID, int portalID, string itemCostVariantIDs) { try { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameter.Add(new KeyValuePair <string, object>("StoreID", storeID)); parameter.Add(new KeyValuePair <string, object>("PortalID", portalID)); parameter.Add(new KeyValuePair <string, object>("ItemCostVariantIDs", itemCostVariantIDs)); OracleHandler sqlH = new OracleHandler(); bool isOutStock = sqlH.ExecuteNonQueryAsGivenType <bool>("[dbo].[usp_Aspx_CheckOutOfStockForCostVariants]", parameter, "IsOutOfStock"); return(isOutStock); } catch (Exception e) { throw e; } }
public static string GetStoreSettingValueByKey(string settingKey, int storeID, int portalID, string cultureName) { try { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("SettingKey", settingKey)); parameter.Add(new KeyValuePair <string, object>("StoreID", storeID)); parameter.Add(new KeyValuePair <string, object>("PortalID", portalID)); parameter.Add(new KeyValuePair <string, object>("CultureName", cultureName)); OracleHandler sqlH = new OracleHandler(); string setValue = sqlH.ExecuteNonQueryAsGivenType <string>("usp_Aspx_GetStoreSettingValueBYKey", parameter, "SettingValue"); return(setValue); } catch (Exception ex) { throw ex; } }
public static bool AddtoCart(int itemID, int storeID, int portalID, string userName, string cultureName) { try { List <KeyValuePair <string, object> > parameter = new List <KeyValuePair <string, object> >(); parameter.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameter.Add(new KeyValuePair <string, object>("StoreID", storeID)); parameter.Add(new KeyValuePair <string, object>("PortalID", portalID)); parameter.Add(new KeyValuePair <string, object>("UserName", userName)); parameter.Add(new KeyValuePair <string, object>("CultureName", cultureName)); OracleHandler sqlH = new OracleHandler(); bool isExist = sqlH.ExecuteNonQueryAsGivenType <bool>("usp_Aspx_CheckCostVariantForItem", parameter, "IsExist"); return(isExist); } catch (Exception e) { throw e; } }
public void SaveItemAttributesFromExcel(int itemID, int attributeSetId, List <ItemsValues> itemObj, AspxCommonInfo aspxCommonObj) { try { OracleHandler sqlH = new OracleHandler(); foreach (var itemsValues in itemObj) { if (itemsValues.AttributeId > 48) { if (itemsValues.InputTypeID > 0 && itemsValues.InputTypeID != 8) { List <KeyValuePair <string, object> > parameterCollection = new List <KeyValuePair <string, object> >(); parameterCollection.Add(new KeyValuePair <string, object>("ItemID", itemID)); parameterCollection.Add(new KeyValuePair <string, object>("AttributeSetID", attributeSetId)); parameterCollection.Add(new KeyValuePair <string, object>("StoreID", aspxCommonObj.StoreID)); parameterCollection.Add(new KeyValuePair <string, object>("PortalID", aspxCommonObj.PortalID)); parameterCollection.Add(new KeyValuePair <string, object>("UserName", aspxCommonObj.UserName)); parameterCollection.Add(new KeyValuePair <string, object>("CultureName", aspxCommonObj.CultureName)); parameterCollection.Add(new KeyValuePair <string, object>("IsActive", true)); parameterCollection.Add(new KeyValuePair <string, object>("IsModified", false)); parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", itemsValues.AttributeValue)); parameterCollection.Add(new KeyValuePair <string, object>("AttributeID", itemsValues.AttributeId)); parameterCollection.Add(new KeyValuePair <string, object>("InputTypeID", itemsValues.InputTypeID)); parameterCollection.Add(new KeyValuePair <string, object>("ValidationTypeID", itemsValues.ValidationTypeID)); int?groupId = GetAttributeSetGroupID(itemsValues.AttributeId, attributeSetId, aspxCommonObj.StoreID, aspxCommonObj.PortalID); parameterCollection.Add(new KeyValuePair <string, object>("GroupID", groupId)); parameterCollection.Add(new KeyValuePair <string, object>("IsIncludeInPriceRule", false)); parameterCollection.Add(new KeyValuePair <string, object>("DisplayOrder", 1)); //inputTypeID //validationTypeID string valueType = string.Empty; if (itemsValues.InputTypeID == 1) { if (itemsValues.ValidationTypeID == 3) { valueType = "DECIMAL"; } else if (itemsValues.ValidationTypeID == 5) { valueType = "INT"; } else { valueType = "VARCHAR"; } } else if (itemsValues.InputTypeID == 2) { valueType = "TEXT"; } else if (itemsValues.InputTypeID == 3) { valueType = "DATE"; } else if (itemsValues.InputTypeID == 4) { valueType = "Boolean"; } else if (itemsValues.InputTypeID == 5 || itemsValues.InputTypeID == 6 || itemsValues.InputTypeID == 9 || itemsValues.InputTypeID == 10 || itemsValues.InputTypeID == 11 || itemsValues.InputTypeID == 12) { valueType = "OPTIONS"; //TODO: to get attributeValueID from itemsValues.AttributeValue List <KeyValuePair <string, object> > paramCol = new List <KeyValuePair <string, object> >(); paramCol.Add(new KeyValuePair <string, object>("AttributeValue", itemsValues.AttributeValue)); paramCol.Add(new KeyValuePair <string, object>("AttributeID", itemsValues.AttributeId)); paramCol.Add(new KeyValuePair <string, object>("StoreID", aspxCommonObj.StoreID)); paramCol.Add(new KeyValuePair <string, object>("PortalID", aspxCommonObj.PortalID)); paramCol.Add(new KeyValuePair <string, object>("UserName", aspxCommonObj.UserName)); paramCol.Add(new KeyValuePair <string, object>("CultureName", aspxCommonObj.CultureName)); itemsValues.AttributeValue = sqlH.ExecuteNonQueryAsGivenType <int>("usp_Aspx_GetAttributesValueIDByValue", paramCol, "AttributeValueID"); parameterCollection.RemoveAll(x => x.Key.Equals("AttributeValue")); parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", itemsValues.AttributeValue)); } else if (itemsValues.InputTypeID == 7) { valueType = "DECIMAL"; } //else if (itemsValues.InputTypeID == 8) //{ // valueType = "FILE"; // valueType.Replace("T, ""); // valueType.Replace("P, ""); //} sqlH.ExecuteNonQuery("usp_Aspx_ItemAttributesValue" + valueType + "AddUpdate", parameterCollection); } } } } catch (Exception ex) { throw ex; } }
public int SaveItemFromExcel(List <ItemsValues> itemObj, bool isTypeSpecified, int itemTypeId, int attributeSetId, string currencyCode, AspxCommonInfo aspxCommonObj)// bool isActive, bool isModified, //string sku, string activeFrom, string activeTo, string hidePrice, string isHideInRSS, string isHideToAnonymous, // bool updateFlag) { System.DateTime today = System.DateTime.Now; DateTime activeFrom = DateTime.Now; System.TimeSpan day1 = new System.TimeSpan(1, 0, 0, 0); activeFrom = today.Subtract(day1); DateTime activeTo = DateTime.Now; System.TimeSpan duration = new System.TimeSpan(365, 0, 0, 0); activeTo = today.Add(duration); bool hasSystemAttributesOnly = true; foreach (ItemsValues item in itemObj) { if (item.AttributeId > 48) { hasSystemAttributesOnly = false; break; } } try { 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"; List <KeyValuePair <string, object> > parameterCollection = new List <KeyValuePair <string, object> >(); parameterCollection.Add(new KeyValuePair <string, object>("ItemID", 0)); parameterCollection.Add(new KeyValuePair <string, object>("ItemTypeID", isTypeSpecified ? itemTypeId : 1)); parameterCollection.Add(new KeyValuePair <string, object>("AttributeSetID", attributeSetId)); parameterCollection.Add(new KeyValuePair <string, object>("TaxRuleID", 1)); parameterCollection.Add(new KeyValuePair <string, object>("SKU", GetValuesByAttirbuteId(itemObj, 4))); parameterCollection.Add(new KeyValuePair <string, object>("ActiveFrom", activeFrom)); parameterCollection.Add(new KeyValuePair <string, object>("ActiveTo", activeTo)); parameterCollection.Add(new KeyValuePair <string, object>("HidePrice", false)); parameterCollection.Add(new KeyValuePair <string, object>("HideInRSSFeed", false)); parameterCollection.Add(new KeyValuePair <string, object>("HideToAnonymous", false)); parameterCollection.Add(new KeyValuePair <string, object>("Name", GetValuesByAttirbuteId(itemObj, 1))); parameterCollection.Add(new KeyValuePair <string, object>("Description", GetValuesByAttirbuteId(itemObj, 2))); parameterCollection.Add(new KeyValuePair <string, object>("ShortDescription", GetValuesByAttirbuteId(itemObj, 3))); parameterCollection.Add(new KeyValuePair <string, object>("Weight", GetValuesByAttirbuteId(itemObj, 5))); parameterCollection.Add(new KeyValuePair <string, object>("Quantity", GetValuesByAttirbuteId(itemObj, 15))); parameterCollection.Add(new KeyValuePair <string, object>("Price", GetValuesByAttirbuteId(itemObj, 8))); if (GetValuesByAttirbuteId(itemObj, 13).ToString() != "") { parameterCollection.Add(new KeyValuePair <string, object>("ListPrice", GetValuesByAttirbuteId(itemObj, 13))); } else { parameterCollection.Add(new KeyValuePair <string, object>("ListPrice", null)); } parameterCollection.Add(new KeyValuePair <string, object>("NewFromDate", activeFrom)); parameterCollection.Add(new KeyValuePair <string, object>("NewToDate", activeTo)); parameterCollection.Add(new KeyValuePair <string, object>("MetaTitle", GetValuesByAttirbuteId(itemObj, 9))); parameterCollection.Add(new KeyValuePair <string, object>("MetaKeyword", GetValuesByAttirbuteId(itemObj, 10))); parameterCollection.Add(new KeyValuePair <string, object>("MetaDescription", GetValuesByAttirbuteId(itemObj, 11))); //parameterCollection.Add(new KeyValuePair<string, object>("@VisibilityOptionValueID", true)); if (GetValuesByAttirbuteId(itemObj, 26) != null) { parameterCollection.Add(new KeyValuePair <string, object>("IsFeaturedOptionValueID", Boolean.Parse( GetValuesByAttirbuteId(itemObj, 26). ToString()))); } if (GetValuesByAttirbuteId(itemObj, 29) != null) { parameterCollection.Add(new KeyValuePair <string, object>("IsSpecialOptionValueID", Boolean.Parse( GetValuesByAttirbuteId(itemObj, 29). ToString()))); } parameterCollection.Add(new KeyValuePair <string, object>("FeaturedFrom", activeFrom)); parameterCollection.Add(new KeyValuePair <string, object>("FeaturedTo", activeTo)); parameterCollection.Add(new KeyValuePair <string, object>("SpecialFrom", activeFrom)); parameterCollection.Add(new KeyValuePair <string, object>("SpecialTo", activeTo)); parameterCollection.Add(new KeyValuePair <string, object>("Length", GetValuesByAttirbuteId(itemObj, 32))); parameterCollection.Add(new KeyValuePair <string, object>("Height", GetValuesByAttirbuteId(itemObj, 33))); parameterCollection.Add(new KeyValuePair <string, object>("Width", GetValuesByAttirbuteId(itemObj, 34))); //parameterCollection.Add(new KeyValuePair<string, object>("@IsPromo", false)); //parameterCollection.Add(new KeyValuePair<string, object>("@ServiceDuration", null)); parameterCollection.Add(new KeyValuePair <string, object>("HasSystemAttributesOnly", hasSystemAttributesOnly)); parameterCollection.Add(new KeyValuePair <string, object>("AttributeIDs", attributeIDs)); //For Static tabs parameterCollection.Add(new KeyValuePair <string, object>("CategoriesIDs", GetValuesByAttirbuteId(itemObj, 0))); parameterCollection.Add(new KeyValuePair <string, object>("RelatedItemsIDs", "0")); parameterCollection.Add(new KeyValuePair <string, object>("UpSellItemsIDs", "0")); parameterCollection.Add(new KeyValuePair <string, object>("CrossSellItemsIDs", "0")); parameterCollection.Add(new KeyValuePair <string, object>("DownloadInfos", "")); parameterCollection.Add(new KeyValuePair <string, object>("StoreID", aspxCommonObj.StoreID)); parameterCollection.Add(new KeyValuePair <string, object>("PortalID", aspxCommonObj.PortalID)); parameterCollection.Add(new KeyValuePair <string, object>("UserName", aspxCommonObj.UserName)); parameterCollection.Add(new KeyValuePair <string, object>("CultureName", aspxCommonObj.CultureName)); parameterCollection.Add(new KeyValuePair <string, object>("IsActive", true)); parameterCollection.Add(new KeyValuePair <string, object>("IsModified", false)); parameterCollection.Add(new KeyValuePair <string, object>("UpdateFlag", false)); //parameterCollection.Add(new KeyValuePair<string, object>("@BrandID", '0')); parameterCollection.Add(new KeyValuePair <string, object>("CurrencyCode", currencyCode)); //parameterCollection.Add(new KeyValuePair<string, object>("@VideosIDs", '0')); parameterCollection.Add(new KeyValuePair <string, object>("CostPrice", GetValuesByAttirbuteId(itemObj, 44))); parameterCollection.Add(new KeyValuePair <string, object>("SpecialPrice", GetValuesByAttirbuteId(itemObj, 45))); parameterCollection.Add(new KeyValuePair <string, object>("SpecialPriceFrom", GetValuesByAttirbuteId(itemObj, 46))); parameterCollection.Add(new KeyValuePair <string, object>("SpecialPriceTo", GetValuesByAttirbuteId(itemObj, 47))); parameterCollection.Add(new KeyValuePair <string, object>("ManufacturerPrice", GetValuesByAttirbuteId(itemObj, 48))); OracleHandler sqlH = new OracleHandler(); return(sqlH.ExecuteNonQueryAsGivenType <int>("usp_Aspx_ItemAddUpdateFromExcel", parameterCollection, "NewItemID")); } catch (Exception ex) { throw ex; } }
public int CategoryAddUpdate(CategoryInfo categoryInfo, string selectedItems, List <CategoryAttributeInfo> listCA, string userName, string culture) { OracleHandler sqlHandler = new OracleHandler(); int categoryID = 0; List <KeyValuePair <string, object> > parameterCollection = new List <KeyValuePair <string, object> >(); parameterCollection.Add(new KeyValuePair <string, object>("CategoryID", categoryInfo.CategoryID)); parameterCollection.Add(new KeyValuePair <string, object>("SelectedItems", selectedItems)); parameterCollection.Add(new KeyValuePair <string, object>("ParentID", categoryInfo.ParentID)); parameterCollection.Add(new KeyValuePair <string, object>("IsShowInSearch", categoryInfo.IsShowInSearch)); parameterCollection.Add(new KeyValuePair <string, object>("IsShowInCatalog", categoryInfo.IsShowInCatalog)); parameterCollection.Add(new KeyValuePair <string, object>("IsShowInMenu", categoryInfo.IsShowInMenu)); parameterCollection.Add(new KeyValuePair <string, object>("ActiveFrom", categoryInfo.ActiveFrom)); parameterCollection.Add(new KeyValuePair <string, object>("ActiveTo", categoryInfo.ActiveTo)); parameterCollection.Add(new KeyValuePair <string, object>("StoreID", categoryInfo.StoreID)); parameterCollection.Add(new KeyValuePair <string, object>("PortalID", categoryInfo.PortalID)); parameterCollection.Add(new KeyValuePair <string, object>("IsActive", true)); parameterCollection.Add(new KeyValuePair <string, object>("UserName", userName)); parameterCollection.Add(new KeyValuePair <string, object>("CultureName", culture)); try { categoryID = sqlHandler.ExecuteNonQueryAsGivenType <int>("usp_Aspx_CategoryAddUpdate", parameterCollection, "NewCategoryID"); int inputTypeID; int validationTypeID; string valueType = string.Empty; foreach (CategoryAttributeInfo ca in listCA) { parameterCollection.Clear(); inputTypeID = ca.InputTypeID; validationTypeID = ca.ValidationTypeID; if (inputTypeID == 1) { if (validationTypeID == 3) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.DecimalValue)); valueType = "DECIMAL"; } else if (validationTypeID == 5) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.IntValue)); valueType = "NUMBER"; } else { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.NvarcharValue)); valueType = "VARCHAR2"; } } else if (inputTypeID == 2) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.TextValue)); valueType = "TEXT"; } else if (inputTypeID == 3) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.DateValue)); valueType = "DATE"; } else if (inputTypeID == 4) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.BooleanValue)); valueType = "Boolean"; } else if (inputTypeID == 5 || inputTypeID == 6 || inputTypeID == 9 || inputTypeID == 10 || inputTypeID == 11 || inputTypeID == 12) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.OptionValues)); valueType = "OPTIONS"; } else if (inputTypeID == 7) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.DecimalValue)); valueType = "DECIMAL"; } else if (inputTypeID == 8) { parameterCollection.Add(new KeyValuePair <string, object>("AttributeValue", ca.FileValue)); valueType = "FILE"; } parameterCollection.Add(new KeyValuePair <string, object>("CategoryID", categoryID)); parameterCollection.Add(new KeyValuePair <string, object>("AttributeID", ca.AttributeID)); parameterCollection.Add(new KeyValuePair <string, object>("StoreID", categoryInfo.StoreID)); parameterCollection.Add(new KeyValuePair <string, object>("PortalID", categoryInfo.PortalID)); parameterCollection.Add(new KeyValuePair <string, object>("UserName", userName)); parameterCollection.Add(new KeyValuePair <string, object>("CultureName", culture)); sqlHandler.ExecuteNonQuery("usp_Aspx_CategoryAttributesValue" + valueType + "AddUpdate", parameterCollection); } } catch (Exception ex) { throw ex; } return(categoryID); }
public void InstallPackage(PaymentGateWayModuleInfo module, int update) { ModuleController moduleCtr = new ModuleController(); XmlDocument doc = new XmlDocument(); ArrayList dllFiles = new ArrayList(); string unistallScriptFile = string.Empty; doc.Load(module.TempFolderPath + '\\' + module.ManifestFile); XmlElement root = doc.DocumentElement; if (!String.IsNullOrEmpty(root.ToString())) { XmlNodeList xnList = doc.SelectNodes("sageframe/folders/folder"); foreach (XmlNode xn in xnList) { #region Module Exist check try { System.Nullable <Int32> newModuleID = 0; System.Nullable <Int32> newModuleDefID = 0; System.Nullable <Int32> newPortalmoduleID = 0; //System.Nullable<Int32> _newPortalmoduleID = 0; //System.Nullable<Int32> _newModuleDefPermissionID = 0; //System.Nullable<Int32> _newPortalModulePermissionID = 0; #region "Module Creation Logic" OracleHandler sqhl = new OracleHandler(); OracleConnection sqlConn = new OracleConnection(SystemSetting.SageFrameConnectionString); OracleCommand sqlCmd = new OracleCommand(); int ReturnValue = -1; sqlCmd.Connection = sqlConn; sqlCmd.CommandText = "usp_Aspx_PaymentGatewayTypeAdd"; sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.Add(new OracleParameter("PaymentGatewayTypeName", module.PaymentGatewayTypeName)); sqlCmd.Parameters.Add(new OracleParameter("StoreID", module.StoreID)); sqlCmd.Parameters.Add(new OracleParameter("PortalID", module.PortalID)); sqlCmd.Parameters.Add(new OracleParameter("FolderName", module.FolderName)); sqlCmd.Parameters.Add(new OracleParameter("FriendlyName", module.FriendlyName)); sqlCmd.Parameters.Add(new OracleParameter("CultureName", module.CultureName)); sqlCmd.Parameters.Add(new OracleParameter("Description", module.Description)); sqlCmd.Parameters.Add(new OracleParameter("Version", module.Version)); sqlCmd.Parameters.Add(new OracleParameter("AddedBy", GetUsername)); sqlCmd.Parameters.Add(new OracleParameter("Update", update)); sqlCmd.Parameters.Add(new OracleParameter("NewModuleId", SqlDbType.Int)); sqlCmd.Parameters["NewModuleId"].Direction = ParameterDirection.Output; sqlConn.Open(); sqlCmd.ExecuteNonQuery(); if (update == 0) { ReturnValue = (int)sqlCmd.Parameters["NewModuleId"].Value; module.PaymentGatewayTypeID = ReturnValue; } sqlConn.Close(); XmlNodeList xnList5 = doc.SelectNodes("sageframe/folders/folder/modules/module/controls/control"); int displayOrder = 0; foreach (XmlNode xn5 in xnList5) { displayOrder++; string ctlKey = xn5["key"].InnerXml.ToString(); string ctlSource = xn5["src"].InnerXml.ToString(); string ctlTitle = xn5["title"].InnerXml.ToString(); string _ctlType = xn5["type"].InnerXml.ToString(); int ctlType = checkControlType(_ctlType); string ctlHelpUrl = xn5["helpurl"].InnerXml.ToString(); string ctlSupportPr = xn5["supportspartialrendering"].InnerXml.ToString(); List <KeyValuePair <string, object> > paramCol = new List <KeyValuePair <string, object> >(); paramCol.Add(new KeyValuePair <string, object>("PaymentGatewayTypeID", module.PaymentGatewayTypeID)); paramCol.Add(new KeyValuePair <string, object>("ControlName", ctlKey)); paramCol.Add(new KeyValuePair <string, object>("ControlType", ctlType)); paramCol.Add(new KeyValuePair <string, object>("ControlSource", ctlSource)); paramCol.Add(new KeyValuePair <string, object>("DisplayOrder", displayOrder)); paramCol.Add(new KeyValuePair <string, object>("StoreID", module.StoreID)); paramCol.Add(new KeyValuePair <string, object>("PortalID", module.PortalID)); paramCol.Add(new KeyValuePair <string, object>("CultureName", module.CultureName)); paramCol.Add(new KeyValuePair <string, object>("AddedBy", GetUsername)); paramCol.Add(new KeyValuePair <string, object>("Update", update)); paramCol.Add(new KeyValuePair <string, object>("HelpUrl", ctlHelpUrl)); paramCol.Add(new KeyValuePair <string, object>("SupportsPartialRendering", bool.Parse(ctlSupportPr.ToString()))); if (xn5.Attributes["type"] == null) { sqlH.ExecuteNonQuery("usp_Aspx_PaymentGateWayControlAdd", paramCol); } else { if (xn5.Attributes["type"] != null && xn5.Attributes["type"].Value.ToString().ToLower() == "page") { if (!IsPageExists(ctlKey)) { //if (update == 0) // { try { #region "Module Creation Logic" // add into module table ModuleInfo moduleObj = new ModuleInfo(); moduleObj.ModuleName = "AspxCommerce." + module.FriendlyName; moduleObj.Name = module.Name; moduleObj.PackageType = "Module"; moduleObj.Owner = "AspxCommerce"; moduleObj.Organization = ""; moduleObj.URL = ""; moduleObj.Email = ""; moduleObj.ReleaseNotes = ""; moduleObj.FriendlyName = ctlKey; moduleObj.Description = ctlKey; moduleObj.Version = module.Version; moduleObj.isPremium = true; moduleObj.BusinessControllerClass = ""; moduleObj.FolderName = module.FolderName; moduleObj.supportedFeatures = 0; moduleObj.CompatibleVersions = ""; moduleObj.dependencies = ""; moduleObj.permissions = ""; int[] outputValue; outputValue = moduleCtr.AddModules(moduleObj, false, 0, true, DateTime.Now, GetPortalID, GetUsername); moduleObj.ModuleID = outputValue[0]; moduleObj.ModuleDefID = outputValue[1]; newModuleID = moduleObj.ModuleID; newModuleDefID = moduleObj.ModuleDefID; //insert into ProtalModule table newPortalmoduleID = moduleCtr.AddPortalModules(GetPortalID, newModuleID, true, DateTime.Now, GetUsername); #endregion //install permission for the installed module in ModuleDefPermission table with ModuleDefID and PermissionID int controlType = 0; controlType = ctlType; string IconFile = ""; //add into module control table moduleCtr.AddModuleCoontrols(newModuleDefID, ctlKey + "View", ctlTitle + "View", ctlSource, IconFile, controlType, 0, ctlHelpUrl, bool.Parse(ctlSupportPr), true, DateTime.Now, GetPortalID, GetUsername); //sp_ModuleDefPermissionAdd string ModuleDefPermissionID; List <KeyValuePair <string, object> > paramDef = new List <KeyValuePair <string, object> >(); paramDef.Add(new KeyValuePair <string, object>("ModuleDefID", newModuleDefID)); paramDef.Add(new KeyValuePair <string, object>("PortalModuleID", newPortalmoduleID)); paramDef.Add(new KeyValuePair <string, object>("PermissionID", 1)); paramDef.Add(new KeyValuePair <string, object>("IsActive", true)); paramDef.Add(new KeyValuePair <string, object>("AddedOn", DateTime.Now)); paramDef.Add(new KeyValuePair <string, object>("PortalID", GetPortalID)); paramDef.Add(new KeyValuePair <string, object>("AddedBy", GetUsername)); ModuleDefPermissionID = sqlH.ExecuteNonQueryAsGivenType <string>( "sp_ModuleDefPermissionAdd", paramDef, "ModuleDefPermissionID"); //ModuleDefPermissionID List <KeyValuePair <string, object> > paramPage = new List <KeyValuePair <string, object> >(); paramPage.Add(new KeyValuePair <string, object>("ModuleDefID", newModuleDefID)); paramPage.Add(new KeyValuePair <string, object>("PageName", ctlKey)); paramPage.Add(new KeyValuePair <string, object>("PortalID", GetPortalID)); paramPage.Add(new KeyValuePair <string, object>( "ModuleDefPermissionID", int.Parse(ModuleDefPermissionID))); ; sqlH.ExecuteNonQuery("usp_Aspx_CreatePaymentGatewayPage", paramPage); } catch (Exception ex) { ProcessException(ex); } // } } } } } XmlNodeList xnList2 = doc.SelectNodes("sageframe/folders/folder/settings/setting"); int onetime = 0; foreach (XmlNode xn2 in xnList2) { onetime++; string settingkey = xn2["key"].InnerXml.ToString(); string settingvalue = xn2["value"].InnerXml.ToString(); List <KeyValuePair <string, object> > paramCol = new List <KeyValuePair <string, object> >(); paramCol.Add(new KeyValuePair <string, object>("PaymentGatewayTypeID", module.PaymentGatewayTypeID)); paramCol.Add(new KeyValuePair <string, object>("StoreID", module.StoreID)); paramCol.Add(new KeyValuePair <string, object>("PortalID", module.PortalID)); paramCol.Add(new KeyValuePair <string, object>("SettingKey", settingkey)); paramCol.Add(new KeyValuePair <string, object>("SettingValue", settingvalue)); paramCol.Add(new KeyValuePair <string, object>("AddedBy", GetUsername)); paramCol.Add(new KeyValuePair <string, object>("Update", update)); paramCol.Add(new KeyValuePair <string, object>("onetime", onetime)); sqlH.ExecuteNonQuery("usp_Aspx_PaymentGateWaySettingByKeyAdd", paramCol); } XmlNodeList xnList3 = doc.SelectNodes("sageframe/folders/folder/files/file"); if (xnList3.Count != 0) { foreach (XmlNode xn3 in xnList3) { string fileName = xn3["name"].InnerXml; try { #region CheckValidDataSqlProvider if (!String.IsNullOrEmpty(fileName) && fileName.Contains(module.Version + ".SqlDataProvider")) { _exceptions = ReadSQLFile(module.TempFolderPath, fileName); } #endregion #region CheckAlldllFiles if (!String.IsNullOrEmpty(fileName) && fileName.Contains(".dll")) { dllFiles.Add(fileName); } #endregion #region ReadUninstall SQL FileName if (!String.IsNullOrEmpty(fileName) && fileName.Contains("Uninstall.SqlDataProvider")) { unistallScriptFile = fileName; } #endregion } catch (Exception ex) { _exceptions += ex.Message; break; } } } if (_exceptions != string.Empty) { if (module.PaymentGatewayTypeID.ToString() != null && module.PaymentGatewayTypeID > 0) { //Run unstallScript if (unistallScriptFile != "") { _exceptions = ReadSQLFile(module.TempFolderPath, unistallScriptFile); } //Delete Module info from data base PaymentGatewayRollBack(module.PaymentGatewayTypeID, GetPortalID, module.StoreID); module.PaymentGatewayTypeID = -1; } } #endregion } catch { if (module.PaymentGatewayTypeID.ToString() != null && module.PaymentGatewayTypeID > 0) { //Run unstallScript if (unistallScriptFile != "") { _exceptions = ReadSQLFile(module.TempFolderPath, unistallScriptFile); } //Delete Module info from data base if (update == 0) { PaymentGatewayRollBack(module.PaymentGatewayTypeID, GetPortalID, module.StoreID); } module.PaymentGatewayTypeID = -1; } } #endregion } } if (module.PaymentGatewayTypeID.ToString() != null && module.PaymentGatewayTypeID > 0 && _exceptions == string.Empty) { string path = HttpContext.Current.Server.MapPath("~/"); string flPath = module.FolderName.ToString().Replace("/", "\\"); string targetPath = path + SageFrame.Common.RegisterModule.Common.ModuleFolder + '\\' + flPath; CopyDirectory(module.TempFolderPath, targetPath); for (int i = 0; i < dllFiles.Count; i++) { string sourcedllFile = module.TempFolderPath + '\\' + dllFiles[i].ToString(); string targetdllPath = path + SageFrame.Common.RegisterModule.Common.DLLTargetPath + '\\' + dllFiles[i].ToString(); File.Copy(sourcedllFile, targetdllPath, true); //File.Move(); } } DeleteTempDirectory(module.TempFolderPath); }
public void CreateMultiplePagesModulePackage(List <ModuleSinglePageInfo> multiPageObj) { ModuleController moduleCtr = new ModuleController(); ModuleInfo module = new ModuleInfo(); OracleHandler sqlH = new OracleHandler(); Int32? newModuleID = 0; Int32? newModuleDefID = 0; Int32? newPortalmoduleID = 0; foreach (ModuleSinglePageInfo pageObj in multiPageObj) { if (!IsPageExists(pageObj.PageName)) { try { #region "Module Creation Logic" // add into module table ModuleInfo moduleObj = new ModuleInfo(); moduleObj.ModuleName = "AspxCommerce." + pageObj.FriendlyName; moduleObj.Name = pageObj.FriendlyName; moduleObj.PackageType = "Module"; moduleObj.Owner = "AspxCommerce"; moduleObj.Organization = ""; moduleObj.URL = ""; moduleObj.Email = ""; moduleObj.ReleaseNotes = ""; moduleObj.FriendlyName = pageObj.FriendlyName; moduleObj.Description = pageObj.Description; moduleObj.Version = pageObj.Version; moduleObj.isPremium = true; moduleObj.BusinessControllerClass = ""; moduleObj.FolderName = pageObj.FolderName; moduleObj.supportedFeatures = 0; moduleObj.CompatibleVersions = ""; moduleObj.dependencies = ""; moduleObj.permissions = ""; int[] outputValue; outputValue = moduleCtr.AddModules(moduleObj, false, 0, true, DateTime.Now, GetPortalID, GetUsername); moduleObj.ModuleID = outputValue[0]; moduleObj.ModuleDefID = outputValue[1]; newModuleID = moduleObj.ModuleID; newModuleDefID = moduleObj.ModuleDefID; //insert into ProtalModule table newPortalmoduleID = moduleCtr.AddPortalModules(GetPortalID, newModuleID, true, DateTime.Now, GetUsername); #endregion string IconFile = ""; //install permission for the installed module in ModuleDefPermission table with ModuleDefID and PermissionID foreach (var item in pageObj.PageControls) { int controlType = 0; controlType = checkControlType(item.ControlType); //add into module control table moduleCtr.AddModuleCoontrols(newModuleDefID, pageObj.PageName + "View", pageObj.PageTitle + "View", item.ControlSource, IconFile, controlType, 0, pageObj.HelpURL, pageObj.SupportPartialRendering, true, DateTime.Now, GetPortalID, GetUsername); } //sp_ModuleDefPermissionAdd string ModuleDefPermissionID; List <KeyValuePair <string, object> > paramDef = new List <KeyValuePair <string, object> >(); paramDef.Add(new KeyValuePair <string, object>("@ModuleDefID", newModuleDefID)); paramDef.Add(new KeyValuePair <string, object>("@PortalModuleID", newPortalmoduleID)); paramDef.Add(new KeyValuePair <string, object>("@PermissionID", 1)); paramDef.Add(new KeyValuePair <string, object>("@IsActive", true)); paramDef.Add(new KeyValuePair <string, object>("@AddedOn", DateTime.Now)); paramDef.Add(new KeyValuePair <string, object>("@PortalID", GetPortalID)); paramDef.Add(new KeyValuePair <string, object>("@AddedBy", GetUsername)); ModuleDefPermissionID = sqlH.ExecuteNonQueryAsGivenType <string>("[dbo].[sp_ModuleDefPermissionAdd]", paramDef, "@ModuleDefPermissionID"); //ModuleDefPermissionID List <KeyValuePair <string, object> > paramPage = new List <KeyValuePair <string, object> >(); paramPage.Add(new KeyValuePair <string, object>("@ModuleDefID", newModuleDefID)); paramPage.Add(new KeyValuePair <string, object>("@PageName", pageObj.PageName)); paramPage.Add(new KeyValuePair <string, object>("@PortalID", GetPortalID)); paramPage.Add(new KeyValuePair <string, object>("@ModuleDefPermissionID", int.Parse(ModuleDefPermissionID))); sqlH.ExecuteNonQuery("[dbo].[usp_Aspx_CreatePaymentGatewayPage]", paramPage); } catch (Exception ex) { ProcessException(ex); } } } }