Exemplo n.º 1
0
        /// <summary>
        /// 新增队列员工
        /// </summary>
        public bool AddQueueResource(sys_resource_department resDep, long userId, ref string faileReason)
        {
            sys_resource_department_dal srdDal = new sys_resource_department_dal();

            if (!CheckResourceRole(resDep))
            {
                faileReason = "已存在该员工角色"; return(false);
            }
            if (resDep.is_lead == 1) // && resDep.is_active==1
            {
                ClearLeadResource(resDep.department_id, userId);
            }
            resDep.id = srdDal.GetNextIdCom();
            srdDal.Insert(resDep);
            OperLogBLL.OperLogAdd <sys_resource_department>(resDep, resDep.id, userId, OPER_LOG_OBJ_CATE.SYS_RESOURCE_DEPARTMENT, "");
            return(true);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 新增员工部门
        /// </summary>
        /// <param name="resDpt"></param>
        /// <param name="type">1:部门;2:队列</param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public bool AddDepartment(sys_resource_department resDpt, int type, long userId)
        {
            sys_resource_department_dal dptDal = new sys_resource_department_dal();

            if (resDpt.is_default == 1)     // 新增默认部门,查找是否已有默认,有则更改为非默认
            {
                string sql = $"select * from sys_resource_department where resource_id={resDpt.resource_id} and is_default=1 and department_id in(select id from sys_department where cate_id={(int)DTO.DicEnum.DEPARTMENT_CATE.DEPARTMENT} and is_active =1 and delete_time = 0)";
                if (type == 2)
                {
                    sql = $"select * from sys_resource_department where resource_id={resDpt.resource_id} and is_default=1 and department_id in(select id from sys_department where cate_id={(int)DTO.DicEnum.DEPARTMENT_CATE.SERVICE_QUEUE} and is_active =1 and delete_time = 0)";
                }
                var dft = dptDal.FindSignleBySql <sys_resource_department>(sql);
                if (dft != null)
                {
                    dft.is_default = 0;
                    dptDal.Update(dft);
                }
            }
            resDpt.id = dptDal.GetNextIdCom();
            dptDal.Insert(resDpt);

            return(true);
        }