示例#1
0
        /**************************************************************************************************/
        public override void BackgroundLoadWork()
        {
            string sql = "select * from v_3_HighRiskColonQueue";
            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())
                        {

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

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

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

            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())
                        {
                            HighRiskColonQueueEntry hrcqe = new HighRiskColonQueueEntry();
                            for (int i = 0; i < reader.FieldCount; i++)
                            {
                                if (reader.IsDBNull(i) == false)
                                {
                                    foreach (FieldInfo fi in hrcqe.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public))
                                    {
                                        string name = fi.Name;
                                        if (name == reader.GetName(i))
                                        {
                                            fi.SetValue(hrcqe, reader.GetValue(i));
                                            break;
                                        }
                                    }
                                }
                            }
                            HighRiskColonPeople.Add(hrcqe);
                        }
                        reader.Close();
                    }
                }
                catch (Exception e)
                {
                    Logger.Instance.WriteToLog(e.ToString());
                }
            }
        }