• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Entities.List类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



List类属于Entities命名空间,在下文中一共展示了List类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetCategory

 // Get all categories of products
 public List<Category> GetCategory()
 {
     try
     {
         List<Category> ListOfCategory = new List<Category>();
         connect = new Connection().Connect;
         connect.Open();
         Command = new SqlCommand("sp_getAllCategory", connect);
         Command.CommandType = System.Data.CommandType.StoredProcedure;
         SqlDataReader dr = Command.ExecuteReader();
         while (dr.Read())
         {
             Category objCategory = new Category();
             objCategory.CategoryID = dr.GetInt32(0);
             objCategory.CategoryName = dr.GetString(1);
             ListOfCategory.Add(objCategory);
         }
         connect.Close();
         return ListOfCategory;
     }
     catch (Exception)
     {
         connect.Close();
         return null;
     }
 }
开发者ID:haidinh,项目名称:Source-Code,代码行数:27,代码来源:DLUserInterfaceProcess.cs


示例2: GetHsql

        public override IQuery GetHsql(Object data)
        {
            StringBuilder sql = new StringBuilder("select a from C_CasNumber a    where  ");
            C_CasNumber C_CasNumber = (C_CasNumber)data;
            if (C_CasNumber != null)
            {
                Parms = new List<Object[]>();
                if (C_CasNumber.CasNumberID != 0)
                {
                    sql.Append(" a.CasNumberID = :id     and   ");
                    Parms.Add(new Object[] { "id", C_CasNumber.CasNumberID });
                }

                if (!String.IsNullOrEmpty(C_CasNumber.Name))
                {
                    sql.Append(" (a.Name like :nom  OR a.Code like :nomz)  and   "); 
                    Parms.Add(new Object[] { "nom", "%" + C_CasNumber.Name + "%" });
                    Parms.Add(new Object[] { "nomz",  C_CasNumber.Name + "%" });
                }

                if (!String.IsNullOrEmpty(C_CasNumber.Code))
                {
                    sql.Append(" a.Code = :nom1     and   "); 
                    Parms.Add(new Object[] { "nom1", C_CasNumber.Code });
                }
            }

            sql = new StringBuilder(sql.ToString());
            sql.Append(" 1=1 order by a.CasNumberID asc ");
            IQuery query = Factory.Session.CreateQuery(sql.ToString());
            SetParameters(query);            
            return query;
        }
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:33,代码来源:DaoC_CasNumber.cs


示例3: BuildBetTeam

#pragma warning disable 1587
        /// <summary>
        /// Set bet team to template by ticket bet team pattern with following rules:
        /// <para>ho: Home and Over, hu: Home and Under</para>
        /// <para>ao: Away and Over, au: Away and Under</para>
        /// <para>do: Draw and Over, du: Draw and Over</para>
        /// </summary>
        /// <param name="ticket"> Ticket with bet type id is 143.</param>
        /// <param name="ticketHelper"> Not null ticket helper.</param>
        /// <param name="ticketData"> Not need this.</param>
#pragma warning restore 1587
        protected override void BuildBetTeam(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData)
        {
            var teamName = string.Empty;

            // Bet team pattern length is always 2
            if (ticket.BetTeam.Length == 2)
            {
                switch (ticket.BetTeam[0])
                {
                    case 'h':
                        teamName = ticketHelper.GetTeamNameById(ticket.HomeId);
                        break;

                    case 'a':
                        teamName = ticketHelper.GetTeamNameById(ticket.AwayId);
                        break;

                    case 'd':
                        teamName = CoreBetList.draw;
                        break;
                }

                var resultOverUnder = (ticket.BetTeam[1].ToString(CultureInfo.InvariantCulture) == BetTeamValue.O)
                    ? CoreBetList.over
                    : CoreBetList.under;

                Template.betTeam = string.Join(" & ", new string[] { teamName, resultOverUnder });
            }
        }
开发者ID:huyjack178,项目名称:harrsion-project,代码行数:40,代码来源:Choice143.cs


