Example #1
0
        public JsonResult Validate(string values)
        {
            FileMetaData      imageFileMetaData          = new FileMetaData();
            FileMetaData      thumbnailImageFileMetaData = new FileMetaData();
            GRINGlobalService _grinGlobalService         = new GRINGlobalService(this.AuthenticatedUserSession.Environment);

            try
            {
                string[] valueList = values.Split(',');
                foreach (var id in valueList)
                {
                    AccessionInventoryAttachment accessionInventoryAttachment = _grinGlobalService.GetAccessionInventoryAttachment(Int32.Parse(id));

                    if (accessionInventoryAttachment.ThumbnailImageURLIsValid < 0)
                    {
                        if (!String.IsNullOrEmpty(accessionInventoryAttachment.VirtualPath))
                        {
                            imageFileMetaData = _grinGlobalService.GetFileMetaData(accessionInventoryAttachment.VirtualPath);
                        }

                        if (!String.IsNullOrEmpty(accessionInventoryAttachment.ThumbnailVirtualPath))
                        {
                            thumbnailImageFileMetaData = _grinGlobalService.GetFileMetaData(accessionInventoryAttachment.ThumbnailVirtualPath);
                        }
                        _grinGlobalService.AddValidationRecord(accessionInventoryAttachment.ID, imageFileMetaData.IsValid, thumbnailImageFileMetaData.IsValid);
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json(new { success = false }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
        }