internal IEnumerable <Gender> PopulateDataGrid() { string query = ""; query = " Select GenderID,GenderName from Gender "; var dt = con.GetDataThroughDataTable(query, null); return(from DataRow row in dt.Rows select Gender.ConvertToGender(row)); }
public Gender GetInfoByID(int id) { string query = ""; List <SqlParameter> param = new List <SqlParameter> { new SqlParameter("@GenderID", id) }; query = " Select GenderID,GenderName from Gender where GenderID=@GenderID"; var dt = con.GetDataThroughDataTable(query, param); return(Gender.ConvertToGender(dt.Rows[0])); }
public IEnumerable <Gender> GetAllGenders() { try { con.Open(); string query = " Select GenderID,RTrim(LTrim(GenderID))+'-'+GenderName GenderName from Gender "; var dt = con.GetDataThroughDataTable(query, null); return(from DataRow row in dt.Rows select Gender.ConvertToGender(row)); } catch (Exception ex) { return(null); } finally { con.Close(); } }