Ejemplo n.º 1
0
        /// <summary>
        /// 如果绑定控件,DataTable方式可以减少数据复制,但本应用需要对数据做聚类处理,需要用上面方法做数据的初步解析
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        private static DataTable findConsFromDate(string date)
        {
            //DataTable dt = CServerWrapper.findConsInfo(DateTime.Now.AddDays(-30).Date.ToString("u"));
            DataTable dt = CServerWrapper.findConsInfo(date);

            return(dt);
        }
Ejemplo n.º 2
0
        //public static int findLast30Cons(out string[] usrName, out string[] projName, out string[] consDate, out double[] longitude, out double[] latitude)
        //{
        //    return findConsFromDate(DateTime.Now.AddDays(-30).Date.ToString("u"), out usrName, out projName, out consDate, out longitude, out latitude);
        //}

        //public static int findLast365Cons(out string[] usrName, out string[] projName, out string[] consDate, out double[] longitude, out double[] latitude)
        //{
        //    return findConsFromDate(DateTime.Now.AddDays(-365).Date.ToString("u"), out usrName, out projName, out consDate, out longitude, out latitude);
        //}


        private static int findConsFromDate(string date, out string[] usrName, out string[] projName, out string[] projDWName, out double[] longitude, out double[] latitude)
        {
            int num = 0;

            usrName   = projName = projDWName = null;
            longitude = latitude = null;

            //DataTable dt = CServerWrapper.findConsInfo(DateTime.Now.AddDays(-30).Date.ToString("u"));
            DataTable dt = CServerWrapper.findConsInfo(date);

            //DatabaseWrapper.PrintDataTable(dt);
            num = dt.Rows.Count;

            if (num == 0)
            {
                return(0);
            }

            usrName    = new string[num];
            projName   = new string[num];
            projDWName = new string[num];
            longitude  = new double[num];
            latitude   = new double[num];

            int i = 0;

            foreach (DataRow dr in dt.Rows)
            {
                usrName[i]    = dr["UsrName"].ToString();
                projName[i]   = dr["ProjectName"].ToString();
                projDWName[i] = dr["DwName"].ToString();
                longitude[i]  = Convert.ToDouble(dr["Longitude"]);
                latitude[i]   = Convert.ToDouble(dr["Latitude"]);
                i++;
            }
            return(num);
        }