public override string GetResults(int samplePeakIndex)
    {
        ProjectReview projHandler = FindObjectOfType <ProjectReview>();

        ToolsScreen toolStuff = FindObjectOfType <ToolsScreen>();

        string results;

        string headerHex = ColorUtility.ToHtmlStringRGBA(toolStuff.GetResultsHeaderColor());
        string bodyHex   = ColorUtility.ToHtmlStringRGBA(toolStuff.GetResultsBodyColor());
        string shiftHex  = ColorUtility.ToHtmlStringRGBA(toolStuff.GetShiftValueColor());
        string peakHex   = ColorUtility.ToHtmlStringRGBA(toolStuff.GetPeakValueColor());

        if (maxima.Count > 0)
        {
            results = "<color=#" + headerHex + ">Signals  found: </color><color=#" + bodyHex + ">" + maxima.Count + "</color>\n";

            for (int i = 0; i < maxima.Count; i++)
            {
                results = results + "<color=#" + bodyHex + ">" + (i + 1) + ".  (</color><color=#" + shiftHex + ">" + maxima[i].shift +
                          "</color><color=#" + bodyHex + ">,  </color><color=#" + peakHex + ">" + maxima[i].intensity.ToString("0.#") + "</color><color=#" + bodyHex + ">)</color>\n";
            }
        }
        else
        {
            results = "<color=#" + bodyHex + ">NO  SIGNALS</color>";
        }

        return(results);
    }
        private async Task CreateReview_ShouldWorkFine()
        {
            var context = ContextInitializer.InitializeContext();

            await this.SeedData(context);

            this.reviewService = new ReviewService(context);

            var review = new ProjectReview
            {
                ProjectId  = "bb2bd817-98cd-4cf3-a80a-53ea0cd9c200",
                CustomerId = new Guid("cb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                Review     = "Second Review",
            };

            var reviewCreate = new ReviewCreateModel
            {
                CustomerId = review.CustomerId,
                ProjectId  = review.ProjectId,
                Review     = "Second Review Text",
            };

            var result = await this.reviewService.CreateReview(reviewCreate);

            Assert.Equal("Review was successfully created!", result);
        }
        public ActionResult _UpdateAjaxEditing(int id)
        {
            ProjectReview pr = CH.DB.ProjectReviews.Find(id);

            if (TryUpdateModel(pr))
            {
                CH.Edit(pr);
            }

            return(View(new GridModel(GetData())));
        }
    public override string GetResults()
    {
        ProjectReview projHandler = FindObjectOfType <ProjectReview>();
        ToolsScreen   toolStuff   = FindObjectOfType <ToolsScreen>();

        string results;

        string headerHex       = ColorUtility.ToHtmlStringRGBA(toolStuff.GetResultsHeaderColor());
        string bodyHex         = ColorUtility.ToHtmlStringRGBA(toolStuff.GetResultsBodyColor());
        string shiftHex        = ColorUtility.ToHtmlStringRGBA(toolStuff.GetShiftValueColor());
        string peakHex         = ColorUtility.ToHtmlStringRGBA(toolStuff.GetPeakValueColor());
        string sampleCursorHex = ColorUtility.ToHtmlStringRGBA(toolStuff.GetSampleCursorColor());

        if (maxima.Count > 0)
        {
            results = "<color=#" + headerHex + ">Signals  found: " + maxima.Count + "</color>\n";

            for (int i = 0; i < maxima.Count; i++)
            {
                results = results + "<color=#" + bodyHex + ">" + (i + 1) + ".  (</color><color=#" + shiftHex + ">" + maxima[i].shift +
                          "</color><color=#" + bodyHex + ">,  </color><color=#" + peakHex + ">" + maxima[i].intensity.ToString("0.#") + "</color><color=#" + bodyHex + ">)</color>\n";
            }
        }
        else
        {
            results = "<color=#" + bodyHex + ">NO  SIGNALS</color>";
        }

        string matchRatingTxt = "<color=#" + headerHex + ">Match  Rating:</color>\n";

        //string matchInfoTxt = "\nMatches:  ";
        //string underMinimumPeakNumTxt = "\nPeak min not met for:  ";

        if (matches.Count > 0)
        {
            for (int i = 0; i < matches.Count; i++)
            {
                float  rating      = this.ReturnMatchRatingWithReferenceSet(matches[i]);
                string ratingHex   = ColorUtility.ToHtmlStringRGBA(toolStuff.GetMatchRatingColor(rating));
                string matchRefHex = ColorUtility.ToHtmlStringRGBA(toolStuff.GetMatchRefColor(i));

                // Add match info to results text
                //matchRatingTxt = matchRatingTxt + "(" + NMRRef.sampleAbbName + ") -\t" + this.ReturnMatchRatingWithReferenceSet(NMRRef).ToString("0.#") + ";\n";
                matchRatingTxt = matchRatingTxt + "<color=#" + matchRefHex + ">" + matches[i].sampleAbbName + "    </color><color=#" + ratingHex + ">" + rating.ToString("0.#") + "</color>\n";
                //matchInfoTxt   = matchInfoTxt + NMRRef.matchNotes + ";  ";

                //if (this.maxima.Count < NMRRef.minNumOfPeakMatchesRequired) {
                //    underMinimumPeakNumTxt = underMinimumPeakNumTxt + NMRRef.sampleName + ";  ";
                //}
            }
        }

        return(results + matchRatingTxt);  //+ underMinimumPeakNumTxt;
    }
Example #5
0
        public async Task <string> CreateReview(ReviewCreateModel model)
        {
            var review = new ProjectReview
            {
                Review     = model.Review,
                CustomerId = model.CustomerId,
                ProjectId  = model.ProjectId,
            };

            this.context.ProjectReviews.Add(review);
            await this.context.SaveChangesAsync();

            return("Review was successfully created!");
        }
 public ActionResult Create(FormCollection c)
 {
     try
     {
         int           id      = int.Parse(c["id"]);
         string        summary = Server.UrlDecode(c["summary"]);
         ProjectReview pr      = new ProjectReview();
         pr.ProjectID = id;
         pr.Summary   = summary;
         CH.Create <ProjectReview>(pr);
     }
     catch (Exception e)
     { }
     return(Json(""));
 }
Example #7
0
        public List <ProjectReview> GetReviewsForWorkProduct(int id)
        {
            var reviews = context.Review.Where(x => x.WorkproductId == id).ToList();
            List <ProjectReview> review = new List <ProjectReview>();

            foreach (var r in reviews)
            {
                ProjectReview pr = new ProjectReview()
                {
                    Complete = r.Complete, Name = r.Name, Id = r.Id
                };
                review.Add(pr);
            }
            return(review);
        }
Example #8
0
        public List <ProjectReview> GetReviewsForProject(int id)
        {
            var review = context.Review.Where(x => x.WorkproductProjectId == id).Include(x => x.Workproduct).ToList();
            List <ProjectReview> reviews = new List <ProjectReview>();

            foreach (var r in review)
            {
                ProjectReview p = new ProjectReview()
                {
                    Complete = r.Complete, Id = r.Id, Name = r.Name, WorkProductId = r.WorkproductId, WorkProductName = r.Workproduct.Name
                };
                reviews.Add(p);
            }
            return(reviews);
        }
    // Finds potential matches in ProjectHandler NMRRefResults, adds them to matches
    public override void DetermineMatches()
    {
        ProjectReview projHandler = FindObjectOfType <ProjectReview>();

        matches.Clear();

        if (projHandler.NMRRefs.Count > 0)
        {
            List <NMRRefResults> acceptableMatches = new List <NMRRefResults>();

            foreach (NMRRefResults NMRRef in projHandler.NMRRefs)
            {
                if (this.ReturnMatchAccuracyWithReferenceSet(NMRRef) > NMRRef.accuracyRequirement)
                {
                    acceptableMatches.Add(NMRRef);
                }
            }

            int           numOfTopPicksFound = 0;
            float         tempMatchRating    = 0;
            NMRRefResults tempTopRef         = null;

            while ((numOfTopPicksFound < defaultNumOfRefsToShow) && (acceptableMatches.Count > 0))
            {
                foreach (NMRRefResults NMRRef in acceptableMatches)
                {
                    float rating = ReturnMatchRatingWithReferenceSet(NMRRef);

                    if (rating > tempMatchRating)
                    {
                        tempMatchRating = rating;
                        tempTopRef      = NMRRef;
                    }
                }

                if (tempTopRef && !matches.Contains(tempTopRef))
                {
                    matches.Add(tempTopRef);
                }

                acceptableMatches.Remove(tempTopRef);
                tempMatchRating = 0;
                tempTopRef      = null;
                numOfTopPicksFound++;
            }
        }
    }
Example #10
0
    private ImageRefCapture SearchForImageRefInDatabase(ImageCapture imgCap)
    {
        ProjectReview projHandler = FindObjectOfType <ProjectReview>();

        if (projHandler.refImagesOfInterest.Count > 0)
        {
            foreach (ImageRefCapture imgRef in projHandler.refImagesOfInterest)
            {
                if (imgCap.thingRevealed == imgRef.thingRevealed)
                {
                    return(imgRef);
                }
            }
        }

        return(null);
    }
        private Project AddProject()
        {
            var model = new ProjectCreateInputModel
            {
                Designer = new ApplicationUser
                {
                    Id           = new Guid("db2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                    Email        = "*****@*****.**",
                    PasswordHash = 5.GetHashCode().ToString(),
                },
                Customer = new ApplicationUser
                {
                    Id           = new Guid("cb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                    Email        = "*****@*****.**",
                    PasswordHash = 5.GetHashCode().ToString(),
                },
                Name     = "Test",
                IsPublic = true,
            };

            var project = new Project
            {
                Id         = new Guid("bb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                DesignerId = model.Designer.Id,
                CustomerId = model.Customer.Id,
                Name       = model.Name,
                IsPublic   = model.IsPublic,
            };

            var projectFile = new ProjectFileCreateModel
            {
                File       = new Mock <IFormFile>().Object,
                IsApproved = false,
                IsPublic   = true,
                Name       = "TestProjectFile",
                ProjectId  = project.Id,
            };

            var projectFileResult = new ProjectFile
            {
                Id         = new Guid("ab2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                IsApproved = projectFile.IsApproved,
                IsPublic   = projectFile.IsPublic,
                Name       = "TestProjectFile.jpg",
                ProjectId  = project.Id,
            };

            var revew = new ProjectReview
            {
                ProjectId  = project.Id,
                CustomerId = new Guid("cb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                Review     = "First Review",
            };

            var designBoard = new DesignBoard
            {
                ProjectId        = project.Id,
                CustomerId       = new Guid("cb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                Id               = new Guid("de2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                Name             = "Test Design Board",
                DesignReferences = new List <DesignReference>(),
            };

            var designRefernce = new DesignReference
            {
                CustomerId    = new Guid("cb2bd817-98cd-4cf3-a80a-53ea0cd9c200").ToString(),
                ImageUrl      = "https://test.test",
                DesignBoardId = "de2bd817-98cd-4cf3-a80a-53ea0cd9c200",
            };

            project.ProjectReviews.Add(revew);
            project.ProjectFiles.Add(projectFileResult);
            project.DesignBoards.Add(designBoard);
            project.DesignBoards[0].DesignReferences.Add(designRefernce);

            return(project);
        }