Beispiel #1
0
        public GetDetailOutput GetDetail(GetDetailInput input)
        {
            var query = _productRepository
                        .GetAllIncluding()
                        .Where(e => e.Id == input.Id);

            var product = query.FirstOrDefault();

            if (product == null)
            {
                throw new UserFriendlyException("产品不存在");
            }
            return(product.MapTo <GetDetailOutput>());
        }
Beispiel #2
0
        public GetDetailOutput GetDetail(GetDetailInput input)
        {
            var query = _customnerRepository
                        .GetAllIncluding()
                        .Where(e => e.Id == input.Id);

            var customer = query.FirstOrDefault();

            if (customer == null)
            {
                throw new UserFriendlyException("客户不存在");
            }
            return(customer.MapTo <GetDetailOutput>());
        }
        /// <summary>
        /// 获取详情信息
        /// </summary>
        /// <param name="input"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public DetailDto GetDetail(GetDetailInput input, RTDbContext db)
        {
            var result = new DetailDto();
            var detail = db.Details.FirstOrDefault(p => p.ModularType == _modularType && p.Classify == input.Classify && p.ProjectId == input.ProjectId);

            if (detail == null)
            {
                return(null);
            }
            result.ImgUrl = detail.ImgUrl;
            var paragraphs = db.DetailParagraphs.Where(p => p.DetailId == detail.Id).OrderBy(p => p.ParagraphIndex).Select(p => p.ParagraphContent);

            if (paragraphs != null && paragraphs.Count() != 0)
            {
                result.Paragraphs = paragraphs.ToList();
            }
            return(result);
        }
        /// <summary>
        /// 删除详情
        /// </summary>
        /// <param name="input"></param>
        /// <param name="db"></param>
        public void Delete(GetDetailInput input, RTDbContext db)
        {
            var detail = db.Details.FirstOrDefault(p => p.ModularType == _modularType && p.Classify == input.Classify && p.ProjectId == input.ProjectId);

            if (detail == null)
            {
                throw new RTException("所选数据不存在");
            }
            var list = db.DetailParagraphs.Where(p => p.DetailId == detail.Id).ToList();

            if (list != null && list.Count() != 0)
            {
                for (int i = 0; i < list.Count; i++)
                {
                    db.DetailParagraphs.Remove(list[i]);
                }
            }
            db.Details.Remove(detail);
            //删除多余的段落
            DeleteSurplusParagraphs(db);
        }
Beispiel #5
0
        /// <summary>
        /// 取得工单详细
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        public GetDetailOutput GetDetail(GetDetailInput input)
        {
            //有管理全部工单的权限,能查看所有工单,否则只能查看分配给自己的工单

            var query = _workOrderRepository
                        .GetAllIncluding()
                        .Where(e => e.Id == input.Id);

            //if (!PermissionChecker.IsGranted("WorkOrder.ManageAllWorkOrder"))
            //{
            //    query.Where(e => e.AssignedPersonId == AbpSession.UserId);
            //}

            var workOrder = query.FirstOrDefault();

            if (workOrder == null)
            {
                throw new UserFriendlyException("工单不存在");
            }
            return(workOrder.MapTo <GetDetailOutput>());
        }