Esempio n. 1
0
        public XmlDocument GetPrefixedEntries(string prefix)
        {
            DateTime       t1          = DateTime.Now;
            CollectionView vContainers = GetContainers();

            vContainers.ApplyFilter("Tag", prefix, CollectionView.FilterOperand.StartsWith);
            System.Xml.XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.AppendChild(xmlDoc.CreateElement("entries"));
            if (prefix != null)
            {
                int nbRows = 0;
                try
                {
                    for (int i = 0; i < vContainers.Count; i++)
                    {
                        Container c         = (Container)vContainers[i];
                        XmlNode   entryNode = xmlDoc.CreateElement("entry");
                        AjaxUtils.addAttribute(ref entryNode, "key", c.Tag);
                        AjaxUtils.addAttribute(ref entryNode, "value", c.Name);
                        xmlDoc.DocumentElement.AppendChild(entryNode);
                        nbRows++;
                        if (nbRows == MAXSUGGEST)
                        {
                            break;
                        }
                    }
                }
                catch
                {
                    HttpRuntime.Cache.Remove(CACHEENTRYNAME);
                }
            }
            return(xmlDoc);
        } // GetPrefixedEntries
Esempio n. 2
0
        public object Verify(string partner, string method, string sign)
        {
            var qs = (HttpContext.Current.Request.HttpMethod.ToLower() == "post"
                ? HttpContext.Current.Request.Form
                : HttpContext.Current.Request.QueryString);
            //判断密钥
            //var mySign = Partner.GetInstance().SignPartner(partner, qs);
            //if (mySign.IsNullOrEmpty())
            //    return BLL.APICommon.GetStatusCodeResult(10007);
            //if (sign != mySign)
            //    return BLL.APICommon.GetStatusCodeResult(10009);
            var mdReg = new Regex("^(?<cls>[a-z0-9_]+)\\.(?<md>[a-z0-9\\._]+)$", RegexOptions.IgnoreCase);

            if (!mdReg.IsMatch(method))
            {
                return(new AjaxResult {
                    state = 0, msg = "请求无效!"
                });
            }
            var macth  = mdReg.Match(method);
            var cls    = macth.Groups["cls"].Value;
            var md     = macth.Groups["md"].Value.Replace(".", "_");
            var result = AjaxUtils.ExecutinonMethod("Shoy.Demo", cls, md, HttpContext.Current);

            if (result is AjaxResult)
            {
                return(result);
            }
            return(new AjaxResult {
                state = 1, msg = "", result = result
            });
        }
Esempio n. 3
0
 public string methods_list()
 {
     return(AjaxUtils.ShowMethods());
 }