本文整理汇总了C#中System.Web.Script.Serialization.JavaScriptSerializer.Select方法的典型用法代码示例。如果您正苦于以下问题:C# Script.Serialization.JavaScriptSerializer.Select方法的具体用法?C# Script.Serialization.JavaScriptSerializer.Select怎么用?C# Script.Serialization.JavaScriptSerializer.Select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Script.Serialization.JavaScriptSerializer
的用法示例。
在下文中一共展示了Script.Serialization.JavaScriptSerializer.Select方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstallPackages
public JsonResult InstallPackages(string packages)
{
try
{
var packagesToInstall = new JavaScriptSerializer().Deserialize<IEnumerable<PackageModel>>(packages);
var context = new SelfUpdaterEntities();
foreach (var self in packagesToInstall.Select(pack => new SelfUpdatingPackages { PackageId = pack.Name, PackageVersion = pack.Version, Source = pack.Source, Install = pack.Install}))
{
context.AddToSelfUpdatingPackages(self);
}
context.SaveChanges();
var config = WebConfigurationManager.OpenWebConfiguration("~/");
var section = config.GetSection("system.web/httpRuntime");
((HttpRuntimeSection)section).WaitChangeNotification = 123456789;
((HttpRuntimeSection)section).MaxWaitChangeNotification = 123456789;
config.Save();
return Json("Ok");
}
catch(Exception e)
{
ErrorHandler.Publish(LogLevel.Error, e);
Response.StatusCode = 500;
return Json(e.Message);
}
}
示例2: LoadOverrides
static void LoadOverrides()
{
var deserialized = new JavaScriptSerializer().Deserialize<Override[]>(Settings.Default.ArchivePathOverrides);
var overrides = new List<KeyValuePair<Regex, string>>();
deserialized
.Select(x => CreateOverride(x.Expression, x.Path))
.Each(overrides.Add);
ArchivePathOverrides = overrides;
}
示例3: GetUnitFollowListChiTieu
public string GetUnitFollowListChiTieu(string lstChiTieu)
{
var result = new List<DonViTinhObject>();
var chiTieuData = new JavaScriptSerializer().Deserialize<List<HeaderObject>>(lstChiTieu);
var lstIdChiTieu = chiTieuData.Select(ct => ct.Id).ToList();
var data = _db.TK_ChiTieu
.Where(ct => lstIdChiTieu.Contains(ct.ChiTieu_Id))
.Select(ct => new DonViTinhObject
{
Id = ct.ChiTieu_Id,
Title = ct.DM_DonViTinh.TenDonViTinh,
Value = ct.DM_DonViTinh.ValueFormat
}).ToList();
lstIdChiTieu.ForEach(ict =>
{
var item = data.FirstOrDefault(d => d.Id == ict);
if (item == null)
{
result.Add(new DonViTinhObject
{
Id = ict,
Title = "Mặc định",
Value = "0,0"
});
}
else
{
result.Add(item);
}
});
return new JavaScriptSerializer().Serialize(result);
}
示例4: GetListThongKe2
public string GetListThongKe2(string lstChiTieu_Id, string lstId)
{
if (lstChiTieu_Id == null)
{
lstChiTieu_Id = "";
}
var chiTieuData = new JavaScriptSerializer().Deserialize<List<HeaderObject>>(lstChiTieu_Id);
var doiTuongData = new JavaScriptSerializer().Deserialize<List<HeaderObject>>(lstId);
var lstIdChiTieu = chiTieuData.Select(ct => ct.Id).ToList();
var lstIdDoiTuong = doiTuongData.Select(dt => dt.Id).ToList();
var result = _db.TK_ThongKe
.Where(tk => lstIdChiTieu.Contains(tk.ChiTieu_Id) &&
lstIdDoiTuong.Contains(tk.DoiTuong_Id));
//.Select(tk => new DataObject
//{
// IdLeft = tk.Id,
// IdTop = tk.ChiTieu_Id,
// GiaTri = (decimal)tk.GiaTriThongKe
//}).ToList();
List<DataObject> LstThongKe = new List<DataObject>();
foreach (var thongke in result)
{
LstThongKe.Add(new DataObject { IdLeft = thongke.ChiTieu_Id, IdTop = thongke.ChiTieu_Id, GiaTri = Convert.ToDecimal(thongke.GiaTriThongKe) });
}
return new JavaScriptSerializer().Serialize(LstThongKe);
}