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


C# List.Count方法代码示例

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


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

示例1: DelSubject

        public static void DelSubject(List<Priority> SP, List<String> SubjectID)
        {
            List<String> SB = new List<String>();
            if (SubjectID != null)
            {
                foreach (var r in SP)
                    if (!SubjectID.Contains(r.SubjectID.ToString()))
                        SB.Add(r.SubjectID);
            }
            else
            {
                foreach (var r in SP)
                    SB.Add(r.SubjectID);
            }

            for (int i = 0; i < SB.Count(); i++)
            {
                var a = SB[i];
                var nhom = (from m in InputHelper.db.nhoms
                            where m.MaMonHoc.Equals(a)
                            select m.Nhom1).ToList();
                foreach (var r in nhom)
                {
                    byte aByte = Convert.ToByte(r);
                    InputHelper.Groups.FirstOrDefault(m => m.Value.MaMonHoc == SB[i] && m.Value.Nhom == aByte).Value.IsIgnored = false;
                }
                OutputHelper.SaveOBJ("Groups", InputHelper.Groups);
            }
        }
开发者ID:NguyenHoangDuy,项目名称:MVC_ESM,代码行数:29,代码来源:PriorityController.cs

示例2: SelectSuccess

        public String SelectSuccess(List<String> SubjectID, List<long> Date, List<long> Time)
        {
            string paramInfo = "";
            if (InputHelper.SubjectPriority.Count() != 0)
            {
                DelSubject(InputHelper.SubjectPriority, SubjectID);
            }

            InputHelper.SubjectPriority = new List<Priority>();
            List<String> SB = new List<String>();
            List<String> aClass = new List<String>();
            List<String> Check = new List<String>();
            if (SubjectID != null)
                for (int i = 0; i < SubjectID.Count(); i++)
                {
                    DateTime dt = (new DateTime(1970, 1, 1, 0, 0, 0, 0)).AddMilliseconds(Date[i]).Date;
                    InputHelper.SubjectPriority.Add(new Priority
                    {
                        SubjectID = SubjectID[i],
                        Date = dt,
                        Time = dt.AddMilliseconds(Time[i])
                    });

                    var a = SubjectID[i];
                    var nhom = (from m in InputHelper.db.nhoms
                                where m.MaMonHoc.Equals(a)
                                select m.Nhom1).ToList();

                    foreach (var r in nhom)
                    {
                        SB.Add(SubjectID[i]);
                        aClass.Add(r.ToString());
                      //  Check.Add("undefined");
                        Check.Add("checked");
                    }

                    paramInfo += "MH:" + SubjectID[i] + " Ngay:" + Date[i] + "Gio:" + Time[i] + "<br /><br />";
                }
            OutputHelper.SaveOBJ("SubjectPriority", InputHelper.SubjectPriority);
            string st = OutputHelper.SaveIgnoreGroups(SB, aClass, Check, true);
            return paramInfo;
        }
开发者ID:NguyenHoangDuy,项目名称:MVC_ESM,代码行数:42,代码来源:PriorityController.cs

示例3: SelectSuccess

 public String SelectSuccess(List<String> StudentID, List<String> SubjectID)
 {
     InputHelper.IgnoreStudents = new Dictionary<String,List<String>>();
     string paramInfo = "";
     if (StudentID != null)
     {
         for (int i = 0; i < StudentID.Count(); i++)
         {
             if (InputHelper.IgnoreStudents.ContainsKey(SubjectID[i]))
             {
                 InputHelper.IgnoreStudents[SubjectID[i]].Add(StudentID[i]);
             }
             else
             {
                 InputHelper.IgnoreStudents.Add(SubjectID[i], new List<String> { StudentID[i] });
             }
             paramInfo += "MH:" + SubjectID[i] + " SV: " + StudentID[i] + "<br /><br />";
         }
     }
     OutputHelper.SaveOBJ("IgnoreStudents", InputHelper.IgnoreStudents);
     return paramInfo;
 }
开发者ID:HoanChan,项目名称:MVC_ESM,代码行数:22,代码来源:SelectIgnoreStudentsController.cs

示例4: ExampleTablesAfterParsing

        //
        //   По аналогии с TreeList, Spreadsheet также должен находиться
        //   на в частичном представлении, которое включается в это представление.
        //
        public ActionResult ExampleTablesAfterParsing(long emailId)
        {
            List<Model.ParsedCells> workSheetCellsList = new List<Model.ParsedCells>();
            List<List<Model.ParsedCells>> tableCellsList = new List<List<Model.ParsedCells>>();
            List<List<List<Model.ParsedCells>>> cellsList = new List<List<List<Model.ParsedCells>>>();
            Model.ParsedCells cellsWSC = new Model.ParsedCells();

            if (emailId != 0)
            {
                var userId = UserHelper.GetUserByEmail(User.Identity.Name).Id;

                if (IsUsersEmail(userId, emailId))
                {
                    var cells = parsedCellsRepository.FindAll(w => w.EmailId_Id == emailId);
                    var distCellsByTable = cells.GroupBy(a => a.TableId_Id).Select(g => g.First()).OrderBy(i => i.TableId_Id).ToList();
                    foreach (var table in distCellsByTable)
                    {
                        var distCellsByWorkcheet = cells.Where(t => t.TableId_Id == table.TableId_Id)
                             .GroupBy(a => a.Worksheet).Select(g => g.First()).OrderBy(i => i.Worksheet).ToList();
                        foreach (var cell in distCellsByWorkcheet)
                        {
                            tableCellsList = new List<List<Model.ParsedCells>>();
                            workSheetCellsList = new List<Model.ParsedCells>();
                            var Cells = cells.Where(c => c.TableId_Id == table.TableId_Id && c.Worksheet == cell.Worksheet).OrderBy(i => i.Column).ToList();

                            foreach (var c in Cells)
                            {
                                c.ColumnName = GetColumnName(c.Column);
                                workSheetCellsList.Add(c);
                            }
                            tableCellsList.Add(workSheetCellsList);
                            cellsList.Add(tableCellsList);
                        }
                    }
                }
            }
            if (cellsList.Count() != 0)
                return View(cellsList);
            else
                return View("ExampleTablesAfterParsingNoData");
        }
