Exemplo n.º 1
0
        public Point EditPoint(Point p1)
        {
            try
            {
                p1.Bound.SetMinMaxXY();
                var dbBound = db.Bounds.Find(p1.BoundId);
                dbBound.Update(p1.Bound);
                db.Bounds.Edit(dbBound);

                var dbPoint = db.Points.Find(p1.Id);
                dbPoint.Update(p1);
                bool r = db.Points.Edit(dbPoint);
                if (r)
                {
                    return(p1);
                }
                else
                {
                    return(null);
                }
            }
            catch (System.Exception ex)
            {
                Log.Error(tag, "EditPoint", ex.ToString());
                return(null);
            }
        }
Exemplo n.º 2
0
 public Point AddPoint(TEntity area, Point point)
 {
     try
     {
         var bound = GetBound(area);
         if (bound == null)
         {
             return(null);
         }
         point.BoundId = bound.Id;
         //p1.Bound = Bound;
         var  dbPoint = point.ToDbModel();
         bool r       = db.Points.Add(dbPoint);
         if (r)
         {
             point.Id = dbPoint.Id;
             bound.AddPoint(point);
             return(point);
         }
         else
         {
             return(null);
         }
     }
     catch (System.Exception ex)
     {
         Log.Error(tag, "AddPoint", ex.ToString());
         return(null);
     }
 }
        internal bool?Show(int areaId, Point point)
        {
            var area = bll.Areas.Find(areaId);

            if (area.Type == AreaTypes.楼层)
            {
                _floor = area;
                _room  = Bll.GetRoomByPos(_floor.Id, point.X, point.Y);
            }
            else if (area.Type == AreaTypes.机房)
            {
                _room  = area;
                _floor = _room.Parent;
            }
            else
            {
                return(false);
            }

            TbBuildingName.Text = _floor.Parent.Name;
            TbFloorName.Text    = _floor.Name;
            floorHeight         = _floor.InitBound.MinZ;
            //TbFloorHeight.Text = floorHeight.ToString("F2");
            if (_room != null)
            {
                TbRoomName.Text = _room.Name;
            }

            var devs = bll.DevInfos.Where(i => i.ParentId == _floor.Id && i.Local_TypeCode == TypeCodes.TrackPoint);

            _tp = new DevInfo();
            _tp.Local_TypeCode = TypeCodes.TrackPoint;
            _tp.PosX           = point.X;
            _tp.PosZ           = point.Y;
            if (_room != null)
            {
                _tp.Name = _room.Name + "_测点_" + (devs.Count + 1);
            }
            else
            {
                _tp.Name = _floor.Name + "_测点_" + (devs.Count + 1);
            }
            _tp.ParentId = _floor.Id;

            TbName.Text = _tp.Name;
            PcArchor.X  = _tp.PosX;
            PcArchor.Y  = _tp.PosZ;

            return(this.ShowDialog());
        }
Exemplo n.º 4
0
 public void SelectPoint(Point point)
 {
     if (SelectedEllipse != null)
     {
         SelectedEllipse.Stroke = Brushes.Blue;
     }
     if (point == null)
     {
         return;
     }
     if (PointEllipse.ContainsKey(point))
     {
         Ellipse ellipse = PointEllipse[point];
         ellipse.Stroke  = Brushes.Red;
         SelectedEllipse = ellipse;
         SelectedPoint   = point;
     }
 }
        private void MenuAdd_Click(object sender, RoutedEventArgs e)
        {
            var bound = Area.InitBound;


            //var point = ListBox1.SelectedItem as Location.TModel.Location.AreaAndDev.Point;
            var point = new Point();
            var win   = new ItemInfoWindow(point);

            win.SaveEvent += (w, p) =>
            {
                var p1  = p as Point;
                var bll = AppContext.GetLocationBll();
                var r   = new AreaService(bll).AddPoint(Area, p1);
                return(r != null);
            };
            if (win.ShowDialog() == true)
            {
                DrawArea();
            }
        }
Exemplo n.º 6
0
        public Point EditPoint(Point p1)
        {
            p1.Bound.SetMinMaxXY();
            var dbBound = db.Bounds.Find(p1.BoundId);

            dbBound.Update(p1.Bound);
            db.Bounds.Edit(dbBound);

            var dbPoint = db.Points.Find(p1.Id);

            dbPoint.Update(p1);
            bool r = db.Points.Edit(dbPoint);

            if (r)
            {
                return(p1);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 7
0
        public Point AddPoint(TEntity area, Point point)
        {
            var bound = GetBound(area);

            if (bound == null)
            {
                return(null);
            }
            point.BoundId = bound.Id;
            //p1.Bound = Bound;
            var  dbPoint = point.ToDbModel();
            bool r       = db.Points.Add(dbPoint);

            if (r)
            {
                point.Id = dbPoint.Id;
                bound.AddPoint(point);
                return(point);
            }
            else
            {
                return(null);
            }
        }