Exemplo n.º 1
0
        public TClassInfo GetByParam(string classCode, string TclsCode)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@ClassCode", SqlDbType.NVarChar, classCode);
            sql.AddParameter("@TClsCode", SqlDbType.NVarChar, TclsCode);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetByParam);

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

                if (!reader.IsDBNull(0)) tClassInfo.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) tClassInfo.ClassCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) tClassInfo.TClsCode = reader.GetString(2);
                tClassInfo.MarkOld();
                reader.Close();
                return tClassInfo;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }
Exemplo n.º 2
0
        public IList<Core.Business.TClassInfo> GetAllTClassInfo()
        {
            IList<Core.Business.TClassInfo> tClassInfolist = new List<Core.Business.TClassInfo>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllTClassInfo);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TClassInfo tClassInfo = new Core.Business.TClassInfo();

                    if (!reader.IsDBNull(0)) tClassInfo.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) tClassInfo.ClassCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) tClassInfo.TClsCode = reader.GetString(2);

                    tClassInfo.MarkOld();
                    tClassInfolist.Add(tClassInfo);
                }
                reader.Close();
            }
            return tClassInfolist;
        }
Exemplo n.º 3
0
        public IList<Core.Business.TClassInfo> GetListByQuery(string wherestr)
        {
            IList<Core.Business.TClassInfo> tClassInfolist = new List<Core.Business.TClassInfo>();
            SqlServerUtility sql = new SqlServerUtility();
            StringBuilder sb = new StringBuilder();
            sb.Append(" SELECT [TClassInfo].* FROM [TClassInfo],[CourseClass],[ClassInfo],[Course]");
            sb.Append(" WHERE  [TClassInfo].[ClassCode]=[ClassInfo].[ClassCode] AND [TClassInfo].[TClsCode]=[CourseClass].[TCCode] AND [CourseClass].[CourseCode]=[Course].[Code]");
            if (!string.IsNullOrEmpty(wherestr))
            {
                sb.Append(" AND " + wherestr);
            }
            SqlDataReader reader = sql.ExecuteSqlReader(sb.ToString());

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.TClassInfo tClassInfo = new Core.Business.TClassInfo();

                    if (!reader.IsDBNull(0)) tClassInfo.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) tClassInfo.ClassCode = reader.GetString(1);
                    if (!reader.IsDBNull(2)) tClassInfo.TClsCode = reader.GetString(2);

                    tClassInfo.MarkOld();
                    tClassInfolist.Add(tClassInfo);
                }
                reader.Close();
            }
            return tClassInfolist;
        }
Exemplo n.º 4
0
        public Core.Business.TClassInfo Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) tClassInfo.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) tClassInfo.ClassCode = reader.GetString(1);
                if (!reader.IsDBNull(2)) tClassInfo.TClsCode = reader.GetString(2);

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

                return null;
            }
        }