private void loadThongTinTaiKhoanMay(string maMay) { TaiKhoanMay thongTin = DAO.DAOTaiKhoanMay.ThongTinTaiKhoanMay(maMay, DateTime.Now); if (thongTin.ThoiGianSuDung > 0) { lbTaiKhoan.Text = thongTin.MaKH; lbGioVao.Text = Convert.ToString(thongTin.GioVao); lbThoiGianSuDung.Text = Convert.ToInt32(thongTin.ThoiGianSuDung) / 60 + " giờ" + thongTin.ThoiGianSuDung % 60 + " phút"; } else { lbTaiKhoan.Text = "Chưa sử dụng"; lbGioVao.Text = ""; lbThoiGianSuDung.Text = Convert.ToString(0); } }
public static TaiKhoanMay ThongTinTaiKhoanMay(string MaMay, DateTime thoiGian) { TaiKhoanMay temp = new TaiKhoanMay(); SqlCommand cmd = new SqlCommand("ThongTin_TaiKhoanMay_HoatDong"); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@idMay", MaMay); cmd.Parameters.AddWithValue("@thoigian", thoiGian); DataTable dt = new DataTable(); dt = SQLDB.SQLDB.GetData(cmd); if (dt.Rows.Count > 0) { foreach (DataRow item in dt.Rows) { temp = new TaiKhoanMay(item); } } return(temp); }