public static ReportItem CreateFromParameters(NameValueCollection nvc)
{
Assert.IsNotNull(nvc, "Incorrect Parameters Format");
var id = nvc["id"];
if (id == null)
{
return(null);
}
id = System.Web.HttpUtility.UrlDecode(id);
var database = Sitecore.Configuration.Factory.GetDatabase(Settings.Instance.ConfigurationDatabase);
var reportItem = new ReportItem(database.GetItem(id));
if (reportItem == null)
{
throw new Exception("Report has been deleted");
}
foreach (string key in nvc.Keys)
{
if (key.Contains("^"))
{
var item_parameter = key.Split('^');
var guid = new ID(item_parameter[0]);
var ri = reportItem.FindItem(guid);
if (ri != null)
{
ri.SetAttributeValue(item_parameter[1], nvc[key]);
}
}
}
return(reportItem);
}