/// <summary>
 /// Default Constructor
 /// (it requires that the DbManager connections is already set)
 /// </summary>
 public PersonSeenList()
 {
     if (instance == null)
     {
         lock (lockInitialization)
         {
             if (instance == null)
             {
                 peopleId = new List <Guid>();
                 faceId   = new List <Guid>();
                 faceTime = new List <DateTime>();
                 instance = new PersonSeenList(true);
                 LoadFaceFromDb();
             }
         }
     }
 }
 /// <summary>
 /// Read all people from DB detected in the current day
 /// and save them into the passed variable
 /// </summary>
 /// <param name="people">Container of people seen in the current day</param>
 public async void ReadPerson(PersonSeenList people)
 {
     try
     {
         List <Guid>     faceIds   = new List <Guid>();
         List <Guid>     peopleIds = new List <Guid>();
         List <DateTime> timeFace  = new List <DateTime>();
         using (SqlConnection conn = new SqlConnection(connections.DbConnectionString))
         {
             conn.Open();
             SqlDataReader personReader;
             try
             {
                 SqlCommand readComand = new SqlCommand(readPersonString, conn);
                 personReader = await readComand.ExecuteReaderAsync();
             } catch (Exception ex)
             {
                 throw new Exception("Unable to Read People Data\n" + ex.Message);
             }
             if (personReader.HasRows)
             {
                 while (personReader.Read())
                 {
                     try
                     {
                         faceIds.Add(new Guid((string)personReader["FaceId"]));
                         peopleIds.Add(new Guid((string)personReader["PersonId"]));
                         timeFace.Add((DateTime)personReader["Date"]);
                     }
                     catch
                     {
                     }
                 }
             }
             conn.Close();
         }
         people.Set(faceIds, peopleIds, timeFace);
     }
     catch (Exception ex)
     {
         throw new Exception("Error on Reading from DB\n" + ex.Message);
     }
 }
示例#3
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public FaceSentimentManager()
 {
     _faceServiceClient = new FaceServiceClient(faceApiKey, uriBase);
     trackList          = new PersonSeenList();
 }