开发者ID:Zowal,项目名称:Oasis,代码行数:45,代码来源:EmailController.cs

示例5: DataTable_IgnoreGroups

        public JsonResult DataTable_IgnoreGroups(jQueryDataTableParamModel param, List<String> SubjectID = null, List<String> Class = null, List<String> Check = null, String Search = null, String ShowIgnore = null, String ShowNotIgnore = null)
        {
            if (SubjectID != null && Class != null && Check != null)
            {
                OutputHelper.SaveIgnoreGroups(SubjectID, Class, Check, false);
            }

            Dictionary<String, Group> dbGroups = Clone.Dictionary<String, Group>((Dictionary<String, Group>)(CurrentSession.Get("IgnoreGroups") ?? InputHelper.Groups));
            //Dictionary<String, Group> dbGroups = InputHelper.Groups;

            var Groups = from m in dbGroups.Values select m;

            var total = Groups.Count();

            if (!string.IsNullOrEmpty(Search))
            {
                Groups = Groups.Where(m => m.MaMonHoc.ToLower().Contains(Search.ToLower()) || m.TenMonHoc.ToLower().Contains(Search.ToLower()));
            }

            if (ShowIgnore != null && ShowNotIgnore != null)
            {
                if (ShowIgnore == "checked" && ShowNotIgnore != "checked")
                {
                    Groups = Groups.Where(m => m.IsIgnored == true);
                }
                if (ShowIgnore != "checked" && ShowNotIgnore == "checked")
                {
                    Groups = Groups.Where(m => m.IsIgnored == false);
                }
                if (ShowIgnore != "checked" && ShowNotIgnore != "checked")
                {
                    Groups = Groups.Where(m => false);
                }
            }

            var Result = new List<string[]>();

            var MH = (from m in InputHelper.db.This
                      select new
                      {
                          MaMonHoc = m.MaMonHoc,
                          Nhom = m.Nhom,
                      }).Distinct();

            Dictionary<String, List<String>> CheckMH = new Dictionary<string, List<string>>();

            foreach (var m in MH)
            {
                if (CheckMH.ContainsKey(m.MaMonHoc))
                    CheckMH[m.MaMonHoc].Add(m.Nhom);
                else
                    CheckMH.Add(m.MaMonHoc, new List<String> { m.Nhom });
            }

            foreach (var su in Groups.OrderBy(m => m.TenMonHoc))
            {
                if (CheckMH.ContainsKey(su.MaMonHoc))
                {
                    if (!CheckGroup(CheckMH[su.MaMonHoc], su.Nhom.ToString()))
                    {
                        Result.Add(new string[] {
                                            su.MaMonHoc,
                                            su.TenMonHoc,
                                            su.TenBoMon,
                                            su.TenKhoa,
                                            su.Nhom.ToString(),
                                            su.SoLuongDK.ToString(),
                                            su.IsIgnored ? "checked" : "",
                                        }
                                    );
                    }
                }
                else
                {
                    Result.Add(new string[] {
                                            su.MaMonHoc,
                                            su.TenMonHoc,
                                            su.TenBoMon,
                                            su.TenKhoa,
                                            su.Nhom.ToString(),
                                            su.SoLuongDK.ToString(),
                                            su.IsIgnored ? "checked" : "",
                                        }
                                );
                }

            }

            return Json(new
                            {
                                sEcho = param.sEcho,
                                iTotalRecords = Result.Count(),
                                iTotalDisplayRecords = Result.Count(),
                                //iTotalDisplayedRecords = Subjects.Count(),
                                aaData = Result.Skip(param.iDisplayStart).Take(param.iDisplayLength)
                            },
                            JsonRequestBehavior.AllowGet
                        );
        }
开发者ID:NguyenHoangDuy,项目名称:MVC_ESM,代码行数:99,代码来源:ServicesController.cs

示例6: GetTourGroupByTeId

 public IList<Model.DJ_Workers> GetTourGroupByTeId(int id)
 {
     var listTg = Idjtourgroup.GetTourGroupByTEId(id).ToList();
     var listGw = new List<Model.DJ_Group_Worker>();
     var listGw2 = new List<Model.DJ_Group_Worker>();
     List<DJ_Workers> Listdw = new List<DJ_Workers>();
     foreach (var tg in listTg)
     {
         listGw.AddRange(tg.Workers.Where(x => x.DJ_Workers.WorkerType == Model.DJ_GroupWorkerType.导游).ToList<Model.DJ_Group_Worker>());
     }
     foreach (var item in listGw)
     {
         if (listGw2.Count(x => x.DJ_Workers.IDCard == item.DJ_Workers.IDCard) == 0)
         {
             listGw2.Add(item);
         }
     }
     foreach (var item in listGw2)
     {
         Listdw.Add(item.DJ_Workers);
     }
     return Listdw;
 }
开发者ID:phiree,项目名称:testttt,代码行数:23,代码来源:BLLDJTourGroup.cs


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