Ejemplo n.º 1
0
        public IActionResult addTransactionStone([FromBody] Stone stn)
        {
            if (stn == null)
            {
                return(BadRequest());
            }

            if (stn.MerchantKey == "" || stn.MerchantKey == null)
            {
                ErrorReport er = new ErrorReport();
                er.Category = "Key Invalida";
                ErrorItemCollection[] eic = new ErrorItemCollection[1];
                eic[0]                 = new ErrorItemCollection();
                eic[0].Description     = "Chave de utilização inválida";
                eic[0].ErrorCode       = 1;
                eic[0].ErrorField      = "Merchant-Key";
                er.ErrorItemCollection = eic;

                stn.ErrorReport = er;
                return(new ObjectResult(stn));
            }


            return(CreatedAtRoute("GetTransacaoStone", new { trans = stn }, stn));
        }
        public void DrawToGraphics(ErrorItemCollection items,
            ErrorItem selected, Graphics g, Rectangle viewport)
        {
            SizeF sizeLineSource;
            int last;
            int i;

            UiExceptionHelper.CheckNotNull(items, "items");
            UiExceptionHelper.CheckNotNull(g, "g");

            if (!_paintData.Equals(items, selected, viewport))
            {
                _paintData.Dispose();
                _paintData = new PaintData(items, selected, viewport, g);

                PaintBackground(Resources.ImageErrorList, _paintData.WorkingGraphics,
                    _rectListBackground, viewport);

                sizeLineSource = g.MeasureString("Line 9999", _font);
                _offsetLine = viewport.Width - sizeLineSource.Width;

                last = LastIndexVisible(items.Count, viewport);
                for (i = FirstIndexVisible(items.Count, viewport); i <= last; ++i)
                    DrawItem(items[i], i, selected == items[i], i == items.Count - 1, false, 
                        _paintData.WorkingGraphics, viewport);

                //_paintData.WorkingGraphics.DrawImage(Resources.ErrorList,
                //new Rectangle(0, 0, viewport.Width, _rectShadow.Height),
                //_rectShadow, GraphicsUnit.Pixel);
            }
            
            _paintData.PaintTo(g);           

            return;
        }
            public bool Equals(ErrorItemCollection items, ErrorItem item, Rectangle rectangle)
            {
                ErrorItem first = ((items.Count > 0) ? items[0] : null);

                return(viewport.Equals(rectangle) &&
                       object.ReferenceEquals(item, selection) &&
                       object.ReferenceEquals(first, _firstItem));
            }
        public ErrorItem ItemAt(ErrorItemCollection items, Graphics g, Point point)
        {
            int idx = point.Y / _itemHeight;

            if (items == null || point.Y < 0 || idx >= items.Count)
            {
                return(null);
            }

            return(items[idx]);
        }
        public void SetUp()
        {
            _items = new InternalTraceItemCollection();

            _resourceA = new TestResource("HelloWorld.txt");
            _resourceB = new TestResource("TextCode.txt");

            _itemA = new ErrorItem(_resourceA.Path, 1);
            _itemB = new ErrorItem(_resourceB.Path, 2);

            return;
        }
        public void SetUp()
        {
            _items = new InternalTraceItemCollection();

            _resourceA = new TestResource("HelloWorld.txt");
            _resourceB = new TestResource("TextCode.txt");

            _itemA = new ErrorItem(_resourceA.Path, 1);
            _itemB = new ErrorItem(_resourceB.Path, 2);

            return;
        }
            public PaintData(ErrorItemCollection items, ErrorItem item, Rectangle rectangle, Graphics g)
            {
                if (item == null)
                {
                    item = new ErrorItem();
                }
                selection = item;

                _firstItem = ((items.Count > 0) ? items[0] : null);

                viewport = rectangle;

                _workingImage   = new Bitmap(rectangle.Width, rectangle.Height, g);
                WorkingGraphics = Graphics.FromImage(_workingImage);

                return;
            }
