Ejemplo n.º 1
1
        public string PostLogin(FormDataCollection body)
        {
            string username = body.Get("username");
            string password = body.Get("password");

            using(var session = store.OpenSession())
            {
                var profile = session.Load<Profile>("profiles/" + username);
                if(profile.Password == password)
                {
                    var defaultPrincipal = new ClaimsPrincipal(
                        new ClaimsIdentity(new[] {new Claim(MyClaimTypes.ProfileKey, profile.Id)},
                            "Application" // this is important. if it's null or empty, IsAuthenticated will be false
                            ));
                    var principal = FederatedAuthentication.FederationConfiguration.IdentityConfiguration.
                            ClaimsAuthenticationManager.Authenticate(
                                Request.RequestUri.AbsoluteUri, // this, or any other string can be available
                                                                // to your ClaimsAuthenticationManager
                                defaultPrincipal);
                    AuthenticationManager.EstablishSession(principal);
                    return "login ok";
                }
                return "login failed";
            }
        }
Ejemplo n.º 2
0
        public string ClearDraft(FormDataCollection form)
        {
            try
            {
                var employeeTypeType = (EmployeeType)form.Get("employeeTypeId").ToInt32();
                ContactRepository.ContactUpdateClearDraft(employeeTypeType);

                // Update Account Draft
                var account = new UserDraftInfo
                {
                    IsDraftConsultant = false,
                    IsDraftCollabortor = false,
                    CreatedDate = DateTime.Now,
                    BranchId = UserContext.GetDefaultBranch(),
                    UserId = UserContext.GetCurrentUser().UserID,
                };
                UserDraftRepository.Update(account);

                // Return
                return "Xóa draft thành công";
            }
            catch
            {
                return "Xóa draft không thành công";
            }
        }
 protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
 {
     var nodes = new TreeNodeCollection();
     var item = this.CreateTreeNode("dashboard", id, queryStrings, "Applicaion Forms", "icon-truck", true);
     nodes.Add(item);
     return nodes;
 }
Ejemplo n.º 4
0
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var collection = new TreeNodeCollection();
            switch (id)
            {
                case "settings":
                    collection.Add(CreateTreeNode("shipping", "settings", queryStrings, "Shipping", "icon-truck", false, "merchello/merchello/Shipping/manage"));
                    collection.Add(CreateTreeNode("taxation", "settings", queryStrings, "Taxation", "icon-piggy-bank", false, "merchello/merchello/Taxation/manage"));
                    collection.Add(CreateTreeNode("payment", "settings", queryStrings, "Payment", "icon-bill-dollar", false, "merchello/merchello/Payment/manage"));
                    collection.Add(CreateTreeNode("notifications", "settings", queryStrings, "Notifications", "icon-chat", false, "merchello/merchello/Notifications/manage"));
                    collection.Add(CreateTreeNode("gateways", "settings", queryStrings, "Gateway Providers", "icon-trafic", false, "merchello/merchello/GatewayProviders/manage"));
                    break;
                case "reports":
                    collection.Add(CreateTreeNode("salesOverTime", "reports", queryStrings, "Sales Over Time", "icon-loading", false, "merchello/merchello/SalesOverTime/manage"));
                    collection.Add(CreateTreeNode("salesByItem", "reports", queryStrings, "Sales By Item", "icon-barcode", false, "merchello/merchello/SalesByItem/manage"));
                    collection.Add(CreateTreeNode("taxesByDestination", "reports", queryStrings, "Taxes By Destination", "icon-piggy-bank", false, "merchello/merchello/TaxesByDestination/manage"));
                    break;
                default:
                    collection.Add(CreateTreeNode("catalog", "", queryStrings, "Catalog", "icon-barcode", false, "merchello/merchello/ProductList/manage"));
                    collection.Add(CreateTreeNode("orders", "", queryStrings, "Orders", "icon-receipt-dollar", false, "merchello/merchello/OrderList/manage"));
                    collection.Add(CreateTreeNode("settings", "", queryStrings, "Settings", "icon-settings", true, "merchello/merchello/Settings/manage"));
                    break;
            }

            return collection;
        }
