コード例 #1
0
        public IList<Core.Business.Leader> GetAllLeader()
        {
            IList<Core.Business.Leader> leaderlist = new List<Core.Business.Leader>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllLeader);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Leader leader = new Core.Business.Leader();

                    if (!reader.IsDBNull(0)) leader.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) leader.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) leader.Description = reader.GetString(2);

                    leader.MarkOld();
                    leaderlist.Add(leader);
                }
                reader.Close();
            }
            return leaderlist;
        }
コード例 #2
0
        public ICollection<Leader> Search(string s)
        {
            IList<Core.Business.Leader> leaderlist = new List<Core.Business.Leader>();

            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@name", SqlDbType.NVarChar, s);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetLeader);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.Leader leader = new Core.Business.Leader();

                    if (!reader.IsDBNull(0)) leader.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) leader.Name = reader.GetString(1);
                    if (!reader.IsDBNull(2)) leader.Description = reader.GetString(2);

                    leader.MarkOld();
                    leaderlist.Add(leader);
                }
                reader.Close();
            }
            return leaderlist;
        }