public List <POS_MENU> GetChildMenuForAdmin(long parentMenuId) { List <POS_MENU> lstChildMenu = new List <POS_MENU>(); try { var result = (from u in _objEntityModel.POS_MENU where u.MASTER_MENU_ID == parentMenuId select new { Controller = u.CONTROLLER, Actions = u.ACTION, FormName = u.FORM_NAME }).AsEnumerable().ToList(); foreach (var item in result) { POS_MENU objMenu = new POS_MENU(); objMenu.CONTROLLER = item.Controller; objMenu.ACTION = item.Actions; objMenu.FORM_NAME = item.FormName; lstChildMenu.Add(objMenu); } return(lstChildMenu); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new UIException("User Rights Info not completed in Data Layer"); } }
public List <POS_MENU> GetChildMenuForUser(long parentMenuId, long userId) { List <POS_MENU> lstChildMenu = new List <POS_MENU>(); try { var result = (from u in _objEntityModel.POS_MENU join j in _objEntityModel.POS_MENU_RIGHTS on u.MENU_ID equals j.MENU_ID where j.USER_ID == userId && u.MASTER_MENU_ID == parentMenuId select new { Controller = u.CONTROLLER, Actions = u.ACTION, FormName = u.FORM_NAME, MenuRightsId = j.MENU_RIGHTS_ID, UserId = j.USER_ID, MenuId = j.MENU_ID, Insertion = j.INSERTION_FLAG, Updation = j.UPDATION_FLAG, Deletion = j.DELETION_FLAG, Selection = j.SELECTION_FLAG, }).AsEnumerable().ToList(); foreach (var item in result) { POS_MENU objMenu = new POS_MENU(); objMenu.CONTROLLER = item.Controller; objMenu.ACTION = item.Actions; objMenu.FORM_NAME = item.FormName; objMenu.MenuRights.MENU_RIGHTS_ID = item.MenuRightsId; objMenu.MenuRights.USER_ID = item.UserId; objMenu.MenuRights.MENU_ID = item.MenuId; objMenu.MenuRights.INSERTION_FLAG = item.Insertion; objMenu.MenuRights.UPDATION_FLAG = item.Updation; objMenu.MenuRights.DELETION_FLAG = item.Deletion; objMenu.MenuRights.SELECTION_FLAG = item.Selection; lstChildMenu.Add(objMenu); } return(lstChildMenu); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new UIException("User Rights Info not completed in Data Layer"); } }
public int UpdateRights(POS_MENU menu, long id) { int isRowUpdated = 0; try { DeleteMenuRightsByUserId(id); isRowUpdated = UpdateMenuRights(menu.MenuRightsList, id); DeleteReportRightsByUserId(id); isRowUpdated = UpdateReportRights(menu.ReportRightsList, id); } catch (Exception ex) { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.DAL, ExceptionType.Error); throw new UIException("User Rights Info not completed in Data Layer"); } return(isRowUpdated); }