Ejemplo n.º 5
0
        public IHttpActionResult RemoveStudent(FormDataCollection form)
        {
            /*
             * clear coordinates in seating chart for the student after delete button click.
             */
            string message = "success";

            try
            {
                string sStudentId = form.Get("sStudentId");

                int nStudentId;
                if (int.TryParse(sStudentId, out nStudentId))
                {
                    CylorDbEntities context = this.getContext();

                    DragDropStudent student = context.DragDropStudents.Find(nStudentId);
                    context.DragDropStudents.Attach(student);
                    student.Left = string.Empty;
                    student.Top = string.Empty;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            dynamic json = new ExpandoObject();
            json.message = message;

            return Json(json);
        }
 protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
 {
     TreeNodeCollection nodes = new TreeNodeCollection();
     TreeNode item = this.CreateTreeNode("-1", "-1", queryStrings, "");
     nodes.Add(item);
     return nodes;
 }
Ejemplo n.º 7
0
        public List<CasecAccountInfo> Provide(FormDataCollection form)
        {
            var contactId = form.Get("contactId").ToInt32();
            var list = CasecAccountRepository.Provide(contactId);
            if (!list.IsNullOrEmpty())
            {
                foreach (var item in list)
                {
                    item.DateTimeString = item.DateTime.ToString("dd/MM/yyyy");
                    item.CreatedDateString = item.CreatedDate.ToString("dd/MM/yyyy");
                    item.StatusString = ObjectExtensions.GetEnumDescription((StatusCasecType)item.StatusCasecAccountId);

                    // Call WS
                    if (item.StatusCasecAccountId == (int) StatusCasecType.Used)
                    {
                        var result = (new HelpUtils()).SendCasecAccount(item);
                        if (result.Code == 0)
                        {
                            ContactLevelInfoRepository.UpdateHasCasecAccount(contactId, true);
                        }
                    }
                }
                return list;
            }
            return null;
        }
 public override Task<object> ReadFromStreamAsync(Type type, System.IO.Stream readStream, HttpContent content, System.Net.Http.Formatting.IFormatterLogger formatterLogger)
 {
     var commandType = type;
     if (type.IsAbstract || type.IsInterface)
     {
         var commandContentType = content.Headers.ContentType.Parameters.FirstOrDefault(p => p.Name == "command");
         if (commandContentType != null)
         {
             commandType = GetCommandType(HttpUtility.UrlDecode(commandContentType.Value));
         }
         else
         {
             commandType = GetCommandType(HttpContext.Current.Request.Url.Segments.Last());
         }
     }
     var part = content.ReadAsStringAsync();
     var mediaType = content.Headers.ContentType.MediaType;
     return Task.Factory.StartNew<object>(() =>
     {
         object command = null;
         if (mediaType == "application/x-www-form-urlencoded" || mediaType == "application/command+form")
         {
             command = new FormDataCollection(part.Result).ConvertToObject(commandType);
         }
         if (command == null)
         {
             command = part.Result.ToJsonObject(commandType);
         }
         return command;
     });
 }
        public void CreateFromUri()
        {
            FormDataCollection form = new FormDataCollection(new Uri("http://foo.com/?x=1&y=2"));

            Assert.Equal("1", form.Get("x"));
            Assert.Equal("2", form.Get("y"));
        }
Ejemplo n.º 10
0
        public IHttpActionResult AddToCalendar(FormDataCollection form)
        {
            string message = "success";

            try
            {
                CylorDbEntities context = this.getContext();
                string ThisDay = form.Get("ThisDay");
                string sSelectUserId = form.Get("sSelectUserId");

                int nCalendarUserListId;
                if (int.TryParse(sSelectUserId, out nCalendarUserListId) && DateFunctions.IsValidDate(ThisDay))
                {
                    CalendarItem instance = new CalendarItem();
                    instance.CalendarDate = DateTime.Parse(ThisDay);
                    instance.CalendarUserListId = nCalendarUserListId;
                    instance.EnteredDate = DateTime.Now.Date;

                    context.CalendarItems.Add(instance);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                message = ex.Message;
            }

            dynamic json = new ExpandoObject();
            json.message = message;

            return Json(json);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Returns all section tree nodes
        /// </summary>
        /// <param name="id">Node's id.</param>
        /// <param name="queryStrings">Query strings</param>
        /// <returns>Collection of tree nodes</returns>
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var nodes = new TreeNodeCollection();
            var ctrl = new WebsiteApiController();            

            if (id == Constants.System.Root.ToInvariantString())
            {
                var item = CreateTreeNode("0", "-1", queryStrings, "Websites", "icon-folder", true);
                nodes.Add(item);
                
                return nodes;
            }
            else if (id == "0")
            {
                foreach (var website in ctrl.GetAll())
                {
                    var node = CreateTreeNode(
                        website.Id.ToString(),
                        "0",
                        queryStrings,
                        website.ToString(),
                        "icon-document",
                        false);
                    
                    nodes.Add(node);
                }

                return nodes;
            }
            throw new NotSupportedException();
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Returns context menu for each tree node
 /// </summary>
 /// <param name="id">Node's id.</param>
 /// <param name="queryStrings">Query strings</param>
 /// <returns>Collection of menu items</returns>
 protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
 {
     var menu = new MenuItemCollection();
     if (id == Constants.System.Root.ToInvariantString())
     {
         // WebPack node actions:       
         menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
         return menu;
     }
     else if(id == "0")
     {
         // Websites node actions:
         MenuItem createItem = new MenuItem("Create", ActionNew.Instance.Alias);
         createItem.Name = "Create";
         createItem.Icon = "add";
         menu.Items.Add(createItem);
         //menu.Items.Add<CreateChildEntity, ActionNew>(ActionNew.Instance.Alias);
         menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
         return menu;
     }
     else
     {
         // Website node actions:
         menu.Items.Add<ActionDelete>(ui.Text("actions", ActionDelete.Instance.Alias));                
     }
     return menu;
 }
Ejemplo n.º 13
0
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            // check if we're rendering the root node's children
            var items = id == RealUmbraco.Core.Constants.System.Root.ToInvariantString()
                ? DefinedContent.Cache.GetRootDefinedContentItems()
                : DefinedContent.Cache.GetDefinedContentItem(id).Children;
            
            // empty tree
            //var tree = new TreeNodeCollection()
            //{
            //    CreateTreeNode("Bobs Something", id, new FormDataCollection("somequerystring=2"), "Bob's News Root", "icon-anchor")
            //};

            var tree = new TreeNodeCollection();
            foreach (var item in items)
            {
                tree.Add(CreateTreeNode(item.Key, item.Key, null, item.Key, "icon-anchor", item.Children.Any()));
            }

            // but if we wanted to add nodes - 
            /*  var tree = new TreeNodeCollection
            {
                CreateTreeNode("1", id, queryStrings, "My Node 1"), 
                CreateTreeNode("2", id, queryStrings, "My Node 2"), 
                CreateTreeNode("3", id, queryStrings, "My Node 3")
            };*/
            return tree;
        }
Ejemplo n.º 14
0
        public string Edit(FormDataCollection form)
        {
            var retVal = string.Empty;
            var operation = form.Get("oper");
            var id = form.Get("Id").Split(',')[0].ToInt32();
            if (string.IsNullOrEmpty(operation)) return retVal;

            PackageFeeEduInfo info;
            switch (operation)
            {
                case "edit":
                    info = CatalogRepository.GetInfo<PackageFeeEduInfo>(id);
                    if (info != null)
                    {
                        info.Name = form.Get("Name");
                        CatalogRepository.Update(info);
                    }
                    break;
                case "add":
                    info = new PackageFeeEduInfo { Name = form.Get("Name") };
                    CatalogRepository.Create(info);
                    break;
                case "del":
                    CatalogRepository.Delete<PackageFeeEduInfo>(id);
                    break;
            }
            StoreData.ReloadData<PackageFeeEduInfo>();
            return retVal;
        }
        public SocketLabsEvent(FormDataCollection formCollection)
            : this()
        {
            // Extract known members from the form collection
            ServerId = Convert.ToInt64(formCollection["ServerId"]);
            Address = formCollection["Address"];
            DateTime = Convert.ToDateTime(formCollection["DateTime"]);
            MailingId = formCollection["MailingId"];
            MessageId = formCollection["MessageId"];
            SecretKey = formCollection["SecretKey"];
            EventType type;
            if (!Enum.TryParse(formCollection["Type"], true, out type))
                type = EventType.Unknown;
            Type = type;

            // Find all additional members from the form collection
            var dictionary = new Dictionary<string, string>();
            foreach (var entry in formCollection)
            {
                if (entry.Key != "Type" &&
                    entry.Key != "ServerId" &&
                    entry.Key != "Address" &&
                    entry.Key != "DateTime" &&
                    entry.Key != "MailingId" &&
                    entry.Key != "MessageId" &&
                    entry.Key != "SecretKey")
                {
                    dictionary[entry.Key] = entry.Value;
                }
            }

            ExtraData = dictionary;
        }
Ejemplo n.º 16
0
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            // check if we're rendering the root node's children
            if (id == Constants.System.Root.ToInvariantString())
            {
                var tree = new TreeNodeCollection();
                var ctrl = new EasyADApiController();

                foreach (var g in ctrl.GetAll())
                {
                    var node = CreateTreeNode(
                                    g.Id.ToInvariantString(),
                                    Constants.System.Root.ToInvariantString(),
                                    queryStrings,
                                    g.Name,
                                    "icon-users-alt");
                    tree.Add(node);
                }

                return tree;
            }

            // this tree doesn't support rendering more than 1 level
            throw new NotSupportedException();
        }
        public HttpResponseMessage GetMembersExport(FormDataCollection queryStrings)
        {
            // Base Query data
            string memberType = queryStrings.HasKey("memberType") ? queryStrings.GetValue<string>("memberType") : "";
            string orderBy = queryStrings.HasKey("orderBy") ? queryStrings.GetValue<string>("orderBy") : "email";
            Direction orderDirection = queryStrings.HasKey("orderDirection") ? queryStrings.GetValue<Direction>("orderDirection") : Direction.Ascending;

            string filter = queryStrings.HasKey("filter") ? queryStrings.GetValue<string>("filter") : "";

            int totalMembers = 0;

            var members = Mapper.Map<IEnumerable<MemberExportModel>>(MemberSearch.PerformMemberSearch(filter, queryStrings, out totalMembers,
                                                                                                        memberType,
                                                                                                        orderBy: orderBy, 
                                                                                                        orderDirection: orderDirection));

            var content = members.CreateCSV();

            // see http://stackoverflow.com/questions/9541351/returning-binary-file-from-controller-in-asp-net-web-api
            // & http://stackoverflow.com/questions/12975886/how-to-download-a-file-using-web-api-in-asp-net-mvc-4-and-jquery
            // We really should use an async version - the above reference includes an example.
            HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK);
            result.Content = new StringContent(content);
            result.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
            result.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue("attachment");
            result.Content.Headers.ContentDisposition.FileName = string.Format("Members_{0:yyyyMMdd}.csv", DateTime.Now);

            return result;
        }
Ejemplo n.º 18
0
        public TreeNode GetRootNode(FormDataCollection queryStrings)
        {
            if (queryStrings == null) queryStrings = new FormDataCollection("");
            var node = CreateRootNode(queryStrings);

            //add the tree alias to the root
            node.AdditionalData["treeAlias"] = TreeAlias;

            AddQueryStringsToAdditionalData(node, queryStrings);

            //check if the tree is searchable and add that to the meta data as well
            if (this is ISearchableTree)
            {
                node.AdditionalData.Add("searchable", "true");
            }

            //now update all data based on some of the query strings, like if we are running in dialog mode           
            if (IsDialog(queryStrings))
            {
                node.RoutePath = "#";
            }

            OnRootNodeRendering(this, new TreeNodeRenderingEventArgs(node, queryStrings));

            return node;
        }
 /// <summary>
 /// Gets the tree nodes for the given id
 /// </summary>
 /// <param name="id"></param>
 /// <param name="queryStrings"></param>
 /// <returns></returns>
 /// <remarks>
 /// If the content item is a container node then we will not return anything
 /// </remarks>
 protected override TreeNodeCollection PerformGetTreeNodes(string id, FormDataCollection queryStrings)
 {
     var nodes = new TreeNodeCollection();
     var entities = GetChildEntities(id);
     nodes.AddRange(entities.Select(entity => GetSingleTreeNode(entity, id, queryStrings)).Where(node => node != null));            
     return nodes;
 }
        public PagedResult<MemberListItem> GetMembers(FormDataCollection queryStrings)
        {
            // Base Query data
            int pageNumber = queryStrings.HasKey("pageNumber") ? queryStrings.GetValue<int>("pageNumber") : 1;
            int pageSize = queryStrings.HasKey("pageSize") ? queryStrings.GetValue<int>("pageSize") : 10;
            string orderBy = queryStrings.HasKey("orderBy") ? queryStrings.GetValue<string>("orderBy") : "email";
            Direction orderDirection = queryStrings.HasKey("orderDirection") ? queryStrings.GetValue<Direction>("orderDirection") : Direction.Ascending;
            string memberType = queryStrings.HasKey("memberType") ? queryStrings.GetValue<string>("memberType") : "";

            string filter = queryStrings.HasKey("filter") ? queryStrings.GetValue<string>("filter") : "";

            int totalMembers = 0;
            var members = Mapper.Map<IEnumerable<MemberListItem>>(MemberSearch.PerformMemberSearch(filter, queryStrings, out totalMembers,
                                                                                                    memberType, pageNumber, pageSize,
                                                                                                    orderBy, orderDirection));
            if (totalMembers == 0)
                return new PagedResult<MemberListItem>(0, 0, 0);

            var pagedResult = new PagedResult<MemberListItem>(
               totalMembers,
               pageNumber,
               pageSize);

            pagedResult.Items = members;

            return pagedResult;
        }
Ejemplo n.º 21
0
        private static string serialize(IDictionary<string, object> source)
        {
            NameValueCollection query = new FormDataCollection(string.Empty).ReadAsNameValueCollection();

            foreach (KeyValuePair<string, object> pair in source)
            {
                if (pair.Value == null)
                    continue;

                // The string implements IEnumerable, but must be interpreted as an entire object and not as
                // an array of characters.
                IEnumerable enumerable = pair.Value is string ? null : pair.Value as IEnumerable;

                if (enumerable == null)
                {
                    query.Add(pair.Key, Convert.ToString(pair.Value));
                }
                else
                {
                    foreach (object item in enumerable)
                    {
                        query.Add(pair.Key, Convert.ToString(item));
                    }
                }
            }

            return query.ToString();
        }
Ejemplo n.º 22
0
 public string Edit(FormDataCollection form)
 {
     var retVal = string.Empty;
     var operation = form.Get("oper");
     var id = ConvertHelper.ToInt32(form.Get("Id").Split(',')[0]);
     WebServiceConfigInfo info;
     switch (operation)
     {
         case "edit":
             info = WebServiceConfigRepository.GetInfo(id);
             if (info != null)
             {
                 info.Value = form.Get("Value");
                 info.Type = form.Get("Type").ToInt32();
                 info.BranchId = form.Get("BranchId").ToInt32();
                 WebServiceConfigRepository.Update(info);
             }
             break;
         case "add":
             info = new WebServiceConfigInfo
             {
                 Value = form.Get("Value"),
                 Type = form.Get("Type").ToInt32(),
                 BranchId = form.Get("BranchId").ToInt32(),
             };
             WebServiceConfigRepository.Create(info);
             break;
         case "del":
             WebServiceConfigRepository.Delete(id);
             break;
     }
     StoreData.ListWebServiceConfig = WebServiceConfigRepository.GetAll();
     return retVal;
 }
    protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
    {
        if (id == Constants.System.Root.ToInvariantString())
        {
            var ctrl = new ClientApiController();
            var nodes = new TreeNodeCollection();

            foreach (var client in ctrl.GetAll())
            {
                var node = CreateTreeNode(
                    client.Id.ToString(),
                    "-1",
                    queryStrings,
                    client.ToString(),
                    "icon-user",
                    false);

                nodes.Add(node);
            }

            return nodes;
        }

        throw new NotSupportedException();
    }
Ejemplo n.º 24
0
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            if (id == "-1")
            {
                var nodes = new TreeNodeCollection();

                var allContacts = this.CreateTreeNode("dashboard", id, queryStrings, "All Contact Message", "icon-list", false);
                var repliedContacts = this.CreateTreeNode("replied", id, queryStrings, "Replied Contact Message", "icon-check", false);
                var unRepliedContacts = this.CreateTreeNode("unreplied", id, queryStrings, "Un-Replied Contact Message", "icon-time", false);
                var spamContacts = this.CreateTreeNode("spam", id, queryStrings, "Spam", "icon-squiggly-line", false);
                var trashedContacts = this.CreateTreeNode("deleted", id, queryStrings, "Deleted", "icon-trash", false);
                var settingsContacts = this.CreateTreeNode("settings", id, queryStrings, "Settings", "icon-wrench", false);

                repliedContacts.RoutePath = "/uContactor/uContactorSection/replied/0";
                unRepliedContacts.RoutePath = "/uContactor/uContactorSection/unreplied/0";
                spamContacts.RoutePath = "/uContactor/uContactorSection/spam/0";
                trashedContacts.RoutePath = "/uContactor/uContactorSection/deleted/0";
                settingsContacts.RoutePath = "/uContactor/uContactorSection/settings/0";

                nodes.Add(allContacts);
                nodes.Add(repliedContacts);
                nodes.Add(unRepliedContacts);
                nodes.Add(spamContacts);
                nodes.Add(trashedContacts);
                nodes.Add(settingsContacts);

                return nodes;
            }

            throw new NotImplementedException();
        }
        private TreeNodeCollection AddFiles(string folder, FormDataCollection queryStrings)
        {
            var pickerApiController = new FileSystemPickerApiController();
            //var str = queryStrings.Get("startfolder");

            if (string.IsNullOrWhiteSpace(folder))
                return null;

            var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray();

            var path = IOHelper.MapPath(folder);
            var rootPath = IOHelper.MapPath(queryStrings.Get("startfolder"));
            var treeNodeCollection = new TreeNodeCollection();

            foreach (FileInfo file in pickerApiController.GetFiles(folder, filter))
            {
                string nodeTitle = file.Name;
                string filePath = file.FullName.Replace(rootPath, "").Replace("\\", "/");

                //if (file.Extension.ToLower() == ".gif" || file.Extension.ToLower() == ".jpg" || file.Extension.ToLower() == ".png")
                //{
                //    nodeTitle += "<div><img src=\"/umbraco/backoffice/FileSystemPicker/FileSystemThumbnailApi/GetThumbnail?width=150&imagePath="+ HttpUtility.UrlPathEncode(filePath) +"\" /></div>";
                //}

                TreeNode treeNode = CreateTreeNode(filePath, path, queryStrings, nodeTitle, "icon-document", false);
                treeNodeCollection.Add(treeNode);
            }

            return treeNodeCollection;
        }
