Esempio n. 1
0
        public static List <PhongMay> ShowPhongMay()
        {
            OpenConnection();
            SqlCommand cmd = new SqlCommand();

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "LoadPM";
            cmd.Connection  = conn;

            SqlDataReader   reader = cmd.ExecuteReader();
            List <PhongMay> dsPM   = new List <PhongMay>();

            while (reader.Read())            // điều kiện đọc
            {
                string mapm    = reader.GetString(0);
                string tenpm   = reader.GetString(1);
                int    soluong = reader.GetInt32(2);

                PhongMay pm = new PhongMay(mapm, tenpm, soluong);

                dsPM.Add(pm);
            }
            reader.Close();
            return(dsPM);
        }
 //Hàm xử chức năng cập nhật phòng máy.
 public int CapNhat(PhongMay phong)
 {
     return(phongData.CapNhat(phong));
 }
 //Hàm xử chức năng thêm mới phòng máy.
 public int Them(PhongMay phong)
 {
     return(phongData.Them(phong));
 }