private MenuBinding FetchMenu(MenuBinding MenuBinding, SafeDataReader dr) { MenuBinding.MainMenuID = dr.GetString("MainMenuID"); MenuBinding.MainMenuClass = dr.GetString("MainMenuClass"); MenuBinding.MainMenuName = dr.GetString("MainMenuName"); MenuBinding.SubMenuID = dr.GetString("SubMenuID"); MenuBinding.SubMenuName = dr.GetString("SubMenuName"); MenuBinding.URL = dr.GetString("URL"); return MenuBinding; }
/// <summary> /// Description : To Bind Menu Data /// Created By : Pavan /// Created Date : 15 September 2014 /// Modified By : /// Modified Date : /// <returns></returns> /// </summary> public static List<Menu> GetMenuDataForUser(int UserID) { var data = new List<Menu>(); System.Diagnostics.StackFrame stackFrame = new System.Diagnostics.StackFrame(); System.Reflection.MethodBase methodBase = stackFrame.GetMethod(); log.Debug("Start: " + methodBase.Name); try { MenuBindingInfo objMenu = new MenuBindingInfo(); SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@UserID", UserID); var reader = SqlHelper.ExecuteReader(ConnectionUtility.GetConnectionString(), CommandType.StoredProcedure, "SpBindMenu", sqlParams); var safe = new SafeDataReader(reader); while (reader.Read()) { var Menudata = new MenuBinding(); Menudata.FetchMenu(Menudata, safe); objMenu.MenuList.Add(Menudata); } FetchMenuToBind(objMenu, data); } catch (Exception ex) { log.Error("Error: " + ex); } finally { log.Debug("End: " + methodBase.Name); } return data; }