Ejemplo n.º 26
0
        // POST: api/User
        //public string Post([FromBody]int userid, [FromBody]List<SaleItem> itens)
        public string Post(FormDataCollection Data)
        {
            var ret = string.Empty;

            JavaScriptSerializer ser = new JavaScriptSerializer();
            List<SaleItem> itens = ser.Deserialize<List<SaleItem>>(Data.Get("itens"));

            int IdStore = 0;

            foreach (SaleItem item in itens)
            {
               var  aux = productBusiness.SelectSingle(e => e.Id == item.IdProduct);
                item.Item = null; //
                item.Price = aux.Price;
                IdStore = aux.IdStore;
            }

            Sale vend = new Sale();
            vend.IdUser = Convert.ToInt32(Data.Get("userid"));
            vend.Items = itens;
            vend.IdStore = IdStore;
            vend.Paid = true;
            vend.Delivered = false;
            vend.Ticket = RandomString(20);

            var result = (new SaleValidator()).Validate(vend);
            if (vend != null && result.IsValid)
                saleBusiness.Insert(vend);
            else
                ret = String.Join("<br>", result.Errors);

            return ret;
        }
Ejemplo n.º 27
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();
            menu.DefaultMenuAlias = ActionNull.Instance.Alias;

            return menu;
        }
 protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
 {
     //var menu = new MenuItemCollection();
     //menu.DefaultMenuAlias = ActionNew.Instance.Alias;
     //menu.Items.Add<ActionNew>("Create");
     return null;
 }
        private Attempt<TreeNodeCollection> TryLoadFromLegacyTree(ApplicationTree appTree, string id, FormDataCollection formCollection)
        {
            //This is how the legacy trees worked....
            var treeDef = TreeDefinitionCollection.Instance.FindTree(appTree.Alias);
            if (treeDef == null)
            {
                return new Attempt<TreeNodeCollection>(new InstanceNotFoundException("Could not find tree of type " + appTree.Alias));
            }

            var bTree = treeDef.CreateInstance();
            var treeParams = new TreeParams();

            //we currently only support an integer id or a string id, we'll refactor how this works
            //later but we'll get this working first
            int startId;
            if (int.TryParse(id, out startId))
            {
                treeParams.StartNodeID = startId;
            }
            else
            {
                treeParams.NodeKey = id;
            }
            var xTree = new XmlTree();
            bTree.SetTreeParameters(treeParams);
            bTree.Render(ref xTree);

            return new Attempt<TreeNodeCollection>(true, LegacyTreeDataAdapter.ConvertFromLegacy(xTree));
        }
        // TODO : Umbraco Refactored the TreeNodeController and it's underlying collections.  This
        // TODO : broke with the introduction of the Umbraco Nightly Build 111
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            if (id == "settings")
            {
                menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
            }

            //if (id == Constants.System.Root.ToInvariantString())
            //{
            //    // root actions
            //    menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
            //    return menu;
            //}
            //else if (id == "catalog")
            //{
            //    //create product
            //    menu.Items.Add<MerchelloActionNewProduct>(ui.Text("actions", MerchelloActionNewProduct.Instance.Alias));
            //}
            //else
            //{
                //only have refres for each node
             //menu.Items.Add<RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);
            //}

            return menu;
        }
