示例#1
0
        /// <summary>
        /// Get a chromatogram with properly sorted time values.
        /// </summary>
        public void ReleaseChromatogram(byte[] bytesFromDisk, out TimeIntensities timeIntensities)
        {
            var times       = Times.ToArray(bytesFromDisk);
            var intensities = Intensities.ToArray(bytesFromDisk);
            var massErrors  = MassErrors != null
                ? MassErrors.ToArray(bytesFromDisk)
                : null;

            var scanIds = Scans != null
                ? Scans.ToArray(bytesFromDisk)
                : null;

            // Make sure times and intensities match in length.
            if (times.Length != intensities.Length)
            {
                throw new InvalidDataException(
                          string.Format(Resources.ChromCollected_ChromCollected_Times__0__and_intensities__1__disagree_in_point_count,
                                        times.Length, intensities.Length));
            }
            if (massErrors != null && massErrors.Length != intensities.Length)
            {
                throw new InvalidDataException(
                          string.Format(Resources.ChromCollector_ReleaseChromatogram_Intensities___0___and_mass_errors___1___disagree_in_point_count_,
                                        intensities.Length, massErrors.Length));
            }
            timeIntensities = new TimeIntensities(times, intensities, massErrors, scanIds);
            // Release memory.
            Times       = null;
            Intensities = null;
            MassErrors  = null;
            Scans       = null;
        }
示例#2
0
        /// <summary>
        /// Get a chromatogram with properly sorted time values.
        /// </summary>
        public void ReleaseChromatogram(byte[] bytesFromDisk, out float[] times, out float[] intensities, out float[] massErrors, out int[] scanIds)
        {
            times       = Times.ToArray(bytesFromDisk);
            intensities = Intensities.ToArray(bytesFromDisk);
            massErrors  = MassErrors != null
                ? MassErrors.ToArray(bytesFromDisk)
                : null;

            scanIds = Scans != null
                ? Scans.ToArray(bytesFromDisk)
                : null;

            // Release memory.
            Times       = null;
            Intensities = null;
            MassErrors  = null;
            Scans       = null;

            // Make sure times and intensities match in length.
            if (times.Length != intensities.Length)
            {
                throw new InvalidDataException(
                          string.Format(Resources.ChromCollected_ChromCollected_Times__0__and_intensities__1__disagree_in_point_count,
                                        times.Length, intensities.Length));
            }
        }
示例#3
0
 public void SetScan(string scan, char token)
 {
     Smart = false;
     Token = token;
     Scans.Clear();
     SetSmartScan(scan);
 }
示例#4
0
        private void UpdateScans(ICollection <Image> otherScans)
        {
            var currentScanIds = Scans
                                 .Select(f => f.ImageId)
                                 .ToImmutableHashSet();

            var nextScanIds = otherScans
                              .Select(f => f.ImageId)
                              .ToImmutableHashSet();

            var dropScans =
                Scans.Where(img => !nextScanIds.Contains(img.ImageId)).ToList();

            foreach (var dropScanItem in dropScans)
            {
                Scans.Remove(dropScanItem);
            }

            var addScans = otherScans
                           .Where(img => !currentScanIds.Contains(img.ImageId));

            foreach (var addScanItem in addScans)
            {
                Scans.Add(addScanItem);
            }
        }
