예제 #1
0
 private void CreateLevels(List <KeyValueVO> values, int levels, int childs, bool includeIndex, ref int index, string prefix)
 {
     if (levels < 0)
     {
         return;
     }
     for (int i = 0; i < childs; i++)
     {
         KeyValueVO keyValue = new KeyValueVO()
         {
             Key = string.Format("L{0}K{1}", levels, i.ToString()), Value = string.Format("L{0}V{1}", levels, i.ToString())
         };
         if (includeIndex)
         {
             keyValue.Key = "I" + index + keyValue.Key;
         }
         if (!string.IsNullOrEmpty(prefix))
         {
             keyValue.Key = prefix + keyValue.Key;
         }
         values.Add(keyValue);
         index++;
         this.CreateLevels(keyValue.Children, levels - 1, childs, includeIndex, ref index, prefix);
     }
 }
예제 #2
0
        public KeyValueVO GetModelSelectSelected()
        {
            KeyValueVO keyValue = new KeyValueVO();

            keyValue.Selection = "K1";
            return(keyValue);
        }
예제 #3
0
        public KeyValueVO GetSelectedTag()
        {
            KeyValueVO selectedTag = new KeyValueVO()
            {
                Key = "d-on-click", Value = "Functions to be called by OnClick events"
            };

            return(selectedTag);
        }
예제 #4
0
        public async Task <ActionResult> Login([FromBody] KeyValueVO identity)
        {
            if ((identity.Key != "admin") || (identity.Value != "password"))
            {
                return(Ok("Error"));
            }
            List <Claim> claims = new List <Claim>();

            claims.Add(new Claim("userLogin", identity.Key));
            claims.Add(new Claim("domain", "domain"));
            ClaimsIdentity claimsIdentity = new ClaimsIdentity(claims, "local", "userlogin", "domain");
            await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity));

            return(Ok("Ok"));
        }
예제 #5
0
        public IEnumerable <KeyValueVO> GetModelSelectOptionTree()
        {
            List <KeyValueVO> tree = new List <KeyValueVO>();

            for (int i = 0; i < 3; i++)
            {
                KeyValueVO parentNode = new KeyValueVO()
                {
                    Key = string.Format("Parent {0}", i.ToString()), Value = string.Format("Parent {0}", i.ToString())
                };
                for (int j = 0; j < 4; j++)
                {
                    parentNode.Children.Add(new KeyValueVO()
                    {
                        Key = string.Format("Child {0} of {1}", j.ToString(), i.ToString()), Value = string.Format("Child {0} of {1}", j.ToString(), i.ToString())
                    });
                }
                tree.Add(parentNode);
            }
            return(tree);
        }
예제 #6
0
        public IEnumerable <KeyValueVO> GetHeadersJoin([FromHeader] string item = null, [FromHeader] string list1 = null, [FromHeader] string list2 = null)
        {
            List <KeyValueVO> list       = new List <KeyValueVO>();
            KeyValueVO        itemObject = DrapoConverter.DeserializeObject <KeyValueVO>(item);

            if (itemObject != null)
            {
                list.Add(itemObject);
            }
            List <KeyValueVO> list1Object = DrapoConverter.DeserializeObject <List <KeyValueVO> >(list1);

            if (list1Object != null)
            {
                list.AddRange(list1Object);
            }
            List <KeyValueVO> list2Object = list2 != null?DrapoConverter.DeserializeObject <List <KeyValueVO> >(list2) : null;

            if (list2Object != null)
            {
                list.AddRange(list2Object);
            }
            return(list);
        }