Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (dlFences.SelectedIndex == 0)
                {
                    return;
                }
                int fenceId = Convert.ToInt32(dlFences.SelectedValue);
                RemoveTrackers(fenceId);

                int fenceID = Convert.ToInt32(dlFences.SelectedValue);

                foreach (ListItem item in lbTrackers.Items)
                {
                    var trackerId       = Convert.ToInt64(item.Value);
                    var trackerFenceMap = new TrackerFenceMap()
                    {
                        TrackerId = Convert.ToString(trackerId),
                        FencesId  = fenceID
                    };
                    TrackerFenceMapManager.Add(trackerFenceMap);
                    //lblError.Text = "Record Saved Successfully";
                    //lblError.ForeColor = System.Drawing.Color.Red;
                    //lblError.Visible = true;
                }
            }
            catch (System.Exception ex)
            {
                lblError.Text    = ex.ToString();
                lblError.Visible = true;
            }
        }
Esempio n. 2
0
        public bool AddFenceTracker(string fenceId, string trackers)
        {
            int id = 0;

            if (!int.TryParse(fenceId, out id))
            {
                return(false);
            }

            TrackerFenceMapManager.RemoveTrackerByFenceId(id);
            var tr = (trackers + "").Split(',');

            foreach (var item in tr)
            {
                if (String.IsNullOrWhiteSpace(item))
                {
                    continue;
                }

                var trackerFenceMap = new TrackerFenceMap()
                {
                    TrackerId = item,
                    FencesId  = id
                };
                TrackerFenceMapManager.Add(trackerFenceMap);
            }
            return(true);
        }