public OrderExitOperation(Order order) { IsAsc = order.ToString().EndsWith("asc"); IsDesc = order.ToString().EndsWith("desc"); Preconditions.CheckState(IsAsc || IsDesc); //this.order = order; propertyName = GetSortingProperty(order); }
private static string GetSortingProperty(Order order) { /** * This method relies on the format that Order is using: * propertyName + ' ' + (ascending?"asc":"desc") */ string str = order.ToString(); return str.Substring(0, str.IndexOf(' ')); }
private static bool IsAscending(Order order) { return order.ToString().ToUpper().EndsWith("ASC"); }