示例#5
0
        //public void ExcelWrite(string file)
        //{
        //    try
        //    {
        //        using (ExcelHelper excelHelper = new ExcelHelper(file))
        //        {
        //            DataTable data = GenerateData();
        //            deptBLL getdataDept = new deptBLL();    //写一个从数据库查出来的表

        //            DataTable data = getdataDept.GetdatagetdataDept();
        //            int count = excelHelper.DataTableToExcel(data, "MySheet", true);
        //            if (count > 0)
        //                Console.WriteLine("Number of imported data is {0} ", count);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine("Exception: " + ex.Message);
        //    }
        //}

        //读EXCEL   导入EXCEL表
        public Scans[] ExcelRead(string file, string sheetname, int headno)
        {
            try
            {
                using (ExcelHelper excelHelper = new ExcelHelper(file))
                {
                    DataTable dt = excelHelper.ExcelToDataTable(sheetname, headno);
                    if (dt.Rows.Count <= 0)
                    {
                        return(null);
                    }
                    else
                    {
                        //要显示的文件的model 例emp
                        Scans[] scan = new Scans[dt.Rows.Count];
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            scan[i] = ToModel(dt.Rows[i]);//这里转换过来
                        }
                        return(scan);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception: " + ex.Message);
                return(null);
            }
        }
示例#6
0
 private void AddScan(string scan)
 {
     if (!Scans.Contains(scan))
     {
         Scans.Add(scan);
         _totalsBar.NumberScans = Scans.Count;
     }
 }
示例#7
0
 public void ResetScan(int currentIndex)
 {
     if (currentIndex >= Scans.Count)
     {
         Smart = false;
         Token = new char();
         Scans.Clear();
     }
 }
示例#8
0
        public int GetTotalScans(OperationGroups operation)
        {
            if (!Scans.ContainsKey(operation))
            {
                return(0);
            }

            return(Scans[operation].Values.Sum());
        }
示例#9
0
        public double GetSpeedScansPerHour(OperationGroups operation)
        {
            if (!Scans.ContainsKey(operation))
            {
                return(0.0);
            }

            return(Scans[operation].Values.Sum() / OperationTimes[operation].TotalHours);
        }
示例#10
0
        public override int GetClosestOneBasedSpectrumNumber(double retentionTime)
        {
            int ok = Array.BinarySearch(Scans.Select(b => b.RetentionTime).ToArray(), retentionTime);

            if (ok < 0)
            {
                ok = ~ok;
            }
            return(ok + 1);
        }
示例#11
0
        public void Init()
        {
            Application.Current.Dispatcher.Invoke(() => { RepoFactory.Scan.GetAll().ForEach(a => Scans.Add(a)); });
            SVR_Scan runscan = Scans.FirstOrDefault(a => a.GetScanStatus() == ScanStatus.Running);

            if (runscan != null)
            {
                ActiveScan = runscan;
                StartScan();
            }
        }
示例#12
0
        public void Init()
        {
            Utils.MainThreadDispatch(() => { RepoFactory.Scan.GetAll().ForEach(a => Scans.Add(a)); });
            SVR_Scan runscan = Scans.FirstOrDefault(a => a.GetScanStatus() == ScanStatus.Running);

            if (runscan != null)
            {
                ActiveScan = runscan;
                StartScan();
            }
        }
示例#13
0
 public void ClearScan()
 {
     if (ActiveScan == null)
     {
         return;
     }
     if (workerIntegrityScanner.IsBusy && RunScan == ActiveScan)
     {
         CancelScan();
     }
     RepoFactory.ScanFile.Delete(RepoFactory.ScanFile.GetByScanID(ActiveScan.ScanID));
     RepoFactory.Scan.Delete(ActiveScan);
     Application.Current.Dispatcher.Invoke(() => { Scans.Remove(ActiveScan); });
     ActiveScan = null;
 }
示例#14
0
 public void ClearScan()
 {
     if (ActiveScan == null)
     {
         return;
     }
     if (workerIntegrityScanner.IsBusy && RunScan == ActiveScan)
     {
         CancelScan();
     }
     RepoFactory.ScanFile.Delete(RepoFactory.ScanFile.GetByScanID(ActiveScan.ScanID));
     RepoFactory.Scan.Delete(ActiveScan);
     Utils.MainThreadDispatch(() => { Scans.Remove(ActiveScan); });
     ActiveScan = null;
 }
示例#15
0
 /// <summary>
 /// Initializes client properties.
 /// </summary>
 private void Initialize()
 {
     ClassificationRules = new ClassificationRules(this);
     DataSources         = new DataSources(this);
     Filters             = new Filters(this);
     Scans                 = new Scans(this);
     ScanRulesets          = new ScanRulesets(this);
     Triggers              = new Triggers(this);
     BaseUri               = new System.Uri("http://localhost");
     SerializationSettings = new JsonSerializerSettings
     {
         Formatting            = Newtonsoft.Json.Formatting.Indented,
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new  List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new TransformationJsonConverter());
     DeserializationSettings = new JsonSerializerSettings
     {
         DateFormatHandling    = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
         DateTimeZoneHandling  = Newtonsoft.Json.DateTimeZoneHandling.Utc,
         NullValueHandling     = Newtonsoft.Json.NullValueHandling.Ignore,
         ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
         ContractResolver      = new ReadOnlyJsonContractResolver(),
         Converters            = new List <JsonConverter>
         {
             new Iso8601TimeSpanConverter()
         }
     };
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ClassificationRule>("kind"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <ClassificationRule>("kind"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <DataSource>("kind"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <DataSource>("kind"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <Scan>("kind"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <Scan>("kind"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ScanRuleset>("kind"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <ScanRuleset>("kind"));
     SerializationSettings.Converters.Add(new PolymorphicSerializeJsonConverter <ClassificationRulePattern>("kind"));
     DeserializationSettings.Converters.Add(new  PolymorphicDeserializeJsonConverter <ClassificationRulePattern>("kind"));
     CustomInitialize();
     DeserializationSettings.Converters.Add(new TransformationJsonConverter());
 }
示例#16
0
        private void SetSmartScan(string scan)
        {
            int index;

            index = scan.IndexOf(Token);

            if (index > -1)
            {
                Smart = true;
                Scans.Add(scan.Substring(0, index));
                SetSmartScan(scan.Substring(index + 1));
            }
            else
            {
                Scans.Add(scan.Substring(0));
            }
        }
        public MainResponse UploadDocumentFile(DocumentUploadRequest documentUploadRequest, string actionBy)
        {
            string uniqueFileName = null;
            string path           = null;

            if (documentUploadRequest.Documents != null)
            {
                foreach (IFormFile file in documentUploadRequest.Documents)
                {
                    string uploadsFolder = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot");


                    uniqueFileName = Guid.NewGuid().ToString() + "_" + file.FileName;

                    var FilePath = Path.Combine(uploadsFolder, "Resources", "Documents");
                    path = Path.Combine(FilePath, uniqueFileName);

                    string filePath = Path.Combine(FilePath, uniqueFileName);


                    file.CopyTo(new FileStream(filePath, FileMode.Create));


                    path = path.Replace(uploadsFolder, "").Replace("\\", "/");

                    var scans = new Scans
                    {
                        ExhibitorId  = documentUploadRequest.Exhibitor,
                        DocumentType = documentUploadRequest.DocumentType,
                        DocumentPath = path,
                        CreatedBy    = actionBy,
                        CreatedDate  = DateTime.Now
                    };
                    _scanRepository.Add(scans);
                }

                _mainResponse.Message = Constants.DOCUMENT_UPLOAD;
                _mainResponse.Success = true;
            }
            else
            {
                _mainResponse.Message = Constants.NO_DOCUMENT_FOUND;
                _mainResponse.Success = false;
            }
            return(_mainResponse);
        }
示例#18
0
 public GameItem Clone() =>
 new GameItem
 {
     Condition        = Condition,
     ConditionDetails = ConditionDetails,
     Files            = Files
                        .Select(file => new File {
         Path = file.Path, Sha256Checksum = file.Sha256Checksum
     })
                        .ToList(),
     ItemType = ItemType,
     Missing  = Missing,
     Notes    = Notes,
     Scans    = Scans
                .Select(scan => new Image {
         Path = scan.Path
     })
                .ToList()
 };
示例#19
0
 public void AddTransistion(ISymbol symbol, DottedRuleSet target)
 {
     if (symbol.SymbolType == SymbolType.NonTerminal)
     {
         if (!Reductions.ContainsKey(symbol))
         {
             _reductions.Add(symbol, target);
         }
     }
     else if (symbol.SymbolType == SymbolType.LexerRule)
     {
         var lexerRule = symbol as ILexerRule;
         if (!Scans.ContainsKey(lexerRule))
         {
             _tokenTransitions.Add(lexerRule.TokenType, target);
             _scans.Add(lexerRule, target);
             _scanKeys.Add(lexerRule);
         }
     }
 }
示例#20
0
        private Scans ToModel(DataRow row)//建立要导入的文件的model
        {
            Scans scan = new Scans();

            if (row.ItemArray.Length > 0)
            {
                scan.TagNumber = Convert.ToString(row.ItemArray[0].ToString());
            }

            if (row.ItemArray.Length > 1)
            {
                scan.ScanTime = Convert.ToString(row.ItemArray[1].ToString());
            }
            if (row.ItemArray.Length > 2)
            {
                scan.Kg = Convert.ToString(row.ItemArray[2].ToString());
            }

            if (row.ItemArray.Length > 3)
            {
                scan.Subinv = Convert.ToString(row.ItemArray[3].ToString());
            }
            if (row.ItemArray.Length > 4)
            {
                scan.Con_no = Convert.ToString(row.ItemArray[4].ToString());
            }
            if (row.ItemArray.Length > 5)
            {
                scan.Location = Convert.ToString(row.ItemArray[5].ToString());
            }
            if (row.ItemArray.Length > 6)
            {
                scan.Org = Convert.ToString(row.ItemArray[6].ToString());
            }
            if (row.ItemArray.Length > 6)
            {
                scan.Cust_Id = Convert.ToString(row.ItemArray[6].ToString());
            }
            return(scan);
        }
示例#21
0
        //public void ExcelWrite(string file)
        //{
        //    try
        //    {
        //        using (ExcelHelper excelHelper = new ExcelHelper(file))
        //        {
        //            DataTable data = GenerateData();
        //            deptBLL getdataDept = new deptBLL();    //写一个从数据库查出来的表

        //            DataTable data = getdataDept.GetdatagetdataDept();
        //            int count = excelHelper.DataTableToExcel(data, "MySheet", true);
        //            if (count > 0)
        //                Console.WriteLine("Number of imported data is {0} ", count);
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        Console.WriteLine("Exception: " + ex.Message);
        //    }
        //}

        //读EXCEL   导入EXCEL表
        public Scans[] ExcelRead(string file, string sheetname, int headno)
        {
            try
            {
                using (ExcelHelper excelHelper = new ExcelHelper(file))
                {
                    DataTable dt = excelHelper.ExcelToDataTable(sheetname, headno);
                    if (dt is null || dt.Rows.Count <= 0)
                    {
                        return(null);
                    }
                    else
                    {
                        //要显示的文件的model 例emp
                        Scans[] scan = new Scans[dt.Rows.Count];
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            scan[i] = ToModel(dt.Rows[i]);//这里转换过来
                        }
                        return(scan);
                    }
                }
 private void ScanBarcode(string arg)
 {
     Scans.Add(arg);
 }
示例#23
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (grpBxScans.Visible)
            {
                var scan = new Scans();


                if (radioReset.Checked)
                {
                    if (scan.setScanStatus(Convert.ToInt32(labtest.LTRNumber), false, true))
                    {
                        radioSet.Checked   = false;
                        radioReset.Checked = false;
                        fillPatientsTests(labpatient.getPatientsTestList());
                    }
                }
            }


            var bloodtest = new BloodTest();


            if (txt_Panel1["Field"] == "Sugar")
            {
                if (!bloodtest.insertSugar(labpatient.ID, labtest.ID, txt_Panel1["Value"]))
                {
                    MessageBox.Show("Please Fill the Relevant Field", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    txtTest_Panel1.Text = "";
                    fillPatientsTests(labpatient.getPatientsTestList());
                    //labtest.Status = true;
                }
            }

            if (txt_Panel1["Field"] == "Platelet Count")
            {
                if (!bloodtest.insertPlatelet(labpatient.ID, labtest.ID, txt_Panel1["Value"]))
                {
                    MessageBox.Show("Please Fill the Relevant Field", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    txtTest_Panel1.Text = "";
                    fillPatientsTests(labpatient.getPatientsTestList());
                    //labtest.Status = true;
                }
            }


            if (txt_Panel1["Field"] == "WBC" && txt_Panel2["Field"] == "RBC")
            {
                if (!bloodtest.insertCellCount(labpatient.ID, labtest.ID, txt_Panel1["Value"], txt_Panel2["Value"]))
                {
                    MessageBox.Show("Please Fill the Relevant Field", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
                else
                {
                    txtTest_Panel1.Text = "";
                    txtTest_Panel2.Text = "";
                    fillPatientsTests(labpatient.getPatientsTestList());
                    //labtest.Status = true;
                }
            }

            if (txt_Panel1["Field"] == "HDL" && txt_Panel2["Field"] == "LDL" && txt_Panel3["Field"] == "Serum Cholesterol")
            {
                var cholesterol = new LipidTest();
                if (!cholesterol.updateCholesterolTest(labpatient.ID, txt_Panel1["Value"], txt_Panel2["Value"], txt_Panel3["Value"]))
                {
                    MessageBox.Show("Please Fill the Relevant Field", "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }

                else
                {
                    txtTest_Panel1.Text = "";
                    txtTest_Panel2.Text = "";
                    txtTest_Panel3.Text = "";
                    fillPatientsTests(labpatient.getPatientsTestList());
                    //labtest.Status = true;
                }
            }

            //clearDictionarys();
            FillAppointments(null, null, null);
        }
示例#24
0
 public void ResetScan()
 {
     Smart = false;
     Token = new char();
     Scans.Clear();
 }
示例#25
0
 public int GetIndex(string scan)
 {
     return(Scans.IndexOf(scan));
 }
 public static IList <PSSqlVulnerabilityAssessmentScanRecord> ConvertToPSType(this Scans value)
 {
     return(value.Value.Select(scan => scan.ConvertToPSType()).ToList());
 }