private StoreSettingObject GetInfo(string subdomain) { try { if (string.IsNullOrEmpty(subdomain)) { return(new StoreSettingObject()); } var domainOj = new StoreSettingServices().GetStoreSettingByAlias(subdomain); if (domainOj.StoreId < 1) { return(new StoreSettingObject()); } var sqlConnection = DbContextSwitcherServices.SwitchSqlDatabase(domainOj); var entityConnection = DbContextSwitcherServices.SwitchEntityDatabase(domainOj); if (string.IsNullOrEmpty(sqlConnection) || string.IsNullOrEmpty(entityConnection)) { return(new StoreSettingObject()); } domainOj.EntityConnectionString = entityConnection; domainOj.SqlConnectionString = sqlConnection; domainOj.StoreLogoPath = string.IsNullOrEmpty(domainOj.StoreLogoPath) ? "/Content/images/noImage.png" : domainOj.StoreLogoPath.Replace("~", ""); SetCurrentSession("mySetting", domainOj); var defaultCurrency = new StoreItemStockServices().GetStoreDefaultCurrency(); if (defaultCurrency != null && defaultCurrency.StoreCurrencyId > 0) { domainOj.DefaultCurrency = defaultCurrency.Name; domainOj.DefaultCurrencySymbol = defaultCurrency.Symbol; } return(domainOj); } catch (Exception) { return(new StoreSettingObject()); } }
private StoreSettingObject GetStoreInfo(string subdomain) { try { var domainOj = new StoreSettingObject(); if (Session["_mySettings"] == null) { domainOj = new StoreSettingServices().GetStoreSettingByAlias(subdomain); if (domainOj.StoreId < 1) { return(null); } var connection = DbContextSwitcherServices.SwitchSqlDatabase(domainOj); if (string.IsNullOrEmpty(connection)) { return(null); } domainOj.SqlConnectionString = connection; Session["_mySettings"] = domainOj; return(domainOj); } else { var sessDom = Session["_mySettings"] as StoreSettingObject; if (sessDom == null || sessDom.StoreId < 1) { return(null); } return(domainOj); } } catch (Exception) { return(null); } }