예제 #1
0
    public bool ParseFile(string path)
    {
        //if we have previously parsed this file, we will abort

        if (HasFileBeenParsed(path))
        {
            return(false);
        }

        FlowTubeList listinfo = new FlowTubeList(path, true, this);

        if (listinfo.exception != null)
        {
            InsertEventLog(listinfo.exception.Message, "File parse error", path, Environment.MachineName, Environment.MachineName);
        }

        if (listinfo.FlowTubes.Count >= 1)
        {
            listinfo.first_tube_barcode = listinfo.FlowTubes[0].AccessionNumberUnformatted;
        }
        this.GetFlowTubeListID(listinfo);
        if (listinfo.is_newly_uploaded && listinfo.is_valid)
        {
            this.InsertFlowTubes(listinfo.FlowTubes, listinfo);
            return(true);
        }
        return(false);
    }
예제 #2
0
    public void InsertFlowTubes(BindingList <FlowTube> tubes, FlowTubeList list_info)
    {
        DataTable dt;

        // create data table to insert items
        dt = new DataTable("Tubes");
        dt.Columns.Add("flow_tube_list_id", typeof(int));
        dt.Columns.Add("label", typeof(string));
        dt.Columns.Add("MRN", typeof(string));
        dt.Columns.Add("name", typeof(string));
        dt.Columns.Add("accession_number", typeof(string));
        dt.Columns.Add("sequence_number", typeof(int));
        foreach (var r in tubes)
        {
            dt.Rows.Add(list_info.flow_tube_list_id, r.TubeLabel, r.MRN, r.Name, r.AccessionNumber, r.SeqNbr);
        }

        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
            using (SqlCommand command = new SqlCommand
            {
                Connection = connection,
                CommandText = "InsertFlowTubes",
                CommandType = CommandType.StoredProcedure
            })
            {
                SqlParameter tvpParam = command.Parameters.AddWithValue("@tube_list", dt);
                tvpParam.SqlDbType = SqlDbType.Structured;
                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            }
    }
예제 #3
0
 public void GetFlowTubeListID(FlowTubeList info)
 {
     using (SqlConnection connection = new SqlConnection(this.ConnectionString))
         using (SqlCommand command = new SqlCommand
         {
             Connection = connection,
             CommandText = "GetFlowTubeListID",
             CommandType = CommandType.StoredProcedure
         })
         {
             command.Parameters.AddWithValue("@filename", info.filename);
             command.Parameters.AddWithValue("@path", info.path);
             command.Parameters.AddWithValue("@directory", info.directory);
             command.Parameters.AddWithValue("@file_hash", info.file_hash);
             command.Parameters.AddWithValue("@file_data", info.file_data);
             command.Parameters.AddWithValue("@is_valid", info.is_valid);
             command.Parameters.AddWithValue("@date_created", info.date_created);
             command.Parameters.AddWithValue("@first_tube_barcode", info.first_tube_barcode);
             command.Parameters.AddWithValue("@containing_directory", info.containing_directory);
             DataSet        dataSet = new DataSet();
             SqlDataAdapter adapter = new SqlDataAdapter(command);
             connection.Open();
             adapter.Fill(dataSet);
             connection.Close();
             DataRow row = dataSet.Tables[0].Rows[0];
             info.flow_tube_list_id = Convert.ToInt32(row["flow_tube_list_id"]);
             info.is_newly_uploaded = Convert.ToBoolean(row["is_new_tube_list"]);
         }
 }
        private bool ProceedWithListLoad(FlowTubeList ftl)
        {
            bool Load = true;

            if (ftl.verified_by != null && ftl.verified_by != "")
            {
                Load = MessageBox.Show("This manifest was already verified on " + ftl.date_verified.Value.ToShortDateString() + " by " + ftl.verified_by + System.Environment.NewLine
                                       + "Are you sure you want to start reverification of this manifest?", "Already verified", MessageBoxButtons.YesNo) == DialogResult.Yes;
            }
            return(Load);
        }
        private void SetFlowTubeList(FlowTubeList FlowTubeList)
        {
            this.lblMessage.Text = "Loaded " + FlowTubeList.filename;
            this.gridSamples.SetOnlyVisibleColumns(VisibleColumnDefinition);
            this.gridSamples.DataSource = FlowTubeList.FlowTubes;
            this.gridSamples.DisplayLayout.Override.SelectTypeRow     = Infragistics.Win.UltraWinGrid.SelectType.None;
            this.gridSamples.DisplayLayout.Override.CellClickAction   = CellClickAction.CellSelect;
            this.gridSamples.DisplayLayout.Override.AllowUpdate       = DefaultableBoolean.False;
            this.gridSamples.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.Select;
            this.gridSamples.DisplayLayout.Override.SelectTypeCol     = Infragistics.Win.UltraWinGrid.SelectType.None;
            UltraGridColumn imageColumn = gridSamples.DisplayLayout.Bands[0].Columns["ConfirmationIcon"];

            imageColumn.CellAppearance.ImageHAlign = HAlign.Center;
            imageColumn.CellAppearance.ImageVAlign = VAlign.Middle;
            _FlowTubeList = FlowTubeList;
            Sound.PlayWaveResource("Camera.wav");
            // _Tubes = FlowTubeList.FlowTubes;
        }
