public IActionResult Index()
        {
            var scale = new Scale(_lookupAppService);
            var photoTrackingLKDId   = (_lookupAppService.GetAllLookDetail(null, LookUpDetailConst.PhotoTracking)).Result.Items.FirstOrDefault().Id;
            var businessDocumentList = (_documentAppService.GetAllBusinessDocuments(null, photoTrackingLKDId, null)).Result.Items.ToList();
            var heightInCm           = _lookupAppService.GetAllLookDetail(null, LookUpDetailConst.Cm).Result.Items.First().Id;
            var model = new ProfileVModel
            {
                LoginInformations  = _sessionAppService.GetCurrentLoginInformations().Result,
                UserTrackingFilter = new UserTrackingFilter()
                {
                    MeasurementScale = scale, MeasurementScaleLKDId = heightInCm
                },
                PhotoTrackingBusinessDocumentList = businessDocumentList
            };
            //Set UserId
            string userEnycId = HttpContext.Request.Query["id"].ToString();

            if (!string.IsNullOrEmpty(userEnycId))
            {
                model.UserTrackingFilter.UserIdEnyc = userEnycId;
            }
            else
            {
                model.UserTrackingFilter.UserIdEnyc = CryptoEngine.EncryptString(AbpSession.UserId.Value.ToString());
            }

            model.PersonalDetail = LoadPersonalDetail(model.UserTrackingFilter.UserIdEnyc).Result;
            return(View(model));
        }
示例#2
0
        private string UploadedFile(UploadVModel model, out string modulePhotoUrl)
        {
            modulePhotoUrl = string.Empty;
            string filePath         = string.Empty;
            var    user             = _userManager.GetUserById(AbpSession.UserId.Value);
            var    rootImagesFolder = Path.Combine(_webHostEnvironment.ContentRootPath, "Images");

            if (model.Image != null)
            {
                string subFolder        = string.Empty;
                var    businessDocument = _documentAppService.GetAllBusinessDocuments(model.BusinessDocumentId, null, null).Result.Items.FirstOrDefault();
                var    module           = _lookupAppService.GetAllLookDetail(null, null, businessDocument.BusinessEntityLKDId).Result.Items.FirstOrDefault();
                if (module != null)
                {
                    if (module.LookUpDetailConst.Equals(LookUpDetailConst.PersonalDetail))
                    {
                        subFolder = "profile";
                    }
                    else if (module.LookUpDetailConst.Equals(LookUpDetailConst.PhotoTracking))
                    {
                        subFolder = "tracking";
                        //subFolder = string.Format("{0}/{1}", "tracking", user.FullName);
                    }
                }

                var subModuleFolder = Path.Combine(rootImagesFolder, subFolder);
                //Module Folder
                bool subModuleFolderExists = System.IO.Directory.Exists(subModuleFolder);
                if (!subModuleFolderExists)
                {
                    System.IO.Directory.CreateDirectory(subModuleFolder);
                }
                //User Folder
                var  userFolder       = Path.Combine(subModuleFolder, user.UserName);
                bool userFolderExists = System.IO.Directory.Exists(userFolder);
                if (!userFolderExists)
                {
                    System.IO.Directory.CreateDirectory(userFolder);
                }


                var uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Image.FileName;
                filePath = Path.Combine(userFolder, uniqueFileName);

                //Update user ProfilePath in User table
                if (module != null)
                {
                    if (module.LookUpDetailConst.Equals(LookUpDetailConst.PersonalDetail))
                    {
                        modulePhotoUrl = Path.Combine(userFolder, uniqueFileName);
                    }
                }

                using (var fileStream = new FileStream(filePath, FileMode.Create))
                {
                    model.Image.CopyTo(fileStream);
                }
            }
            return(filePath);
        }
        public async Task <IViewComponentResult> InvokeAsync(ViewComponentVModel model)
        {
            try
            {
                var userTrackingLKDId    = (await _lookupAppService.GetAllLookDetail(null, model.Module)).Items.FirstOrDefault().Id;
                var businessDocumentList = (await _documentAppService.GetAllBusinessDocuments(null, userTrackingLKDId, null)).Items.ToList();

                foreach (var businessDoc in businessDocumentList)
                {
                    businessDoc.BusinessDocumentAttachmentDto = _documentAppService.GetAllBusinessDocumentAttachments(null, businessDoc.Id, model.BusinessEntityId).Result.Items.ToList();
                }

                var documentModel = new DocumentUploaderViewModel()
                {
                    BusinessEntityId = model.BusinessEntityId,
                    DocumentList     = businessDocumentList,
                    IsReadOnly       = model.IsReadOnly
                };
                return(View(documentModel));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
        public PagedResultDto <PhotoTrackingListDto> GetAllPhotoTrackingPagedResult(PagedResultRequestExtDto input, int?documentTypeId = null)
        {
            var queryable = GetAllPhotoTrackingIQueryable(input);
            ////Server Side Pagging
            ////var count = queryable.Count();
            ////var result = queryable.Skip((input.SkipCount)).Take(input.MaxResultCount);
            var list = queryable.OrderByDescending(x => x.CreationTime);
            var photoTrackingList    = ObjectMapper.Map <IReadOnlyList <PhotoTrackingListDto> >(list).ToList();
            var photoTrackingLKDId   = _lookupAppService.GetAllLookDetail(null, LookUpDetailConst.PhotoTracking).Result.Items.First().Id;
            var businessDocumentList = _documentAppService.GetAllBusinessDocuments(null, photoTrackingLKDId, documentTypeId).Result.Items;

            for (int i = 0; i < photoTrackingList.Count; i++)
            {
                var attachmentCount = _documentAppService.GetAllBusinessDocumentAttachments(null, null, photoTrackingList[i].Id).Result.Items.Count;
                if (attachmentCount == 0)//Soft Delete Photo Tracking
                {
                    _photoTrackingRepository.Delete(photoTrackingList[i].Id);
                    photoTrackingList.Remove(photoTrackingList[i]);
                    continue;
                }
                var bizDocList = new List <BusinessDocumentDto>();
                foreach (var businessDoc in businessDocumentList)
                {
                    var businessDocument = new BusinessDocumentDto()
                    {
                        AllowMultiple       = businessDoc.AllowMultiple,
                        BusinessEntityLKDId = businessDoc.BusinessEntityLKDId,
                        DocumentType        = businessDoc.DocumentType,
                        DocumentTypeId      = businessDoc.DocumentTypeId,
                        Id         = businessDoc.Id,
                        IsRequired = businessDoc.IsRequired
                    };
                    businessDocument.BusinessDocumentAttachmentDto = _documentAppService.GetAllBusinessDocumentAttachments(null, businessDoc.Id, photoTrackingList[i].Id).Result.Items.ToList();
                    bizDocList.Add(businessDocument);
                }

                photoTrackingList[i].DocumentList = bizDocList;
            }
            var data = new PagedResultDto <PhotoTrackingListDto>(photoTrackingList.Count(), photoTrackingList);

            return(data);
        }