/// <summary> /// Setups target language selector control. /// </summary> private void SetupTargetLanguageDropDownWhereCondition() { WhereCondition condition = new WhereCondition(); var culturesAreEqual = currentCulture.EqualsCSafe(defaultCulture, true); var selectedSourceCulture = selectCultureElem.DropDownCultures.SelectedValue; string notTargetLanguage = null; if (!String.IsNullOrEmpty(selectedSourceCulture)) { // Use source language if selected notTargetLanguage = selectedSourceCulture; } else if (!culturesAreEqual || !UseCurrentCultureAsDefaultTarget) { // Use default culture if source and target languages are equal notTargetLanguage = defaultCulture; } if (!String.IsNullOrEmpty(selectedSourceCulture)) { condition.WhereNotEquals("CultureCode", notTargetLanguage); } if (!CurrentUser.IsGlobalAdministrator && CurrentUser.UserHasAllowedCultures) { condition.WhereIn("CultureID", new IDQuery(UserCultureInfo.OBJECT_TYPE, "CultureID").WhereEquals("UserID", CurrentUser.UserID).WhereEquals("SiteID", CurrentSite.SiteID)); } selectTargetCultureElem.AdditionalWhereCondition = condition.ToString(true); }
/// <summary> /// Exclude main currency and currencies without exchange rate according selector settings. /// </summary> /// <param name="whereCondition">Where condition.</param> protected override string AppendExclusiveWhere(string whereCondition) { // Prepare where condition var where = new WhereCondition(whereCondition); if (DisplayOnlyWithExchangeRate) { var tableInfo = ExchangeTableInfoProvider.GetLastExchangeTableInfo(SiteID); if (tableInfo != null) { where.Where(w => w.WhereEquals("CurrencyID", MainCurrencyID) .Or() .WhereIn("CurrencyID", new IDQuery(ExchangeRateInfo.OBJECT_TYPE, "ExchangeRateToCurrencyID") .WhereEquals("ExchangeTableID", tableInfo.ExchangeTableID) .WhereTrue("CurrencyEnabled"))); } else { where.NoResults(); } } // Exclude site main currency when required if (ExcludeSiteDefaultCurrency && (MainCurrencyID > 0)) { where.WhereNotEquals("CurrencyID", MainCurrencyID); } // Restrict disabled or site not related currencies return(base.AppendExclusiveWhere(where.ToString(true))); }
/// <summary> /// Gets where condition based on value of given controls. /// </summary> /// <param name="where">Where condition</param> /// <param name="column">Column to compare</param> /// <param name="drpOperator">List control with operator</param> /// <param name="valueBox">Text control with value</param> /// <returns>Where condition for outdated documents</returns> private void AddOutdatedWhereCondition(WhereCondition where, string column, ListControl drpOperator, ITextControl valueBox) { var value = TextHelper.LimitLength(valueBox.Text, 100); if (!String.IsNullOrEmpty(value)) { string condition = drpOperator.SelectedValue; // Create condition based on operator switch (condition) { case WhereBuilder.LIKE: where.WhereContains(column, value); break; case WhereBuilder.NOT_LIKE: where.WhereNotContains(column, value); break; case WhereBuilder.EQUAL: where.WhereEquals(column, value); break; case WhereBuilder.NOT_EQUAL: where.WhereNotEquals(column, value); break; } } }
/// <summary> /// Exclude main currency and currencies without exchange rate according selector settings. /// </summary> /// <param name="whereCondition">Where condition.</param> protected override string AppendExclusiveWhere(string whereCondition) { // Prepare where condition var where = new WhereCondition(whereCondition); // Exclude site main currency when required if (ExcludeSiteDefaultCurrency && (MainCurrencyID > 0)) { where.WhereNotEquals("CurrencyID", MainCurrencyID); } // Restrict disabled or site not related currencies return(base.AppendExclusiveWhere(where.ToString(true))); }
/// <summary> /// Checks activity permissions. /// Returns restricted sites condition. /// </summary> private WhereCondition CheckSitePermissions(IWhereCondition whereCondition) { var restrictedSitesCondition = new WhereCondition(); var activitiesSites = ActivityInfoProvider.GetActivities() .Distinct() .Column("ActivitySiteID") .Where(whereCondition); foreach (var activity in activitiesSites) { if (!CurrentUser.IsAuthorizedPerObject(PermissionsEnum.Modify, "om.activity", SiteInfoProvider.GetSiteName(activity.ActivitySiteID))) { SiteInfo notAllowedSite = SiteInfoProvider.GetSiteInfo(activity.ActivitySiteID); AddError(String.Format(GetString("accessdeniedtopage.info"), ResHelper.LocalizeString(notAllowedSite.DisplayName))); restrictedSitesCondition.WhereNotEquals("ActivitySiteID", activity.ActivitySiteID); } } return restrictedSitesCondition; }
/// <summary> /// Reloads grid. /// </summary> public void ReloadData() { WhereCondition where = new WhereCondition(); if (!String.IsNullOrEmpty(drpCustom.SelectedValue)) { string columnName = Views ? "TABLE_NAME" : "ROUTINE_NAME"; string prefix = Views ? "View_Custom_" : "Proc_Custom_"; switch (drpCustom.SelectedValue) { case "1": where.WhereStartsWith(columnName, prefix); break; case "0": where.WhereNotStartsWith(columnName, prefix); break; } } // Filter system views if (Views) { where.WhereNotEquals("TABLE_SCHEMA", "sys"); } where.Where(fltViews.GetCondition()); TableManager tm = new TableManager(null); if (Views) { gridViews.DataSource = tm.GetList(where.ToString(true), "TABLE_NAME, TABLE_SCHEMA, IsCustom=CASE SUBSTRING(TABLE_NAME,0,13) WHEN 'View_Custom_' THEN 1 ELSE 0 END", true); } else { where.WhereEquals("ROUTINE_TYPE", "PROCEDURE"); gridViews.DataSource = tm.GetList(where.ToString(true), "ROUTINE_NAME, ROUTINE_SCHEMA, IsCustom=CASE SUBSTRING(ROUTINE_NAME,0,13) WHEN 'Proc_Custom_' THEN 1 ELSE 0 END", false); } }
protected override void OnInit(EventArgs e) { currentUser = MembershipContext.AuthenticatedUser; prefferedUICultureCode = currentUser.PreferredUICultureCode; var categoryWhere = new WhereCondition(); if (IsUITemplate()) { categorySelector.RootPath = CATEGORY_UIWEBPARTS; COOKIE_SELECTED_CATEGORY += "UI"; } else { categoryWhere.WhereNotEquals("ObjectPath", CATEGORY_UIWEBPARTS).WhereNotStartsWith("ObjectPath", CATEGORY_UIWEBPARTS + "/"); } // Display only top level categories categoryWhere.WhereLessThan("ObjectLevel", 2); categorySelector.WhereCondition = categoryWhere.ToString(true); base.OnInit(e); }
/// <summary> /// Reloads the data in the selector. /// </summary> public void ReloadData() { uniSelector.IsLiveSite = IsLiveSite; if (!DisplayNoDataMessage) { uniSelector.ZeroRowsText = string.Empty; } // Need to set uni-selector value again after basic form reload if (AllowMultipleChoice) { uniSelector.Value = mMultipleChoiceValue; } var where = new WhereCondition(); if (ProductOptionCategoryID > 0) { where.WhereEquals("SKUOptionCategoryID", ProductOptionCategoryID); } else { var productSiteWhere = new WhereCondition(); // Add global products if (DisplayGlobalProducts) { productSiteWhere.Where(w => w.WhereNull("SKUOptionCategoryID") .WhereNull("SKUSiteID")); } // Add site specific products if (DisplaySiteProducts) { productSiteWhere.Or().Where(w => w.WhereNull("SKUOptionCategoryID") .WhereEquals("SKUSiteID", SiteID)); } where.Where(productSiteWhere); } // Exclude standard products if needed if (!DisplayStandardProducts) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Product.ToStringRepresentation()); } // Exclude memberships if needed if (!DisplayMemberships) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Membership.ToStringRepresentation()); } // Exclude e-products if needed if (!DisplayEproducts) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.EProduct.ToStringRepresentation()); } // Exclude bundles if needed if (!DisplayBundles) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Bundle.ToStringRepresentation()); } // Exclude products with product options if needed if (DisplayOnlyProductsWithoutOptions) { where.WhereNotIn("SKUID", new IDQuery <SKUOptionCategoryInfo>("SKUID")); } if (DisplayProductOptions && (ProductOptionCategoryID <= 0)) { var optionsSiteWhere = new WhereCondition(); // Add global options if (DisplayGlobalOptions) { optionsSiteWhere.Where(w => w.WhereNotNull("SKUOptionCategoryID") .WhereNull("SKUSiteID")); } // Add site specific options if (DisplaySiteOptions) { optionsSiteWhere.Or().Where(w => w.WhereNotNull("SKUOptionCategoryID") .WhereEquals("SKUSiteID", SiteID)); } where.Or().Where(optionsSiteWhere); where = new WhereCondition().Where(where); } // Filter out only enabled items if (DisplayOnlyEnabled) { where.WhereTrue("SKUEnabled"); } if (!DisplayProductOptions && (ProductOptionCategoryID <= 0)) { where.WhereNull("SKUOptionCategoryID"); } if (DisplayProductVariants) { // Alias for COM_SKU var parents = new QuerySourceTable("COM_SKU", "parentIDs"); // Select IDs of all products that are not parents of variants var ids = new IDQuery <SKUInfo>() .Columns(new QueryColumn("COM_SKU.SKUID")) .Source(s => s.LeftJoin(parents, "COM_SKU.SKUID", "parentIDs.SKUParentSKUID")) .Where(new WhereCondition().WhereNull("parentIDs.SKUID")); where.WhereIn("SKUID", ids); } else { // Do not display variants where.WhereNull("SKUParentSKUID"); } // Add items which have to be on the list var additionalList = AdditionalItems.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); if (additionalList.Length > 0) { var ids = ValidationHelper.GetIntegers(additionalList, 0); where.Or().WhereIn("SKUID", ids); } // Selected value must be on the list if (SKUID > 0) { where.Or().WhereEquals("SKUID", SKUID); } uniSelector.WhereCondition = where.ToString(true); }
/// <summary> /// Returns SQL WHERE condition depending on selected checkboxes. /// </summary> /// <returns>Returns SQL WHERE condition</returns> public string GetWhereCondition() { var where = new WhereCondition(); // Contacts checked if (chkContacts.Checked) { where.Where(GetContactWhereCondition()); } // Address checked if (chkAddress.Checked) { where.Where(GetAddressWhereCondition()); } // Email address checked if (chkEmail.Checked) { string domain = ContactHelper.GetEmailDomain(CurrentAccount.AccountEmail); if (!String.IsNullOrEmpty(domain)) { var emailWhere = new WhereCondition().WhereEndsWith("AccountEmail", "@" + domain); where.Where(emailWhere); } } // URL checked if (chkURL.Checked && !String.IsNullOrEmpty(CurrentAccount.AccountWebSite)) { var urlWhere = new WhereCondition().WhereContains("AccountWebSite", URLHelper.CorrectDomainName(CurrentAccount.AccountWebSite)); where.Where(urlWhere); } // Phone & fax checked if (chkPhone.Checked && (!String.IsNullOrEmpty(CurrentAccount.AccountPhone) || !String.IsNullOrEmpty(CurrentAccount.AccountFax))) { where.Where(GetPhoneWhereCondition()); } if ((!chkContacts.Checked && !chkAddress.Checked && !chkEmail.Checked && !chkURL.Checked && !chkPhone.Checked) || (String.IsNullOrEmpty(where.WhereCondition))) { return "(1 = 0)"; } // Filter out current account where.WhereNotEquals("AccountID", CurrentAccount.AccountID); // Filter out merged records where.Where(w => w.Where(x => x.WhereNull("AccountMergedWithAccountID") .WhereNull("AccountGlobalAccountID") .WhereGreaterThan("AccountSiteID", 0)) .Or(y => y.WhereNull("AccountGlobalAccountID") .WhereNull("AccountSiteID"))); // For global object use siteselector's value if (plcSite.Visible) { mSelectedSiteID = UniSelector.US_ALL_RECORDS; if (siteSelector.Visible) { mSelectedSiteID = siteSelector.SiteID; } else if (siteOrGlobalSelector.Visible) { mSelectedSiteID = siteOrGlobalSelector.SiteID; } // Only global objects if (mSelectedSiteID == UniSelector.US_GLOBAL_RECORD) { where.WhereNull("AccountSiteID"); } // Global and site objects else if (mSelectedSiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD) { where.Where(w => w.WhereNull("AccountSiteID").Or().WhereEquals("AccountSiteID", SiteContext.CurrentSiteID)); } // Site objects else if (mSelectedSiteID != UniSelector.US_ALL_RECORDS) { where.WhereEquals("AccountSiteID", mSelectedSiteID); } } // Filter out accounts from different sites else { // Site accounts only if (CurrentAccount.AccountSiteID > 0) { where.WhereEquals("AccountSiteID", CurrentAccount.AccountSiteID); } // Global accounts only else { where.WhereNull("AccountSiteID"); } } return where.ToString(expand: true); }
/// <summary> /// Returns SQL WHERE condition depending on selected checkboxes. /// </summary> /// <returns>Returns SQL WHERE condition</returns> public string GetWhereCondition() { var where = new WhereCondition(); // Contacts checked if (chkContacts.Checked) { where.Where(GetContactWhereCondition()); } // Address checked if (chkAddress.Checked) { where.Where(GetAddressWhereCondition()); } // Email address checked if (chkEmail.Checked) { string domain = ContactHelper.GetEmailDomain(CurrentAccount.AccountEmail); if (!String.IsNullOrEmpty(domain)) { var emailWhere = new WhereCondition().WhereEndsWith("AccountEmail", "@" + domain); where.Where(emailWhere); } } // URL checked if (chkURL.Checked && !String.IsNullOrEmpty(CurrentAccount.AccountWebSite)) { var urlWhere = new WhereCondition().WhereContains("AccountWebSite", URLHelper.CorrectDomainName(CurrentAccount.AccountWebSite)); where.Where(urlWhere); } // Phone & fax checked if (chkPhone.Checked && (!String.IsNullOrEmpty(CurrentAccount.AccountPhone) || !String.IsNullOrEmpty(CurrentAccount.AccountFax))) { where.Where(GetPhoneWhereCondition()); } if ((!chkContacts.Checked && !chkAddress.Checked && !chkEmail.Checked && !chkURL.Checked && !chkPhone.Checked) || (String.IsNullOrEmpty(where.WhereCondition))) { return("(1 = 0)"); } // Filter out current account where.WhereNotEquals("AccountID", CurrentAccount.AccountID); // Filter out merged records where.Where(w => w.Where(x => x.WhereNull("AccountMergedWithAccountID") .WhereNull("AccountGlobalAccountID") .WhereGreaterThan("AccountSiteID", 0)) .Or(y => y.WhereNull("AccountGlobalAccountID") .WhereNull("AccountSiteID"))); // For global object use siteselector's value if (plcSite.Visible) { mSelectedSiteID = UniSelector.US_ALL_RECORDS; if (siteSelector.Visible) { mSelectedSiteID = siteSelector.SiteID; } else if (siteOrGlobalSelector.Visible) { mSelectedSiteID = siteOrGlobalSelector.SiteID; } // Only global objects if (mSelectedSiteID == UniSelector.US_GLOBAL_RECORD) { where.WhereNull("AccountSiteID"); } // Global and site objects else if (mSelectedSiteID == UniSelector.US_GLOBAL_AND_SITE_RECORD) { where.Where(w => w.WhereNull("AccountSiteID").Or().WhereEquals("AccountSiteID", SiteContext.CurrentSiteID)); } // Site objects else if (mSelectedSiteID != UniSelector.US_ALL_RECORDS) { where.WhereEquals("AccountSiteID", mSelectedSiteID); } } // Filter out accounts from different sites else { // Site accounts only if (CurrentAccount.AccountSiteID > 0) { where.WhereEquals("AccountSiteID", CurrentAccount.AccountSiteID); } // Global accounts only else { where.WhereNull("AccountSiteID"); } } return(where.ToString(expand: true)); }
/// <summary> /// Checks activity permissions. /// Returns restricted sites condition. /// </summary> private WhereCondition CheckSitePermissions(IWhereCondition whereCondition) { var restrictedSitesCondition = new WhereCondition(); var activitiesSites = ActivityInfoProvider.GetActivities() .Distinct() .Column("ActivitySiteID") .Where(whereCondition); foreach (var activity in activitiesSites) { if (!CurrentUser.IsAuthorizedPerObject(PermissionsEnum.Modify, "om.activity", SiteInfoProvider.GetSiteName(activity.ActivitySiteID))) { SiteInfo notAllowedSite = SiteInfoProvider.GetSiteInfo(activity.ActivitySiteID); AddError(String.Format(GetString("accessdeniedtopage.info"), ResHelper.LocalizeString(notAllowedSite.DisplayName))); restrictedSitesCondition.WhereNotEquals("ActivitySiteID", activity.ActivitySiteID); } } return restrictedSitesCondition; }
/// <summary> /// Gets where condition based on value of given controls. /// </summary> /// <param name="where">Where condition</param> /// <param name="column">Column to compare</param> /// <param name="drpOperator">List control with operator</param> /// <param name="valueBox">Text control with value</param> /// <returns>Where condition for outdated documents</returns> private void AddOutdatedWhereCondition(WhereCondition where, string column, ListControl drpOperator, ITextControl valueBox) { var value = TextHelper.LimitLength(valueBox.Text, 100); if (!String.IsNullOrEmpty(value)) { string condition = drpOperator.SelectedValue; // Create condition based on operator switch (condition) { case WhereBuilder.LIKE: where.WhereContains(column, value); break; case WhereBuilder.NOT_LIKE: where.WhereNotContains(column, value); break; case WhereBuilder.EQUAL: where.WhereEquals(column, value); break; case WhereBuilder.NOT_EQUAL: where.WhereNotEquals(column, value); break; } } }
/// <summary> /// Setups target language selector control. /// </summary> private void SetupTargetLanguageDropDownWhereCondition() { WhereCondition condition = new WhereCondition(); var culturesAreEqual = currentCulture.EqualsCSafe(defaultCulture, true); var selectedSourceCulture = selectCultureElem.DropDownCultures.SelectedValue; string notTargetLanguage = null; if (!String.IsNullOrEmpty(selectedSourceCulture)) { // Use source language if selected notTargetLanguage = selectedSourceCulture; } else if (!culturesAreEqual || !UseCurrentCultureAsDefaultTarget) { // Use default culture if source and target languages are equal notTargetLanguage = defaultCulture; } if (!String.IsNullOrEmpty(selectedSourceCulture)) { condition.WhereNotEquals("CultureCode", notTargetLanguage); } if (!CurrentUser.IsGlobalAdministrator && CurrentUser.UserHasAllowedCultures) { condition.WhereIn("CultureID", new IDQuery(UserCultureInfo.OBJECT_TYPE, "CultureID").WhereEquals("UserID", CurrentUser.UserID).WhereEquals("SiteID", CurrentSite.SiteID)); } selectTargetCultureElem.AdditionalWhereCondition = condition.ToString(true); }
/// <summary> /// Exclude main currency and currencies without exchange rate according selector settings. /// </summary> /// <param name="whereCondition">Where condition.</param> protected override string AppendExclusiveWhere(string whereCondition) { // Prepare where condition var where = new WhereCondition(whereCondition); // Exclude site main currency when required if (ExcludeSiteDefaultCurrency && (MainCurrencyID > 0)) { where.WhereNotEquals("CurrencyID", MainCurrencyID); } // Restrict disabled or site not related currencies return base.AppendExclusiveWhere(where.ToString(true)); }
protected override void OnInit(EventArgs e) { currentUser = MembershipContext.AuthenticatedUser; prefferedUICultureCode = currentUser.PreferredUICultureCode; var categoryWhere = new WhereCondition(); if (IsUITemplate()) { categorySelector.RootPath = CATEGORY_UIWEBPARTS; COOKIE_SELECTED_CATEGORY += "UI"; } else { categoryWhere.WhereNotEquals("ObjectPath", CATEGORY_UIWEBPARTS).WhereNotStartsWith("ObjectPath", CATEGORY_UIWEBPARTS + "/"); } // Display only top level categories categoryWhere.WhereLessThan("ObjectLevel", 2); categorySelector.WhereCondition = categoryWhere.ToString(true); base.OnInit(e); }
/// <summary> /// Reloads the data in the selector. /// </summary> public void ReloadData() { uniSelector.IsLiveSite = IsLiveSite; if (!DisplayNoDataMessage) { uniSelector.ZeroRowsText = string.Empty; } // Need to set uni-selector value again after basic form reload if (AllowMultipleChoice) { uniSelector.Value = mMultipleChoiceValue; } var where = new WhereCondition(); if (ProductOptionCategoryID > 0) { where.WhereEquals("SKUOptionCategoryID", ProductOptionCategoryID); } else { var productSiteWhere = new WhereCondition(); // Add global products if (DisplayGlobalProducts) { productSiteWhere.Where(w => w.WhereNull("SKUOptionCategoryID") .WhereNull("SKUSiteID")); } // Add site specific products if (DisplaySiteProducts) { productSiteWhere.Or().Where(w => w.WhereNull("SKUOptionCategoryID") .WhereEquals("SKUSiteID", SiteID)); } where.Where(productSiteWhere); } // Exclude standard products if needed if (!DisplayStandardProducts) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Product.ToStringRepresentation()); } // Exclude memberships if needed if (!DisplayMemberships) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Membership.ToStringRepresentation()); } // Exclude e-products if needed if (!DisplayEproducts) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.EProduct.ToStringRepresentation()); } // Exclude donations if needed if (!DisplayDonations) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Donation.ToStringRepresentation()); } // Exclude bundles if needed if (!DisplayBundles) { where.WhereNotEquals("SKUProductType", SKUProductTypeEnum.Bundle.ToStringRepresentation()); } // Exclude products with product options if needed if (DisplayOnlyProductsWithoutOptions) { where.WhereNotIn("SKUID", new IDQuery<SKUOptionCategoryInfo>("SKUID")); } if (DisplayProductOptions && (ProductOptionCategoryID <= 0)) { var optionsSiteWhere = new WhereCondition(); // Add global options if (DisplayGlobalOptions) { optionsSiteWhere.Where(w => w.WhereNotNull("SKUOptionCategoryID") .WhereNull("SKUSiteID")); } // Add site specific options if (DisplaySiteOptions) { optionsSiteWhere.Or().Where(w => w.WhereNotNull("SKUOptionCategoryID") .WhereEquals("SKUSiteID", SiteID)); } where.Or().Where(optionsSiteWhere); where = new WhereCondition().Where(where); } // Filter out only product from users departments if (UserID > 0) { where.WhereIn("SKUDepartmentID", new IDQuery<UserDepartmentInfo>("DepartmentID").WhereEquals("UserID", UserID).Or().WhereNull("SKUDepartmentID")); } // Filter out only enabled items if (DisplayOnlyEnabled) { where.WhereTrue("SKUEnabled"); } if (!DisplayProductOptions && (ProductOptionCategoryID <= 0)) { where.WhereNull("SKUOptionCategoryID"); } if (DisplayProductVariants) { // Do not display parent product in selector where.WhereNotIn("SKUID", new IDQuery<SKUInfo>("SKUParentSKUID").WhereNotNull("SKUParentSKUID")); } else { // Do not display variants where.WhereNull("SKUParentSKUID"); } // Add items which have to be on the list var additionalList = AdditionalItems.Split(new[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries); if (additionalList.Length > 0) { var ids = ValidationHelper.GetIntegers(additionalList, 0); where.Or().WhereIn("SKUID", ids); } // Selected value must be on the list if (SKUID > 0) { where.Or().WhereEquals("SKUID", SKUID); } uniSelector.WhereCondition = where.ToString(true); }
/// <summary> /// Exclude main currency and currencies without exchange rate according selector settings. /// </summary> /// <param name="whereCondition">Where condition.</param> protected override string AppendExclusiveWhere(string whereCondition) { // Prepare where condition var where = new WhereCondition(whereCondition); if (DisplayOnlyWithExchangeRate) { var tableInfo = ExchangeTableInfoProvider.GetLastExchangeTableInfo(SiteID); if (tableInfo != null) { where.Where(w => w.WhereEquals("CurrencyID", MainCurrencyID) .Or() .WhereIn("CurrencyID", new IDQuery(ExchangeRateInfo.OBJECT_TYPE, "ExchangeRateToCurrencyID") .WhereEquals("ExchangeTableID", tableInfo.ExchangeTableID) .WhereTrue("CurrencyEnabled"))); } else { where.NoResults(); } } // Exclude site main currency when required if (ExcludeSiteDefaultCurrency && (MainCurrencyID > 0)) { where.WhereNotEquals("CurrencyID", MainCurrencyID); } // Restrict disabled or site not related currencies return base.AppendExclusiveWhere(where.ToString(true)); }