示例#1
0
        private void test_excel_Click(object sender, EventArgs e)
        {
            dateTimeCopy.Value = dateTime.Value;
            string time1 = ToTime.convertTime(dateTimeCopy.Text + " " + str_Time1.Text, 0);
            //ToExcel.wExcel("行1列1\t行1列2\t\r\n行2列1\t行2列2\t\r\n行3列1\t行3列2\t\r\n行4列1\t行4列2\t\r\n行5列1\t行5列2\t\r\n");
            string time2 = ToTime.convertTime(dateTimeCopy.Text + " " + str_Time1.Text, 15);

            LogOut.WriteLine(time1.ToString());
            LogOut.WriteLine(time2.ToString());
            LogOut.WriteLine(ToTime.CompareTimes(time2, time1).ToString());
        }
示例#2
0
        public string Search_final_result(string tag_id, string m_strDate, string m_strTime1, string m_strTime2)
        {
            string userTable_Name    = "user" + m_strDate;
            string ideaconTable_Name = "ibeacon" + m_strDate;
            string baseStation       = "basestation";

            string[] result;
            int      k = 0;

            //string sql = string.Format("select * from " + ideaconTable_Name + "," + baseStation + " where " + ideaconTable_Name + ".BSMAC=" + baseStation + ".BSMAC and TagID=" + tag_id + " and Time>='" + m_strTime1 + "' and Time<='" + m_strTime2+ "';");
            //List<Object[]> retRows = ExecuteQuery(sql);
            //查询所得原始表
            for (string time = m_strTime1; ToTime.CompareTimes(time, m_strTime2); time = ToTime.convertTime(time, 90))                     //每90秒得到一个结果
            {
                for (string time1 = time; ToTime.CompareTimes(time1, ToTime.convertTime(time, 90)); time1 = ToTime.convertTime(time1, 10)) //每十秒得到一个结果
                {
                    int k = 0;
                    for (string time2 = time1; ToTime.CompareTimes(time1, ToTime.convertTime(time1, 10)); time2 = ToTime.convertTime(time2, 2))//每两秒得到一个结果
                    {
                        string          time2_end = ToTime.convertTime(time2, 2);
                        string          sql       = string.Format("select * from " + ideaconTable_Name + "," + baseStation + " where " + ideaconTable_Name + ".BSMAC=" + baseStation + ".BSMAC and TagID=" + tag_id + " and Time>='" + m_strTime1 + "' and Time<='" + m_strTime2 + "';");
                        List <Object[]> retRows   = ExecuteQuery(sql);

                        foreach (object[] item in retRows)
                        {
                            if (int.Parse(item[3].ToString()) >= k)
                            {
                                k         = int.Parse(item[3].ToString());
                                result[k] = item[1].ToString();
                            }
                            k++;
                            LogOut.WriteLine(result[k]);
                        }
                    }//result数组被五个基站的Mac地址填满,下一步五选一
                }
            }

            /*foreach (object[] item in retRows)
             * {
             *  result += item[2].ToString() + "\t" + item[1].ToString() + "\t" + item[3].ToString() + "\t" + item[7].ToString() + "\t" + item[4].ToString() + "\t\r\n";
             *  LogOut.WriteLine(item[4].ToString());
             *  cnt++;
             * }*/
            return(result);
        }