Beispiel #1
0
 static void printJsonReturn(string url, List <Param> param, Object dt)
 {
     Console.WriteLine("url:" + url + " post:" + APIInstance.ChangePostToStr(param));
     if (dt is object[])
     {
         object[] objs = (object[])dt;
         foreach (var obj in objs)
         {
             Dictionary <string, object> dict = (Dictionary <string, object>)obj;
             foreach (var item in dict)
             {
                 Console.Write(item.Key + "=" + item.Value + ",");
             }
             Console.WriteLine();
         }
     }
     else
     {
         Dictionary <string, object> dict = (Dictionary <string, object>)dt;
         foreach (var item in dict)
         {
             Console.Write(item.Key + "=" + item.Value + ",");
         }
         Console.WriteLine();
     }
 }
Beispiel #2
0
 public DebugClient(BrowserInstance browser, TabInfo tab)
 {
     Browser   = browser;
     Tab       = tab;
     WebSocket = new AsyncClientWebSocket();
     // KeepAlives cause chrome to disconnect (-:
     WebSocket.Options.KeepAliveInterval = TimeSpan.FromSeconds(9999);
     API = new APIInstance(this);
 }
Beispiel #3
0
 /// <param name="api">Get from APIFactory.GetInstance()</param>
 /// <param name="requestParam">list.add(new AppLink.core.Param("key","value")</param>
 /// <param name="requestParam">Async Call back to get data</param>
 public static void update(APIInstance api, List <Param> requsetParam, APIInstance.CallbackDelegate callback)
 {
     api.CallApiAsync("notifylog/update", requsetParam, callback);
 }
Beispiel #4
0
        /// <summary>
        /// 更新notifylog,传入对应的表字段
        /// </summary>

        /// <param name="api">Get from APIFactory.GetInstance()</param>
        /// <param name="requsetParam">list.add(new AppLink.core.Param("key","value")</param>
        /// <returns>Object[] or Object to change to Dictionary<string,string>[] or Dictionary<string,string></returns>
        public static Object update(APIInstance api, List <Param> requsetParam)
        {
            return(api.CallApi("notifylog/update", requsetParam));
        }
Beispiel #5
0
 /// <param name="api">Get from APIFactory.GetInstance()</param>
 /// <param name="requestParam">list.add(new AppLink.core.Param("key","value")</param>
 /// <param name="requestParam">Async Call back to get data</param>
 public static void list(APIInstance api, List <Param> requsetParam, APIInstance.CallbackDelegate callback)
 {
     api.CallApiAsync("payment/list", requsetParam, callback);
 }
Beispiel #6
0
        /// <summary>
        /// 获取payment列表,传入对应的搜索条件
        /// </summary>

        /// <param name="api">Get from APIFactory.GetInstance()</param>
        /// <param name="requsetParam">list.add(new AppLink.core.Param("key","value")</param>
        /// <returns>Object[] or Object to change to Dictionary<string,string>[] or Dictionary<string,string></returns>
        public static Object list(APIInstance api, List <Param> requsetParam)
        {
            return(api.CallApi("payment/list", requsetParam));
        }
Beispiel #7
0
        static void Main(string[] args)
        {
            //以下是调用的例子,请你自己替换为相关的对象,谢谢

            //获取数据库实例,超级简单工厂
            DBInstance   dbmgr = DBFactory.GetInstance();
            List <Param> list  = new List <Param>();


            //获取远程API实例
            APIInstance api = APIFactory.GetInstance();

            //api.SetToken("TOKEN","id");   //设置token,防止私密信息暴露
            //api.SetLang("LANG");   //设置多语言ID

            #region 列表数据搜索


            list.Add(new Param("category_id", DbType.Int32, 1));
            //list.Add(new Param("lang_code_name", DbType.String, "简体%"));
            //DataTable dt=AppLink.api.BlogMgr.list(dbmgr, list);
            //Console.WriteLine("blog/list" );
            //printDataTable(dt);

            //同步返回列表数据
            //object blogjson = BlogMgr.list(api, list);
            //printJsonReturn("blog/list", null, blogjson);

            //异步返回列表数据
            //BlogMgr.list(api, list, printJsonReturn);


            #endregion


            #region 单条数据获取
            //Console.WriteLine("blog/get");
            //int blogid =Convert.ToInt32( dt.Rows[0]["id"]);
            //Dictionary<string, object> info = AppLink.api.BlogMgr.get(dbmgr, blogid);
            //printJson(info);
            #endregion


            #region 更新存在数据
            //list.Clear();
            //list.Add(new Param("category_id", 1));
            //list.Add(new Param("name", "test csharp in name"));
            //list.Add(new Param("summary", "test csharp in summary"));
            //list.Add(new Param("published_date", "2011-11-11"));
            //list.Add(new Param("content", "test csharp in content"));
            //list.Add(new Param("status", "A"));
            //list.Add(new Param("lang_code", "1"));
            //Console.WriteLine("blog/update");
            //AppLink.api.BlogMgr.update(dbmgr, list,blogid);
            #endregion

            #region 新增数据
            //list.Clear();
            //list.Add(new Param("category_id",1));
            //list.Add(new Param("name","test csharp in name +"));
            //list.Add(new Param("summary", "test csharp in summary +"));
            //list.Add(new Param("published_date", "2011-11-11"));
            //list.Add(new Param("content", "test csharp in content +"));
            //list.Add(new Param("status", "A"));
            //list.Add(new Param("lang_code", "1"));
            //Console.WriteLine("blog/update");
            //int newblogid = AppLink.api.BlogMgr.update(dbmgr, list);
            //Console.WriteLine("new id is "+ newblogid.ToString());
            #endregion


            Console.Read();
        }