示例4: GetTopTenWorstMovies

        public List<Movie> GetTopTenWorstMovies()
        {
            using (var ctx = new DatabaseContext())
            {
                var bests = (from r in ctx.Review
                             group r by r.MovieId into groupIds
                             select new { groupIds.Key, Average = groupIds.Sum(x => x.Note) / groupIds.Count() })
                             .OrderByDescending(x => x.Average)
                             .Take(10)
                             .ToList();

                var worst = (from r in ctx.Review
                             group r by r.MovieId into groupIds
                             select new { groupIds.Key, Average = groupIds.Sum(x => x.Note) / groupIds.Count() })
                             .ToList()
                             .Where(r => !bests.Any(y => y.Key == r.Key))
                             .OrderBy(x => x.Average)
                             .Take(10)
                             .ToList();

                var listWorst = new List<Movie>();
                foreach (var movie in worst)
                    listWorst.Add(GetById(movie.Key));

                return listWorst;
            }
        }
开发者ID:frc1983,项目名称:TrabalhoFinalPSA,代码行数:27,代码来源:MovieRepository.cs


示例5: getAuthors

        public static List<Yazar> getAuthors()
        {
            List<Yazar> Value = new List<Yazar>();
            SqlConnection con = new SqlConnection("Server=.;Database=KutuphaneOtomasyon;Trusted_Connection=true");

            SqlCommand cmd = new SqlCommand("select * from dbo.Yazar", con);
            con.Open();
            SqlDataReader reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                int id = reader.GetInt32(0);
                string adi = reader.GetString(1);
                string soyadi = reader.GetString(2);
                Yazar Current = new Yazar(id, adi, soyadi);
                string ozgecmis;
                try
                {
                    ozgecmis = reader.GetString(3);
                }
                catch(SqlNullValueException snve)
                {
                    ozgecmis = "";
                }
                Current.Ozgecmis = ozgecmis;
                Value.Add(Current);
            }
            reader.Close();
            con.Close();
            return Value;
        }
开发者ID:ErelOzcakirlar,项目名称:KutuphaneOtomasyon,代码行数:30,代码来源:YazarIslemleri.cs


示例6: BookList

 /// <summary>
 /// Constructor with user's way keeping
 /// </summary>
 /// <param name="repository">Object describing storage kind</param>
 public BookList(IRepository repository)
 {
     if (repository == null)
         throw new ArgumentNullException("Repository is undefined");
     books = new List<Book>();
     this.repository = repository;
 }
开发者ID:zzhukanton,项目名称:BSU.ASP1501.Day5.Zhuk,代码行数:11,代码来源:BookList.cs


示例7: FillTeams

 public List<Team> FillTeams(Team homeTeam, Team awayTeam)
 {
     List<Team> teams = new List<Team>();
     teams.Add(homeTeam);
     teams.Add(awayTeam);
     return teams;
 }
开发者ID:theklausster,项目名称:DragonsLair,代码行数:7,代码来源:MatchViewModel.cs


示例8: GetAllComplejos

        public IQueryable<ComplejoModelResponse> GetAllComplejos()
        {
            try
            {
                var complejos = from complejo in complejoRepository.All
                                select complejo;

                List<ComplejoModelResponse> list = new List<ComplejoModelResponse>();
                list.Add(new ComplejoModelResponse()
                {
                    HttpStatusCode = 200,
                    HttpStatusDesc = "Ok",
                    Complejos = complejos
                });
                return list.AsQueryable();
            }
            catch (Exception ex)
            {
                List<ComplejoModelResponse> list = new List<ComplejoModelResponse>();
                list.Add(new ComplejoModelResponse()
                {
                    HttpStatusCode = 400,
                    HttpStatusDesc = "Bad Request",
                    Complejos = new List<Complejo>().AsQueryable(),
                    Exception = ex
                });

                return list.AsQueryable();
            }
        }
开发者ID:reserva5,项目名称:Dev,代码行数:30,代码来源:ComplejoService.cs


