Example #1
0
        /// <summary>
        /// 新增员工和地域之间的关联记录
        /// </summary>
        /// <param name="cat"></param>
        /// <param name="user_id"></param>
        /// <returns></returns>
        public ERROR_CODE Insert(sys_resource_territory cat, long user_id)
        {
            cat.id = (int)_dal.GetNextIdCom();
            //不得插入重复数据
            var kk = new sys_resource_territory_dal().FindSignleBySql <sys_resource_territory>($"select * from sys_resource_territory where territory_id={cat.territory_id} and resource_id={cat.resource_id} and delete_time=0");

            if (kk != null)
            {
                return(ERROR_CODE.EXIST);
            }
            new sys_resource_territory_dal().Insert(cat);
            return(ERROR_CODE.SUCCESS);
        }
Example #2
0
        /// <summary>
        /// 新增知识库目录
        /// </summary>
        public bool AddKnowMenu(string name, int parentId, long userId, ref string failReason)
        {
            if (string.IsNullOrEmpty(name))
            {
                failReason = "为获取到相关名称";
                return(false);
            }
            var dgDal    = new d_general_dal();
            var isCanAdd = true;
            var subList  = dgDal.GetGeneralByParentId(parentId);

            if (subList != null && subList.Count > 0)
            {
                if (subList.Any(_ => name.Equals(_.name)))
                {
                    isCanAdd = false;
                }
            }
            if (!isCanAdd)
            {
                failReason = "同一级目录,名称不能相同!";
                return(false);
            }
            var timeNow  = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            var thisCate = new d_general()
            {
                id = (int)dgDal.GetNextIdCom(),
                general_table_id = (int)DTO.GeneralTableEnum.KNOWLEDGE_BASE_CATE,
                create_time      = timeNow,
                update_time      = timeNow,
                create_user_id   = userId,
                update_user_id   = userId,
                name             = name,
                parent_id        = parentId,
            };

            dgDal.Insert(thisCate);
            OperLogBLL.OperLogAdd <d_general>(thisCate, thisCate.id, userId, OPER_LOG_OBJ_CATE.General_Code, "新增知识库目录");
            return(true);
        }