예제 #1
0
        // This entire method is a proof-of-concept.  It will not work like this.
        private void ShowLocations(int userId)
        {
            var devices = Sprocs.GetUserDevices(userId);

            foreach (var device in devices)
            {
                var gridView  = new GridView();
                var dataTable = new DataTable();
                gridView.RowDataBound += gridView_RowDataBound;
                dataTable.Columns.Add(new DataColumn("TimeStamp", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Longitude", typeof(string)));
                dataTable.Columns.Add(new DataColumn("Latitude", typeof(string)));

                foreach (var logloc in device.LocationLogs)
                {
                    DataRow dataRow = dataTable.NewRow();
                    dataRow["TimeStamp"] = Utils.FormatTimeStamp(logloc.TimeStamp);
                    dataRow["Longitude"] = logloc.Longitude.ToString();
                    dataRow["Latitude"]  = logloc.Latitude.ToString();

                    //Utils.LinkDataRow()

                    dataTable.Rows.Add(dataRow);
                }
                gridView.DataSource = dataTable;
                gridView.DataBind();

                if (devices.Count > 1)
                {
                    var devicename = new Label();
                    devicename.Text = device.Name;
                    viewScheduling.Controls.Add(devicename);
                }
                viewScheduling.Controls.Add(gridView);
            }
        }