当前位置: 首页>>代码示例>>C#>>正文


C# Script.Serialization.JavaScriptSerializer.Select方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:divyang4481,项目名称:appleseedapp,代码行数:30,代码来源:InstallationController.cs

示例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;
        }
开发者ID:agross,项目名称:mpc-deleter,代码行数:11,代码来源:ApplicationSettings.cs

示例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);
 }
开发者ID:chungminhtu,项目名称:DANN,代码行数:32,代码来源:GridController.cs

示例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);
        }
开发者ID:chungminhtu,项目名称:DANN,代码行数:28,代码来源:GridController.cs


注:本文中的System.Web.Script.Serialization.JavaScriptSerializer.Select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。