private ManuInterfaces CreateObjects(IDataReader oReader) { ManuInterfaces oManuInterfaces = new ManuInterfaces(); NullHandler oHandler = new NullHandler(oReader); while (oReader.Read()) { ManuInterface oItem = CreateObject(oHandler); oManuInterfaces.Add(oItem); } return(oManuInterfaces); }
public ManuInterfaces Gets(int nUserID) { ManuInterfaces oManuInterfaces = null; try { string QueryString = "SELECT Menu_Table.*,(SELECT CAST(CASE WHEN UPT.MenuID = Menu_Table.Menu_id and user_id=" + nUserID + " THEN 1 ELSE 0 END AS bit)) as IsCheck FROM Menu_Table Left Outer Join Menu_Permission_Table AS UPT ON Menu_Table.Menu_id=UPT.MenuID and UPT.user_id=" + nUserID + " ORDER BY Menu_id"; IDataReader reader = null; reader = ExecuteQueryFunctions.ExeReader(_conn, QueryString); oManuInterfaces = CreateObjects(reader); reader.Close(); _conn.Close(); } catch (Exception e) { throw new ServiceException(e.Message); } return(oManuInterfaces); }