/// <summary>
        /// Tab关闭时触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Item_RequestClose(object sender, EventArgs e)
        {
            DiagramPageViewModel item = sender as DiagramPageViewModel;

            DiagramDataSource.Remove(item);
            this.WebInterAct.DeleteProcess(WorkflowUtils.CLIENTSCRIPT_PARAM_WORKFLOW,
                                           item.Key,
                                           WorkflowUtils.ExtractWorkflowInfoJson(item));
        }
Esempio n. 2
0
        public IActionResult CRUD()
        {
            DiagramCrudAction nodeCrud = new DiagramCrudAction()
            {
                //Define URL to perform CRUD operations with nodes records in database.
                Read         = "https://js.syncfusion.com/demos/ejServices/api/Diagram/GetNodes",
                Create       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/AddNodes",
                Update       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/UpdateNodes",
                Destroy      = "https://js.syncfusion.com/demos/ejServices/api/Diagram/DeleteNodes",
                CustomFields = new object[] { "Id", "Description", "Color" },
            };

            ViewBag.NodeCrud = nodeCrud;
            ConnectionDataSource dataSource = new ConnectionDataSource()

            {
                Id           = "Name",
                SourceID     = "SourceNode",
                TargetID     = "TargetNode",
                CustomFields = new object[] { "Id" },
                CrudAction   = new CRUDAction()
                {
                    //Define URL to perform CRUD operations with connector records in database.
                    Read         = "https://js.syncfusion.com/demos/ejServices/api/Diagram/GetConnectors",
                    Create       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/AddConnectors",
                    Update       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/UpdateConnectors",
                    Destroy      = "https://js.syncfusion.com/demos/ejServices/api/Diagram/DeleteConnectors",
                    CustomFields = new object[] { "Id" },
                }
            };

            ViewBag.DataSource = dataSource;

            DiagramDataSource DataSourceSettings = new DiagramDataSource();

            DataSourceSettings.Id                   = "Name";
            DataSourceSettings.CrudAction           = nodeCrud;
            DataSourceSettings.ConnectionDataSource = dataSource;
            ViewBag.DataSourceSettings              = DataSourceSettings;

            ViewBag.button = new
            {
                content   = "Update",
                isPrimary = true
            };
            ViewBag.setNodeTemplate   = "setNodeTemplate";
            ViewBag.nodeDefaults      = "nodeDefaults";
            ViewBag.connectorDefaults = "connectorDefaults";
            return(View());
        }
        /// <summary>
        /// Tab关闭时触发
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Item_RequestClose(object sender, EventArgs e)
        {
            DiagramPageViewModel item = sender as DiagramPageViewModel;

            DiagramDataSource.Remove(item);
        }
        // GET: CRUD
        public ActionResult CRUD()
        {
            //Add icons in Toolbar.
            List <ToolbarItem> items = new List <ToolbarItem>();

            items.Add(new ToolbarItem {
                TooltipText = "Add", Id = "Add", PrefixIcon = "e-ddb-icons e-add", Text = "Add"
            });
            items.Add(new ToolbarItem {
                Type = ItemType.Separator
            });
            items.Add(new ToolbarItem {
                TooltipText = "Edit", Id = "Edit", PrefixIcon = "e-ddb-icons e-update", Text = "Edit"
            });
            items.Add(new ToolbarItem {
                Type = ItemType.Separator
            });
            items.Add(new ToolbarItem {
                TooltipText = "Delete", Id = "Delete", PrefixIcon = "e-ddb-icons e-delete", Text = "Delete"
            });

            ViewBag.tbItems = items;

            DiagramCrudAction nodeCrud = new DiagramCrudAction()
            {
                //Define URL to perform CRUD operations with nodes records in database.
                Read         = "https://js.syncfusion.com/demos/ejServices/api/Diagram/GetNodes",
                Create       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/AddNodes",
                Update       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/UpdateNodes",
                Destroy      = "https://js.syncfusion.com/demos/ejServices/api/Diagram/DeleteNodes",
                CustomFields = new object[] { "Id", "Description", "Color" },
            };

            ViewBag.NodeCrud = nodeCrud;



            ConnectionDataSource dataSource = new ConnectionDataSource()
            {
                Id           = "Name",
                SourceID     = "SourceNode",
                TargetID     = "TargetNode",
                CustomFields = new object[] { "Id" },
                CrudAction   = new CRUDAction()
                {
                    //Define URL to perform CRUD operations with connector records in database.
                    Read         = "https://js.syncfusion.com/demos/ejServices/api/Diagram/GetConnectors",
                    Create       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/AddConnectors",
                    Update       = "https://js.syncfusion.com/demos/ejServices/api/Diagram/UpdateConnectors",
                    Destroy      = "https://js.syncfusion.com/demos/ejServices/api/Diagram/DeleteConnectors",
                    CustomFields = new object[] { "Id" },
                }
            };

            ViewBag.DataSource = dataSource;

            DiagramDataSource DataSourceSettings = new DiagramDataSource();

            DataSourceSettings.Id                   = "Name";
            DataSourceSettings.CrudAction           = nodeCrud;
            DataSourceSettings.ConnectionDataSource = dataSource;
            ViewBag.DataSourceSettings              = DataSourceSettings;

            //Button control rendered in dialog to update node bgColor and label.
            List <DialogDialogButton> buttons = new List <DialogDialogButton>()
            {
            };

            buttons.Add(new DialogDialogButton()
            {
                Click = "dlgButtonClick", ButtonModel = new DefaultButtonModel()
                {
                    content = "Update", isPrimary = true
                }
            });
            ViewBag.DefaultButtons = buttons;

            return(View());
        }