public List <Menu> GetOprationMenu(Guid oprationId, int groupId, Guid?userId, bool?display = true) { try { var menus = new List <Menu>(); var list = new OperationMenuBO().GetOprationMenu(this.ConnectionHandler, oprationId, groupId); var childMenus = new MenuBO().ChildMenus(this.ConnectionHandler, list, userId, groupId, display); var menuBo = new MenuBO(); foreach (var menu in list) { menuBo.GetChildMenu(this.ConnectionHandler, menus, childMenus, menu, userId, display); } return(list); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public List <Menu> GetByOprationIdParentIsnull(Guid operationId) { try { var list = new OperationMenuBO().GetOprationMenu(this.ConnectionHandler, operationId); return(list.OrderBy(x => x.TitleWithParentTitle).ToList()); } catch (KnownException ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }
public bool AddMenu(Guid operationId, List <Guid> menuList) { try { this.ConnectionHandler.StartTransaction(IsolationLevel.ReadUncommitted); var operationMenuBO = new OperationMenuBO(); foreach (var guid in menuList) { var groupRole = operationMenuBO.Get(this.ConnectionHandler, operationId, guid); if (groupRole == null) { var operationMenu = new OperationMenu { OperationId = operationId, MenuId = guid }; if (!operationMenuBO.Insert(this.ConnectionHandler, operationMenu)) { throw new Exception("خطایی در ذخیره منوی عملیات وجود دارد"); } } } this.ConnectionHandler.CommitTransaction(); return(true); } catch (KnownException ex) { this.ConnectionHandler.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } catch (Exception ex) { this.ConnectionHandler.RollBack(); Log.Save(ex.Message, LogType.ApplicationError, ex.Source, ex.StackTrace); throw new KnownException(ex.Message, ex); } }