Exemplo n.º 1
0
        protected RadDock AddRadDock(tbl_WidgetToAccessProfile widget)
        {
            if (string.IsNullOrEmpty(widget.tbl_Widget.UserControl))
            {
                return(null);
            }

            var radDock = new RadDock
            {
                Text       = string.Empty,
                ID         = Guid.NewGuid().ToString(),
                Skin       = "Windows7",
                DockMode   = DockMode.Docked,
                Width      = new Unit(290, UnitType.Pixel),
                Title      = widget.tbl_Widget.Title,
                UniqueName = Guid.NewGuid().ToString()
            };

            radDock.Commands.Add(new DockExpandCollapseCommand());

            var widgetControl = (WidgetBase)LoadControl(widget.tbl_Widget.UserControl);

            widgetControl.WidgetId      = widget.ID;
            widgetControl.AccessProfile = widget.tbl_AccessProfile;
            radDock.ContentContainer.Controls.Add(widgetControl);

            //radDock.OnClientDockPositionChanged = "RadDockPositionChanged";
            //radDock.OnClientCommand = "RadDockClientCommand";

            return(radDock);
            //radDockZone.Controls.Add(radDock);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Proceeds the drop.
        /// </summary>
        /// <param name="radDockZone">The RAD dock zone.</param>
        /// <param name="e">The <see cref="Telerik.Web.UI.RadTreeNodeDragDropEventArgs"/> instance containing the event data.</param>
        private void ProceedDrop(RadDockZone radDockZone, RadTreeNodeDragDropEventArgs e)
        {
            if ((WidgetTypeInTreeView)int.Parse(e.SourceDragNode.Attributes["Type"]) != WidgetTypeInTreeView.Category)
            {
                var widgetToAccessProfile = new tbl_WidgetToAccessProfile
                {
                    AccessProfileID = AccessProfileId,
                    WidgetID        = Guid.Parse(e.SourceDragNode.Value),
                    Order           = radDockLayout.RegisteredDocks.Count,
                    ModuleID        = CurrentModuleId == Guid.Empty ? null : (Guid?)CurrentModuleId
                };

                dataManager.WidgetToAccessProfile.Add(widgetToAccessProfile);

                radDockZone.Controls.Add(AddRadDock(e.SourceDragNode.Text, widgetToAccessProfile.ID.ToString()));
            }
            else
            {
                foreach (RadTreeNode node in e.SourceDragNode.Nodes)
                {
                    var widgetToAccessProfile = new tbl_WidgetToAccessProfile
                    {
                        AccessProfileID = AccessProfileId,
                        WidgetID        = Guid.Parse(node.Value),
                        Order           = radDockLayout.RegisteredDocks.Count,
                        ModuleID        = CurrentModuleId == Guid.Empty ? null : (Guid?)CurrentModuleId
                    };

                    dataManager.WidgetToAccessProfile.Add(widgetToAccessProfile);

                    radDockZone.Controls.Add(AddRadDock(node.Text, widgetToAccessProfile.ID.ToString()));
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Adds the specified widget to access profile.
        /// </summary>
        /// <param name="widgetToAccessProfile">The widget to access profile.</param>
        /// <returns></returns>
        public tbl_WidgetToAccessProfile Add(tbl_WidgetToAccessProfile widgetToAccessProfile)
        {
            if (widgetToAccessProfile.ID == Guid.Empty)
            {
                widgetToAccessProfile.ID = Guid.NewGuid();
            }
            _dataContext.tbl_WidgetToAccessProfile.AddObject(widgetToAccessProfile);
            _dataContext.SaveChanges();

            return(widgetToAccessProfile);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Deletes the specified widget to access profile.
 /// </summary>
 /// <param name="widgetToAccessProfile">The widget to access profile.</param>
 public void Delete(tbl_WidgetToAccessProfile widgetToAccessProfile)
 {
     _dataContext.tbl_WidgetToAccessProfile.DeleteObject(widgetToAccessProfile);
     _dataContext.SaveChanges();
 }
Exemplo n.º 5
0
 /// <summary>
 /// Updates the specified widget to access profile.
 /// </summary>
 /// <param name="widgetToAccessProfile">The widget to access profile.</param>
 public void Update(tbl_WidgetToAccessProfile widgetToAccessProfile)
 {
     _dataContext.SaveChanges();
 }