Ejemplo n.º 31
0
        public dynamic ProcessUpgrade(FormDataCollection formData)
        {
            if (formData != null)
            {
                List <string> errors = new List <string>();

                string CustIP      = formData.Get("CustIP");
                string CardNumber  = formData.Get("CardNumber");
                string CVCNumber   = formData.Get("CVCNumber");
                string ExpiryDateY = formData.Get("ExpiryDateY");
                string ExpiryDateM = formData.Get("ExpiryDateM");
                string NameOnCard  = formData.Get("NameOnCard");
                string MembershipSubscriptionType = formData.Get("MembershipSubscriptionType");
                int    membershipSubscriptionType = 0;

                if (string.IsNullOrEmpty(CustIP))
                {
                    errors.Add("Customer IP is required.");
                }

                if (string.IsNullOrEmpty(CardNumber))
                {
                    errors.Add("CardNumber is required.");
                }

                if (string.IsNullOrEmpty(CVCNumber))
                {
                    errors.Add("CVCNumber is required.");
                }

                if (string.IsNullOrEmpty(ExpiryDateY))
                {
                    errors.Add("ExpiryDateY is required.");
                }

                if (string.IsNullOrEmpty(ExpiryDateM))
                {
                    errors.Add("ExpiryDateM is required.");
                }

                if (string.IsNullOrEmpty(NameOnCard))
                {
                    errors.Add("NameOnCard is required.");
                }

                if (string.IsNullOrEmpty(MembershipSubscriptionType))
                {
                    errors.Add("MembershipSubscriptionType is required.");
                }

                if (errors.Count > 0)
                {
                    var e = Enumerable.Range(0, errors.Count).ToDictionary(x => "Error" + x, x => errors[x]);
                    return(e);
                }

                bool convertMembershipSusbTypeOutcome = Int32.TryParse(MembershipSubscriptionType, out membershipSubscriptionType);
                if (!convertMembershipSusbTypeOutcome)
                {
                    return(new { Error = "MembershipSubscriptionType is invalid." });
                }


                PaymentsModel paymentsModel = new PaymentsModel();
                paymentsModel.CardNumber  = CardNumber;
                paymentsModel.CVCNumber   = CVCNumber;
                paymentsModel.ExpiryDateM = ExpiryDateM;
                paymentsModel.ExpiryDateY = ExpiryDateY;
                paymentsModel.NameOnCard  = NameOnCard;

                Vaultlife.Service.PaymentService paymentService = new Vaultlife.Service.PaymentService(new VaultLifeApplicationEntities());
                bool success = paymentService.pay(paymentsModel, membershipSubscriptionType, User.Identity.Name, this.GetIPAddress(), CustIP);

                return(new { PaymentSuccessful = "" + success });
            }

            return(new { Error = "No data received." });
        }
Ejemplo n.º 32
0
        /// <inheritdoc />
        protected override TreeNode GetSingleTreeNode(IEntitySlim entity, string parentId, FormDataCollection queryStrings)
        {
            var culture = queryStrings?["culture"];

            var allowedUserOptions = GetAllowedUserMenuItemsForNode(entity);

            if (CanUserAccessNode(entity, allowedUserOptions, culture))
            {
                //Special check to see if it is a container, if so then we'll hide children.
                var isContainer = entity.IsContainer;   // && (queryStrings.Get("isDialog") != "true");

                var node = CreateTreeNode(
                    entity,
                    Constants.ObjectTypes.Document,
                    parentId,
                    queryStrings,
                    entity.HasChildren);

                // set container style if it is one
                if (isContainer)
                {
                    node.AdditionalData.Add("isContainer", true);
                    node.SetContainerStyle();
                }

                var documentEntity = (IDocumentEntitySlim)entity;

                if (!documentEntity.Variations.VariesByCulture())
                {
                    if (!documentEntity.Published)
                    {
                        node.SetNotPublishedStyle();
                    }
                    else if (documentEntity.Edited)
                    {
                        node.SetHasPendingVersionStyle();
                    }
                }
                else
                {
                    if (!culture.IsNullOrWhiteSpace())
                    {
                        if (!documentEntity.Published || !documentEntity.PublishedCultures.Contains(culture))
                        {
                            node.SetNotPublishedStyle();
                        }
                        else if (documentEntity.EditedCultures.Contains(culture))
                        {
                            node.SetHasPendingVersionStyle();
                        }
                    }
                }

                node.AdditionalData.Add("variesByCulture", documentEntity.Variations.VariesByCulture());
                node.AdditionalData.Add("contentType", documentEntity.ContentTypeAlias);

                if (Services.PublicAccessService.IsProtected(entity.Path))
                {
                    node.SetProtectedStyle();
                }

                return(node);
            }

            return(null);
        }
Ejemplo n.º 33
0
        public static string GetTreeUrl(this UrlHelper urlHelper, Type treeType, string nodeId, FormDataCollection queryStrings)
        {
            var actionUrl = urlHelper.GetUmbracoApiService("GetNodes", treeType)
                            .EnsureEndsWith('?');

            //now we need to append the query strings
            actionUrl += "id=" + nodeId.EnsureEndsWith('&') + queryStrings.ToQueryString("id",
                                                                                         //Always ignore the custom start node id when generating URLs for tree nodes since this is a custom once-only parameter
                                                                                         // that should only ever be used when requesting a tree to render (root), not a tree node
                                                                                         TreeQueryStringParameters.StartNodeId);
            return(actionUrl);
        }
 /// <summary>
 /// GetMenuForNode(string id, FormDataCollection queryStrings)
 /// This method create the actions on a single menu item (by pressing "..." symbol)
 /// </summary>
 /// <param name="id"></param>
 /// <param name="queryStrings"></param>
 /// <returns>menu</returns>
 protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
 {
     return(null);
 }
Ejemplo n.º 35
0
        private IEnumerable <EntityBasic> GetResultForAncestors(int id, UmbracoEntityTypes entityType, FormDataCollection queryStrings = null)
        {
            var objectType = ConvertToObjectType(entityType);

            if (objectType.HasValue)
            {
                //TODO: Need to check for Object types that support hierarchic here, some might not.

                var ids = Services.EntityService.Get(id).Path.Split(',').Select(int.Parse).Distinct().ToArray();

                int[] aids = null;
                switch (entityType)
                {
                case UmbracoEntityTypes.Document:
                    aids = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService);
                    break;

                case UmbracoEntityTypes.Media:
                    aids = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService);
                    break;
                }

                if (aids != null)
                {
                    var lids = new List <int>();
                    var ok   = false;
                    foreach (var i in ids)
                    {
                        if (ok)
                        {
                            lids.Add(i);
                            continue;
                        }
                        if (aids.Contains(i))
                        {
                            lids.Add(i);
                            ok = true;
                        }
                    }
                    ids = lids.ToArray();
                }

                var culture = queryStrings?.GetValue <string>("culture");

                return(ids.Length == 0
                    ? Enumerable.Empty <EntityBasic>()
                    : Services.EntityService.GetAll(objectType.Value, ids)
                       .WhereNotNull()
                       .OrderBy(x => x.Level)
                       .Select(x => Mapper.Map <EntityBasic>(x, opts => { opts.SetCulture(culture); })));
            }
            //now we need to convert the unknown ones
            switch (entityType)
            {
            case UmbracoEntityTypes.PropertyType:
            case UmbracoEntityTypes.PropertyGroup:
            case UmbracoEntityTypes.Domain:
            case UmbracoEntityTypes.Language:
            case UmbracoEntityTypes.User:
            case UmbracoEntityTypes.Macro:
            default:
                throw new NotSupportedException("The " + typeof(EntityController) + " does not currently support data for the type " + entityType);
            }
        }
Ejemplo n.º 36
0
 public IEnumerable <EntityBasic> GetAncestors(int id, UmbracoEntityTypes type, FormDataCollection queryStrings)
 {
     return(GetResultForAncestors(id, type, queryStrings));
 }
Ejemplo n.º 37
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            return(menu);
        }
