K3 Cloud 学习笔记

1.K3 Cloud BOS 是用来修改单据的,而K3 Cloud 是用来查看修改之后的单据 

2.在VS中写一个简单的按钮,用来测试单据的数据是否通过,来得到别人需要的Json字符串(这样VS就和K3 Cloud、K3 Cloud BOS实现了互联)

        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                K3CloudApiClient client = new K3CloudApiClient("http://127.0.0.1/k3cloud/");  //自己电脑的k3cloud
                var ret = client.ValidateLogin("5a542341da71c2", "Administrator", "888888", 2052);  //其中第一个参数要根据自己电脑里面的来修改(直接拷贝K3 Cloud Web API里面的参考代码就行)
                var result = JObject.Parse(ret)["LoginResultType"].Value<int>();
                // 登陆成功
                if (result == 1)
                {
                    string json = this.richTxt.Text;
                    string _type = this.comboBox1.Text;
                    string _return = client.Save(_type, json);
                    MessageBox.Show(_return);
                }
            }
            catch(Exception er)
            {
                MessageBox.Show(er.Message);
            }

        }

3.下面是demo的截图(其中,下拉列表用来存放单据类型;富文本区域用来粘贴存放正确的Json字符串;按钮是为了添加点击事件)

4.格式化Json数据,百度可以搜索出很多网址,如 http://www.sojson.com/

5.注意!在从K3 Cloud Web API直接复制出来的Json字符串,需要将   "  全替换为  "    是英文输入法哦!这样才可以粘贴到上面图片中的富文本区域,调试正确

原文地址:https://www.cnblogs.com/surfacebook007/p/8289403.html