示例9: BuildBetTeam

        protected override void BuildBetTeam(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData)
        {
            var betTeam = string.Empty;

            switch (ticket.BetTeam)
            {
                case "0:0":
                    betTeam = CoreBetList.NoGoalBetType14;
                    break;
                case "1:1":
                    betTeam = CoreBetList.HomeFG;
                    break;
                case "1:2":
                    betTeam = CoreBetList.HomeLG;
                    break;
                case "2:1":
                    betTeam = CoreBetList.AwayFG;
                    break;
                case "2:2":
                    betTeam = CoreBetList.AwayLG;
                    break;
            }

            Template.betTeam = betTeam;
        }
开发者ID:huyjack178,项目名称:harrsion-project,代码行数:25,代码来源:Choice14.cs


示例10: Select

        public IList<KitAssembly> Select(KitAssembly data, int showRegs)
        {
            IList<KitAssembly> datos = new List<KitAssembly>();

            /*
                datos = GetHsql(data).List<KitAssembly>();
                if (!Factory.IsTransactional)
                    Factory.Commit();
                return datos;
            */
                try
                {
                    if (showRegs > 0)
                        datos = GetHsql(data).SetMaxResults(showRegs).List<KitAssembly>();
                    else
                        datos = GetHsql(data).List<KitAssembly>();

                    if (!Factory.IsTransactional)
                        Factory.Commit();
                }

                catch (Exception e)
                {
                    NHibernateHelper.WriteEventLog(WriteLog.GetTechMessage(e));
                }


                return datos;
        }
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:29,代码来源:DaoKitAssembly.cs


示例11: GetHsql

        public override IQuery GetHsql(Object data)
        {
            StringBuilder sql = new StringBuilder("select a from NodeRoute a    where  ");
            NodeRoute noderoute = (NodeRoute)data;
            if (noderoute != null)
            {
                Parms = new List<Object[]>();
                if (noderoute.RowID != 0)
                {
                    sql.Append(" a.RowID = :id     and   ");
                    Parms.Add(new Object[] { "id", noderoute.RowID });
                }

                if (noderoute.NextNode != null && noderoute.NextNode.NodeID != 0)
                {
                    sql.Append(" a.NextNode.NodeID = :id1     and   ");
                    Parms.Add(new Object[] { "id1", noderoute.NextNode.NodeID });
                }

                if (noderoute.CurNode != null && noderoute.CurNode.NodeID != 0)
                {
                    sql.Append(" a.CurNode.NodeID = :id2     and   ");
                    Parms.Add(new Object[] { "id2", noderoute.CurNode.NodeID });
                }


            }

            sql = new StringBuilder(sql.ToString());
            sql.Append("1=1 order by a.RowID asc ");
            IQuery query = Factory.Session.CreateQuery(sql.ToString());
            SetParameters(query);
            return query;
        }
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:34,代码来源:DaoNodeRoute.cs


示例12: BuildBetTeam

        protected override void BuildBetTeam(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData)
        {
            string team = ticket.BetTeam != null && ticket.BetTeam.Contains(BetTeamValue.H) ? Template.Match.homeTeam : Template.Match.awayTeam;
            string yesNo = ticket.BetTeam != null && ticket.BetTeam.Contains(BetTeamValue.Y) ? CoreBetList.lblYes : CoreBetList.lblNo;

            Template.betTeam = string.Join(null, new string[] { team, " <span class=\"", Favorite, "\">", yesNo.ToUpper(), "</span>" });
        }
开发者ID:huyjack178,项目名称:harrsion-project,代码行数:7,代码来源:Choice13.cs


