Пример #1
0
        public Control Make(UI.ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, UI.Instance parentNode, Action <Control> controlAction)
        {
            var button = new Control()
            {
                Virtual     = true,
                ParentNode  = parentNode,
                ControlType = ControlType.ButtonPageNumberControl
            };

            button.Props = new Dictionary <string, object>()
            {
                { "Width", 1 },
                { "PageSize", ticketSet.PageSize.ToString() },
                { "SortFieldId", ticketSet.SortField.Id.ToString() },
                { "SortDirection", ticketSet.SortDirection },
                { "Style", GetStyle() }
            };

            controlAction(button);

            button.Props.Add("PageNumber", button.Props["DisplayName"]);

            button.Value = button.Props["DisplayName"];

            var evt = new Event()
            {
                Virtual = true, EventType = EventType.Click, ParentNode = button
            };

            evt.Actions.Add(new SearchActionBehaviour(CurrentUser).Make(null, null, evt));

            button.Events.Add(evt);

            return(button);
        }
Пример #2
0
        public UI.Control Make(UI.ControlDefinition definition, DAL.Models.DbSearchResponse ticketSet, UI.Instance parentNode, Action <UI.Control> controlAction)
        {
            var button = new UI.Control()
            {
                ControlType = Mapper.Map <UI.ControlType>(definition.ControlType),
                ParentNode  = parentNode
            };

            var dalControl = (DAL.Models.Control)definition.Entity;

            var ticket = ticketSet.Tickets.FirstOrDefault();

            if (dalControl.Field != null)
            {
                button.Props.Add("FieldId", dalControl.Field.Id);
                button.Props.Add("Name", dalControl.Field.Name);
                button.DocId = Convert.ToInt32(ticket[dalControl.Field]);
            }

            button.Events = definition
                            .Events
                            .Select(e => BehaviourSelector.EventBehaviours[Mapper.Map <UI.EventType>(e.EventType)](CurrentUser).Make(e, ticketSet, button))
                            .ToList();

            button.Props = new Dictionary <string, object>()
            {
                { "DisplayName", definition.DisplayName },
                { "Width", definition.Width },
                { "Order", definition.OrderIndex },
                { "Style", Mapper.Map <UI.StyleDefinition>(((DAL.Models.Control)definition.Entity).Style) }
            };

            return(button);
        }
Пример #3
0
        public UI.ControlDefinition UpdateControl(UI.ControlDefinition control)
        {
            var dbControl = Mapper.Map <DAL.Models.Control>(control);

            dbControl = DbEditorService.UpdateControl(dbControl);

            return(Mapper.Map <UI.ControlDefinition>(dbControl));
        }
Пример #4
0
        public UI.ControlDefinition CreateControl(UI.ControlDefinition control)
        {
            var dalControl = DbEditorService.CreateControl(Mapper.Map <DAL.Models.Control>(control));

            return(Mapper.Map <UI.ControlDefinition>(dalControl));
        }