using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Collections;
using System.Collections.Generic;
using Telerik.Web.UI;
using System.Reflection;

public partial class _Default : System.Web.UI.Page
{

    protected void Page_Load(object sender, EventArgs e)
    {

    }


    protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        List<Movie> movies = new List<Movie>();

        movies.Add(new Movie("Yes", "120 minutes", "Dunav most", "Bulgaria", 120));
        movies.Add(new Movie("No", "100 minutes", "Repentance", "Georgia", 100));
        movies.Add(new Movie("Yes", "10 minutes", "The American Gangster", "England", 10));
        movies.Add(new Movie("No", "20 minutes", "Sabachee serdce", "Russia", null));

        RadGrid1.DataSource = movies;


    }
    protected void button1_Click(object sender, EventArgs e)
    {
        GridSortExpression sortExpression = new GridSortExpression();
        sortExpression.FieldName = "Configuration.Description";
        sortExpression.SortOrder = GridSortOrder.Descending;
        RadGrid1.MasterTableView.SortExpressions.AddSortExpression(sortExpression);
        RadGrid1.Rebind();
    }
}

public class Movie
{

    private string _Name;
    public string Name
    {
        get { return _Name; }
        set { _Name = value; }
    }

    private string _Country;
    public string Country
    {
        get { return _Country; }
        set { _Country = value; }
    }


    private SkuAvail _SkuAvailability;

    public SkuAvail SkuAvailability
    {
        get { return _SkuAvailability; }
        set { _SkuAvailability = value; }
    }

    private Config _Configuration;
    public Config Configuration
    {
        get { return _Configuration; }
        set { _Configuration = value; }
    }

    public Movie(string descAvail, string descConfig, string name, string country, int? minutes)
    {
        _SkuAvailability = null;
        _Configuration = new Config(descConfig);

        _Name = name;
        _Country = country;

    }
}

public class SkuAvail
{
    public SkuAvail(string desc, int? minutes)
    {
        _Description = desc;
        _Minutes = minutes;
    }
    private string _Description;
    private int? _Minutes;

    public string Description
    {
        get { return _Description; }
        set { _Description = value; }
    }

    public int? Minutes
    {
        get
        {
            return _Minutes;
        }
        set
        {
            _Minutes = value;
        }
    }
}

public class Config
{

    public Config(string desc)
    {
        _Description = desc;
    }

    private string _Description;

    public string Description
    {
        get { return _Description; }
        set { _Description = value; }
    }



}