Ejemplo n.º 38
0
        /// <summary>
        /// 尝试根据方法的修饰属性来构造IActionResult实例
        /// </summary>
        /// <param name="result">Action的执行结果</param>
        /// <param name="actionAttr">Action方法上的ActionAttribute实例</param>
        /// <returns></returns>
        private IActionResult ObjectToResult(object result, ActionAttribute actionAttr)
        {
            // 如果返回值是byte[]就直接按BinaryResult方式封装结果
            //if( result != null && result.GetType() == typeof(byte[]) )
            //    return new ClownFish.Web.Action.BinaryResult((byte[])result);

            IActionResult   actionResult = null;
            SerializeFormat format       = actionAttr.OutFormat;

            // 先判断是不是由客户端指定的自动模式,如果是就解析客户端需要的序列化格式
            if (format == SerializeFormat.Auto)
            {
                // 如果是自动响应,那么就根据请求头的指定的方式来决定
                string expectFormat = this.HttpContext.Request.Headers["X-Result-Format"];

                if (string.IsNullOrEmpty(expectFormat) == false)
                {
                    SerializeFormat outFormat;
                    if (Enum.TryParse <SerializeFormat>(expectFormat, true, out outFormat))
                    {
                        format = outFormat;
                    }
                }
            }


            // 根据已指定的序列化格式包装具体的IActionResult实例

            if (format == SerializeFormat.Json)
            {
                actionResult = new JsonResult(result);
            }

            else if (format == SerializeFormat.Json2)
            {
                actionResult = new JsonResult(result, true);
            }

            else if (format == SerializeFormat.Xml)
            {
                actionResult = new XmlResult(result);
            }

            else if (format == SerializeFormat.Text)
            {
                actionResult = new TextResult(result);
            }

            else if (format == SerializeFormat.Form)
            {
                string text = FormDataCollection.Create(result).ToString();
                actionResult = new TextResult(text);
            }


            // 无法构造出IActionResult实例,就交给ActionProcessor来处理
            if (actionResult == null)
            {
                ActionHelper actionProcessor = ObjectFactory.New <ActionHelper>();
                actionResult = actionProcessor.ObjectToResult(result);
            }

            return(actionResult);
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Initializes the tree with a current starting node.
        /// </summary>
        /// <param name="currentTree">
        /// The current Tree.
        /// </param>
        /// <param name="splitId">
        /// The split id.
        /// </param>
        /// <param name="queryStrings">
        /// The query strings.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{TreeNode}"/>.
        /// </returns>
        private IEnumerable <TreeNode> InitializeTree(TreeElement currentTree, SplitRoutePath splitId, FormDataCollection queryStrings)
        {
            // collection tree
            if (_collectiontrees.Contains(splitId.CollectionId))
            {
                return(this.GetTreeNodesForCollections(
                           splitId.CollectionId,
                           MakeCollectionRoutePathId(splitId.CollectionId, splitId.CollectionKey),
                           queryStrings));
            }

            if (_attributetrees.Contains(splitId.CollectionId))
            {
                return(GetAttributeDefinedTrees(queryStrings));
            }

            return(currentTree.SubTree.GetTrees()
                   .Where(x => x.Visible)
                   .Select(tree => GetTreeNodeFromConfigurationElement(tree, queryStrings, currentTree)));
        }
Ejemplo n.º 40
0
        public static string GetMenuUrl(this UrlHelper urlHelper, Type treeType, string nodeId, FormDataCollection queryStrings)
        {
            var actionUrl = urlHelper.GetUmbracoApiService("GetMenu", treeType)
                            .EnsureEndsWith('?');

            //now we need to append the query strings
            actionUrl += "id=" + nodeId.EnsureEndsWith('&') + queryStrings.ToQueryString("id");
            return(actionUrl);
        }
Ejemplo n.º 41
0
        /// <summary>
        /// Gets tree nodes for static collections.
        /// </summary>
        /// <param name="info">
        /// The info.
        /// </param>
        /// <param name="splitId">
        /// The split id.
        /// </param>
        /// <param name="collectionId">
        /// The collection id.
        /// </param>
        /// <param name="parentRouteId">
        /// The parent route id.
        /// </param>
        /// <param name="queryStrings">
        /// The query strings.
        /// </param>
        /// <param name="collectionRoots">
        /// The collection roots.
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{TreeNode}"/>.
        /// </returns>
        private IEnumerable <TreeNode> GetTreeNodesFromCollection(CollectionProviderInfo info, SplitRoutePath splitId, string collectionId, string parentRouteId, FormDataCollection queryStrings, bool collectionRoots = true)
        {
            var collections = collectionRoots
                                  ? info.ManagedCollections.Where(x => x.ParentKey == null).OrderBy(x => x.SortOrder)
                                  : info.ManagedCollections.Where(x => x.ParentKey == splitId.CollectionKeyAsGuid())
                              .OrderBy(x => x.SortOrder);

            var treeNodes = collections.Any() ?

                            collections.Select(
                collection =>
                CreateTreeNode(
                    MakeCollectionRoutePathId(collectionId, collection.Key.ToString()),
                    parentRouteId,
                    queryStrings,
                    collection.Name,
                    "icon-list",
                    info.ManagedCollections.Any(x => x.ParentKey == collection.Key),
                    string.Format("/merchello/merchello/{0}/{1}", info.ViewName, collection.Key))).ToArray() :

                            new TreeNode[] { };

            if (!treeNodes.Any())
            {
                return(treeNodes);
            }


            //// need to tag these nodes so that they can be filtered by the directive to select which
            //// collections entities can be assigned to via the back office
            foreach (var tn in treeNodes)
            {
                tn.CssClasses.Add("static-collection");
            }

            return(treeNodes);
        }
Ejemplo n.º 42
0
        /// <summary>
        /// The get tree node from configuration element.
        /// </summary>
        /// <param name="tree">
        /// The tree.
        /// </param>
        /// <param name="collectionId">
        /// The root collection type (e.g. sales, product, customer)
        /// </param>
        /// <param name="info">
        /// The info.
        /// </param>
        /// <param name="queryStrings">
        /// The query strings.
        /// </param>
        /// <param name="parentRouteId">The parent route id</param>
        /// <returns>
        /// The <see cref="IEnumerable{TreeNode}"/>.
        /// </returns>
        private IEnumerable <TreeNode> GetTreeNodeForConfigurationEntityCollectionProviders(TreeElement tree, string collectionId, CollectionProviderInfo info, FormDataCollection queryStrings, string parentRouteId)
        {
            // get the self managed providers
            var grouping = new List <Tuple <EntityCollectionProviderElement, EntityCollectionProviderDisplay> >();

            foreach (var element in
                     tree.SelfManagedEntityCollectionProviderCollections.EntityCollectionProviders().Where(x => x.Visible))
            {
                Guid elementKey;
                if (!Guid.TryParse(element.Key, out elementKey))
                {
                    continue;
                }

                var providerDisplay =
                    this._entityCollectionProviderResolver.GetProviderAttributes()
                    .First(x => x.Key == elementKey)
                    .ToEntityCollectionProviderDisplay();
                if (providerDisplay != null)
                {
                    grouping.Add(new Tuple <EntityCollectionProviderElement, EntityCollectionProviderDisplay>(element, providerDisplay));
                }
            }

            if (!grouping.Any())
            {
                return(Enumerable.Empty <TreeNode>());
            }

            var treeNodes = new List <TreeNode>();

            // ReSharper disable once LoopCanBeConvertedToQuery
            foreach (var g in grouping)
            {
                if (!g.Item2.ManagedCollections.Any())
                {
                    continue;
                }

                var element    = g.Item1;
                var provider   = g.Item2;
                var collection = g.Item2.ManagedCollections.First();

                treeNodes.Add(
                    this.CreateTreeNode(
                        MakeCollectionRoutePathId(collectionId, collection.Key.ToString()) + "_resolved",
                        parentRouteId,
                        queryStrings,
                        provider.LocalizedNameKey.IsNullOrWhiteSpace() ? provider.Name : this._textService.Localize(provider.LocalizedNameKey, this._culture),
                        element.Icon,
                        false,
                        string.Format("/merchello/merchello/{0}/{1}", info.ViewName, collection.Key)));
            }

            return(treeNodes);
        }
Ejemplo n.º 43
0
        /// <summary>
        /// The get menu for node.
        /// </summary>
        /// <param name="id">
        /// The id.
        /// </param>
        /// <param name="queryStrings">
        /// The query strings.
        /// </param>
        /// <returns>
        /// The <see cref="MenuItemCollection"/>.
        /// </returns>
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            var menu = new MenuItemCollection();

            // Products
            if (id == "products")
            {
                menu.Items.Add <NewCollectionAction>(
                    _textService.Localize("merchelloVariant/newProduct", _culture),
                    false)
                .LaunchDialogView(
                    DialogsPath + "product.add.html",
                    _textService.Localize("merchelloVariant/newProduct", _culture));
                //.NavigateToRoute("merchello/merchello/productedit/create");

                menu.Items.Add <NewProductContentTypeAction>(
                    _textService.Localize("merchelloDetachedContent/associateContentType", _culture),
                    false)
                .LaunchDialogView(DialogsPath + "productcontenttype.add.html", _textService.Localize("merchelloDetachedContent/associateContentType", _culture));
            }

            if (id == "customers")
            {
                menu.Items.Add <NewCollectionAction>(
                    _textService.Localize("merchelloCustomers/newCustomer", _culture), false)
                .LaunchDialogView(DialogsPath + "customer.newcustomer.html", _textService.Localize("merchelloCustomers/newCustomer", _culture));
            }

            if (id == "marketing")
            {
                menu.Items.Add <NewOfferSettingsAction>(
                    _textService.Localize("merchelloMarketing/newOffer", _culture),
                    false)
                .LaunchDialogView(
                    DialogsPath + "marketing.newofferproviderselection.html",
                    _textService.Localize("merchelloMarketing/newOffer", _culture));
            }

            //// child nodes will have an id separated with a hypen and key
            //// e.g.  products_[GUID]
            var splitId = new SplitRoutePath(id);

            if (_collectiontrees.Contains(splitId.CollectionId) && !id.EndsWith("_resolved"))
            {
                menu.Items.Add <NewCollectionAction>(
                    _textService.Localize(string.Format("merchelloCollections/{0}", NewCollectionAction.Instance.Alias), _culture),
                    _collectiontrees.Contains(id),
                    new Dictionary <string, object>()
                {
                    { "dialogData", new { entityType = splitId.CollectionId, parentKey = splitId.CollectionKey } }
                }).LaunchDialogView(DialogsPath + "create.staticcollection.html", _textService.Localize(string.Format("merchelloCollections/{0}", NewCollectionAction.Instance.Alias), _culture));

                if (!_collectiontrees.Contains(id)) // don't show this on root nodes
                {
                    menu.Items.Add <ManageEntitiesAction>(
                        _textService.Localize(string.Format("merchelloCollections/{0}", ManageEntitiesAction.Instance.Alias), _culture),
                        false,
                        new Dictionary <string, object>()
                    {
                        { "dialogData", new { entityType = splitId.CollectionId, collectionKey = splitId.CollectionKey } }
                    }).LaunchDialogView(DialogsPath + "manage.staticcollection.html", _textService.Localize(string.Format("merchelloCollections/{0}", ManageEntitiesAction.Instance.Alias), _culture));
                }

                menu.Items.Add <SortCollectionAction>(
                    _textService.Localize("actions/sort", _culture),
                    false,
                    new Dictionary <string, object>()
                {
                    { "dialogData", new { entityType = splitId.CollectionId, parentKey = splitId.CollectionKey } }
                }).LaunchDialogView(DialogsPath + "sort.staticcollection.html", _textService.Localize(string.Format("merchelloCollections/{0}", SortCollectionAction.Instance.Alias), _culture));

                if (splitId.IsChildCollection)
                {
                    // add the delete button
                    menu.Items.Add <DeleteCollectionAction>(
                        _textService.Localize("actions/delete", _culture),
                        false,
                        new Dictionary <string, object>()
                    {
                        { "dialogData", new { entityType = splitId.CollectionId, collectionKey = splitId.CollectionKey } }
                    })
                    .LaunchDialogView(DialogsPath + "delete.staticcollection.html", _textService.Localize("actions/delete", _culture));
                }
            }

            menu.Items.Add <RefreshNode, ActionRefresh>(_textService.Localize(string.Format("actions/{0}", ActionRefresh.Instance.Alias), _culture), id != "gateways" && !id.EndsWith("_resolved"));

            return(menu);
        }
