示例#1
0
        /**************************************************************************************************/
        public override void BackgroundLoadWork()
        {
            string sql = "select * from v_3_HighRiskBrcaQueue";
            using (SqlConnection connection = new SqlConnection(BCDB2.Instance.getConnectionString()))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sql, connection);

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

                    if (reader != null)
                    {
                        while (reader.Read())
                        {

                            HighRiskBrcaQueueEntry hrbqe = new HighRiskBrcaQueueEntry();
                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                if (reader.IsDBNull(i) == false)
                                {
                                    foreach (FieldInfo fi in hrbqe.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public))
                                    {
                                        string name = fi.Name;
                                        if (name == reader.GetName(i))
                                        {
                                            fi.SetValue(hrbqe, reader.GetValue(i));
                                        }
                                    }
                                }
                            }
                            HighRiskBrcaPeople.Add(hrbqe);

                        }
                        reader.Close();
                    }
                }
                catch (Exception e)
                {
                    Logger.Instance.WriteToLog(e.ToString());
                }
            }
        }
示例#2
0
        /**************************************************************************************************/

        public override void BackgroundLoadWork()
        {
            string sql = "select * from v_3_HighRiskBrcaQueue";

            using (SqlConnection connection = new SqlConnection(BCDB2.Instance.getConnectionString()))
            {
                connection.Open();
                SqlCommand command = new SqlCommand(sql, connection);

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

                    if (reader != null)
                    {
                        while (reader.Read())
                        {
                            HighRiskBrcaQueueEntry hrbqe = new HighRiskBrcaQueueEntry();
                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                if (reader.IsDBNull(i) == false)
                                {
                                    foreach (FieldInfo fi in hrbqe.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public))
                                    {
                                        string name = fi.Name;
                                        if (name == reader.GetName(i))
                                        {
                                            fi.SetValue(hrbqe, reader.GetValue(i));
                                        }
                                    }
                                }
                            }
                            HighRiskBrcaPeople.Add(hrbqe);
                        }
                        reader.Close();
                    }
                }
                catch (Exception e)
                {
                    Logger.Instance.WriteToLog(e.ToString());
                }
            }
        }