Ejemplo n.º 1
0
        public async Task <ActionResult <BaseResponse> > AddTypeOverviewAsync(int typeId, [FromBody] TypeOverViewAddDto req)
        {
            string Account = User.Claims.FirstOrDefault(a => a.Type == "Account").Value;

            #region 检测类型
            var type = await _ts.CheckTypeAsync(typeId);

            if (!type.IsExist)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的类型编号不存在"
                });
            }
            if (type.Status == 0)
            {
                return(new BaseResponse {
                    Success = false, Message = "该类型为目录型节点,不允许添加数据"
                });
            }
            #endregion
            #region 检测数据定义标示是否存在
            var td = await _td.IsExist(a => a.Id == req.TypeDataDefineId);

            if (!td)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的类型数据定义不存在"
                });
            }
            #endregion
            var rm = await _tos.AddTypeOverviewAsync(Account, typeId, req);

            return(rm);
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <BaseResponse> > AddAsync(int accessoryId, TypeControlDataAddDto req)
        {
            //string user = User.Identity.Name;
            //if (string.IsNullOrWhiteSpace(user))
            //{
            //    return Unauthorized("用户凭证缺失");
            //}
            //UserMessage um = JsonConvert.DeserializeObject<UserMessage>(user);
            //string GroupId;
            //var ret = _tas.IsExist(a => a.Id == accessoryId, out GroupId);
            //if (!ret)
            //{
            //    return new BaseResponse { Success = false, Message = "输入的类型配件不存在" };
            //}
            //if (!(um.IsAdmin && (um.GroupId == GroupId || um.Code == _config["Group"])))
            //{
            //    return Unauthorized("用户没有权限");
            //}
            //验证数据定义标示是否存在
            var data = await _tds.IsExist(a => a.Id == req.DataDefineId);

            if (!data)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的数据定义标示不存在"
                });
            }
            //验证关联的数据定义是否存在
            if (req.AssociateDefineId != 0)
            {
                data = await _tds.IsExist(a => a.Id == req.AssociateDefineId);

                if (!data)
                {
                    return(new BaseResponse {
                        Success = false, Message = "输入的关联数据定义标示不存在"
                    });
                }
            }
            string Account = User.Claims.FirstOrDefault(a => a.Type == "Account").Value;
            var    rm      = await _tacs.AddAccessoryControlData(accessoryId, req, Account);

            return(rm);
        }
Ejemplo n.º 3
0
        public async Task <ActionResult <BaseResponse> > AddTypeModuleFeedbackAsync(int typeId, TypeModuleFeedbackAddDto req)
        {
            string Account = User.Claims.FirstOrDefault(a => a.Type == "Account").Value;

            #region 检测类型
            var type = await _ts.CheckTypeAsync(typeId);

            if (!type.IsExist)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的类型编号不存在"
                });
            }
            if (type.Status == 0)
            {
                return(new BaseResponse {
                    Success = false, Message = "该类型为目录型节点,不允许添加数据"
                });
            }
            #endregion
            #region 检测数据定义标示是否存在
            var td = await _td.IsExist(a => a.Id == req.DataDefineId);

            if (!td)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的类型数据定义不存在"
                });
            }
            #endregion
            #region 检测相关的控制项是否存在
            var exist = await _tmcs.IsExist(a => a.Id == req.ModuleControlId);

            if (!exist)
            {
                return(new BaseResponse {
                    Success = false, Message = "输入的控制项不存在"
                });
            }
            #endregion
            var rm = await _tfs.AddTypeModuleFeedbaskAsync(Account, req);

            return(rm);
        }