예제 #6
0
    public void UpdateVerficationInfo(FlowTubeList list)

    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
            using (SqlCommand command = new SqlCommand
            {
                Connection = connection,
                CommandText = "UpdateVerificationInfo",
                CommandType = CommandType.StoredProcedure
            })
            {
                command.Parameters.AddWithValue("@flow_tube_list_id", list.flow_tube_list_id);
                command.Parameters.AddWithValue("@verified_by", list.verified_by);
                connection.Open();
                command.ExecuteNonQuery();
                connection.Close();
            }
    }
예제 #7
0
    public List <FlowTubeList> GetMatchingTubeLists(string barcode)
    {
        List <FlowTubeList> output = new List <FlowTubeList>();

        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
            using (SqlCommand command = new SqlCommand
            {
                Connection = connection,
                CommandText = "GetMatchingTubeLists",
                CommandType = CommandType.StoredProcedure
            })
            {
                command.Parameters.AddWithValue("@first_accession_number", barcode);
                DataSet        dataSet = new DataSet();
                SqlDataAdapter adapter = new SqlDataAdapter(command);
                connection.Open();
                adapter.Fill(dataSet);
                connection.Close();
                foreach (DataRow row in dataSet.Tables[0].Rows)
                {
                    FlowTubeList info = new FlowTubeList(row["path"].ToString(), false, this);
                    info.filename          = row["filename"].ToString();
                    info.directory         = row["directory"].ToString();
                    info.is_newly_uploaded = false;
                    info.flow_tube_list_id = Convert.ToInt32(row["flow_tube_list_id"]);
                    info.date_parsed       = Convert.ToDateTime(row["date_parsed"]);
                    info.date_created      = Convert.ToDateTime(row["date_created"]);
                    if (!row["date_verified"].Equals(DBNull.Value))
                    {
                        info.date_verified = Convert.ToDateTime(row["date_verified"]);
                    }
                    if (!row["verified_by"].Equals(DBNull.Value))
                    {
                        info.verified_by = row["verified_by"].ToString();
                    }
                    info.first_tube_barcode = row["first_tube_barcode"].ToString();
                    output.Add(info);
                }
            }


        return(output);
    }
        private void gridFlowLists_ClickCell(object sender, ClickCellEventArgs e)
        {
            e.Cell.Row.Selected = true;
            this.Refresh();
            System.Threading.Thread.Sleep(250);
            this.gridSamples.Visible   = true;
            this.gridFlowLists.Visible = false;
            FlowTubeList ftl = e.Cell.Row.ListObject as FlowTubeList;

            if (ProceedWithListLoad(ftl))
            {
                this.SetFlowTubeList(ftl);
                SetCurrentSampleIndex(0);
                CurrentStatus = Status.ManifestInProgress;
            }
            else
            {
                CurrentStatus = Status.PendingManifest;
                SetBaselineMessage();
            }
        }