Пример #1
0
        public IList<Core.Business.TRGroup> GetAllTRGroup()
        {
            IList<Core.Business.TRGroup> tRGrouplist = new List<Core.Business.TRGroup>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllTRGroup);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TRGroup tRGroup = new Core.Business.TRGroup();

                    if (!reader.IsDBNull(0)) tRGroup.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) tRGroup.TrGroupCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) tRGroup.TrGoupName = reader.GetString(2);
                    if (!reader.IsDBNull(3)) tRGroup.AddDate = reader.GetDateTime(3);
                    if (!reader.IsDBNull(4)) tRGroup.BuildDate = reader.GetDateTime(4);

                    tRGroup.MarkOld();
                    tRGrouplist.Add(tRGroup);
                }
                reader.Close();
            }
            return tRGrouplist;
        }
Пример #2
0
        public Core.Business.TRGroup Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectTRGroup);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.TRGroup tRGroup = new Core.Business.TRGroup();

                if (!reader.IsDBNull(0)) tRGroup.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) tRGroup.TrGroupCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) tRGroup.TrGoupName = reader.GetString(2);
                if (!reader.IsDBNull(3)) tRGroup.AddDate = reader.GetDateTime(3);
                if (!reader.IsDBNull(4)) tRGroup.BuildDate = reader.GetDateTime(4);

                reader.Close();
                return tRGroup;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }