示例#1
0
        /// <summary>
        /// Static method to return the tree service url with the specified parameters
        /// </summary>
        /// <param name="startNodeID"></param>
        /// <param name="treeType"></param>
        /// <param name="showContextMenu"></param>
        /// <param name="isDialog"></param>
        /// <param name="dialogMode"></param>
        /// <param name="app"></param>
        /// <param name="nodeKey"></param>
        /// <param name="functionToCall"></param>
        /// <returns></returns>
        public static string GetServiceUrl(int?startNodeID, string treeType, bool?showContextMenu,
                                           bool?isDialog, TreeDialogModes dialogMode, string app, string nodeKey, string functionToCall)
        {
            TreeService treeSvc = new TreeService(startNodeID, treeType, showContextMenu, isDialog, dialogMode, app, nodeKey, functionToCall);

            return(treeSvc.GetServiceUrl());
        }
        /// <summary>
        /// Returns the tree service url to return the tree xml structure from the node passed in
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetTreeServiceUrl(int id)
        {
            // updated by NH to pass showcontextmenu, isdialog and dialogmode variables
            TreeService treeSvc = new TreeService(id, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "");

            return(treeSvc.GetServiceUrl());
        }
        public override void Render(ref XmlTree tree)
        {
            if (this.NodeKey == string.Empty)
            {

                var seasons = _repository.GetAll().OrderBy(s => s.Year);
                foreach (var season in seasons) {
                    var node = XmlTreeNode.Create(this);
                    node.NodeID = season.Id.ToString();
                    node.Text = season.Name;
                    node.Icon = "calendar.png";
                    node.Action = "javascript:openSeasonTemplates(" + season.Id + ")";
                    node.NodeType = "season";

                    TreeService treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, string.Format("Season-{0}", season.Id));
                    node.Source = season.Races.Count() > 0 ? treeService.GetServiceUrl() : "";

                    node.Menu.Clear();
                    node.Menu.AddRange(new List<IAction> { ActionNew.Instance, ActionDelete.Instance, ContextMenuSeperator.Instance, ActionRefresh.Instance });

                    tree.Add(node);
                }

            } else {

                string keyType = this.NodeKey.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[0];
                int keyId = int.Parse(this.NodeKey.Split(new string[] { "-" }, StringSplitOptions.RemoveEmptyEntries)[1]);

                switch (keyType) {
                    case "Season":

                        var season = _repository.GetById(keyId);

                        if (season != null) {

                            foreach (var race in season.Races)
                            {
                                var node = XmlTreeNode.Create(this);
                                node.NodeID = race.Id.ToString();
                                node.Text = race.Circuit.Name;
                                node.Icon = "map_go.png";
                                node.NodeType = "seasonRace";
                                node.Action = "javascript:openSeasonRace(" + race.Id + "," + season.Id + ")";

                                node.Menu.Clear();
                                if (race.GetQualificationResults().Count() == 0 && race.GetRaceResults().Count() == 0)
                                    node.Menu.Add(ActionDelete.Instance);

                                tree.Add(node);
                            }
                        }

                        break;
                }
            }
        }
        /// <summary>
        /// Converts an ITree into a BaseTree. This is used for Legacy trees that don't inherit from BaseTree already.
        /// </summary>
        /// <param name="tree"></param>
        /// <param name="alias"></param>
        /// <param name="appAlias"></param>
        /// <param name="iconClosed"></param>
        /// <param name="iconOpened"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static BaseTree FromITree(ITree tree, string alias, string appAlias, string iconClosed, string iconOpened, string action)
        {
            TreeService treeSvc = new TreeService(null, alias, null, null, TreeDialogModes.none, appAlias);
            //create the generic XmlTreeNode and fill it with the properties from the db
            NullTree    nullTree = new NullTree(appAlias);
            XmlTreeNode node     = XmlTreeNode.CreateRoot(nullTree);

            node.Text     = BaseTree.GetTreeHeader(alias);;
            node.Action   = action;
            node.Source   = treeSvc.GetServiceUrl();
            node.Icon     = iconClosed;
            node.OpenIcon = iconOpened;
            node.NodeType = "init" + alias;
            node.NodeType = alias;
            node.NodeID   = "init";
            node.Menu     = BaseTree.GetDefaultRootNodeActions();

            //convert the tree to a LegacyTree
            LegacyTree bTree = new LegacyTree(tree, appAlias, node);

            return(bTree);
        }
        /// <summary>
        /// Returns the tree service url to render tree xml structure from the node passed in, in dialog mode.
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public virtual string GetTreeDialogUrl(int id)
        {
            TreeService treeSvc = new TreeService(id, TreeAlias, false, true, this.DialogMode, "");

            return(treeSvc.GetServiceUrl());
        }
        /// <summary>
        /// Returns the tree service url to return the tree xml structure based on a string node key.
        /// </summary>
        /// <param name="nodeKey"></param>
        /// <returns></returns>
        public string GetTreeServiceUrl(string nodeKey)
        {
            TreeService treeSvc = new TreeService(-1, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "", nodeKey);

            return(treeSvc.GetServiceUrl());
        }
示例#7
0
        /// <summary>
        /// Converts an ITree into a BaseTree. This is used for Legacy trees that don't inherit from BaseTree already.
        /// </summary>
        /// <param name="tree"></param>
        /// <param name="alias"></param>
        /// <param name="appAlias"></param>
        /// <param name="iconClosed"></param>
        /// <param name="iconOpened"></param>
        /// <param name="action"></param>
        /// <returns></returns>
        public static BaseTree FromITree(ITree tree, string alias, string appAlias, string iconClosed, string iconOpened, string action)
        {
            TreeService treeSvc = new TreeService(null, alias, null, null, TreeDialogModes.none, appAlias);
            //create the generic XmlTreeNode and fill it with the properties from the db          
			NullTree nullTree = new NullTree(appAlias);
            XmlTreeNode node = XmlTreeNode.CreateRoot(nullTree);
            node.Text = BaseTree.GetTreeHeader(alias);;
            node.Action = action;
            node.Source = treeSvc.GetServiceUrl();
            node.Icon = iconClosed;
            node.OpenIcon = iconOpened;
            node.NodeType = "init" + alias;
			node.NodeType = alias;
            node.NodeID = "init";
            node.Menu = BaseTree.GetDefaultRootNodeActions();

            //convert the tree to a LegacyTree
            LegacyTree bTree = new LegacyTree(tree, appAlias, node);

            return bTree;
        }
示例#8
0
 /// <summary>
 /// Returns the tree service url to render tree xml structure from the node passed in, in dialog mode.
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public virtual string GetTreeDialogUrl(int id)
 {
     TreeService treeSvc = new TreeService(id, TreeAlias, false, true, this.DialogMode, "");
     return treeSvc.GetServiceUrl();
 }
示例#9
0
		/// <summary>
		/// Returns the tree service url to return the tree xml structure based on a string node key.
		/// </summary>
		/// <param name="nodeKey"></param>
		/// <returns></returns>
		public string GetTreeServiceUrl(string nodeKey)
		{
			TreeService treeSvc = new TreeService(-1, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "", nodeKey);
			return treeSvc.GetServiceUrl();
		}
示例#10
0
        /// <summary>
        /// Returns the tree service url to return the tree xml structure from the node passed in
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public string GetTreeServiceUrl(int id)
        {
			// updated by NH to pass showcontextmenu, isdialog and dialogmode variables
			TreeService treeSvc = new TreeService(id, TreeAlias, this.ShowContextMenu, this.IsDialog, this.DialogMode, "");
			return treeSvc.GetServiceUrl();            
        }
示例#11
0
		/// <summary>
		/// Static method to return the tree service url with the specified parameters
		/// </summary>
		/// <param name="startNodeID"></param>
		/// <param name="treeType"></param>
		/// <param name="showContextMenu"></param>
		/// <param name="isDialog"></param>
		/// <param name="dialogMode"></param>
		/// <param name="app"></param>
		/// <param name="nodeKey"></param>
		/// <param name="functionToCall"></param>
		/// <returns></returns>
		public static string GetServiceUrl(int? startNodeID, string treeType, bool? showContextMenu,
			bool? isDialog, TreeDialogModes dialogMode, string app, string nodeKey, string functionToCall)
		{
			TreeService treeSvc = new TreeService(startNodeID, treeType, showContextMenu, isDialog, dialogMode, app, nodeKey, functionToCall);
			return treeSvc.GetServiceUrl();
		}
示例#12
0
        protected void PopulateSeasons(ref XmlTree tree)
        {
            var seasons = _seasonRepository.GetAll().OrderBy(s => s.Year);

            foreach (var season in seasons)
            {

                var node = XmlTreeNode.Create(this);
                node.NodeID = season.Id.ToString();
                node.Text = season.Name;
                node.Icon = "folder.gif";
                node.OpenIcon = "folder_o.gif";

                var treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, string.Format("Season-{0}", season.Id));
                node.Source = treeService.GetServiceUrl();

                node.Menu.Clear();
                node.Menu.Add(ActionRefresh.Instance);

                tree.Add(node);

            }
        }
        private void RenderCalendar(ref XmlTree tree)
        {
            if (null != this._db)
            {
                var calendars = this._db.Query<ECalendar>("SELECT * FROM ec_calendars");

                foreach (var c in calendars)
                {
                    XmlTreeNode node = XmlTreeNode.Create(this);

                    node.NodeID = c.Id.ToString();
                    node.NodeType = "CalendarEntry";
                    node.Text = c.Calendarname;
                    node.Icon = "calendar.png";
                    node.Action = "javascript:openCalendar(" + c.Id.ToString() + ")";

                    var treeService = new TreeService(c.Id, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, "CalendarEntry-"+c.Id.ToString());
                    node.Source = treeService.GetServiceUrl();

                    node.Menu.Clear();
                    //node.Menu.Add(ActionNew.Instance);
                    node.Menu.Add(ActionDelete.Instance);

                    tree.Add(node);
                }
            }
        }
        /// <summary>
        /// Render the top Root Nodes.
        /// - Calendar -> The Root of all Calendars
        /// - Locations -> The Root of all Locations
        /// </summary>
        /// <param name="tree">The current tree</param>
        private void PopulateRootNodes(ref XmlTree tree)
        {
            XmlTreeNode xNode = XmlTreeNode.Create(this);
            xNode.NodeID = "1";
            xNode.Text = "Calendar";
            //xNode.Action = "javascript:openCustom('" + "1" + "');";
            xNode.Icon = "calendar.png";
            xNode.OpenIcon = "folder_o.gif";
            xNode.NodeType = "EventCalendarBase";

            var treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, "CalendarBase");
            xNode.Source = treeService.GetServiceUrl();

            xNode.Menu.Clear();
            xNode.Menu.Add(ActionNew.Instance);
            xNode.Menu.Add(ActionRefresh.Instance);

            tree.Add(xNode);

            xNode = XmlTreeNode.Create(this);
            xNode.NodeID = "2";
            xNode.Text = "Locations";
            //xNode.Action = "javascript:openCustom('" + "1" + "');";
            xNode.Icon = "map.png";
            xNode.OpenIcon = "folder_o.gif";
            xNode.NodeType = "EventLocationBase";

            treeService = new TreeService(-1, TreeAlias, ShowContextMenu, IsDialog, DialogMode, app, "LocationBase");
            xNode.Source = treeService.GetServiceUrl();

            xNode.Menu.Clear();
            xNode.Menu.Add(ActionNew.Instance);
            xNode.Menu.Add(ActionRefresh.Instance);

            tree.Add(xNode);
        }