Пример #1
0
        private void SetAllInteractionsLast()
        {
            List <InteractionDB> interactionLog = new List <InteractionDB>();
            InteractionDB        ins;

            SqlConnection sqlConn = DataBaseConnection.SqlConn();

            using (var con = sqlConn)
            {
                con.Open();

                using (SqlCommand cmd = new SqlCommand("exec service_GetInteractionsAllGiveTime @StartDate, @EndDate", con))
                {
                    DateTime EndDate   = DateTime.Today;
                    DateTime StartDate = EndDate.AddDays(-1 * this.SocialHistoryDays);

                    cmd.Parameters.AddWithValue("@StartDate", StartDate);
                    cmd.Parameters.AddWithValue("@EndDate", EndDate);

                    using (var drI = cmd.ExecuteReader())
                    {
                        int AnimalConnectedIndex = drI.GetOrdinal("AnimalConnectedTo");
                        int AnimalInProxIndex    = drI.GetOrdinal("AnimalInProximity");
                        int NumberIndex          = drI.GetOrdinal("Interactions");
                        int TimeIndex            = drI.GetOrdinal("TimeConnected");

                        while (drI.Read())
                        {
                            ins = new InteractionDB();

                            ins.AnimalConnected    = Convert.ToInt32(drI[AnimalConnectedIndex]);
                            ins.AnimalInProx       = Convert.ToInt32(drI[AnimalInProxIndex]);
                            ins.NumberInteractions = Convert.ToInt32(drI[NumberIndex]);
                            ins.TimeInteracted     = Convert.ToInt32(drI[TimeIndex]);
                            ins.InterAct           = new Interaction(ins.AnimalInProx, ins.NumberInteractions, ins.TimeInteracted);

                            interactionLog.Add(ins);
                        }
                    }
                }

                con.Close();
                con.Dispose();
            }

            //Console.WriteLine("Done Inserting Data in object list @ " + DateTime.Now.ToString());
            this.AllInteractionsLast = interactionLog;
            this.SetInteractionsLast();
            //Console.WriteLine("Done Processing List @ " + DateTime.Now.ToString());
        }
Пример #2
0
        private void SetAllInteractions()
        {
            List <InteractionDB> interactionLog = new List <InteractionDB>();
            InteractionDB        ins;

            SqlConnection sqlConn = DataBaseConnection.SqlConn();

            using (var con = sqlConn)
            {
                con.Open();

                using (SqlCommand cmd = new SqlCommand("exec service_GetInteractionsAll", con))
                {
                    using (var drI = cmd.ExecuteReader())
                    {
                        int AnimalConnectedIndex = drI.GetOrdinal("AnimalConnectedTo");
                        int AnimalInProxIndex    = drI.GetOrdinal("AnimalInProximity");
                        int NumberIndex          = drI.GetOrdinal("Interactions");
                        int TimeIndex            = drI.GetOrdinal("TimeConnected");

                        while (drI.Read())
                        {
                            ins = new InteractionDB();
                            ins.AnimalConnected    = Convert.ToInt32(drI[AnimalConnectedIndex]);
                            ins.AnimalInProx       = Convert.ToInt32(drI[AnimalInProxIndex]);
                            ins.NumberInteractions = Convert.ToInt32(drI[NumberIndex]);
                            ins.TimeInteracted     = Convert.ToInt32(drI[TimeIndex]);
                            ins.InterAct           = new Interaction(ins.AnimalInProx, ins.NumberInteractions, ins.TimeInteracted);

                            interactionLog.Add(ins);
                        }
                    }
                }

                con.Close();
                con.Dispose();
            }

            //Console.WriteLine("Done Inserting Data in object list @ " + DateTime.Now.ToString());
            this.AllInteractions = interactionLog;
            this.SetInteractions();
            //Console.WriteLine("Done Processing List @ " + DateTime.Now.ToString());
        }
Пример #3
0
        private void SetAllInteractionsLast()
        {
            List<InteractionDB> interactionLog = new List<InteractionDB>();
            InteractionDB ins;

            SqlConnection sqlConn = DataBaseConnection.SqlConn();

            using (var con = sqlConn)
            {
                con.Open();

                using (SqlCommand cmd = new SqlCommand("exec service_GetInteractionsAllGiveTime @StartDate, @EndDate", con))
                {
                    DateTime EndDate = DateTime.Today;
                    DateTime StartDate = EndDate.AddDays(-1 * this.SocialHistoryDays);

                    cmd.Parameters.AddWithValue("@StartDate", StartDate);
                    cmd.Parameters.AddWithValue("@EndDate", EndDate);

                    using (var drI = cmd.ExecuteReader())
                    {
                        int AnimalConnectedIndex = drI.GetOrdinal("AnimalConnectedTo");
                        int AnimalInProxIndex = drI.GetOrdinal("AnimalInProximity");
                        int NumberIndex = drI.GetOrdinal("Interactions");
                        int TimeIndex = drI.GetOrdinal("TimeConnected");

                        while (drI.Read())
                        {
                            ins = new InteractionDB();

                            ins.AnimalConnected = Convert.ToInt32(drI[AnimalConnectedIndex]);
                            ins.AnimalInProx = Convert.ToInt32(drI[AnimalInProxIndex]);
                            ins.NumberInteractions = Convert.ToInt32(drI[NumberIndex]);
                            ins.TimeInteracted = Convert.ToInt32(drI[TimeIndex]);
                            ins.InterAct = new Interaction(ins.AnimalInProx, ins.NumberInteractions, ins.TimeInteracted);

                            interactionLog.Add(ins);
                        }
                    }
                }

                con.Close();
                con.Dispose();
            }

            //Console.WriteLine("Done Inserting Data in object list @ " + DateTime.Now.ToString());
            this.AllInteractionsLast = interactionLog;
            this.SetInteractionsLast();
            //Console.WriteLine("Done Processing List @ " + DateTime.Now.ToString());
        }
Пример #4
0
        private void SetAllInteractions()
        {
            List<InteractionDB> interactionLog = new List<InteractionDB>();
            InteractionDB ins;

            SqlConnection sqlConn = DataBaseConnection.SqlConn();

            using (var con = sqlConn)
            {
                con.Open();

                using (SqlCommand cmd = new SqlCommand("exec service_GetInteractionsAll", con))
                {
                    using (var drI = cmd.ExecuteReader())
                    {
                        int AnimalConnectedIndex = drI.GetOrdinal("AnimalConnectedTo");
                        int AnimalInProxIndex = drI.GetOrdinal("AnimalInProximity");
                        int NumberIndex = drI.GetOrdinal("Interactions");
                        int TimeIndex = drI.GetOrdinal("TimeConnected");

                        while (drI.Read())
                        {
                            ins = new InteractionDB();
                            ins.AnimalConnected = Convert.ToInt32(drI[AnimalConnectedIndex]);
                            ins.AnimalInProx = Convert.ToInt32(drI[AnimalInProxIndex]);
                            ins.NumberInteractions = Convert.ToInt32(drI[NumberIndex]);
                            ins.TimeInteracted = Convert.ToInt32(drI[TimeIndex]);
                            ins.InterAct = new Interaction(ins.AnimalInProx, ins.NumberInteractions, ins.TimeInteracted);

                            interactionLog.Add(ins);
                        }
                    }
                }

                con.Close();
                con.Dispose();
            }

            //Console.WriteLine("Done Inserting Data in object list @ " + DateTime.Now.ToString());
            this.AllInteractions = interactionLog;
            this.SetInteractions();
            //Console.WriteLine("Done Processing List @ " + DateTime.Now.ToString());
        }