示例13: getExamplePersons

        public List<Person> getExamplePersons()
        {
            List<Person> PERSON = null;

            try
            {
                CONNECTION.Open();

                String query = "SELECT TOP 100 [FirstName],[MiddleName],[LastName] FROM [Person].[Person]";
                COMMAND = new SqlCommand(query, CONNECTION);
                READER = COMMAND.ExecuteReader();

                if (READER.HasRows)
                {
                    PERSON = new List<Person>();
                    EntityMapper MAPPER = new EntityMapper();

                    while (READER.Read())
                        PERSON.Add(MAPPER.convertToPerson(READER));
                }

                CONNECTION.Close();
            }
            catch (Exception EX)
            {
                errorMessage = EX.Message;
                Console.WriteLine("Error: " + EX.Message);
            }

            return PERSON;
        }
开发者ID:Ch3M4x,项目名称:CodeExamples,代码行数:31,代码来源:Data.cs


示例14: getCategories

 public static List<Kategori> getCategories()
 {
     List<Kategori> Value = new List<Kategori>();
     SqlConnection con = new SqlConnection("Server=.;Database=KutuphaneOtomasyon;Trusted_Connection=true");
     SqlCommand cmd = new SqlCommand("select * from dbo.Kategori", con);
     con.Open();
     SqlDataReader reader = cmd.ExecuteReader();
     while (reader.Read())
     {
         int id = reader.GetInt32(0);
         string adi = reader.GetString(1);
         Kategori Current = new Kategori(id, adi);
         string aciklama;
         try
         {
             aciklama = reader.GetString(2);
         }
         catch (SqlNullValueException snve)
         {
             aciklama = "";
         }
         Current.Aciklama = aciklama;
         Value.Add(Current);
     }
     reader.Close();
     con.Close();
     return Value;
 }
开发者ID:ErelOzcakirlar,项目名称:KutuphaneOtomasyon,代码行数:28,代码来源:KategoriIslemleri.cs


示例15: BuildBetTeam

        /// <summary>
        /// Builds the bet team.
        /// </summary>
        /// <param name="ticket">The ticket.</param>
        /// <param name="ticketHelper">The ticket helper.</param>
        /// <param name="ticketData">The ticket data.</param>
        protected override void BuildBetTeam(ITicket ticket, ITicketHelper ticketHelper, List<ITicketData> ticketData)
        {
            string choice = ticket.BetTeam;
            var betTeam = string.Empty;
            switch (choice)
            {
                case "01":
                    betTeam = "4 " + CoreBetList.points;
                    break;

                case "02":
                    betTeam = "5 " + CoreBetList.points;
                    break;

                case "03":
                    betTeam = "6 " + CoreBetList.points;
                    break;

                case "04":
                    betTeam = "7 " + CoreBetList.upPoints;
                    break;
            }

            // "&nbsp" because export format
            Template.betTeam = HtmlCharacters.NoneBreakingSpace + betTeam;
        }
开发者ID:huyjack178,项目名称:harrsion-project,代码行数:32,代码来源:Choice1328.cs


示例16: GetHsql

        public override IQuery GetHsql(Object data)
        {
            StringBuilder sql = new StringBuilder("select a from Rol a    where  ");
            Rol rol = (Rol)data;
            if (rol != null)
            {
                Parms = new List<Object[]>();
                if (rol.RolID != 0)
                {
                    sql.Append(" a.RolID = :id     and   ");
                    Parms.Add(new Object[] { "id", rol.RolID });
                }

                if (!String.IsNullOrEmpty(rol.RolCode))
                {
                    sql.Append(" a.RolCode = :nom     and   ");
                    Parms.Add(new Object[] { "nom", rol.RolCode });
                }

                if (!String.IsNullOrEmpty(rol.Name))
                {
                    sql.Append(" a.Name = :nom1     and   ");
                    Parms.Add(new Object[] { "nom1", rol.Name });
                }



            }

            sql = new StringBuilder(sql.ToString());
            sql.Append("1=1 order by a.RolID asc ");
            IQuery query = Factory.Session.CreateQuery(sql.ToString());
            SetParameters(query);
            return query;
        }
开发者ID:erwin-hamid,项目名称:LogPro,代码行数:35,代码来源:DaoRol.cs


