예제 #1
0
        /**************************************************************************************************/
        private void LoadGeneticTestResults(string patient_unitnum, int relativeID, int instanceId)
        {
            using (SqlConnection connection = new SqlConnection(BCDB2.Instance.getConnectionString()))
            {
                connection.Open();

                SqlCommand cmdProcedure = new SqlCommand("sp_3_LoadgeneticTestResults", connection);
                cmdProcedure.CommandType = CommandType.StoredProcedure;

                cmdProcedure.Parameters.Add("@unitnum", SqlDbType.NVarChar);
                cmdProcedure.Parameters["@unitnum"].Value = patient_unitnum;
                cmdProcedure.Parameters.Add("@apptid", SqlDbType.Int);
                cmdProcedure.Parameters["@apptid"].Value = owningPMH.RelativeOwningPMH.owningFHx.proband.apptid;

                cmdProcedure.Parameters.Add("@relId", SqlDbType.NVarChar);
                cmdProcedure.Parameters["@relId"].Value = relativeID;

                cmdProcedure.Parameters.Add("@instanceId", SqlDbType.Int);
                cmdProcedure.Parameters["@instanceId"].Value = instanceID;

                try
                {
                    SqlDataReader reader = cmdProcedure.ExecuteReader(CommandBehavior.CloseConnection);

                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            GeneticTestResult geneticTestResult = new GeneticTestResult(this);

                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                if (reader.IsDBNull(i) == false)
                                {
                                    foreach (FieldInfo fi in geneticTestResult.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public))
                                    {
                                        string name = fi.Name;
                                        if (name == reader.GetName(i))
                                        {
                                            SetFieldInfoValue(fi, reader.GetValue(i), geneticTestResult);
                                            break;
                                        }
                                    }
                                }
                            }
                            geneticTestResult.HraState = States.Ready;
                            GeneticTestResults.Add(geneticTestResult);
                        }
                        reader.Close();
                    }
                }
                catch (Exception ex)
                {
                    Logger.Instance.WriteToLog(ex.ToString());
                }
            }
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            GeneticTestResult result = obj as GeneticTestResult;

            if (result != null)
            {
                GeneticTestResult test = result;
                return
                    (test.geneName == this.geneName &&
                     (test.mutationName == this.mutationName ||
                      test.mutationAA == this.mutationAA));
            }
            else
            {
                return(false);
            }
        }