Ejemplo n.º 1
0
 public Object GetPerson(int id)
 {
     Person p = new Person();
     p.Id = id;
     PersonDb logDb = new PersonDb();
     return logDb.GetPerson(p);
 }
Ejemplo n.º 2
0
        public Person Login(string UserName, string Password)
        {
            Person p = new Person();
            p.UserName = UserName;
            p.Password = Password;
            PersonDb logDb = new PersonDb();

            return logDb.Login(p);
        }
        public Person Login(string user, string password)
        {
            Person pers = new Person();
            pers.User = user;
            pers.Password = password;

            persDb = new PersonDb();

            return persDb.Login(pers);
        }
        private List<TutoringTime> MiscWhere(string where, Boolean retrieveAssociation)
        {
            List<TutoringTime> tts = new List<TutoringTime>();

            try
            {
                cmd = new SqlCommand();
                cmd.CommandText = BuildQuery(where);

                dbCon = new DbConnection();
                cmd.Connection = dbCon.GetConnection();
                cmd.Connection.Open();

                cmd.CommandType = CommandType.Text;
                SqlDataReader dr = cmd.ExecuteReader();

                TutoringTime tt = null;
                while (dr.Read())
                {
                    tt = BuildTutoringTime(dr);
                    if (retrieveAssociation)
                    {
                        PersonDb persDb = new PersonDb();
                        int pid = tt.Teacher.Id;
                        Person teacher = persDb.SingleWhere("pid = '" + pid + "'", false);
                        tt.Teacher = teacher;
                    }
                    tts.Add(tt);
                }
                dr.Close();
            }
            catch
            {
                throw;
            }
            return tts;
        }
        private List<Assignment> MiscWhere(string where, Boolean retrieveAssociation)
        {
            List<Assignment> asgs = new List<Assignment>();

            try
            {
                cmd = new SqlCommand();
                cmd.CommandText = BuildQuery(where);

                dbCon = new DbConnection();
                cmd.Connection = dbCon.GetConnection();
                cmd.Connection.Open();

                cmd.CommandType = CommandType.Text;
                SqlDataReader dr = cmd.ExecuteReader();

                Assignment asg = null;
                while (dr.Read())
                {
                    asg = BuildAssignment(dr);
                    if (retrieveAssociation)
                    {
                        PersonDb persDb = new PersonDb();
                        int pid = asg.Teacher.Id;
                        Person teacher = persDb.SingleWhere("pid = '" + pid + "'", false);
                        asg.Teacher = teacher;
                    }
                    asgs.Add(asg);
                }
                dr.Close();
            }
            catch
            {
                throw;
            }
            return asgs;
        }
        public List<Person> GetAllTeachersBySubject(string subject)
        {
            persDb = new PersonDb();

            return persDb.GetAllTeachersBySubject(subject);
        }
        public List<Person> GetAllTeachers()
        {
            persDb = new PersonDb();

            return persDb.GetAllTeachers();
        }
Ejemplo n.º 8
0
 public List<Teacher> GetAllTeachers()
 {
     PersonDb pDb = new PersonDb();
     return pDb.GetAllTeachers();
 }
        private List<Homework> MiscWhere(string where, Boolean retrieveAssociation)
        {
            List<Homework> hws = new List<Homework>();

            try
            {
                cmd = new SqlCommand();
                cmd.CommandText = BuildQuery(where);

                dbCon = new DbConnection();
                cmd.Connection = dbCon.GetConnection();
                cmd.Connection.Open();

                cmd.CommandType = CommandType.Text;
                SqlDataReader dr = cmd.ExecuteReader();

                Homework hw = null;
                while (dr.Read())
                {
                    hw = BuildHomework(dr);
                    if (retrieveAssociation)
                    {
                        PersonDb persDb = new PersonDb();
                        int childId = hw.Child.Id;
                        Person child = persDb.SingleWhere("pid = '" + childId + "'", false);
                        hw.Child = child;

                        AssignmentDb asgDb = new AssignmentDb();
                        int assignmentId = hw.Assignment.Id;
                        Assignment asg = asgDb.SingleWhere("aid = '" + assignmentId + "'", false);
                        hw.Assignment = asg;
                    }
                    hws.Add(hw);
                }
                dr.Close();
            }
            catch
            {
                throw;
            }
            return hws;
        }