Ejemplo n.º 44
0
        /// <summary>
        /// Gets tree nodes for collections.
        /// </summary>
        /// <param name="collectionId">
        /// The collection id.
        /// </param>
        /// <param name="parentRouteId">
        /// The parent route id.
        /// </param>
        /// <param name="queryStrings">
        /// The query strings.
        /// </param>
        /// <param name="collectionRoots">
        /// Indicates this is a collection root node
        /// </param>
        /// <returns>
        /// The <see cref="IEnumerable{TreeNode}"/>.
        /// </returns>
        private IEnumerable <TreeNode> GetTreeNodesForCollections(string collectionId, string parentRouteId, FormDataCollection queryStrings, bool collectionRoots = true)
        {
            var info    = this.GetCollectionProviderInfo(collectionId);
            var splitId = new SplitRoutePath(parentRouteId);

            // add any configured dynamic collections
            var currentTree = _rootTrees.FirstOrDefault(x => x.Id == splitId.CollectionId && x.Visible);

            var treeNodes = new List <TreeNode>();

            if (currentTree == null)
            {
                return(treeNodes);
            }

            var managedFirst = true;

            if (currentTree.ChildSettings.Count > 0)
            {
                var setting =
                    currentTree.ChildSettings.AllSettings()
                    .First(x => x.Alias == "selfManagedProvidersBeforeStaticProviders");
                if (setting != null)
                {
                    managedFirst = bool.Parse(setting.Value);
                }
            }

            if (managedFirst)
            {
                var sm = GetTreeNodesForSelfManagedProviders(currentTree, info, splitId, collectionId, parentRouteId, queryStrings).ToArray();
                if (sm.Any())
                {
                    treeNodes.AddRange(sm);
                }

                var sc = GetTreeNodesFromCollection(info, splitId, collectionId, parentRouteId, queryStrings, collectionRoots).ToArray();
                if (sc.Any())
                {
                    treeNodes.AddRange(sc);
                }
            }
            else
            {
                var sc = GetTreeNodesFromCollection(info, splitId, collectionId, parentRouteId, queryStrings, collectionRoots).ToArray();
                if (sc.Any())
                {
                    treeNodes.AddRange(sc);
                }

                var sm = GetTreeNodesForSelfManagedProviders(currentTree, info, splitId, collectionId, parentRouteId, queryStrings).ToArray();
                if (sm.Any())
                {
                    treeNodes.AddRange(sm);
                }
            }

            return(treeNodes);
        }
Ejemplo n.º 45
0
 /// <summary>
 /// The method called to render the contents of the tree structure
 /// </summary>
 /// <param name="id"></param>
 /// <param name="queryStrings">
 /// All of the query string parameters passed from jsTree
 /// </param>
 /// <remarks>
 /// We are allowing an arbitrary number of query strings to be passed in so that developers are able to persist custom data from the front-end
 /// to the back end to be used in the query for model data.
 /// </remarks>
 protected abstract TreeNodeCollection GetTreeNodes(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings);
Ejemplo n.º 46
0
 /// <summary>
 /// Returns the menu structure for the node
 /// </summary>
 /// <param name="id"></param>
 /// <param name="queryStrings"></param>
 /// <returns></returns>
 protected abstract MenuItemCollection GetMenuForNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings);
Ejemplo n.º 47
0
        /// <summary>
        /// Helper method to create tree nodes and automatically generate the json url + UDI
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="entityObjectType"></param>
        /// <param name="parentId"></param>
        /// <param name="queryStrings"></param>
        /// <param name="icon"></param>
        /// <param name="hasChildren"></param>
        /// <returns></returns>
        public TreeNode CreateTreeNode(IUmbracoEntity entity, Guid entityObjectType, string parentId, FormDataCollection queryStrings, string icon, bool hasChildren)
        {
            var treeNode = CreateTreeNode(entity.Id.ToInvariantString(), parentId, queryStrings, entity.Name, icon);

            treeNode.Udi         = Udi.Create(ObjectTypes.GetUdiType(entityObjectType), entity.Key);
            treeNode.Path        = entity.Path;
            treeNode.HasChildren = hasChildren;
            return(treeNode);
        }
Ejemplo n.º 48
0
 /// <summary>
 /// If the request is for a dialog mode tree
 /// </summary>
 /// <param name="queryStrings"></param>
 /// <returns></returns>
 protected bool IsDialog(FormDataCollection queryStrings)
 {
     return(queryStrings.GetValue <bool>(TreeQueryStringParameters.IsDialog));
 }
Ejemplo n.º 49
0
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var cacheKey = $"PerplexFormTreeController_GetTreeNodes_id:{queryStrings["id"]}";
            var rtCache  = ApplicationContext.ApplicationCache.RuntimeCache;

            // If this is a form, use Umbraco's default behavior
            var folder = PerplexFolder.Get(id);

            if (folder == null)
            {
                var treeNodeCollection = _cacheConfig.EnableCache ? (TreeNodeCollection)rtCache.GetCacheItem(cacheKey) : (TreeNodeCollection)null;

                if (treeNodeCollection == null)
                {
                    treeNodeCollection = base.GetTreeNodes(id, queryStrings);

                    if (_cacheConfig.EnableCache)
                    {
                        if (rtCache.GetCacheItemsByKeySearch(cacheKey).Any())
                        {
                            rtCache.ClearCacheByKeySearch(cacheKey);
                        }

                        rtCache.InsertCacheItem(cacheKey, () => treeNodeCollection, new TimeSpan(0, _cacheConfig.CacheDurationInMinutes, 0), true);
                    }
                }

                return(treeNodeCollection);
            }

            // This is a folder
            var baseTreeNodes = _cacheConfig.EnableCache ? (TreeNodeCollection)rtCache.GetCacheItem(cacheKey) : (TreeNodeCollection)null;

            if (baseTreeNodes == null)
            {
                // We require all forms, and apply filtering based on folders later
                baseTreeNodes = base.GetTreeNodes("-1", queryStrings);

                // Sanity check; make sure there are no orphan forms around
                // (forms not contained within any folder). If so, move them to the root folder
                var orphans = baseTreeNodes.Where(n => PerplexFolder.Get(f => f.Forms.Any(formId => formId == n.Id.ToString())) == null).ToList();
                if (orphans.Count > 0)
                {
                    foreach (var orphan in orphans)
                    {
                        PerplexFolder.GetRootFolder().Forms.Add(orphan.Id.ToString());
                    }

                    PerplexFolder.SaveAll();
                }

                // Hide all Forms that are not contained within this folder
                // If this folder itself is disabled (due to the user not having access),
                // we also hide all its forms
                baseTreeNodes.RemoveAll(n =>
                                        !folder.Forms.Contains(n.Id.ToString()) ||
                                        (folder.Disabled && folder.Forms.Contains(n.Id.ToString()))
                                        );

                // Sort the forms of this folder in the order as defined by the folder
                baseTreeNodes.Sort((x, y) =>
                {
                    int idxX, idxY;

                    idxX = folder.Forms.IndexOf(x.Id.ToString());
                    idxY = folder.Forms.IndexOf(y.Id.ToString());

                    return(idxX.CompareTo(idxY));
                });

                // Add any subfolders of this node
                // We loop through the list in reverse as we add every folder at the start of the list (before forms)
                foreach (var subFolder in folder.Folders.Reverse())
                {
                    // If this subfolder is disabled, and it is not on a path towards
                    // a folder that is NOT disabled, it should not be listed at all.
                    // When multiple start nodes are defined, it is possible for a disabled
                    // folder to be displayed in the tree, when one of its descendant folders is enabled.
                    if (subFolder.Disabled)
                    {
                        var startFolders = PerplexFolder.GetStartFoldersForCurrentUser();

                        bool isOnPathTowardsStartFolder = startFolders.Any(sf => sf.Path.Any(fid => fid == subFolder.Id));
                        if (!isOnPathTowardsStartFolder)
                        {
                            continue;
                        }
                    }

                    var treeNode = CreateTreeNode(subFolder.Id, id, queryStrings, subFolder.Name);

                    // Clicking this folder will show the folder overview
                    // By default all nodes go to /forms/form/edit/<GUID>, but this
                    // is only valid for forms. We direct to our custom folder view
                    treeNode.RoutePath = "forms/perplexForms/folder/" + treeNode.Id;
                    if (subFolder.Disabled)
                    {
                        treeNode.CssClasses.Add("disabled");
                    }

                    // Folder has children if it has either forms or folders.
                    // If it is disabled, this is only true when it has subfolders
                    // since we do not show its forms.
                    treeNode.HasChildren = (subFolder.Disabled && subFolder.Folders.Any()) || (!subFolder.Disabled && (subFolder.Forms.Any() || subFolder.Folders.Any()));

                    // Folders are added at the top of the list, before forms
                    baseTreeNodes.Insert(0, treeNode);
                }

                if (_cacheConfig.EnableCache)
                {
                    if (rtCache.GetCacheItemsByKeySearch(cacheKey).Any())
                    {
                        rtCache.ClearCacheByKeySearch(cacheKey);
                    }

                    rtCache.InsertCacheItem(cacheKey, () => baseTreeNodes, new TimeSpan(0, _cacheConfig.CacheDurationInMinutes, 0), true);
                }
            }

            return(baseTreeNodes);
        }
Ejemplo n.º 50
0
        /// <summary>
        /// Helper method to create tree nodes and automatically generate the json url + UDI
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="entityObjectType"></param>
        /// <param name="parentId"></param>
        /// <param name="queryStrings"></param>
        /// <param name="hasChildren"></param>
        /// <returns></returns>
        public TreeNode CreateTreeNode(IEntitySlim entity, Guid entityObjectType, string parentId, FormDataCollection queryStrings, bool hasChildren)
        {
            var contentTypeIcon = entity is IContentEntitySlim contentEntity ? contentEntity.ContentTypeIcon : null;
            var treeNode        = CreateTreeNode(entity.Id.ToInvariantString(), parentId, queryStrings, entity.Name, contentTypeIcon);

            treeNode.Path        = entity.Path;
            treeNode.Udi         = Udi.Create(ObjectTypes.GetUdiType(entityObjectType), entity.Key);
            treeNode.HasChildren = hasChildren;
            return(treeNode);
        }
        protected virtual TreeNodeCollection PerformGetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var nodes = new TreeNodeCollection();

            var rootIdString    = Constants.System.RootString;
            var hasAccessToRoot = UserStartNodes.Contains(Constants.System.Root);

            var startNodeId = queryStrings.HasKey(TreeQueryStringParameters.StartNodeId)
                ? queryStrings.GetValue <string>(TreeQueryStringParameters.StartNodeId)
                : string.Empty;

            var ignoreUserStartNodes = IgnoreUserStartNodes(queryStrings);

            if (string.IsNullOrEmpty(startNodeId) == false && startNodeId != "undefined" && startNodeId != rootIdString)
            {
                // request has been made to render from a specific, non-root, start node
                id = startNodeId;

                // ensure that the user has access to that node, otherwise return the empty tree nodes collection
                // TODO: in the future we could return a validation statement so we can have some UI to notify the user they don't have access
                if (ignoreUserStartNodes == false && HasPathAccess(id, queryStrings) == false)
                {
                    Logger.Warn <ContentTreeControllerBase>("User {Username} does not have access to node with id {Id}", Security.CurrentUser.Username, id);
                    return(nodes);
                }

                // if the tree is rendered...
                // - in a dialog: render only the children of the specific start node, nothing to do
                // - in a section: if the current user's start nodes do not contain the root node, we need
                //   to include these start nodes in the tree too, to provide some context - i.e. change
                //   start node back to root node, and then GetChildEntities method will take care of the rest.
                if (IsDialog(queryStrings) == false && hasAccessToRoot == false)
                {
                    id = rootIdString;
                }
            }

            // get child entities - if id is root, but user's start nodes do not contain the
            // root node, this returns the start nodes instead of root's children
            var entities = GetChildEntities(id, queryStrings).ToList();

            //get the current user start node/paths
            GetUserStartNodes(out var userStartNodes, out var userStartNodePaths);

            nodes.AddRange(entities.Select(x => GetSingleTreeNodeWithAccessCheck(x, id, queryStrings, userStartNodes, userStartNodePaths)).Where(x => x != null));

            // if the user does not have access to the root node, what we have is the start nodes,
            // but to provide some context we also need to add their topmost nodes when they are not
            // topmost nodes themselves (level > 1).
            if (id == rootIdString && hasAccessToRoot == false)
            {
                var topNodeIds = entities.Where(x => x.Level > 1).Select(GetTopNodeId).Where(x => x != 0).Distinct().ToArray();
                if (topNodeIds.Length > 0)
                {
                    var topNodes = Services.EntityService.GetAll(UmbracoObjectType, topNodeIds.ToArray());
                    nodes.AddRange(topNodes.Select(x => GetSingleTreeNodeWithAccessCheck(x, id, queryStrings, userStartNodes, userStartNodePaths)).Where(x => x != null));
                }
            }

            return(nodes);
        }
Ejemplo n.º 52
0
        protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
        {
            // Default behavior
            var menu = base.GetMenuForNode(id, queryStrings);

            // Remove Umbraco Copy
            menu.Items.RemoveAll(m => m.Alias == "copy");

            // Clear any stored folderId
            var sessionId = UmbracoContext.Security.GetSessionId();

            HttpContext.Current.Cache.Remove(sessionId + "_folderId");

            // If we can parse the GUID, it must be a form (or a folder)
            // Other types contain a guid with _workflow and _entries which do not parse as a guid
            Guid result;

            if (Guid.TryParse(queryStrings.Get("id"), out result))
            {
                // Is this a Folder?
                var folder = PerplexFolder.Get(result.ToString());

                if (folder != null)
                {
                    // If the folder is disabled, we will remove all entries from the menu,
                    // except for "Reload" (it's harmless)
                    if (folder.Disabled)
                    {
                        menu.Items.RemoveAll(m => m.Alias != ActionRefresh.Instance.Alias);
                        return(menu);
                    }

                    // Create Form (default Umbraco view, hence alias)
                    AddMenuItem(menu, "Create Form", alias: "create", icon: "icon icon-add");

                    // Create Folder
                    AddMenuItem(menu, "Create Folder", view: "createFolder", icon: "icon icon-folder");

                    // Move Folder
                    AddMenuItem(menu, "Move Folder", view: "moveFolder", icon: "icon icon-enter");

                    // Remove existing Delete (works only on a Form)
                    menu.Items.RemoveAll(m => m.Alias == "delete");

                    // Delete Folder
                    AddMenuItem(menu, "Delete Folder", view: "deleteFolder", icon: "icon icon-delete");

                    // Sort Folder
                    AddMenuItem(menu, "Sort", view: "sort", icon: "icon icon-navigation-vertical");

                    // Reload
                    menu.Items.Add <RefreshNode, ActionRefresh>(ui.Text("actions", ActionRefresh.Instance.Alias), true);

                    // We store this folder's ID in our session in case a new form is created
                    HttpContext.Current.Cache[sessionId + "_folderId"] = folder.Id;
                }
                // This is a form
                else
                {
                    // Copy Form
                    AddMenuItem(menu, "Copy", view: "copyForm", icon: "icon icon-documents");

                    // Move Form
                    AddMenuItem(menu, "Move", view: "moveForm", icon: "icon icon-enter");
                }
            }
            else
            {
                // This is the root folder
                var root = PerplexFolder.GetRootFolder();

                // If the root folder is disabled, remove all menu actions except Reload
                if (root.Disabled)
                {
                    menu.Items.RemoveAll(m => m.Alias != ActionRefresh.Instance.Alias);
                    return(menu);
                }

                // Add Create Folder button to root
                AddMenuItem(menu, "Create Folder", view: "createFolder", icon: "icon icon-folder");

                // Sort Folder
                AddMenuItem(menu, "Sort", view: "sort", icon: "icon icon-navigation-vertical");

                // We store this folder's ID in our session in case a new form is created
                HttpContext.Current.Cache[sessionId + "_folderId"] = "-1";
            }

            return(menu);
        }
