public List <uspCheckGuest> checkguest(string guest) { List <uspCheckGuest> list = new List <uspCheckGuest>(); SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@guest", guest) }; using (DataTable dt = DBHelper.ParamSelect("uspCheckGuest", CommandType.StoredProcedure, pars)) { if (dt.Rows.Count > 0) { foreach (DataRow row in dt.Rows) { uspCheckGuest g = new uspCheckGuest { PersonnelID = Convert.ToString(row["PersonnelID"]) }; list.Add(g); } } else { list = null; } } return(list); }
// Get Guest public uspCheckGuest CheckGuest(string guest) { uspCheckGuest cg = null; SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@guest", guest) }; using (DataTable table = DBHelper.ParamSelect("uspCheckGuest", CommandType.StoredProcedure, pars)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; cg = new uspCheckGuest { PersonnelID = Convert.ToString(row["PersonnelID"]) }; } } return(cg); }