public ActionResult Index(long id) { POS_MENU objMenu = new POS_MENU(); try { TempData["UserId"] = id; if (Session[SessionVariables.Session_UserInfo] != null) { objMenu.MenuRightsList = mobjBALMenu.GetMenuRightsByUserId(id); objMenu.ReportRightsList = mobjBALMenu.GetReportRightsByUserId(id); return(View(objMenu)); } else { return(RedirectToAction("Login", "Home")); } } catch (Exception ex) { if (ex is BALException) { throw ex; } else { ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.UI, ExceptionType.Error); } throw new UIException("User Rights Info not completed in UI Layer"); } }
public ActionResult Create(POS_MENU menuModel) { try { if (Session[SessionVariables.Session_UserInfo] != null) { long id = (long)TempData["UserId"]; foreach (var item in menuModel.MenuRightsList) { if (item.INSERTION_FLAG == true || item.UPDATION_FLAG == true || item.DELETION_FLAG == true || item.SELECTION_FLAG == true) { item.CREATEDBY = SessionHandling.UserId.ToString(); item.CREATEDWHEN = DateTime.Now; } } foreach (var item in menuModel.ReportRightsList) { if (item.Selection == true) { item.CREATEDBY = SessionHandling.UserId.ToString();; item.CREATEDWHEN = DateTime.Now; } } mobjNotify = mobjBALMenu.UpdateRights(menuModel, id); if (mobjNotify.RowEffected > 0) { ShowAlert(AlertType.Success, mobjNotify.NotifyMessage); return(RedirectToAction("UserList")); } else { ShowAlert(AlertType.Error, mobjNotify.NotifyMessage); return(View(menuModel)); } } else { return(RedirectToAction("Login", "Home")); } } catch (Exception ex) { if (ex is BALException) { throw ex; } else { //ExceptionLogger.WriteExceptionInDB(ex, ExceptionLevel.UI, ExceptionType.Error); throw new UIException("User Rights Info not completed in UI Layer"); } } }
public POS_MENU GetChildMenuForUser(long userId) { POS_MENU objMenu = new POS_MENU(); try { objMenu.Menus = mobjDALMenu.GetParentMenu(); foreach (var item in objMenu.Menus) { item.ChildItems = mobjDALMenu.GetChildMenuForUser(item.ParentId, userId); } return(objMenu); } catch (Exception ex) { throw ex; } }
public Notify UpdateRights(POS_MENU menu, long id) { int isRowUpdated = 0; try { isRowUpdated = mobjDALMenu.UpdateRights(menu, id); mobjNotify.RowEffected = isRowUpdated; if (isRowUpdated > 0) { mobjNotify.NotifyMessage = "User rights updated successfully!"; } else { mobjNotify.NotifyMessage = "User rights not updated."; } } catch (Exception ex) { throw ex; } return(mobjNotify); }