Esempio n. 1
0
        public StudentList GetStudentsById(Guid Id)
        {
            Database  database = new Database("DB_109645_projectfinal");
            DataTable dt       = new DataTable();

            database.Command.CommandType = CommandType.StoredProcedure;
            database.Command.CommandText = "tblStudentGetById";
            database.Command.Parameters.Add("@Id", SqlDbType.UniqueIdentifier).Value = Id;
            dt = database.ExecuteQuery();
            foreach (DataRow dr in dt.Rows)
            {
                Student student = new Student();
                student.Initialize(dr);
                student.InitializeBusinessData(dr);
                _List.Add(student);
            }
            return(this);
        }
Esempio n. 2
0
        public StudentList Search()
        {
            StudentDB database = new StudentDB("Student");

            database.Command.Parameters.Clear();
            database.Command.CommandType = System.Data.CommandType.Text;
            _Criteria.TableName          = "tblStudent";
            database.Command.CommandText = SQLHelper.Builder.Build(_Criteria);
            DataTable dt = database.ExecuteQuery();

            foreach (DataRow dr in dt.Rows)
            {
                Student student = new Student();
                student.Initialize(dr);
                student.InitializeBusinessData(dr);
                student.isNew   = false;
                student.isDirty = false;
                _List.Add(student);
            }
            return(this);
        }
Esempio n. 3
0
        public StudentList GetAll()
        {
            Database database = new Database("DB_109645_projectfinal");

            database.Command.Parameters.Clear();
            database.Command.CommandType = CommandType.StoredProcedure;
            database.Command.CommandText = "tblStudentGetAll";

            DataTable dt = database.ExecuteQuery();

            foreach (DataRow dr in dt.Rows)
            {
                Student student = new Student();
                student.Initialize(dr);
                student.InitializeBusinessData(dr);
                student.IsNew    = false;
                student.IsDirty  = false;
                student.Savable += Student_Savable;
                _List.Add(student);
            }

            return(this);
        }