Esempio n. 1
0
        public Core.Business.StudentPass GetPassByStdID(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();
            string sqlwhere = "SELECT [ID], [StuID],[Pass] from [StudentPass] where StuID="+id+"";
            SqlDataReader reader = sql.ExecuteSqlReader(sqlwhere);

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

                if (!reader.IsDBNull(0)) studentPass.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) studentPass.StuID = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) studentPass.Pass = reader.GetString(2);

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

                return null;
            }
        }
Esempio n. 2
0
        public IList<Core.Business.StudentPass> GetAllStudentPass()
        {
            IList<Core.Business.StudentPass> studentPasslist = new List<Core.Business.StudentPass>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllStudentPass);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.StudentPass studentPass = new Core.Business.StudentPass();

                    if (!reader.IsDBNull(0)) studentPass.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) studentPass.StuID = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) studentPass.Pass = reader.GetString(2);

                    studentPass.MarkOld();
                    studentPasslist.Add(studentPass);
                }
                reader.Close();
            }
            return studentPasslist;
        }
Esempio n. 3
0
        public Core.Business.StudentPass Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

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

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

                if (!reader.IsDBNull(0)) studentPass.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) studentPass.StuID = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) studentPass.Pass = reader.GetString(2);

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

                return null;
            }
        }