using System;
using System.Collections.Generic;
using System.Text;
using FastReport.Utils;
namespace FastReport
{
///
/// Represents a sort condition used in the .
///
public class Sort : IFRSerializable
{
private string expression;
private bool descending;
///
/// Gets or sets an expression used to sort data band rows.
///
///
/// This property can contain any valid expression.
///
public string Expression
{
get { return expression; }
set { expression = value; }
}
///
/// Gets or sets a value indicating that sort must be performed in descending order.
///
public bool Descending
{
get { return descending; }
set { descending = value; }
}
///
/// Serializes the class.
///
/// Writer object.
///
/// This method is for internal use only.
///
public void Serialize(FRWriter writer)
{
writer.ItemName = "Sort";
writer.WriteStr("Expression", Expression);
if (Descending)
writer.WriteBool("Descending", Descending);
}
///
/// Deserializes the class.
///
/// Reader object.
///
/// This method is for internal use only.
///
public void Deserialize(FRReader reader)
{
reader.ReadProperties(this);
}
///
/// Initializes a new instance of the class with default settings.
///
public Sort() : this("")
{
}
///
/// Initializes a new instance of the class with specified expression.
///
public Sort(string expression) : this(expression, false)
{
}
///
/// Initializes a new instance of the class with specified expression and sort order.
///
public Sort(string expression, bool descending)
{
this.expression = expression;
this.descending = descending;
}
}
}