Ejemplo n.º 8
0
        protected ErrorList(IErrorListRenderer renderer)
        {
            UiExceptionHelper.CheckNotNull(renderer, "display");

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            DoubleBuffered = true;

            _renderer        = renderer;
            _items           = new ErrorItemCollection();
            _stackTrace      = null;
            _selection       = null;
            _workingGraphics = CreateGraphics();
            _hoveredIndex    = -1;

            _autoSelectFirstItem = false;
            _listOrder           = ErrorListOrderPolicy.InitialOrder;

            return;
        }
        public Size GetDocumentSize(ErrorItemCollection items, Graphics g)
        {
            SizeF current;
            float w;

            _paintData = new PaintData();

            if (items.Count == 0)
            {
                return(new Size());
            }

            w = 0;
            foreach (ErrorItem item in items)
            {
                current = MeasureItem(g, item);
                w       = Math.Max(w, current.Width);
            }

            return(new Size((int)w, items.Count * _itemHeight));
        }
        public void DrawToGraphics(ErrorItemCollection items,
                                   ErrorItem selected, Graphics g, Rectangle viewport)
        {
            SizeF sizeLineSource;
            int   last;
            int   i;

            UiExceptionHelper.CheckNotNull(items, "items");
            UiExceptionHelper.CheckNotNull(g, "g");

            if (!_paintData.Equals(items, selected, viewport))
            {
                _paintData.Dispose();
                _paintData = new PaintData(items, selected, viewport, g);

                PaintBackground(Resources.ImageErrorList, _paintData.WorkingGraphics,
                                _rectListBackground, viewport);

                sizeLineSource = g.MeasureString("Line 9999", _font);
                _offsetLine    = viewport.Width - sizeLineSource.Width;

                last = LastIndexVisible(items.Count, viewport);
                for (i = FirstIndexVisible(items.Count, viewport); i <= last; ++i)
                {
                    DrawItem(items[i], i, selected == items[i], i == items.Count - 1, false,
                             _paintData.WorkingGraphics, viewport);
                }

                //_paintData.WorkingGraphics.DrawImage(Resources.ErrorList,
                //new Rectangle(0, 0, viewport.Width, _rectShadow.Height),
                //_rectShadow, GraphicsUnit.Pixel);
            }

            _paintData.PaintTo(g);

            return;
        }
        public ErrorItem ItemAt(ErrorItemCollection items, Graphics g, Point point)
        {
            int idx = point.Y / _itemHeight;

            if (items == null || point.Y < 0 || idx >= items.Count)
                return (null);

            return (items[idx]);
        }
 public new bool IsDirty(ErrorItemCollection items, ErrorItem selection, Rectangle viewport) {
     return (base.IsDirty(items, selection, viewport));
 }
Ejemplo n.º 13
0
 public new bool IsDirty(ErrorItemCollection items, ErrorItem selection, Rectangle viewport)
 {
     return(base.IsDirty(items, selection, viewport));
 }
 protected bool IsDirty(ErrorItemCollection items, ErrorItem selection, Rectangle viewport)
 {
     return (!_paintData.Equals(items, selection, viewport));
 }
            public PaintData(ErrorItemCollection items, ErrorItem item, Rectangle rectangle, Graphics g)
            {
                if (item == null)
                    item = new ErrorItem();
                selection = item;

                _firstItem = ((items.Count > 0) ? items[0] : null);

                viewport = rectangle;

                _workingImage = new Bitmap(rectangle.Width, rectangle.Height, g);
                WorkingGraphics = Graphics.FromImage(_workingImage);

                return;
            }
 protected bool IsDirty(ErrorItemCollection items, ErrorItem selection, Rectangle viewport)
 {
     return(!_paintData.Equals(items, selection, viewport));
 }
            public bool Equals(ErrorItemCollection items, ErrorItem item, Rectangle rectangle)
            {               
                ErrorItem first = ((items.Count > 0) ? items[0] : null);

                return (viewport.Equals(rectangle) &&
                        object.ReferenceEquals(item, selection) &&
                        object.ReferenceEquals(first, _firstItem));
            }
        public Size GetDocumentSize(ErrorItemCollection items, Graphics g)
        {
            SizeF current;
            float w;

            _paintData = new PaintData();

            if (items.Count == 0)
                return (new Size());

            w = 0;
            foreach (ErrorItem item in items)
            {
                current = MeasureItem(g, item);
                w = Math.Max(w, current.Width);
            }            

            return (new Size((int)w, items.Count * _itemHeight));
        }
Ejemplo n.º 19
0
        protected ErrorList(IErrorListRenderer renderer)
        {
            UiExceptionHelper.CheckNotNull(renderer, "display");

            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            DoubleBuffered = true;

            _renderer = renderer;
            _items = new ErrorItemCollection();
            _stackTrace = null;
            _selection = null;
            _workingGraphics = CreateGraphics();
            _hoveredIndex = -1;

            _autoSelectFirstItem = false;
            _listOrder = ErrorListOrderPolicy.InitialOrder;

            return;
        }