private void LoadCBCHsitory(string countryCode, string reportingPeriod) { var cbcr = DBReadManager.GetOutgoingPackageHistory(countryCode, reportingPeriod); Session["subhistorydata"] = cbcr; gvCBCHistory.Bind(cbcr); }
public static object LoadCBCHistory(string countryCode, string reportingPeriod) { var cbcr = DBReadManager.GetOutgoingPackageHistory(countryCode.Trim(), reportingPeriod); string jsonString = ""; if (cbcr.HasRows) { var lst = cbcr.Tables[0].AsEnumerable() .Select(r => r.Table.Columns.Cast <DataColumn>() .Select(c => new KeyValuePair <string, object>(c.ColumnName, r[c.Ordinal]) ).ToDictionary(z => z.Key, z => z.Value) ).ToList(); var serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); jsonString = serializer.Serialize(lst); } ; return(jsonString); }