/// <summary> /// Builds a SQL condition for filtering the discount list, and returns it. /// </summary> /// <returns>A SQL condition for filtering the discount list.</returns> private string GetFilterWhereCondition() { string discountStatus = drpStatus.SelectedValue; var condition = new WhereCondition(); /* Active discounts */ if (discountStatus == "0") { condition.Where(GetActiveQuery()); } /* Disabled discounts */ else if (discountStatus == "1") { condition.WhereNot(GetEnabledDiscounts()); } /* Finished discounts */ else if (discountStatus == "2") { condition.Where(GetEnabledDiscounts()) .WhereLessThan(GetColumn("DiscountValidTo"), DateTime.Now) .WhereNot(GetIncompleteDiscounts()) .Or(GetDiscountsWithCouponsExceeded()); } /* Scheduled discounts */ else if (discountStatus == "3") { condition.Where(GetEnabledDiscounts()) .WhereGreaterThan(GetColumn("DiscountValidFrom"), DateTime.Now) .WhereNot(GetIncompleteDiscounts()); } /* Incomplete discounts */ else if (discountStatus == "4") { condition.Where(GetEnabledDiscounts()) .Where(GetIncompleteDiscounts()); } return(condition.ToString(true)); }
/// <summary> /// Builds a SQL condition for filtering the discount list, and returns it. /// </summary> /// <returns>A SQL condition for filtering the discount list.</returns> private string GetFilterWhereCondition() { string discountStatus = drpStatus.SelectedValue; var condition = new WhereCondition(); /* Active discounts */ if (discountStatus == "0") { condition.Where(GetActiveQuery()); } /* Disabled discounts */ else if (discountStatus == "1") { condition.WhereNot(GetEnabledDiscounts()); } /* Finished discounts */ else if (discountStatus == "2") { condition.Where(GetEnabledDiscounts()) .WhereLessThan(GetColumn("DiscountValidTo"), DateTime.Now) .WhereNot(GetIncompleteDiscounts()) .Or(GetDiscountsWithCouponsExceeded()); } /* Scheduled discounts */ else if (discountStatus == "3") { condition.Where(GetEnabledDiscounts()) .WhereGreaterThan(GetColumn("DiscountValidFrom"), DateTime.Now) .WhereNot(GetIncompleteDiscounts()); } /* Incomplete discounts */ else if (discountStatus == "4") { condition.Where(GetEnabledDiscounts()) .Where(GetIncompleteDiscounts()); } return condition.ToString(true); }