示例17: ItemsGridview

        public List<Item> ItemsGridview(string name)
        {
            var griditems = new List<Item>();
            Item item = null;
            using (var db = new Database())
            {
                db.OpenConnection();
                db.CreateCommand(
                    "SELECT Item.*, Quality.Name AS Quality FROM Item, Quality WHERE Item.Quality_ID=Quality.Quality_ID AND Item.Name LIKE @name");
                db.AddParameter("@name", "%" + name + "%");
                MySqlDataReader dr = db.Command.ExecuteReader();

                while (dr.Read())
                {
                    item = new Item();
                    item.Name = (string)dr["name"];
                    item.Level = (int)dr["level"];
                    item.ReqLevel = (int)dr["Reqlevel"];
                    item.Quality = (string)dr["Quality"];
                    griditems.Add(item);
                }
            }

            return griditems;
        }
开发者ID:JustinAarden,项目名称:Wowhead,代码行数:25,代码来源:DALItem.cs


示例18: LoadToList

        public List<Book> LoadToList()
        {
            List<Book> books = new List<Book>();

            try
            {
                XDocument document = XDocument.Load(filePath);
                var boooks = document.Elements("books").Elements("book");

                foreach (XElement e in boooks)
                {
                    Book b = new Book();
                    b.Title = e.Element("title").Value;
                    b.Author = e.Element("author").Value;
                    b.Publiser = e.Element("publisher").Value;
                    b.Year = int.Parse(e.Element("year").Value);
                    b.NumberOfPages = int.Parse(e.Element("numberOfPages").Value);

                    books.Add(b);
                }
                return books;
            }
            catch (FileNotFoundException)
            {
                throw new InvalidDataException("Error while saving");
            }
        }
开发者ID:zzhukanton,项目名称:BSU.ASP1501.Day5.Zhuk,代码行数:27,代码来源:LINQ2XMLRepository.cs


示例19: GetAllBooks

        public static List<BookModel> GetAllBooks(string skip, string top)
        {
            var cache = HttpContext.Current.Cache["allBooks"];
            var model = new BookModel();
            List<BookModel> listAllBooks = new List<BookModel>();

            if (cache == null)
            {
                GetApiResponse<BookModel> apiModelBook= new GetApiResponse<BookModel>();
                listAllBooks = apiModelBook.GetAllBooksFromDb("api/APIDbBook?");
                BookCount = listAllBooks.Count;

                if (top=="0")
                {
                    listAllBooks = apiModelBook.GetAllBooksFromDb("api/APIDbBook?");
                }
                else
                {
                    listAllBooks = apiModelBook.GetAllBooksFromDb("api/APIDbBook?$skip=" + skip + "&$top=" + top );
                }

                cache = listAllBooks;
            }
            else
            {
                listAllBooks = cache as List<BookModel>;
            }
            return listAllBooks;
        }
开发者ID:the-test-account,项目名称:e-commerce,代码行数:29,代码来源:CacheHelper.cs


示例20: CreateBlocks

        private IList<byte[]> CreateBlocks(byte[] file)
        {
            var size = chunkSize;
            var blocksCount = Math.Ceiling((decimal)file.Length / size);
            var remainingSize = file.Length;
            var blocks = new List<byte[]>();

            for (int i = 0; i < blocksCount; i++)
            {
                if (remainingSize > size)
                {
                    remainingSize -= size;
                }
                else
                {
                    size = remainingSize;
                }

                var block = file.Skip(i * chunkSize).Take(size).ToArray();

                if (block.Length >= chunkSize)
                {
                    blocks.Add(block);
                }
                else
                {
                    var chunk = new byte[chunkSize];
                    Array.Copy(block, 0, chunk, 0, block.Length);
                    blocks.Add(chunk);
                }
            }

            return blocks;
        }
开发者ID:rrsc,项目名称:Your-Digital-Fountain,代码行数:34,代码来源:Encode.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Trace.Document类代码示例发布时间:2022-05-24
下一篇:
C# Entitas.Pool类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap