コード例 #1
0
ファイル: AppDAO.cs プロジェクト: QuocDungKHTN2010/appfuny
        public List<Teacher> getAllTeacher()
        {
            List<Teacher> listTeacher = new List<Teacher>();
            string strSql = "SELECT * FROM Teacher";
            DataTable dt = DataProviderApp.executeQuery(strSql);
            int n = dt.Rows.Count;
            if (n > 0)
            {
                for (int i = 0; i < n; i++)
                {
                    Teacher Cus = new Teacher();
                    Cus.TeacherId = Convert.ToInt32(dt.Rows[i]["TeacherId"].ToString());
                    Cus.Email = dt.Rows[i]["Email"].ToString();
                    Cus.Username = dt.Rows[i]["Username"].ToString();
                    Cus.Password = dt.Rows[i]["Password"].ToString();
                    Cus.PhoneNumber = dt.Rows[i]["PhoneNumber"].ToString();
                    Cus.FullName = dt.Rows[i]["FullName"].ToString();
                    Cus.Status = dt.Rows[i]["Status"].ToString();
                    Cus.CMND = dt.Rows[i]["CMND"].ToString();
                    Cus.ImagePath = dt.Rows[i]["ImagePath"].ToString();
                    Cus.Address = dt.Rows[i]["Address"].ToString();
                    Cus.TypeId = Convert.ToInt32(dt.Rows[i]["TypeId"].ToString());
                    listTeacher.Add(Cus);
                }
            }

            return listTeacher;
        }
コード例 #2
0
ファイル: AppDAO.cs プロジェクト: QuocDungKHTN2010/appfuny
 //checkLogin
 public Teacher checkLoginTeacher(string Username, string Password)
 {
     Teacher Cus = new Teacher();
     string strSql = "SELECT * FROM Teacher Where Username='******' and Password='******'";
     DataTable dt = DataProviderApp.executeQuery(strSql);
     int n = dt.Rows.Count;
     if (n > 0)
     {
         Cus.TeacherId = Convert.ToInt32(dt.Rows[0]["TeacherId"].ToString());
         Cus.Email = dt.Rows[0]["Email"].ToString();
         Cus.Username = dt.Rows[0]["Username"].ToString();
         Cus.Password = dt.Rows[0]["Password"].ToString();
         Cus.PhoneNumber = dt.Rows[0]["PhoneNumber"].ToString();
         Cus.FullName = dt.Rows[0]["FullName"].ToString();
         Cus.Status = dt.Rows[0]["Status"].ToString();
         Cus.CMND = dt.Rows[0]["CMND"].ToString();
         Cus.ImagePath = dt.Rows[0]["ImagePath"].ToString();
         Cus.Address = dt.Rows[0]["Address"].ToString();
         Cus.TypeId = Convert.ToInt32(dt.Rows[0]["TypeId"].ToString());
     }
     else
     {
         Cus = null;
     }
     return Cus;
 }
コード例 #3
0
ファイル: AppDAO.cs プロジェクト: QuocDungKHTN2010/appfuny
 public bool updateClassAndTeacher(int classId,int teacherId)
 {
     Teacher Cus = new Teacher();
     string strSql = "SELECT * FROM Class_Student_Mapping Where ClassId=" + classId;
     DataTable dt = DataProviderApp.executeQuery(strSql);
     int n = dt.Rows.Count;
     List<bool> listB = new List<bool>();
     if (n > 0)
     {
         for (int i = 0; i < n; i++)
         {
             int tempId = Convert.ToInt32(dt.Rows[i]["StudentId"].ToString());
             if (insertClassTeacherMapping(teacherId, tempId))
                 listB.Add(true);
             else
                 listB.Add(false);
         }
         if (listB.Count == n)
             return true;
         else
             return false;
     }
     else
     {
         return false;
     }
 }