Ejemplo n.º 53
0
        protected override MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings)
        {
            if (id == Constants.System.RootString)
            {
                var menu = new MenuItemCollection();

                // if the user's start node is not the root then the only menu item to display is refresh
                if (UserStartNodes.Contains(Constants.System.Root) == false)
                {
                    menu.Items.Add(new RefreshNode(Services.TextService, true));
                    return(menu);
                }

                //set the default to create
                menu.DefaultMenuAlias = ActionNew.ActionAlias;

                // we need to get the default permissions as you can't set permissions on the very root node
                var assignedPermissions = Services.UserService.GetAssignedPermissions(Security.CurrentUser, Constants.System.Root);
                var nodeActions         = _actions.GetByLetters(assignedPermissions)
                                          .Select(x => new MenuItem(x));

                //these two are the standard items
                menu.Items.Add <ActionNew>(Services.TextService, opensDialog: true);
                menu.Items.Add <ActionSort>(Services.TextService, true);

                //filter the standard items
                FilterUserAllowedMenuItems(menu, nodeActions);

                if (menu.Items.Any())
                {
                    menu.Items.Last().SeparatorBefore = true;
                }

                // add default actions for *all* users
                menu.Items.Add(new RefreshNode(Services.TextService, true));

                return(menu);
            }


            //return a normal node menu:
            int iid;

            if (int.TryParse(id, out iid) == false)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }
            var item = Services.EntityService.Get(iid, UmbracoObjectTypes.Document);

            if (item == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            //if the user has no path access for this node, all they can do is refresh
            if (!Security.CurrentUser.HasContentPathAccess(item, Services.EntityService))
            {
                var menu = new MenuItemCollection();
                menu.Items.Add(new RefreshNode(Services.TextService, true));
                return(menu);
            }

            var nodeMenu = GetAllNodeMenuItems(item);

            //if the content node is in the recycle bin, don't have a default menu, just show the regular menu
            if (item.Path.Split(Constants.CharArrays.Comma, StringSplitOptions.RemoveEmptyEntries).Contains(RecycleBinId.ToInvariantString()))
            {
                nodeMenu.DefaultMenuAlias = null;
                nodeMenu = GetNodeMenuItemsForDeletedContent(item);
            }
            else
            {
                //set the default to create
                nodeMenu.DefaultMenuAlias = ActionNew.ActionAlias;
            }

            var allowedMenuItems = GetAllowedUserMenuItemsForNode(item);

            FilterUserAllowedMenuItems(nodeMenu, allowedMenuItems);

            return(nodeMenu);
        }
 /// <summary>
 /// Returns true or false if the current user has access to the node based on the user's allowed start node (path) access
 /// </summary>
 /// <param name="id"></param>
 /// <param name="queryStrings"></param>
 /// <returns></returns>
 //we should remove this in v8, it's now here for backwards compat only
 protected abstract bool HasPathAccess(string id, FormDataCollection queryStrings);
 protected abstract TreeNode GetSingleTreeNode(IEntitySlim entity, string parentId, FormDataCollection queryStrings);
Ejemplo n.º 56
0
        /// <summary>
        /// Returns true or false if the current user has access to the node based on the user's allowed start node (path) access
        /// </summary>
        /// <param name="id"></param>
        /// <param name="queryStrings"></param>
        /// <returns></returns>
        protected override bool HasPathAccess(string id, FormDataCollection queryStrings)
        {
            var entity = GetEntityFromId(id);

            return(HasPathAccess(entity, queryStrings));
        }
 protected override MenuItemCollection GetMenuForNode(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings) => null;
 protected override TreeNodeCollection GetTreeNodes(string id, [ModelBinder(typeof(HttpQueryStringModelBinder))] FormDataCollection queryStrings) => null;
        /// <summary>
        /// GetTreeNodes(string id, FormDataCollection queryStrings)
        /// This method create the Base Tree of FALM custom section
        /// </summary>
        /// <param name="id"></param>
        /// <param name="queryStrings"></param>
        /// <returns>tree</returns>
        protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
        {
            var tree        = new TreeNodeCollection();
            var textService = ApplicationContext.Services.TextService;

            // check if we're rendering the root node's children
            if (id == global::Umbraco.Core.Constants.System.Root.ToInvariantString())
            {
                tree = new TreeNodeCollection
                {
                    CreateTreeNode("logs", "-1", queryStrings, textService.Localize("FALM/LogsManager.TreeSection", CultureInfo.CurrentCulture), "icon-list", true, queryStrings.GetValue <string>("application")),
                    CreateTreeNode("media", "-1", queryStrings, textService.Localize("FALM/MediaManager.TreeSection", CultureInfo.CurrentCulture), "icon-umb-media", true, queryStrings.GetValue <string>("application")),
                    CreateTreeNode("users", "-1", queryStrings, textService.Localize("FALM/UsersManager.TreeSection", CultureInfo.CurrentCulture), "icon-users", true, queryStrings.GetValue <string>("application")),
                    CreateTreeNode("versions", "-1", queryStrings, textService.Localize("FALM/VersionsManager.TreeSection", CultureInfo.CurrentCulture), "icon-books", true, queryStrings.GetValue <string>("application")),
                    CreateTreeNode("recyclebin", "-1", queryStrings, textService.Localize("FALM/RecycleBinManager.TreeSection", CultureInfo.CurrentCulture), "icon-trash", true, queryStrings.GetValue <string>("application")),
                    CreateTreeNode("cachetemp", "-1", queryStrings, textService.Localize("FALM/CacheTempManager.TreeSection", CultureInfo.CurrentCulture), "icon-folders", true, queryStrings.GetValue <string>("application"))
                };

                return(tree);
            }
            else
            {
                switch (id)
                {
                case "logs":     // check if we're rendering Logs node's children
                    tree = new TreeNodeCollection {
                        CreateTreeNode("logs-dbmanager", id, queryStrings, textService.Localize("FALM/LogsManager.TreeActionManagerDB", CultureInfo.CurrentCulture), "icon-diagnostics color-green", false),
                        CreateTreeNode("logs-tlmanager", id, queryStrings, textService.Localize("FALM/LogsManager.TreeActionManagerTL", CultureInfo.CurrentCulture), "icon-folder", true, queryStrings.GetValue <string>("application"))
                    };
                    break;

                case "logs-tlmanager":     // check if we're rendering Logs node's children
                    tree = new TreeNodeCollection();

                    // LogService
                    HkLogsService logsService        = new HkLogsService();
                    string        currentMachineName = Environment.MachineName;
                    int           iCount             = 1;

                    // Create TraceLog tree
                    foreach (var logFile in logsService.GetTraceLogFiles())
                    {
                        string title = iCount == 1 ? textService.Localize("FALM/LogsManager.TreeActionManagerTL.Today", CultureInfo.CurrentCulture) : logFile.Date.ToString("yyyy-MM-dd");

                        if (logFile.MachineName != null && !logFile.MachineName.InvariantEquals(currentMachineName))
                        {
                            title += " (" + logFile.MachineName + ")";
                        }

                        string path = HttpUtility.UrlEncode(System.IO.Path.GetFileName(logFile.FileName));
                        string traceLogRoutePath = queryStrings.GetValue <string>("application") + "/housekeeping/edittl/" + path;

                        tree.Add(CreateTreeNode(path, id, queryStrings, title, "icon-calendar-alt color-green", false, traceLogRoutePath));

                        iCount++;
                    }
                    ;
                    break;

                case "media":     //check if we're rendering Media node's children
                    var mediaPath = queryStrings.GetValue <string>("application") + "/" + this.TreeAlias + "/media-cleanup";
                    tree = new TreeNodeCollection {
                        CreateTreeNode("media-cleanup", id, queryStrings, textService.Localize("FALM/MediaManager.TreeActionCleanup", CultureInfo.CurrentCulture), "icon-delete color-red", false)
                    };
                    break;

                case "users":     //check if we're rendering Users node's children
                    tree = new TreeNodeCollection {
                        CreateTreeNode("users-cleanup", id, queryStrings, textService.Localize("FALM/UsersManager.TreeActionCleanup", CultureInfo.CurrentCulture), "icon-delete color-red", false)
                    };
                    break;

                case "versions":     //check if we're rendering Versions node's children
                    tree = new TreeNodeCollection {
                        CreateTreeNode("versions-manager", id, queryStrings, textService.Localize("FALM/VersionsManager.TreeActionManager", CultureInfo.CurrentCulture), "icon-diagnostics color-green", false)
                    };
                    break;

                case "recyclebin":     //check if we're rendering Recycle Bin node's children
                    tree = new TreeNodeCollection {
                        CreateTreeNode("recyclebin-cleanup", id, queryStrings, textService.Localize("FALM/RecycleBinManager.TreeActionCleanup", CultureInfo.CurrentCulture), "icon-delete color-red", false)
                    };
                    break;

                case "cachetemp":     //check if we're rendering Recycle Bin node's children
                    tree = new TreeNodeCollection {
                        CreateTreeNode("cache-cleanup", id, queryStrings, textService.Localize("FALM/CacheTempManager.Cache.TreeActionCleanup", CultureInfo.CurrentCulture), "icon-delete color-red", false),
                        CreateTreeNode("temp-cleanup", id, queryStrings, textService.Localize("FALM/CacheTempManager.Temp.TreeActionCleanup", CultureInfo.CurrentCulture), "icon-delete color-red", false)
                    };
                    break;
                }

                return(tree);
            }

            //this tree doesn't suport rendering more than 1 level
            throw new NotSupportedException();
        }
 protected abstract MenuItemCollection PerformGetMenuForNode(string id, FormDataCollection queryStrings);