Пример #1
0
        private void MainPictureBox_MouseDown(object sender, MouseEventArgs e)
        {
            if (!_isSelectMode && !_isMoveMode && e.Button == MouseButtons.Left)
            {
                var hexSize = new ShapeSize(pictureBoxMain.Size);
                _bl.NewShape(_currentMode, _currentBrashSize, _curentcolor, _cornesValue, hexSize);
                _bl.Last().MouseDown(new ShapePoint(e.Location));

                Repaint();
            }
            else if (_isSelectMode && !_isStartMove && e.Button == MouseButtons.Left)
            {
                _lastPonit  = new ShapePoint(e.Location);
                _isSelected = _bl.IsSelectShape(_lastPonit);

                if (_isSelected && _isMoveMode)
                {
                    _isStartMove = true;
                    IShape currentShape = _bl.GetSelectedShape();
                    _currentBitmap = new PaintBitmap(pictureBoxMain.Width, pictureBoxMain.Height);
                    Repaint();
                    _bl.UpdatePicture(_currentBitmap);
                    currentShape.EShapeStatus = EShapeStatus.IN_PROGRESS;
                    _bl.AddSelectShape(currentShape);
                    Repaint();
                }
            }
        }
Пример #2
0
 public Rectangle(ShapeSize size)
 {
     Size = size;
     ++Rectangle.RectangleCounter;
 }
Пример #3
0
        public JsonResult Save(ShapeSizeViewModel model)
        {
            Response response;

            try
            {
                int    status  = 200;
                string message = string.Empty;
                using (var db = new KiaGalleryContext())
                {
                    var user = GetAuthenticatedUser();
                    if (model.id != null && model.id > 0)
                    {
                        var entity = db.ShapeSize.Single(x => x.Id == model.id);
                        entity.Order        = model.order;
                        entity.StoneShape   = model.stoneShape;
                        entity.SizeLength   = model.sizeLength;
                        entity.SizeWidth    = model.sizeWidth;
                        entity.Active       = model.active;
                        entity.ModifyUserId = GetAuthenticatedUserId();
                        entity.ModifyDate   = DateTime.Now;
                        entity.Ip           = Request.UserHostAddress;

                        status  = 200;
                        message = "سایز با موفقیت ویرایش شد.";
                    }
                    else
                    {
                        var entity = new ShapeSize()
                        {
                            Order        = model.order,
                            StoneShape   = model.stoneShape,
                            SizeLength   = model.sizeLength,
                            SizeWidth    = model.sizeWidth,
                            Active       = model.active,
                            CreateUserId = GetAuthenticatedUserId(),
                            ModifyUserId = GetAuthenticatedUserId(),
                            CreateDate   = DateTime.Now,
                            ModifyDate   = DateTime.Now,
                            Ip           = Request.UserHostAddress
                        };

                        db.ShapeSize.Add(entity);

                        status  = 200;
                        message = "سایز با موفقیت ایجاد شد.";
                    }
                    db.SaveChanges();
                }

                response = new Response()
                {
                    status  = status,
                    message = message
                };
            }
            catch (Exception ex)
            {
                response = Core.GetExceptionResponse(ex);
            }

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
 public Triangle(ShapeSize size)
 {
     Size = size;
     ++Triangle.TriangleCounter;
 }