Exemplo n.º 1
0
        public List <personal_kidModel> tb_kid_person(string person)
        {
            List <personal_kidModel> obj = new List <personal_kidModel>();

            using (SqlConnection conn = new SqlConnection(db.sqlConnection))
            {
                conn.Open();

                int           i   = 0;
                SqlCommand    cmd = new SqlCommand("SELECT * FROM tab_personal_kid WHERE kid_ref_personal_id = '" + person + "'", conn);
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    personal_kidModel kid = new personal_kidModel();;
                    kid.kid_id           = rdr["kid_id"].ToString();
                    kid.kid_name         = rdr["kid_name"].ToString();
                    kid.kid_lastname     = rdr["kid_lastname"].ToString();
                    kid.kid_age          = rdr["kid_age"].ToString();
                    kid.kid_study_status = rdr["kid_study_status"].ToString();
                    kid.kid_study_level  = rdr["kid_study_level"].ToString();
                    kid.kid_study_school = rdr["kid_study_school"].ToString();
                    if (rdr["kid_study_status"].ToString() == "yes")
                    {
                        kid.kid_check_yes = "checked";
                        kid.kid_check_not = "";
                    }
                    else if (rdr["kid_study_status"].ToString() == "not")
                    {
                        kid.kid_check_yes = "";
                        kid.kid_check_not = "checked";
                    }

                    obj.Add(kid);
                    i++;
                }

                conn.Close();
            }

            return(obj);
        }
Exemplo n.º 2
0
        public List <personal_kidModel> tb_kid(string id)
        {
            List <personal_kidModel> obj = new List <personal_kidModel>();

            using (SqlConnection conn = new SqlConnection(db.sqlConnection)) {
                conn.Open();

                SqlCommand    cmd = new SqlCommand("SELECT * FROM tab_personal_kid INNER JOIN tab_emp ON tab_emp.ep_ref_personal_id = tab_personal_kid.kid_ref_personal_id WHERE tab_emp.ep_id = '" + id + "'", conn);
                SqlDataReader rdr = cmd.ExecuteReader();

                while (rdr.Read())
                {
                    personal_kidModel kid = new personal_kidModel();;

                    kid.kid_name     = rdr["kid_name"].ToString();
                    kid.kid_lastname = rdr["kid_lastname"].ToString();
                    kid.kid_age      = rdr["kid_age"].ToString();
                    if (rdr["kid_study_status"].ToString() == "yes")
                    {
                        kid.kid_study_status = "กำลังศึกษา";
                        kid.kid_study_level  = rdr["kid_study_level"].ToString();
                        kid.kid_study_school = rdr["kid_study_school"].ToString();
                    }
                    else
                    {
                        kid.kid_study_status = "-";
                        kid.kid_study_level  = "-";
                        kid.kid_study_school = "-";
                    }


                    obj.Add(kid);
                }

                conn.Close();
            }

            return(obj);
        }