/// <summary> /// Checks payment methods. /// </summary> private void CheckPaymentMethods() { if (PaymentMethodsCheck) { // Get all payment options DataSet ds = PaymentOptionInfoProvider.GetPaymentOptions("PaymentOptionEnabled = 1", "PaymentOptionID", 0, "PaymentOptionID", CMSContext.CurrentSiteID); if (!DataHelper.DataSourceIsEmpty(ds)) { // Build where condition StringBuilder sb = new StringBuilder(); foreach (DataRow row in ds.Tables[0].Rows) { sb.Append(row["PaymentOptionID"] + ","); } sb.Remove(sb.Length - 1, 1); // Check if at least one is assigned to shipping method DataSet ds2 = PaymentShippingInfoProvider.GetPaymentShippings("PaymentOptionID IN (" + sb.ToString() + ")", null, 1, "PaymentOptionID"); if (DataHelper.DataSourceIsEmpty(ds2)) { DisplayMessage("com.settingschecker.nopaymentoptionsshippingmethod"); } } // If there is no Payment option, it shows error else { DisplayMessage("com.settingschecker.nopaymentoptions"); } } }
/// <summary> /// Checks payment methods. /// </summary> private void CheckPaymentMethods() { if (PaymentMethodsCheck) { // Get all payment options DataSet ds = PaymentOptionInfoProvider.GetPaymentOptions(SiteContext.CurrentSiteID, true).Column("PaymentOptionID").OrderBy("PaymentOptionID"); if (!DataHelper.DataSourceIsEmpty(ds)) { // Build where condition var paymentIds = DataHelper.GetIntegerValues(ds.Tables[0], "PaymentOptionID"); // Check if at least one is assigned to shipping method DataSet ds2 = PaymentShippingInfoProvider.GetPaymentShippings().TopN(1).Column("PaymentOptionID").WhereIn("PaymentOptionID", paymentIds); if (DataHelper.DataSourceIsEmpty(ds2)) { DisplayMessage("com.settingschecker.nopaymentoptionsshippingmethod"); } } // Show error if there is no payment option else { DisplayMessage("com.settingschecker.nopaymentoptions"); } } }