コード例 #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 TRGroup Select(string TrCode)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Code", SqlDbType.NVarChar, TrCode);

            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectTRGroupByCode);

            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();
                tRGroup.MarkOld();
                return tRGroup;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }