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


C# BindingList.OrderByDescending方法代码示例

本文整理汇总了C#中BindingList.OrderByDescending方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.OrderByDescending方法的具体用法?C# BindingList.OrderByDescending怎么用?C# BindingList.OrderByDescending使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BindingList的用法示例。


在下文中一共展示了BindingList.OrderByDescending方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetData

        private void GetData()
        {
            LawDictionaryModels = new BindingList<LawDictionaryModel>();

            // Read the file contents back into a variable.
            try
            {
                LawDictionaryModels =
                    BinaryFileHelper.ReadFromBinaryFile<IList<LawDictionaryModel>>(dir + "MyLDData.dll");

                
            }
            catch
            {
            }

            var roleKey = "";

            try
            {
                roleKey = BinaryFileHelper.ReadFromBinaryFile<string>(dir + "RoleKey.dll");
            }
            catch
            {
            }


            if (roleKey.Equals(RoleKey))
            {
                IsAdmin = true;
            }

            Types =
                new BindingList<string>(
                    LawDictionaryModels.OrderBy(s => s.OrderType).Select(s => s.Type).Distinct().ToList());
            Years =
                new BindingList<string>(
                    LawDictionaryModels.OrderByDescending(s => s.Year).Select(s => s.Year).Distinct().ToList());
            NGOs =
                new BindingList<string>(LawDictionaryModels.OrderBy(s => s.NGO).Select(s => s.NGO).Distinct().ToList());

            BindButtons();
            BindType();
            BindYear();
            BindNGO();

            Search();
        }
开发者ID:konzuk,项目名称:LoanProjectSQL,代码行数:48,代码来源:MainForm.cs

示例2: goOne

    private static void goOne()
    {
      var list = new List<SetupItem>();
      list.Add(new SetupItem { BbgTicker = "IKH13 Comdty", StartDate = new DateTime(2013, 01, 08), EndDate = new DateTime(2013, 01, 15), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKH13 Comdty", StartDate = new DateTime(2013, 02, 08), EndDate = new DateTime(2013, 02, 15), StartHour = 7, EndHour = 18 });

      list.Add(new SetupItem { BbgTicker = "IKM13 Comdty", StartDate = new DateTime(2013, 03, 08), EndDate = new DateTime(2013, 03, 15), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKM13 Comdty", StartDate = new DateTime(2013, 04, 08), EndDate = new DateTime(2013, 04, 15), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKM13 Comdty", StartDate = new DateTime(2013, 05, 08), EndDate = new DateTime(2013, 05, 15), StartHour = 7, EndHour = 18 });

      list.Add(new SetupItem { BbgTicker = "IKU13 Comdty", StartDate = new DateTime(2013, 06, 08), EndDate = new DateTime(2013, 06, 17), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKU13 Comdty", StartDate = new DateTime(2013, 07, 08), EndDate = new DateTime(2013, 07, 15), StartHour = 7, EndHour = 18 });


      list.Add(new SetupItem { BbgTicker = "IKZ3 Comdty", StartDate = new DateTime(2013, 09, 09), EndDate = new DateTime(2013, 09, 16), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKZ3 Comdty", StartDate = new DateTime(2013, 10, 09), EndDate = new DateTime(2013, 10, 15), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKZ3 Comdty", StartDate = new DateTime(2013, 11, 09), EndDate = new DateTime(2013, 11, 15), StartHour = 7, EndHour = 18 });

      list.Add(new SetupItem { BbgTicker = "IKH4 Comdty", StartDate = new DateTime(2013, 12, 09), EndDate = new DateTime(2013, 12, 16), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKH4 Comdty", StartDate = new DateTime(2014, 01, 08), EndDate = new DateTime(2014, 01, 15), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKH4 Comdty", StartDate = new DateTime(2014, 02, 10), EndDate = new DateTime(2014, 02, 17), StartHour = 7, EndHour = 18 });



      list.Add(new SetupItem { BbgTicker = "IKH13 Comdty", StartDate = new DateTime(2013, 01, 25), EndDate = new DateTime(2013, 02, 01), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKH13 Comdty", StartDate = new DateTime(2013, 02, 22), EndDate = new DateTime(2013, 03, 01), StartHour = 7, EndHour = 18 });

      list.Add(new SetupItem { BbgTicker = "IKM13 Comdty", StartDate = new DateTime(2013, 03, 22), EndDate = new DateTime(2013, 04, 02), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKM13 Comdty", StartDate = new DateTime(2013, 04, 23), EndDate = new DateTime(2013, 05, 02), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKM13 Comdty", StartDate = new DateTime(2013, 05, 27), EndDate = new DateTime(2013, 06, 03), StartHour = 7, EndHour = 18 });

      list.Add(new SetupItem { BbgTicker = "IKU13 Comdty", StartDate = new DateTime(2013, 06, 24), EndDate = new DateTime(2013, 07, 01), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKU13 Comdty", StartDate = new DateTime(2013, 07, 25), EndDate = new DateTime(2013, 08, 01), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKU13 Comdty", StartDate = new DateTime(2013, 08, 26), EndDate = new DateTime(2013, 09, 02), StartHour = 7, EndHour = 18 });

      list.Add(new SetupItem { BbgTicker = "IKZ3 Comdty", StartDate = new DateTime(2013, 09, 24), EndDate = new DateTime(2013, 10, 01), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKZ3 Comdty", StartDate = new DateTime(2013, 10, 25), EndDate = new DateTime(2013, 11, 01), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKZ3 Comdty", StartDate = new DateTime(2013, 11, 23), EndDate = new DateTime(2013, 12, 02), StartHour = 7, EndHour = 18 });

      list.Add(new SetupItem { BbgTicker = "IKH4 Comdty", StartDate = new DateTime(2013, 12, 24), EndDate = new DateTime(2014, 01, 02), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKH4 Comdty", StartDate = new DateTime(2014, 01, 25), EndDate = new DateTime(2014, 02, 03), StartHour = 7, EndHour = 18 });
      list.Add(new SetupItem { BbgTicker = "IKH4 Comdty", StartDate = new DateTime(2014, 02, 23), EndDate = new DateTime(2014, 03, 03), StartHour = 7, EndHour = 18 });

      foreach (var sec in list.Select(x => x.BbgTicker).Distinct())
      {
        foreach (var setup in list.Where(x => x.BbgTicker.Equals(sec)).OrderBy(x => x.StartDate))
        {
          var outputList = new BindingList<OutputItem>();

          var contract = Singleton<IntradayFuturesContracts>.Instance.Where(x => x.BbgTicker.Equals(setup.BbgTicker)).FirstOrDefault();

          if (contract == null) System.Diagnostics.Debugger.Break();

          var currentDate = setup.StartDate;

          while (currentDate <= setup.EndDate)
          {
            DateTime startLN = currentDate.AddHours(setup.StartHour);
            DateTime endLN = currentDate.AddHours(setup.EndHour);

            DateTime startUTC = startLN - LN_TZI.GetUtcOffset(startLN);
            DateTime endUTC = endLN - LN_TZI.GetUtcOffset(endLN);

            //if (startUTC != startLN)
            //  System.Diagnostics.Debugger.Break();

            var data = contract.GetPricesBetween(startUTC, endUTC);

            if (data != null && data.Length>0)
            {
              for (int i = 0; i < data.Length; ++i)
                outputList.Add(new OutputItem() { Ticker = contract.BbgTicker, GMT = data.Dates[i], LNT=TimeZoneInfo.ConvertTime(data.Dates[i],LN_TZI), Price = data.Data[i] });
            }

            currentDate = currentDate.AddDays(1d);
            while (currentDate.DayOfWeek == DayOfWeek.Saturday || currentDate.DayOfWeek == DayOfWeek.Sunday)
              currentDate = currentDate.AddDays(1d);

            //data.DisplayLineChart(setup.BbgTicker);
          }

          StringBuilder b = new StringBuilder();
          b.Append("Ticker,GMT,LN_Time,Price").AppendLine();

          foreach (var v in outputList.OrderByDescending(x => x.GMT))
          {
            b.Append(v.Ticker).Append(",").Append(v.GMT.ToString("dd-MMM-yyyy HH:mm:ss")).Append(",").Append(v.LNT.ToString("dd-MMM-yyyy HH:mm:ss")).Append(",").AppendLine(v.Price.ToString());
          }

          System.IO.FileInfo t = new System.IO.FileInfo(string.Format(@"c:\kalyan\{0}_{1}to{2}.csv", setup.BbgTicker, setup.StartDate.ToString("dd-MMM-yyyy"), setup.EndDate.ToString("dd-MMM-yyyy")));
          System.IO.StreamWriter writer = t.CreateText();
          writer.Write(b.ToString());
          writer.Close();

        }


      }

      
//.........这里部分代码省略.........
开发者ID:heimanhon,项目名称:researchwork,代码行数:101,代码来源:FuturesExtractForKalyan.cs


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