Esempio n. 1
0
        public void Put(int id, [FromBody] IEnumerable<TaskWaypoint> task)
        {
            var taskAdapter = new TrackerDataSetTableAdapters.TaskTableAdapter();
              TrackerDataSet.TaskDataTable taskTable = taskAdapter.GetDataByEventId(id);

              foreach (DataRow row in taskTable.Rows)
              {
            row.Delete();
              }

              if (task != null)
              {
            int iWp = 0;
            foreach (TaskWaypoint waypoint in task)
            {
              taskTable.AddTaskRow(waypoint.id, waypoint.radius, iWp++);
            }
              }

              taskAdapter.Update(taskTable);
        }
Esempio n. 2
0
        protected void Page_PreRender(object sender, EventArgs e)
        {
            string waypointsJsArr =
            string.Join(
              ", ",
              _allEventWaypoints
              .Select(row => $"{{id: {row.Id}, name: '{row.Name}'}}")
            );
              Page.ClientScript.RegisterArrayDeclaration("_allWaypoints", waypointsJsArr);

              var taskAdapter = new TrackerDataSetTableAdapters.TaskTableAdapter();
              TrackerDataSet.TaskDataTable taskTable = taskAdapter.GetDataByEventId(EventId);

              string taskPointsArr =
            string.Join(
              ", ",
              taskTable
              .Select(row => $"{{id: {row.WaypointId}, radius: '{row.Radius}'}}")
            );
              Page.ClientScript.RegisterArrayDeclaration("_taskWaypoints", taskPointsArr);

              // The code below can't be in Page_Load because uploadBtn_Click is fired after that, and
              // we need all the just inserted wpts when we fill comboboxes and decide whether to show taskPanel or not.
              // At the same time, we can't do that in uploadBtn_Click because we need the same stuff every time page loads.
              // So do it here, after all other events has fired.

              loadWaypointsPanel.Visible = noWaypointsInfoPanel.Visible = AllEventWptsCount == 0;
              taskPanel.Visible = !loadWaypointsPanel.Visible;
        }