예제 #1
0
        // GET: api/AssayNamesReportFile
        public IEnumerable <object> Get()
        {
            logData.Info("Get Assay Name from Report File Function is called");
            // getting assay id from the database table( ReportFile)
            using (var repo = new AssayRepository())
            {
                try
                {
                    List <DisplayClass> objectAssay = new List <DisplayClass>();
                    List <long>         ids         = new List <long>();
                    List <long>         typeId      = new List <long>();
                    List <string>       assayNames  = new List <string>();
                    var assayobject = repo.GetAssayNameFromReportFile();
                    foreach (var assayName in assayobject)
                    {
                        DisplayClass ds = new DisplayClass();
                        ids.Add(assayName.AssayTypeId);
                        ds.Id = assayName.AssayTypeId;
                    }

                    //Using the assayId getting back the assay names
                    foreach (var assayid in ids)
                    {
                        DisplayClass ds = new DisplayClass();
                        ds.AssayName = repo.GetAssayName(assayid);
                        ds.TypeId    = repo.GetTypeIdWithID(assayid);
                        objectAssay.Add(ds);
                    }
                    return(objectAssay);
                }

                catch (SqlException odbcEx)
                {
                    Console.WriteLine(odbcEx.Message);
                    logData.Error(odbcEx.Message);
                    return(null);
                }
            }
        }
        public string Get(Boolean IsGolden, string Tag, string AssayVersion, string SoftwareVersion, int AssayID)
        {
            long   AssayDBID;
            string AssayName = "";

            //Assay name is specified
            if (AssayID != -1)
            {
                using (var repo = new AssayRepository())
                {
                    AssayDBID = repo.GetTypeIdWithID(AssayID);
                    AssayName = repo.GetAssayName(AssayID);
                }
            }
            else
            {
                AssayDBID = -1;
            }
            var files = new List <Pair>();

            if (Tag == "undefined")
            {
                Tag = "";
            }
            if (AssayVersion == "undefined")
            {
                AssayVersion = "";
            }
            if (SoftwareVersion == "undefined")
            {
                SoftwareVersion = "";
            }

            using (var repo = new CurveFilesRepository())
            {
                var tempContainer = repo.GetSpecifiedFile(IsGolden, Tag, AssayVersion, SoftwareVersion, AssayDBID);
                if (tempContainer.Count <CurveFile>() == 0)
                {
                    return(JsonConvert.SerializeObject("No Matching Curve File Found"));
                }
                else
                {
                    var service   = new CurveDataPointService();
                    var assayRepo = new AssayRepository();


                    foreach (var temp in tempContainer)
                    {
                        var container = service.getCurveData(temp.Data, temp.FullFileName);

                        if (AssayDBID == -1)
                        {
                            AssayName = assayRepo.GetAssayNameUsingTypeID(temp.AssayDBID);
                        }

                        files.Add(new Pair
                        {
                            AssayName = AssayName,
                            curveFile = temp,
                            data      = container.dataSet,
                            FileType  = container.FileType
                        });
                    }
                }
            }
            return(JsonConvert.SerializeObject(files));
        }