Exemplo n.º 1
0
        /// <summary>
        /// 导入数据
        /// </summary>
        /// <param name="list"></param>
        /// <returns></returns>
        public string ImportProCateData(List <AdminEntity> list)
        {
            string msg = "";

            try
            {
                foreach (var entity in list)
                {
                    entity.IncludeAll();
                    entity.UserCode   = SequenceProvider.GetSequence(typeof(AdminEntity));
                    entity.PassWord   = "******";
                    entity.IsDelete   = (int)EIsDelete.NotDelete;
                    entity.CreateTime = DateTime.Now;
                    entity.UpdateTime = DateTime.Now;
                    entity.ParentCode = string.Empty;
                    entity.RoleNum    = string.Empty;
                }
                this.Admin.Add(list);
            }
            catch (Exception ex)
            {
                msg = ex.Message;
            }

            return(msg);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增菜单项或者操作项
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int AddResource(SysResourceEntity entity)
        {
            entity.ThrowIfNull("添加资源信息对象为空");
            //父类的处理
            if (!entity.ParentNum.IsEmpty())
            {
                SysResourceEntity parentRes = GetResource(entity.ParentNum);
                if (parentRes.IsNotNull())
                {
                    parentRes.ChildCount++;
                    entity.Depth = parentRes.Depth + 1;
                    parentRes.IncludeChildCount(true)
                    .Where <SysResourceEntity>("ResNum", ECondition.Eth);
                    this.SysResource.Update(parentRes);
                }
            }
            entity.ResNum = entity.ResNum.IsNullOrEmpty() ? SequenceProvider.GetSequence(typeof(SysResourceEntity)) : entity.ResNum;
            entity.IncludeAll();
            int line = this.SysResource.Add(entity);

            if (line > 0)
            {
                CacheHelper.Remove(CacheKey.JOOSHOW_SYSRESOURCE_CACHE);
            }
            return(line);
        }