Exemplo n.º 1
0
        /// <summary>
        /// 保存角色跟菜单项的关系
        /// </summary>
        /// <param name="RoleInfoId"></param>
        /// <param name="insertItem"></param>
        /// <returns></returns>
        public bool SaveRoleMenuRelationship(string RoleInfoId, List <RoleMenuRelationship> insertItem)
        {
            BaseBusinessObject _BaseBusinessObject = new BaseBusinessObject();

            List <RoleMenuRelationship> itemDel = _BaseBusinessObject.GetEntityByField <RoleMenuRelationship>("RoleInfoId", RoleInfoId);


            bool rel = BaseEntityFac.TransactionOPEntitys <RoleMenuRelationship>((cn, transaction) =>
            {
                bool result = false;

                result = BaseEntityFac.TransactionOPEntitysAdd <RoleMenuRelationship>(cn, transaction, EOPType.Delete, itemDel);
                result = BaseEntityFac.TransactionOPEntitysAdd <RoleMenuRelationship>(cn, transaction, EOPType.Insert, insertItem);


                return(result);
            }

                                                                                 );

            return(rel);
        }
Exemplo n.º 2
0
        public List <MenuInfo> UpdateLanguageMenus(List <MenuInfo> itemList, string languageCode)
        {
            if (itemList == null)
            {
                return(itemList);
            }
            BaseBusinessObject bbo = new BaseBusinessObject();

            foreach (var item in itemList)
            {
                List <MenuInfoLanguage> itemLanguage = bbo.GetEntityByField <MenuInfoLanguage>("MenuInfoId", item.MenuInfoId);
                if (itemLanguage != null && itemLanguage.Count > 0)
                {
                    MenuInfoLanguage mil = itemLanguage.Find(x => x.LanguageCode == languageCode);
                    if (mil != null)
                    {
                        item.MenuName = mil.MenuName;//多国语言
                    }
                }
            }

            return(itemList);
        }