public List<ScreenBO> LoadGrantedScreensByRoleID(int roleId) { DBEgine dbEgine = new DBEgine(); List<ScreenBO> screenList = new List<ScreenBO>(); try { dbEgine.DBOpen(); SqlParameter[] parms = new SqlParameter[1]; SqlParameter p1 = new SqlParameter(); p1.ParameterName = "@RoleId"; p1.SqlDbType = SqlDbType.Int; p1.Direction = ParameterDirection.Input; p1.Value = roleId; parms[0] = p1; SqlDataReader drScreenList = dbEgine.ExecuteReader("UserManagement.UM_LoadGrantedScreensByRoleID", parms); while (drScreenList.Read()) { ScreenBO objscreen = new ScreenBO(); objscreen.ScreenId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenId")); objscreen.ScreenName = drScreenList.GetValue(drScreenList.GetOrdinal("Screen")).ToString(); objscreen.Url = drScreenList.GetValue(drScreenList.GetOrdinal("URL")).ToString(); objscreen.ScreenParentId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenParentId")); objscreen.IsMenu = drScreenList.GetBoolean(drScreenList.GetOrdinal("IsMenu")); objscreen.IsEnable = drScreenList.GetBoolean(drScreenList.GetOrdinal("IsEnable")); objscreen.ScreenOrderId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenOrderId")); List<ScreenFunctionsBO> listScreenFuntions = new ScreenFunctionsDAL().LoadScreenFunctions(objscreen.ScreenId, roleId); objscreen.ScreenFunctions = new List<ScreenFunctionsBO>(); if (listScreenFuntions != null && listScreenFuntions.Count > 0) { objscreen.ScreenFunctions = listScreenFuntions; } screenList.Add(objscreen); } dbEgine.DBClose(); return screenList; } catch { throw; } finally { dbEgine.DBClose(); } }
public List<ScreenBO> LoadScreensbyUserName(string userName) { DBEgine dbEgine = new DBEgine(); List<ScreenBO> screenList = new List<ScreenBO>(); try { dbEgine.DBOpen(); SqlParameter[] parms = null; SqlDataReader drScreenList = dbEgine.ExecuteReader("UserManagement.UM_LoadScreens", parms); while (drScreenList.Read()) { ScreenBO objscreen = new ScreenBO(); objscreen.ScreenId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenId")); objscreen.ScreenName = drScreenList.GetValue(drScreenList.GetOrdinal("Screen")).ToString(); objscreen.Url = drScreenList.GetValue(drScreenList.GetOrdinal("URL")).ToString(); objscreen.ScreenParentId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenParentId")); objscreen.IsMenu = drScreenList.GetBoolean(drScreenList.GetOrdinal("IsMenu")); objscreen.ShowOnMenu = drScreenList.GetBoolean(drScreenList.GetOrdinal("ShowOnMenu")); objscreen.IsEnable = drScreenList.GetBoolean(drScreenList.GetOrdinal("IsEnable")); objscreen.ScreenOrderId = drScreenList.GetInt32(drScreenList.GetOrdinal("ScreenOrderId")); List<ScreenFunctionsBO> listScreenFuntions = new ScreenFunctionsDAL().LoadGrantedScreenFunctionsbyScreenIDandUserName(objscreen.ScreenId, userName); objscreen.ScreenFunctions = new List<ScreenFunctionsBO>(); if (listScreenFuntions != null && listScreenFuntions.Count > 0) { objscreen.ScreenFunctions = listScreenFuntions; } screenList.Add(objscreen); } dbEgine.DBClose(); return screenList; } catch { throw; } finally { dbEgine.DBClose(); } }