public static tools.AnalyzeJson getJson(MakeJson json, string urlKey, out string error)
        {
            error = login();
            if (error != null)
            {
                return(null);
            }
            if (urlKey != "checkUpdate" && urlKey != "downloadVersion")
            {
                json.add("deviceid", GetMacAddress(), DataStyle.STR);
                json.add("channelcode", channelcode, DataStyle.STR);
                json.add("tokenid", token, DataStyle.STR);
                json.add("equipmentNo", GetMacAddress(), DataStyle.STR);
            }

            string inJson = json.ToString();

            tools.AnalyzeJson aj = getJson_private(inJson, urlKey, out error);
            if (error == null)
            {
                return(aj);
            }
            else
            {
                return(null);
            }
        }
        public static tools.AnalyzeJson getJson(MakeJson json, string urlKey)
        {
            try
            {
                string error = null;
                error = login();
                if (error != null)
                {
                    return(new tools.AnalyzeJson(error, false));
                }
                if (urlKey != "checkUpdate" && urlKey != "downloadVersion")
                {
                    json.add("deviceid", GetMacAddress(), DataStyle.STR);
                    json.add("channelcode", channelcode, DataStyle.STR);
                    json.add("tokenid", token, DataStyle.STR);
                    json.add("equipmentNo", GetMacAddress(), DataStyle.STR);
                }

                string inJson = json.ToString();

                tools.AnalyzeJson aj = getJson_private(inJson, urlKey, out error);
                error = getError(aj, error);
                if (error != null)
                {
                    aj.error = error;
                }
                return(aj);
            }
            catch (Exception e)
            {
                return(new tools.AnalyzeJson(e.ToString(), false));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 显示输出
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="me"></param>
        /// <returns></returns>
        public static string OutPutShow(string key, object data = null, MessageEnum me = MessageEnum.Success)
        {
            if (data == null)
            {
                data = "";
            }
            string       mestr = me.ToString();
            MessageState ms    = new MessageState()
            {
                key = key
            };

            System.Type t      = me.GetType();
            FieldInfo[] filist = t.GetFields();
            foreach (var fi in filist)
            {
                if (fi.Name == mestr)
                {
                    MsgStateAttribute ai = (MsgStateAttribute)System.Attribute.GetCustomAttribute(fi, typeof(MsgStateAttribute), false);
                    ms.SetMsgState(ai.GetMsg());
                    break;
                }
            }
            ms.data  = data;
            ms.state = me.ConvertData <int>();
            return(MakeJson.ObjectToJson(new
            {
                ms.state,
                ms.key,
                ms.data
            }, "yyyy-MM-dd HH:mm:ss"));
        }
        public static string login()
        {
            if (channelcodeMD5 == null)
            {
                channelcodeMD5 = MD5.GetMD5String(channelcode);
            }
            MakeJson mj = new MakeJson();

            mj.add("channelcode", channelcode, DataStyle.STR);
            mj.add("username", channelcodeMD5, DataStyle.STR);
            mj.add("password", channelcodeMD5, DataStyle.STR);
            string inJson     = mj.ToString();
            string loginError = null;

            tools.AnalyzeJson aj = getJson_private(inJson, "Login", out loginError);
            if (loginError != null)
            {
                return(loginError);
            }
            if (aj["statusCode"].ToString() != "200")
            {
                return("登录失败");
            }
            else
            {
                token = aj["data"].ToString();
                return(null);
            }
        }
        public static void test_lingka()
        {
            MakeJson mj1    = new MakeJson();
            string   error1 = null;

            tools.AnalyzeJson device = Network3.getJson(mj1, "deviceLogin", out error1);

            MakeJson mj = new MakeJson();

            mj.add("sfzh", "44178994455745255", DataStyle.STR);
            mj.add("xm", "李三", DataStyle.STR);
            string error = null;

            tools.AnalyzeJson aj = Network3.getJson(mj, "getCPCardInfo", out error);

            int index = 0;
            //固定部分
            MakeJson mj2 = new MakeJson();

            mj2.add("orgCode", device["data"]["orgCode"], DataStyle.STR);
            mj2.add("devSeq", device["data"]["devSeq"], DataStyle.STR);
            mj2.add("sfzh", aj["data"]["data"][index]["sfzh"], DataStyle.STR);
            mj2.add("xm", aj["data"]["data"][index]["xm"], DataStyle.STR);
            mj2.add("cardId", int.Parse(aj["data"]["data"][index]["cardId"].ToString()), DataStyle.INT);
            mj2.add("orgId", device["data"]["orgId"], DataStyle.STR);
            mj2.add("applytype", "0", DataStyle.STR);
            mj2.add("status", "1", DataStyle.STR);
            mj2.add("description", "成功", DataStyle.STR);

            string error2 = null;

            tools.AnalyzeJson aj2 = Network3.getJson(mj2, "uploadFKRecord", out error2);
        }
        private tools.AnalyzeJson getBalance(string persionid, string name)
        {
            MakeJson json1 = new MakeJson();

            json1.add("appid", "zqccb");
            json1.add("appkey", "ccb2293702");
            json1.add("idNo", persionid);
            json1.add("name", name);
            return(Post.Post_Json2("getBalance", json1.ToString()));
        }
Exemplo n.º 7
0
        private void invalidSessionID(Guid key, StreamWriter textWriter)
        {
            Hashtable response = new Hashtable();

            response.Add("success", false);
            // Guid::ToString("D") outputs the Guid in standard printable format:
            // 00000000-0000-0000-0000-000000000000
            response.Add("message", "The session '" + key.ToString("D") + "' does not exist.\nTry reloading the page.");
            textWriter.Write(MakeJson.FromHashtable(response));
            textWriter.Flush();
        }
Exemplo n.º 8
0
    // 既存のセーブデータをロード
    private void LoadSaveData()
    {
        // パスの読み込み
        var load = new StreamReader(path);

        // ファイルの内容を文字列としてすべて読み込む
        json = load.ReadToEnd();
        // 読み込んだファイルを閉じる 閉じないと他で開けなくなる
        load.Close();

        // Jsonからオブジェクト作成
        json_object = JsonUtility.FromJson <MakeJson>(json);
    }
Exemplo n.º 9
0
    // Start is called before the first frame update
    void Start()
    {
        // パス
        string path = Application.dataPath + SAVE_PATH + SAVE_NAME;

        // 存在するかチェック
        if (!File.Exists(path))
        {
            Debug.Log("ファイルが存在しないので新規作成");
            // jsonファイルの作成
            var data = new MakeJson();
            // ステージを全てfalseでセーブデータを作成
            data.stageOne = Enumerable.Repeat <bool>(false, 10).ToArray();
            data.stageTwo = Enumerable.Repeat <bool>(false, 2).ToArray();

            // オブジェクトからjsonを作成
            string json = JsonUtility.ToJson(data);
            Debug.Log(json);

            // セーブ用パス 上書き
            var writer = new StreamWriter(path, false);
            // セーブ
            writer.WriteLine(json);
            writer.Flush();
            writer.Close();
        }
        // ロード
        else
        {
            Debug.Log("ファイルが存在するのでロード");
            // パスの読み込み
            var load = new StreamReader(path);
            var test = load.ReadToEnd();

            // Jsonからオブジェクト作成
            var obj = JsonUtility.FromJson <MakeJson>(test);
            load.Close();

            Debug.Log(obj.stageOne[1]);

            // foreach (var item in obj.stageOne)
            // {
            //     Debug.Log(item);
            // }
            obj.stageOne[0] = true;
            var writer = new StreamWriter(path, false);
            writer.WriteLine(JsonUtility.ToJson(obj));
            writer.Flush();
            writer.Close();
        }
    }
        private tools.AnalyzeJson getList(string persionid, string name)
        {
            MakeJson json2 = new MakeJson();

            json2.add("appid", "zqccb");
            json2.add("appkey", "ccb2293702");
            json2.add("idNo", persionid);
            json2.add("name", name);
            json2.add("stDate", DateTime.Now.AddDays(-31).ToString("yyyyMMdd").ToString());
            json2.add("endDate", DateTime.Now.ToString("yyyyMMdd").ToString());
            json2.add("pageno", "1");
            json2.add("pagesize", 100);
            return(Post.Post_Json2("getDetails", json2.ToString()));
        }
Exemplo n.º 11
0
        /// <summary>
        /// 显示输出
        /// </summary>
        /// <param name="data"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static string OutPutShow(object data, string msg)
        {
            MessageState ms = new MessageState()
            {
                data = data
            };

            ms.SetMsgState(msg);
            ms.state = MessageEnum.OtherError.ConvertData <int>();
            return(MakeJson.ObjectToJson(new
            {
                ms.state,
                ms.key,
                ms.data
            }, "yyyy-MM-dd HH:mm:ss"));
        }
Exemplo n.º 12
0
        /// <summary>
        /// 输出文本
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static string OutPutShow(string msg)
        {
            MessageState ms = new MessageState()
            {
                data = msg
            };

            ms.SetMsgState("成功");
            ms.state = MessageEnum.Success.ConvertData <int>();
            return(MakeJson.ObjectToJson(new
            {
                ms.state,
                ms.key,
                ms.data
            }, "yyyy-MM-dd HH:mm:ss"));
        }
Exemplo n.º 13
0
        async private void handlePersionData()
        {
            Log(ReadIDCar.pOutInfo.ToString());
            updateTitle();
            CD.business1.hidenBackAndExitBtn();
            CD.business1.stop();
            Loading.show1("正在挂失");
            List <Dictionary <string, string> > zkData = null;
            string error = null;
            await TaskMore.Run(new Action(() =>
            {
                int box = int.Parse(Config.dic("yzkBoxs"));
                int ret = MS2.getLetfCardNum(box, out error);
                if (error == null && ret == 0)
                {
                    error = "预制卡已用完,请联系管理员加卡";
                }
                else if (error == null && ret == -1)
                {
                    error = "料盒状态异常,请联系管理员处理!";
                }
                if (error != null)
                {
                    return;
                }
                MakeJson mj = new MakeJson();
                deviceMsg = Network3.getJson(mj, "deviceLogin");
                error = deviceMsg.error;
                if (error != null)
                {
                    return;
                }
                //获取制卡数据

                if (error == null)
                {
                    zkData = WeiWang.getZKData(ReadIDCar.persionid, ReadIDCar.name, out error);
                }
            })).ConfigureAwait(true);

            if (error != null)
            {
                ShowTip.show(false, BackExit.Exit, error);
                return;
            }
            check(zkData);
        }
Exemplo n.º 14
0
    // セーブデータを作成
    private void CreateSaveData()
    {
        Debug.LogFormat("保存するパス:{0}", path);

        // jsonオブジェクト作成
        json_object = new MakeJson();
        // オブジェクトからjsonを作成
        json = JsonUtility.ToJson(json_object);
        Debug.Log(json);

        // セーブ用パス 上書き
        var writer = new StreamWriter(path, false);

        // セーブ
        writer.WriteLine(json);
        writer.Flush();
        writer.Close();
    }
Exemplo n.º 15
0
        public void OnFileRequested(HttpRequest request, IDirectory directory)
        {
            request.Response.ResponseContent = new MemoryStream();
            StreamWriter writer = new StreamWriter(request.Response.ResponseContent);
            Guid         key    = Guid.NewGuid();
            User         user   = User.CreateUser();

            lock (users) users.Add(key, user);
            Hashtable ret = new Hashtable();

            ret.Add("SessionID", key.ToString("D"));
            ret.Add("Challenge", user.Challenge);
            ret.Add("Exponent", StringHelper.BytesToHexString(AjaxLife.RSAp.Exponent));
            ret.Add("Modulus", StringHelper.BytesToHexString(AjaxLife.RSAp.Modulus));
            ret.Add("Grids", AjaxLife.LOGIN_SERVERS.Keys);
            ret.Add("DefaultGrid", AjaxLife.DEFAULT_LOGIN_SERVER);
            writer.Write(MakeJson.FromHashtable(ret));
            writer.Flush();
        }
Exemplo n.º 16
0
        public void OnFileRequested(HttpRequest request, IDirectory directory)
        {
            request.Response.ResponseContent = new MemoryStream();
            StreamWriter writer = new StreamWriter(request.Response.ResponseContent);

            try
            {
                SecondLife client;
                User       user;
                // Get the session.
                Dictionary <string, string> POST = AjaxLife.PostDecode((new StreamReader(request.PostData)).ReadToEnd());
                Guid sessionid = new Guid(POST["sid"]);
                // Standard user stuff.
                lock (users)
                {
                    user             = users[sessionid];
                    client           = user.Client;
                    user.LastRequest = DateTime.Now;
                    // Clear the inventory cache to avoid confusion.
                    user.Events.ClearInventory();
                }
                Hashtable data = new Hashtable();
                Dictionary <string, int> pos = new Dictionary <string, int>();
                pos.Add("x", (int)Math.Floor(client.Self.GlobalPosition.X / 256));
                pos.Add("y", (int)Math.Floor(client.Self.GlobalPosition.Y / 256));
                data.Add("RegionCoords", pos);
                data.Add("Region", client.Network.CurrentSim.Name);
                data.Add("Position", client.Self.SimPosition);
                data.Add("MOTD", client.Network.LoginMessage);
                data.Add("UserName", client.Self.FirstName + " " + client.Self.LastName);
                data.Add("AgentID", client.Self.AgentID);
                data.Add("InventoryRoot", client.Inventory.Store.RootFolder.UUID);
                writer.Write(MakeJson.FromHashtable(data));
                writer.Flush();
            }
            catch (Exception e)
            {
                writer.WriteLine("Error: " + e.Message);
            }
            writer.Flush();
        }
        public static void checkSelf()
        {
            //while(true)
            //{
            //    Network3.login();
            //    int a = 0;
            //}
            return;

            try
            {
                Status.isWorking = true;
                Thread.Sleep(15000);

                //MS2.setLogFileName_Old("设备自检");
                string printStatus = "";
                bool   zkj         = false;
                bool   dyj         = false;
                int    canPrintNum = 0;
                string icError     = MS2.checkIC();
                string idError     = MS2.checkSFZ();
                string qrError     = MS2.checkScanner();
                string cameraError = MS2.checkSam();
                string printError  = Print.checkPrint(ref printStatus);
                string zkjError    = MS2.ResetAllAndGetStatus(out zkj, out dyj, ref canPrintNum);


                if (zkjError == null)
                {
                    zkjError = "正常";
                }
                if (icError == null)
                {
                    icError = "正常";
                }
                if (idError == null)
                {
                    idError = "正常";
                }
                if (qrError == null)
                {
                    qrError = "正常";
                }
                if (cameraError == null)
                {
                    cameraError = "正常";
                }
                if (printError == null)
                {
                    printError = "正常";
                }
                string result = "1";
                if (zkjError != "正常" ||
                    icError != "正常" ||
                    idError != "正常" ||
                    qrError != "正常" ||
                    printError != "正常" ||
                    cameraError != "正常")
                {
                    result = "0";
                }

                #region

                /*
                 * channelcode	String	是	渠道编码(参考3.1渠道类型编码说明 channelCode)
                 * deviceid	String	是	设备编码
                 * tokenid	String	是	权限验证码,前端主页面第一次进入会请求返回的key
                 * equipmentNo	String	是	设备id/编码
                 * checkState	String	是	自检状态 1通过,0不通过
                 * cardBox	String	是	卡盒
                 * wheelDisc	String	是	轮盘
                 * filpMachine	String	是	翻转机
                 * eleCar	String	是	电动小车
                 * icReader	String	是	IC读卡器
                 * cardReader	String	是	二代证读卡器
                 * a4printer	String	是	A4打印机
                 * voucherPrinter	String	是	凭条打印机
                 * camera	String	是	摄像头
                 * qrCode	String	是	二维码扫描仪
                 * mj.add("","", DataStyle.STR);
                 */
                #endregion
                MakeJson mj = new MakeJson();
                mj.add("checkState", result, DataStyle.STR);
                mj.add("cardBox", zkjError, DataStyle.STR);
                mj.add("wheelDisc", zkjError, DataStyle.STR);
                mj.add("filpMachine", zkjError, DataStyle.STR);
                mj.add("eleCar", zkjError, DataStyle.STR);
                mj.add("icReader", icError, DataStyle.STR);
                mj.add("cardReader", idError, DataStyle.STR);
                mj.add("a4printer", "正常", DataStyle.STR);
                mj.add("voucherPrinter", printError, DataStyle.STR);
                mj.add("camera", cameraError, DataStyle.STR);
                mj.add("qrCode", qrError, DataStyle.STR);

                string            error = null;
                tools.AnalyzeJson aj    = Network3.getJson(mj, "DevCheck", out error);

                //保存色带信息
                #region

                /*
                 * channelcode	String	是	渠道编码(参考3.1渠道类型编码说明 channelCode)
                 * deviceid	String	是	设备编码
                 * tokenid	String	是	权限验证码,前端主页面第一次进入会请求返回的key
                 * equipmentNo	String	是	设备id/编码
                 * ribState	String	是	色带使用状态 2余量充足(可制卡量>30张)、1即将耗尽(<=30张)、 0已耗尽(色带剩余可制卡量<=3)
                 *
                 */
                #endregion
                string have = "0";
                if (canPrintNum > 30)
                {
                    have = "2";
                }
                else if (canPrintNum <= 30 && canPrintNum > 0)
                {
                    have = "1";
                }
                MakeJson mj2 = new MakeJson();
                mj2.add("ribState", have, DataStyle.STR);
                string            error2 = null;
                tools.AnalyzeJson aj2    = Network3.getJson(mj2, "saveDevRibbon", out error2);


                //保存凭条打印机信息
                #region

                /*
                 * channelcode	String	是	渠道编码(参考3.1渠道类型编码说明 channelCode)
                 * deviceid	String	是	设备编码
                 * tokenid	String	是	权限验证码,前端主页面第一次进入会请求返回的key
                 * equipmentNo	String	是	设备id/编码
                 * priState	String	是	打印机使用状态 1正常、0缺纸
                 */
                #endregion
                MakeJson mj3 = new MakeJson();
                //mj3.add("priState", ((printStatus != null && printStatus.Replace(" ", "") == "") ? "1" : "0"), DataStyle.STR);
                mj3.add("priState", "1", DataStyle.STR);//Test
                string            error3 = null;
                tools.AnalyzeJson aj3    = Network3.getJson(mj3, "saveDevPrinter", out error3);
            }
            catch (Exception e)
            {
                Log.AddLog("设备自检", e.ToString());
            }
            finally
            {
                Status.isWorking = false;
            }
        }
Exemplo n.º 18
0
        //3.信息校验
        async private void goToLingKa()
        {
            bool carHasOut = false;

            tellHadGetCard = null;
            string error      = null;
            string bankcarnum = null;

            if (ds == null)
            {
                ds = sc.getSelectItems();
            }
            if (ds == null || ds.Count == 0)
            {
                return;
            }

            updateTitle();
            CD.business1.hidenBackAndExitBtn();
            CD.business1.stop();
            int getIndex = ds[0];

            ds.RemoveAt(0);

            Loading.show1("正在出卡,请稍候....");
            string carMsg = cpCardInfo["data"]["data"][getIndex]["klbName"].ToString() + "-" +
                            cpCardInfo["data"]["data"][getIndex]["yhkh"].ToString() + "-" +
                            cpCardInfo["data"]["data"][getIndex]["kh"].ToString();
            string   msg = cpCardInfo["data"]["data"][getIndex]["cardId"].ToString();
            MakeJson mj2 = new MakeJson();

            mj2.add("orgCode", deviceInfo["data"]["orgCode"], DataStyle.STR);
            mj2.add("devSeq", deviceInfo["data"]["devSeq"], DataStyle.STR);
            mj2.add("sfzh", cpCardInfo["data"]["data"][getIndex]["sfzh"], DataStyle.STR);
            mj2.add("xm", cpCardInfo["data"]["data"][getIndex]["xm"], DataStyle.STR);
            mj2.add("cardId", int.Parse(cpCardInfo["data"]["data"][getIndex]["cardId"].ToString()), DataStyle.INT);
            mj2.add("orgId", deviceInfo["data"]["orgId"], DataStyle.STR);
            mj2.add("applytype", "0", DataStyle.STR);
            string atr_json = cpCardInfo["data"]["data"][getIndex]["atr"].ToString();
            int    kc       = int.Parse(cpCardInfo["data"]["data"][getIndex]["slotno"].ToString());

            await TaskMore.Run(new Action(() =>
            {
                string atr_raed = null;
                string[] carDatas = null;
                error = MS2.PutCardToIC(atr_json, kc);
                if (error == null)
                {
                    atr_raed = MS2.GetATR(out error);
                }
                if (error == null)
                {
                    carDatas = MS2.GetBaseMsg(out error);
                }
                if (error == null)
                {
                    bankcarnum = MS2.ReadBankNum(out error);
                }
                if (error != null)
                {
                    ShowTip.show(false, BackExit.Exit, error);
                    return;
                }
                ssid = carDatas[6];
                //卡识别码、卡类别、规范版本、初始化机构编号、发卡日期、卡有效期、卡号、社会保障号码、姓名、性别、民族、出生地、出生日期
                //0         1       2         3               4         5         6     7             8     9     10    11      12
                if (atr_raed != cpCardInfo["data"]["data"][getIndex]["atr"].ToString() ||
                    carDatas[7] != cpCardInfo["data"]["data"][getIndex]["sfzh"].ToString() ||
                    carDatas[8] != cpCardInfo["data"]["data"][getIndex]["xm"].ToString() ||
                    carDatas[6] != cpCardInfo["data"]["data"][getIndex]["kh"].ToString() ||
                    bankcarnum != cpCardInfo["data"]["data"][getIndex]["yhkh"].ToString()
                    )
                {
                    error = "信息校验失败!";
                    MS2.PutCardToReject();
                }

                if (error != null)
                {
                    mj2.add("status", "2", DataStyle.STR);
                    mj2.add("description", "卡信息校验失败", DataStyle.STR);
                }
                else
                {
                    mj2.add("status", "1", DataStyle.STR);
                    mj2.add("description", "成功", DataStyle.STR);
                }
                tellHadGetCard = Network3.getJson(mj2, "uploadFKRecord");
            })).ConfigureAwait(true);

            if (error != null)
            {
                Log.AddLog("领卡", carMsg + "  error:" + error);
                if (carHasOut)
                {
                    MS2.PutCardToReject();
                }
                ShowTip.show(false, BackExit.Exit, error);
            }
            else if (tellHadGetCard.error != null)
            {
                MS2.PutCardToReject();

                ShowTip.show(false, BackExit.Exit, tellHadGetCard.error);
            }
            else
            {
                checkPsw();
            }
        }
Exemplo n.º 19
0
        //2.选择卡片
        async private void selectCards()
        {
            index = 1;
            string error = null;

            if (CD.timeTag.equal(timeTag) == false)
            {
                return;
            }
            Loading.show1("正在查询个人数据...");
            await TaskMore.Run(new Action(() =>
            {
                MakeJson mj_normal = new MakeJson();
                deviceInfo = Network3.getJson(mj_normal, "deviceLogin");
                error = deviceInfo.error;
                if (error != null)
                {
                    return;
                }

                MakeJson mj = new MakeJson();
                mj.add("sfzh", ReadIDCar.persionid, DataStyle.STR);
                mj.add("xm", ReadIDCar.name, DataStyle.STR);
                cpCardInfo = Network3.getJson(mj, "getCPCardInfo");
                error = cpCardInfo.error;
            })).ConfigureAwait(true);

            if (error != null)
            {
                ShowTip.show(false, BackExit.Exit, error);
                return;
            }
            try
            {
                List <string[]> datas = new List <string[]>();
                int             count = cpCardInfo["data"]["data"].getArrayCount();
                //"序号,姓名,身份证号,待领卡类型,银行卡号,社保卡号"
                int k = 1;
                for (int i = 0; i < count; i++)
                {
                    if (cpCardInfo["data"]["data"][i]["status"].ToString() == "0")
                    {
                        string name = cpCardInfo["data"]["data"][i]["xm"].ToString();
                        string sfzh = cpCardInfo["data"]["data"][i]["sfzh"].ToString();
                        string yhkh = cpCardInfo["data"]["data"][i]["yhkh"].ToString();

                        name = "*" + name.Substring(1, name.Length - 1);
                        sfzh = sfzh.Substring(0, 6) + "**********" + sfzh.Substring(16, 2);
                        yhkh = "**********************".Substring(0, yhkh.Length - 4) + yhkh.Substring(yhkh.Length - 4, 4);

                        datas.Add(new string[] {
                            (k++).ToString(),
                            name,
                            sfzh,
                            cpCardInfo["data"]["data"][i]["klbName"].ToString(),
                            yhkh,
                            cpCardInfo["data"]["data"][i]["kh"].ToString()
                        });
                    }
                }

                if (sc == null)
                {
                    sc = new SelectCars();
                    sc.setSelectOK(goToLingKa);
                }
                updateTitle();
                sc.setTable(datas);
                CD.business1.setBusinessValue(sc);
            }
            catch (Exception e)
            {
                ShowTip.show(false, BackExit.Exit, "数据解析异常:" + e.ToString());
                return;
            }
        }
Exemplo n.º 20
0
        //2.加载数据
        async private void LoadData()
        {
            BackExit.setBack(LoadData);
            index = 0;

            timeTag = CD.timeTag.updateTag();
            if (CD.business2 == null)
            {
                CD.business2 = new Business2();
            }
            CD.setMainUI(CD.business2);
            CD.business2.start();

            Loading.show2("正在查询,请稍候...");
            tools.AnalyzeJson retJson = null;
            await TaskMore.Run(new Action(() => {
                MakeJson json = new MakeJson();
                json.add("fkcs", Config.dic("cityCode"));
                json.add("shbzh", ReadIDCar.persionid);
                json.add("xm", ReadIDCar.name);
                //ppid String  是 由肇庆市社保局提供
                //appkey String  是 由肇庆市社保局提供
                retJson = Post.Post_Json("getCardProgress", json.ToString());
            })).ConfigureAwait(true);

            if (retJson.error != null)
            {
                ShowTip.show(false, BackExit.Exit, retJson.error);
            }
            else
            {
                if (retJson["data"]["err"].ToString() != "OK")
                {
                    ShowTip.show(false, BackExit.Exit, retJson["data"]["err"].ToString());
                    return;
                }
                if (retJson["data"]["validtag"].ToString().Trim().IndexOf("-") == 0)
                {
                    error.Text = "制卡失败:" + retJson["data"]["remarks"].ToString();
                }
                else
                {
                    error.Text = "";
                }

                times[0].Text = handleTimeStr(retJson["data"]["applytime"].ToString());
                times[1].Text = handleTimeStr(retJson["data"]["banktime"].ToString());
                times[2].Text = handleTimeStr(retJson["data"]["kszkhpsj"].ToString());
                times[3].Text = handleTimeStr(retJson["data"]["provincetime"].ToString());
                times[4].Text = handleTimeStr(retJson["data"]["citytime"].ToString());
                times[5].Text = handleTimeStr(retJson["data"]["gettime"].ToString());
                times[6].Text = handleTimeStr(retJson["data"]["yhjhtime"].ToString());

                if (times[0].Text == "")
                {
                    CD.business2.setBusinessValue(MakeCardProcess2.GetObject());
                    return;
                }

                if (times[4].Text != "")
                {
                    T52.Text = "(" + retJson["data"]["lkjgmc"].ToString() + ")";
                }
                else
                {
                    T52.Text = "";
                }

                index = 0;
                for (int i = 0; i < times.Count; i++)
                {
                    if (times[i].Text == "")
                    {
                        break;
                    }
                    index++;
                }

                showResult();
            }
        }
Exemplo n.º 21
0
        private void ProccessJson(WorkSocket workSocket, byte[] payLoad)
        {
            ApplicationProtocol ap = MakeJson.getApplicationProtocol(payLoad);

            updateInfo(ap.type + ":" + ap.content, MyConfig.INT_UPDATEUI_TXBOX);
            switch (ap.type)
            {
            case AppProtocol.json_type_req_local_check:
                CheckPsw(workSocket, ap.content);
                break;

            case AppProtocol.json_type_req_local_open_shadow:
                if (serverWorkStatus == MyConfig.SERVER_WORK_STATUS_FREE)
                {
                    CreateShadowContainer(workSocket, ap.content + "|" + orientation);
                }
                else
                {
                    SendMsgToClient(workSocket, AppProtocol.json_type_notify_back_shadow_open_fail, "服务端被占用");
                }
                break;

            case AppProtocol.json_type_req_local_close_shadow:
                closeShadowForm(workSocket);
                break;

            case AppProtocol.json_type_req_local_open_mouse:
                if (serverWorkStatus == MyConfig.SERVER_WORK_STATUS_FREE)
                {
                    startMouseMode(workSocket);
                }
                else
                {
                    SendMsgToClient(workSocket, AppProtocol.json_type_notify_back_shadow_open_fail, "服务端被占用");
                }
                break;

            case AppProtocol.json_type_req_local_close_mouse:
                closeMouseMode(workSocket);
                break;

            case AppProtocol.json_type_req_local_repeat_conn:
                repeatConn(workSocket, ap.content);
                break;

            case AppProtocol.json_type_req_local_refresh_screen:
                deskWidth  = Int32.Parse(ap.content.Split('|')[0]);
                deskHeight = Int32.Parse(ap.content.Split('|')[1]);
                break;

            case AppProtocol.json_type_cmd_mouse_event_move:
                MoveMouse(ap.content);
                break;

            case AppProtocol.json_type_cmd_mouse_event_esc:
                ClickMouse(ap.type);
                break;

            case AppProtocol.json_type_cmd_mouse_event_l_down:
                ClickMouse(ap.type);
                break;

            case AppProtocol.json_type_cmd_mouse_event_l_up:
                ClickMouse(ap.type);
                break;

            case AppProtocol.json_type_cmd_mouse_event_r_down:
                ClickMouse(ap.type);
                break;

            case AppProtocol.json_type_cmd_mouse_event_r_up:
                ClickMouse(ap.type);
                break;

            case AppProtocol.json_type_cmd_mouse_event_page_up:
                ClickMouse(ap.type);
                break;

            case AppProtocol.json_type_cmd_mouse_event_page_down:
                ClickMouse(ap.type);
                break;
            }
        }
        public static void test_add_card()
        {
            try
            {
                MakeJson          mj       = new MakeJson();
                string            netError = null;
                tools.AnalyzeJson aj       = getJson(mj, "deviceLogin", out netError);

                //6、接口入库

                /*
                 * channelcode	String	是	渠道编码
                 * orgCode	String	是	网点编码(接口2.5返回orgCode)
                 * devSeq	String	是	设备序号(接口2.5返回devSeq)
                 * atr	String	是	ATR
                 * ksbm	String	是	卡识别码(社保卡时必填)
                 * yhkh	String	是	银行卡号
                 * shbzh	String	是	社会保障号(社保卡时必填)
                 * sfzh	String	是	身份证(社保卡时必填)
                 * xm	String	是	姓名(社保卡时必填)
                 * slotno	int	是	槽号
                 * orgId	long	是	网点id(2.5接口返回的orgId)
                 * klb	String	是	卡类别 01:社保卡 02:借记卡 03:信用卡
                 * gfbb	String	否	规范版本
                 * jgbm	String	否	机构编码
                 * fkrq	String	否	发卡日期yyyyMMdd
                 * kyxq	String	否	卡有效期
                 * kh	String	否	卡号
                 * sex	String	否	性别
                 * nation	String	否	民族
                 * csrq	String	否	出生日期
                 *
                 */
                string   carDatas1 = "111|1|1|111111|20200101|20200101|01234567891|44178994455745255|李三|1|01|出生地|20200101";
                string[] carDatas  = carDatas1.Split('|');
                MakeJson mj2       = new MakeJson();
                mj2.add("orgCode", aj["data"]["orgCode"], DataStyle.STR);
                mj2.add("devSeq", aj["data"]["devSeq"], DataStyle.STR);
                mj2.add("orgId", int.Parse(aj["data"]["orgId"].ToString()), DataStyle.INT);
                mj2.add("atr", "111111111111111111", DataStyle.STR);
                mj2.add("yhkh", "66666666666666", DataStyle.STR);
                mj2.add("slotno", "1", DataStyle.INT);
                mj2.add("boxno", 1, DataStyle.INT);

                //卡识别码、卡类别、规范版本、初始化机构编号、发卡日期、卡有效期、卡号、社会保障号码、姓名、性别、民族、出生地、出生日期
                //0         1       2         3               4         5         6     7             8     9     10    11      12

                //mj2.add("ksbm", carDatas[0], DataStyle.STR);
                //mj2.add("shbzh", carDatas[7], DataStyle.STR);
                //mj2.add("kh", carDatas[6], DataStyle.STR);
                //mj2.add("sfzh", carDatas[7], DataStyle.STR);
                //mj2.add("xm", carDatas[8], DataStyle.STR);
                //mj2.add("klb", "01", DataStyle.STR);
                //mj2.add("gfbb", carDatas[2], DataStyle.STR);
                //mj2.add("jgbm", carDatas[3], DataStyle.STR);
                //mj2.add("fkrq", carDatas[4], DataStyle.STR);
                //mj2.add("kyxq", carDatas[5], DataStyle.STR);
                //mj2.add("sex", carDatas[9], DataStyle.STR);
                //mj2.add("nation", carDatas[10], DataStyle.STR);
                //mj2.add("csrq", carDatas[12], DataStyle.STR);

                //string netError2 = null;
                //AnalyzeJson aj2 = Network3.getJson(mj2, "uploadYZCardInfo", out netError2);


                mj2.add("ksbm", carDatas[0], DataStyle.STR);
                mj2.add("shbzh", carDatas[7], DataStyle.STR);
                mj2.add("kh", carDatas[6], DataStyle.STR);
                mj2.add("sfzh", carDatas[7], DataStyle.STR);
                mj2.add("xm", carDatas[8], DataStyle.STR);
                mj2.add("klb", "01", DataStyle.STR);
                mj2.add("gfbb", carDatas[2], DataStyle.STR);
                mj2.add("jgbm", carDatas[3], DataStyle.STR);
                mj2.add("fkrq", carDatas[4], DataStyle.STR);
                mj2.add("kyxq", carDatas[5], DataStyle.STR);
                mj2.add("sex", carDatas[9], DataStyle.STR);
                mj2.add("nation", carDatas[10], DataStyle.STR);
                mj2.add("csrq", carDatas[12], DataStyle.STR);

                string            netError2 = null;
                tools.AnalyzeJson aj2       = Network3.getJson(mj2, "uploadCPCardInfo", out netError2);
            }
            catch (Exception e)
            {
            }
            finally
            {
                Status.isWorking = false;
            }
        }
        //接口测试
        public static void test()
        {
            //自检
            {
                /*
                 * channelcode	String	是	渠道编码(参考3.1渠道类型编码说明 channelCode)
                 * deviceid	String	是	设备编码
                 * tokenid	String	是	权限验证码,前端主页面第一次进入会请求返回的key
                 * equipmentNo	String	是	设备id/编码
                 * checkState	String	是	自检状态 1通过,0不通过
                 * cardBox	String	是	卡盒
                 * wheelDisc	String	是	轮盘
                 * filpMachine	String	是	翻转机
                 * eleCar	String	是	电动小车
                 * icReader	String	是	IC读卡器
                 * cardReader	String	是	二代证读卡器
                 * a4printer	String	是	A4打印机
                 * voucherPrinter	String	是	凭条打印机
                 * camera	String	是	摄像头
                 * qrCode	String	是	二维码扫描仪
                 * mj.add("","", DataStyle.STR);
                 */
                MakeJson mj = new MakeJson();
                mj.add("checkState", "1", DataStyle.STR);
                mj.add("cardBox", "正常", DataStyle.STR);
                mj.add("wheelDisc", "正常", DataStyle.STR);
                mj.add("filpMachine", "正常", DataStyle.STR);
                mj.add("eleCar", "正常", DataStyle.STR);
                mj.add("icReader", "正常", DataStyle.STR);
                mj.add("cardReader", "正常", DataStyle.STR);
                mj.add("a4printer", "正常", DataStyle.STR);
                mj.add("voucherPrinter", "正常", DataStyle.STR);
                mj.add("camera", "正常", DataStyle.STR);
                mj.add("qrCode", "正常", DataStyle.STR);

                string error = null;
                //AnalyzeJson aj = getJson(mj, "DevCheck", out error);
            }
            //保存色带信息
            {
                /*
                 * channelcode	String	是	渠道编码(参考3.1渠道类型编码说明 channelCode)
                 * deviceid	String	是	设备编码
                 * tokenid	String	是	权限验证码,前端主页面第一次进入会请求返回的key
                 * equipmentNo	String	是	设备id/编码
                 * ribState	String	是	色带使用状态 2余量充足(可制卡量>30张)、1即将耗尽(<=30张)、 0已耗尽(色带剩余可制卡量<=3)
                 *
                 */
                MakeJson mj = new MakeJson();
                mj.add("ribState", "2", DataStyle.STR);
                string error = null;
                //AnalyzeJson aj = getJson(mj, "saveDevRibbon", out error);
            }
            //保存凭条打印机信息
            {
                /*
                 * channelcode	String	是	渠道编码(参考3.1渠道类型编码说明 channelCode)
                 * deviceid	String	是	设备编码
                 * tokenid	String	是	权限验证码,前端主页面第一次进入会请求返回的key
                 * equipmentNo	String	是	设备id/编码
                 * priState	String	是	打印机使用状态 1正常、0缺纸
                 */
                MakeJson mj = new MakeJson();
                mj.add("priState", "1", DataStyle.STR);
                string error = null;
                //AnalyzeJson aj = getJson(mj, "saveDevPrinter", out error);
            }
            //保存设备在线信息saveDevOnline
            {
                /*
                 * channelcode	String	是	渠道编码(参考3.1渠道类型编码说明 channelCode)
                 * deviceid	String	是	设备编码
                 * tokenid	String	是	权限验证码,前端主页面第一次进入会请求返回的key
                 * equipmentNo	String	是	设备id/编码
                 * onlineState	String	是	状态1在线,0不在线
                 */
                MakeJson mj = new MakeJson();
                mj.add("onlineState", "1", DataStyle.STR);
                string error = null;
                //AnalyzeJson aj = getJson(mj, "saveDevOnline", out error);
            }
            //设备登录deviceLogin + 预制卡入库管理putYZCardInStock
            {
                /*
                 * deviceid	String	是	设备编号
                 * deviceIP	String	否	设备IP地址
                 */
                MakeJson mj = new MakeJson();
                //mj.add("deviceid", GetMacAddress(), DataStyle.STR);
                string            error = null;
                tools.AnalyzeJson aj    = getJson(mj, "deviceLogin", out error);

                /*
                 * 返回字段
                 * 1	deviceId	设备编号
                 * 2	address	设备所在地址
                 * 3	status	状态 Y可用,S删除,T停用
                 * 4	deviceName	设备名称
                 * 5	areaCode	区域编码
                 * 6	branch	网点信息
                 * 7	deviceIp	设备ip
                 * 8	deviceMac	设备mac
                 * 9	orgId	网点id
                 * 10	orgCode	网点编码
                 * 11	devSeq	设备序列号
                 *
                 */


                /*
                 * channelcode	String	是	渠道编码
                 * allNum	int	是	卡总数
                 * orgId	String	是	网点id(2.5接口返回的orgId)
                 * operator	String	是	操作人员(姓名)
                 */
                MakeJson mj1 = new MakeJson();
                mj1.add("allNum", 150, DataStyle.INT);
                mj1.add("orgId", aj["data"]["orgId"].ToString(), DataStyle.STR);
                mj1.add("operator", "测试姓名", DataStyle.STR);

                string error1 = null;
                //AnalyzeJson aj1 = getJson(mj1, "putYZCardInStock", out error1);
            }
            //制卡->回盘->查询卡信息->是否可以领卡->领卡   回盘getBackData + 上传领卡信息uploadFKRecord
            if (true)
            {
                MakeJson          mj    = new MakeJson();
                string            error = null;
                tools.AnalyzeJson aj    = getJson(mj, "deviceLogin", out error);

                /*
                 * channelcode	String	是	渠道编码
                 * orgCode	String	是	网点编码(接口2.5返回orgCode)
                 * devSeq	String	是	设备序号(接口2.5返回devSeq)
                 * atr	String	是	ATR
                 * ksbm	String	是	卡识别码
                 * sfzh	String	是	身份证
                 * xm	String	是	姓名
                 * status	String	是	制卡状态 1:成功 2:失败
                 * orgId	String	是	网点id(2.5接口返回的orgId)
                 * kh	String	是	社保卡号
                 * yhkh	String	是	银行卡号
                 * backStatus	String	是	回盘状态 1:回盘成功,2:回盘失败
                 * backmsg	String	否	回盘信息
                 * slotno	String	否	槽号
                 * batchno	String	否	批次号
                 * description	String	否	制卡成功或失败原因描述
                 * ksdm	String	否	卡商代码
                 * gfbb	String	否	规范版本
                 * jgbm	String	否	机构编码
                 * yhbm	String	否	银行编码
                 * kyxq	String	否	卡有效期
                 * sex	String	否	性别
                 * nation	String	否	民族
                 *
                 *  "channelcode": "CardDispenser",
                 * "atr": "3B6D0000008154443686605328A8888888",
                 * "ksbm": "3B6D0011111111111111113388888888",
                 * "sfzh": "413024197410137053",
                 * "xm": "张四",
                 * "status": "1",
                 * "batchno": "PC1000008",
                 * "orgId": 3,
                 * "yhkh": "6688888888888888888888",
                 * "kh": "A88888888",
                 * "orgCode": "4400",
                 * "devSeq": "1",
                 * "backStatus": "2"
                 *
                 */
                MakeJson mj3 = new MakeJson();
                mj3.add("orgCode", aj["data"]["orgCode"], DataStyle.STR);
                mj3.add("devSeq", aj["data"]["devSeq"], DataStyle.STR);
                mj3.add("atr", "3B6D0000008154443686605328A8888881", DataStyle.STR);
                mj3.add("ksbm", "3B6D0011111111111111113388888881", DataStyle.STR);
                mj3.add("sfzh", "413024197410137051", DataStyle.STR);
                mj3.add("xm", "张无", DataStyle.STR);
                mj3.add("status", "1", DataStyle.STR);
                mj3.add("orgId", aj["data"]["orgId"], DataStyle.STR);
                mj3.add("kh", "A123456781", DataStyle.STR);
                mj3.add("yhkh", "6688888888888888888881", DataStyle.STR);
                mj3.add("backStatus", "1", DataStyle.STR);
                mj3.add("description", "制卡成功", DataStyle.STR);


                string            error3 = null;
                tools.AnalyzeJson aj3    = getJson(mj3, "getBackData", out error3);



                /*
                 * channelcode	String	是	渠道编码
                 * sfzh	String	是	身份证号
                 * xm	String	是	姓名
                 * pageno	int	否	页码
                 * pagesize	int	否	页数
                 * JSON数据格式:
                 * {
                 * "channelcode": "CardDispenser",
                 * "sfzh": "413024197410137053",
                 * "xm": "张四"
                 * }
                 */
                //getCPCardInfo=/iface/machine/getCPCardInfo	#查询成品卡数据
                MakeJson mj4 = new MakeJson();
                mj4.add("sfzh", "413024197410137051", DataStyle.STR);
                mj4.add("xm", "张无", DataStyle.STR);
                string            error4 = null;
                tools.AnalyzeJson aj4    = getJson(mj4, "getCPCardInfo", out error4);


                /*    查询领卡授权信息canGetCard
                 * channelcode	String	是	渠道编码
                 * bankNo	String	是	银行卡号
                 * orgCode	String	是	网点编码(接口2.5返回orgCode)
                 * devSeq	String	是	设备序号(接口2.5返回devSeq)
                 * JSON数据格式:
                 * {
                 * "channelcode": "CardDispenser",
                 * "bankNo": "66666668888888",
                 * "orgCode": "4400",
                 * "devSeq": "1"
                 * }
                 *
                 * yhkh
                 */
                MakeJson mj5 = new MakeJson();
                mj5.add("bankNo", aj4["data"]["data"][0]["yhkh"], DataStyle.STR);
                mj5.add("orgCode", aj["data"]["orgCode"], DataStyle.STR);
                mj5.add("devSeq", aj["data"]["devSeq"], DataStyle.STR);
                string            error5 = null;
                tools.AnalyzeJson aj5    = getJson(mj5, "canGetCard", out error5);



                /*
                 * channelcode	String	是	渠道编码
                 * orgCode	String	是	网点编码(接口2.5返回orgCode)
                 * devSeq	String	是	设备序号(接口2.5返回devSeq)
                 * sfzh	String	是	身份证
                 * xm	String	是	姓名
                 * status	String	是	发卡状态 1:成功 2:失败
                 * description	String	是	成功或失败原因
                 * cardId	long	是	卡片id (成品卡:2.11接口返回的cardId)
                 * applytype	String	是	申请类型(0自领或1代领)
                 * orgId	String	是	网点id(2.5接口返回的orgId)
                 * szqmId	long	否	数字签名照片id (2.15接口返回的picId)
                 * rlzpId	long	否	领卡人照片id (2.15接口返回的picId)
                 *
                 */
                MakeJson mj2 = new MakeJson();
                mj2.add("orgCode", aj["data"]["orgCode"], DataStyle.STR);
                mj2.add("devSeq", aj["data"]["devSeq"], DataStyle.STR);
                mj2.add("sfzh", "413024197410137053", DataStyle.STR);
                mj2.add("xm", "张四", DataStyle.STR);
                mj2.add("status", "1", DataStyle.STR);
                mj2.add("description", "成功", DataStyle.STR);
                mj2.add("cardId", int.Parse(aj4["data"]["data"][0]["cardId"].ToString()), DataStyle.INT);
                mj2.add("applytype", "0", DataStyle.STR);
                mj2.add("orgId", aj["data"]["orgId"], DataStyle.STR);
                string            error2 = null;
                tools.AnalyzeJson aj2    = getJson(mj2, "uploadFKRecord", out error2);
            }
            //
            {
                //2.2	校验软件版本信息checkUpdate

                /*
                 * cpu	String	是	CPU编码
                 * model	String	否	型号
                 * hardwareVersion	String	否	设备硬件版本号
                 * androidVersion	String	否	设备安卓版本号
                 * appType	String	是	App类型(参考系统字典设置值)
                 * softwareVersion	String	是	设备软件版本号(整数)
                 * keyboardCode	String	否	密码键盘机器号
                 * encryptionString	String	否	加密字符串
                 * moduleId	String	否	3G模块ID
                 *
                 */
                MakeJson mj = new MakeJson();
                mj.add("cpu", GetMacAddress(), DataStyle.STR);
                mj.add("appType", "SelfService_Card_NH", DataStyle.STR);
                mj.add("softwareVersion", "1", DataStyle.STR);
                string            error = null;
                tools.AnalyzeJson aj    = getJson(mj, "checkUpdate", out error);



                //2.3	下载新版软件文件downloadVersion接口

                /*
                 * cpu	String	是	CPU编码
                 * model	String	否	型号
                 * hardwareVersion	String	否	设备硬件版本号
                 * androidVersion	String	否	设备安卓版本号
                 * appType	String	是	App类型(参考系统字典设置值)
                 * softwareVersion	String	否	设备软件版本号(整数)
                 * keyboardCode	String	否	密码键盘机器号
                 * encryptionString	String	否	加密字符串
                 * moduleId	String	否	3G模块ID
                 */

                MakeJson mj2 = new MakeJson();
                mj2.add("cpu", GetMacAddress(), DataStyle.STR);
                mj2.add("appType", "SelfService_Card_NH", DataStyle.STR);
                string            error2 = null;
                tools.AnalyzeJson aj2    = getJson(mj2, "downloadVersion", out error2);
            }
        }
Exemplo n.º 24
0
 public void SendMsgToClient(WorkSocket workSocket, int type, String content)
 {
     byte[] data = MakeJson.getJsonByte(type, content);
     mySocket.sent(workSocket, data);
 }
Exemplo n.º 25
0
        async private void WriteCar()
        {
            updateTitle();
            CD.business1.hidenBackAndExitBtn();
            Loading.show1("制卡中,请稍候...");
            string error = null;
            await TaskMore.Run(new Action(() =>
            {
                //==制卡
                string result = WeiWang.iWrite(out error);
                if (error != null)
                {
                    if (MS2.PutCardToReject() != null)
                    {
                        error += "-卡回收失败";
                    }
                    return;
                }

                /*
                 * //==读卡信息
                 * string[] datas = null;
                 * string atr2 = MS2.GetATR(out error);
                 * if (error != null)
                 *  return;
                 * bankcarNum = MS2.ReadBankNum(out error);
                 * if (error != null)
                 *  return;
                 * //卡识别码、卡类别、规范版本、初始化机构编号、发卡日期、卡有效期、卡号、社会保障号码、姓名、性别、民族、出生地、出生日期
                 * //0         1       2         3               4         5         6     7             8     9     10    11      12
                 * datas = MS2.GetBaseMsg(out error);
                 * if (error != null)
                 *  return;
                 * ssid = datas[6];
                 */

                //0,6217281914006994119,441800  ,441225198703040437,R47708862,441800D1560000053030737878EC1A84,杨建辉,0087CF20018649618B00930612,2.00    ,20200226,20300226
                //0,1                  ,2       ,3                 ,4        ,5                               ,6     ,7                         ,8       ,9       ,10
                //0,银行卡号           ,发卡地区,社会保障号码      ,卡号     ,卡识别码                        ,姓名  ,卡复位信息                ,规范版本,发卡日期,卡有效期
                string[] results = result.Split(',');

                MakeJson mj = new MakeJson();
                tools.AnalyzeJson aj = Network3.getJson(mj, "deviceLogin", out error);
                mj3 = new MakeJson();
                mj3.add("yhkh", results[1], DataStyle.STR);
                mj3.add("orgCode", aj["data"]["orgCode"], DataStyle.STR);
                mj3.add("devSeq", aj["data"]["devSeq"], DataStyle.STR);
                mj3.add("orgId", aj["data"]["orgId"], DataStyle.STR);
                mj3.add("atr", results[7], DataStyle.STR);
                mj3.add("ksbm", results[5], DataStyle.STR);
                mj3.add("sfzh", results[3], DataStyle.STR);
                mj3.add("xm", results[6], DataStyle.STR);
                mj3.add("kh", results[4], DataStyle.STR);
                mj3.add("backStatus", "1", DataStyle.STR);
                mj3.add("status", "1", DataStyle.STR);
                mj3.add("description", "制卡成功", DataStyle.STR);
                ssid = results[4];
            })).ConfigureAwait(true);

            if (error != null)
            {
                ShowTip.show(false, BackExit.Exit, error);
                return;
            }

            updateTitle();
            Autograph.GetObject().Goin(sign);
        }
Exemplo n.º 26
0
        //业务流程

        public void addCar2()
        {
            try
            {
                MS2.Open();
                string error = MS2.checkMachine();
                if (error != null)
                {
                    Log(error);
                    ShowError("设备异常:" + error);
                    return;
                }

                string            addCarError = null;
                MakeJson          mj          = new MakeJson();
                tools.AnalyzeJson aj          = Network3.getJson(mj, "deviceLogin", out error);
                if (error != null)
                {
                    Log(error);
                    addCarError = "网络异常";
                }
                else if (aj != null && aj["statusCode"].ToString() != "200")
                {
                    Log(error);
                    addCarError = "设备登录失败。";
                }
                //处理
                if (addCarError != null)
                {
                    ShowError(addCarError);
                    return;
                }

                MS2.ResetWithOutPrint();
                string   boxs  = Config.dic("addCardBoxs");
                string[] boxs2 = boxs.Split('|');
                foreach (string box_ in boxs2)
                {
                    int box = int.Parse(box_);
                    while (true)
                    {
                        //1、料盒出卡
                        error = MS2.GetCarFromBox(box);
                        if (error != null && error == "-1")
                        {
                            break;
                        }
                        else if (error != null)
                        {
                            ShowError("出卡异常,请联系管理员处理");
                            return;
                        }
                        //2、移到读卡器
                        string atr = MS2.GetATR(out error);
                        if (error != null)
                        {
                            addFailed();
                            MS2.PutCardToReject();
                            if (error.IndexOf("-1") != -1)
                            {
                                ShowError("读卡异常,请联系管理员处理");
                                return;
                            }
                            continue;
                        }
                        //3、读银行卡号
                        string bankcarNum = MS2.ReadBankNum(out error);
                        if (error != null)
                        {
                            addFailed();
                            MS2.PutCardToReject();
                            continue;
                        }
                        //4、读社保基本信息
                        string[] carDatas = MS2.GetBaseMsg(out error);
                        if (error != null)
                        {
                            addFailed();
                            MS2.PutCardToReject();
                            continue;
                        }
                        //5、入库
                        int stlo = 0;
                        error = MS2.PutCardToStore(atr, ref stlo);
                        if (error != null)
                        {
                            addFailed();
                            ShowError(error);
                            return;
                        }
                        //6、接口入库

                        /*
                         * channelcode	String	是	渠道编码
                         * orgCode	String	是	网点编码(接口2.5返回orgCode)
                         * devSeq	String	是	设备序号(接口2.5返回devSeq)
                         * atr	String	是	ATR
                         * ksbm	String	是	卡识别码(社保卡时必填)
                         * yhkh	String	是	银行卡号
                         * shbzh	String	是	社会保障号(社保卡时必填)
                         * sfzh	String	是	身份证(社保卡时必填)
                         * xm	String	是	姓名(社保卡时必填)
                         * slotno	int	是	槽号
                         * orgId	long	是	网点id(2.5接口返回的orgId)
                         * klb	String	是	卡类别 01:社保卡 02:借记卡 03:信用卡
                         * gfbb	String	否	规范版本
                         * jgbm	String	否	机构编码
                         * fkrq	String	否	发卡日期yyyyMMdd
                         * kyxq	String	否	卡有效期
                         * kh	String	否	卡号
                         * sex	String	否	性别
                         * nation	String	否	民族
                         * csrq	String	否	出生日期
                         *
                         */

                        MakeJson mj2 = new MakeJson();
                        mj2.add("orgCode", aj["data"]["orgCode"], DataStyle.STR);
                        mj2.add("devSeq", aj["data"]["devSeq"], DataStyle.STR);
                        mj2.add("orgId", int.Parse(aj["data"]["orgId"].ToString()), DataStyle.INT);
                        mj2.add("atr", atr, DataStyle.STR);
                        mj2.add("yhkh", bankcarNum, DataStyle.STR);
                        mj2.add("slotno", stlo, DataStyle.INT);
                        mj2.add("boxno", 1, DataStyle.INT);
                        //卡识别码、卡类别、规范版本、初始化机构编号、发卡日期、卡有效期、卡号、社会保障号码、姓名、性别、民族、出生地、出生日期
                        //0         1       2         3               4         5         6     7             8     9     10    11      12
                        mj2.add("ksbm", carDatas[0], DataStyle.STR);
                        mj2.add("shbzh", carDatas[7], DataStyle.STR);
                        mj2.add("kh", carDatas[6], DataStyle.STR);
                        mj2.add("sfzh", carDatas[7], DataStyle.STR);
                        mj2.add("xm", carDatas[8], DataStyle.STR);
                        mj2.add("klb", "01", DataStyle.STR);
                        mj2.add("gfbb", carDatas[2], DataStyle.STR);
                        mj2.add("jgbm", carDatas[3], DataStyle.STR);
                        mj2.add("fkrq", carDatas[4], DataStyle.STR);
                        mj2.add("kyxq", carDatas[5], DataStyle.STR);
                        mj2.add("sex", carDatas[9], DataStyle.STR);
                        mj2.add("nation", carDatas[10], DataStyle.STR);
                        mj2.add("csrq", carDatas[12], DataStyle.STR);
                        tools.AnalyzeJson aj2 = Network3.getJson(mj2, "uploadCPCardInfo");
                        if (aj2.error != null)
                        {
                            addFailed();
                            addCarError = "后台入库接口调用失败";
                            error       = MS2.PutCardToIC(atr, stlo);
                            if (error == null)
                            {
                                error = MS2.PutCardToReject();
                            }
                            if (error != null)
                            {
                                ShowTip.show(false, null, "机器故障:" + error);
                                End();
                                return;
                            }
                            continue;
                        }
                        addSuccess();
                    }
                }
                End();
            }
            catch (Exception e)
            {
                Log("加卡异常:" + e.ToString());
                ShowError("加卡异常:" + e.ToString());
            }
        }
Exemplo n.º 27
0
        public TCommandState ExeCommand <TCommandState>(WebCommandVOBase command) where TCommandState : CommandState, new()
        {
            string code       = web.GetValue("code");
            string userSource = web.GetValue("source");
            int    acctype    = web.GetValue <int>("acctype"); //账号类型
            int    region     = web.GetValue <int>("region");  //职位

            if (code.StrIsNull())
            {
                return(Show <TCommandState>("CODE是空的,微信认证失败!"));
            }

            #region 获取公众号APPID与密钥

            string AppId     = System.Configuration.ConfigurationManager.AppSettings["AppID"];
            string AppSecret = System.Configuration.ConfigurationManager.AppSettings["AppSecret"];
            #endregion

            //通过code换取网页授权access_token
            var htmlvo = GetHtml.GetHtmlFromUrl("https://api.weixin.qq.com/sns/oauth2/access_token?appid=" + AppId + "&secret=" + AppSecret + "&code=" + code + "&grant_type=authorization_code", string.Empty, null, null);
            if (!htmlvo.Item1)
            {
                return(Show <TCommandState>("请求微信AccessToken验证时出现了通讯故障!"));
            }
            var jsonvo = MakeJson.JsonToLinqObject(htmlvo.Item2);
            //获取account_key
            string access_token = jsonvo.TryGetValue <string>("access_token");
            string openid       = jsonvo.TryGetValue <string>("openid");
            string scope        = jsonvo.TryGetValue <string>("scope");
            if (access_token.StrIsNull())
            {
                return(Show <TCommandState>("AccessToken微信授权失败"));
            }


            string scope_str = scope.ToLower();
            Tuple <bool, string> userhtmlvo = null;
            //判断授权类型
            switch (scope_str)
            {
            case "snsapi_userinfo":
                //获取用户信息
                userhtmlvo = GetHtml.GetHtmlFromUrl("https://api.weixin.qq.com/sns/userinfo?access_token=" + access_token + "&openid=" + openid + "&lang=zh_CN", string.Empty, null, null);
                break;

            case "snsapi_base":
                userhtmlvo = new Tuple <bool, string>(true, string.Empty);
                break;

            default:
                return(Show <TCommandState>("居然返回了一个我从来都不清楚的scope:" + scope_str));
            }

            //判断获取详情数据是否成功
            if (!userhtmlvo.Item1)
            {
                return(Show <TCommandState>("获取用户详细数据时出现了错误!"));
            }


            JObject             userjsonvo = null;
            string              my_openid  = string.Empty;
            string              unionid    = string.Empty;
            Model.Model.LC_User suser      = null;

            switch (scope_str)
            {
            case "snsapi_userinfo":
                //解析数据
                userjsonvo = Tools.MakeJson.JsonToLinqObject(userhtmlvo.Item2);
                my_openid  = userjsonvo.TryGetValue <string>("openid");
                unionid    = userjsonvo.TryGetValue("unionid", string.Empty);

                suser = new Model.Model.LC_User()
                {
                    WX_NickName = userjsonvo.TryGetValue <string>("nickname"),
                    WX_Sex      = userjsonvo.TryGetValue <int>("sex"),
                    WX_OpenID   = my_openid,
                    WX_Province = userjsonvo.TryGetValue <string>("province"),
                    WX_City     = userjsonvo.TryGetValue <string>("city"),
                    WX_Country  = userjsonvo.TryGetValue <string>("country"),
                    WX_HeadPic  = userjsonvo.TryGetValue <string>("headimgurl"),
                    ZType       = acctype,
                    PositionID  = region
                };
                //更新或添加账号
                (bool, string, Model.Model.LC_User suser)AddOrUpdateVO = BLL.BLL.LC_User.AddOrUpdateUserVO(web, suser);
                if (!AddOrUpdateVO.Item1)
                {
                    return(Show <TCommandState>(AddOrUpdateVO.Item2));
                }
                suser = AddOrUpdateVO.suser;
                break;

            case "snsapi_base":
                my_openid = openid;
                //获取个人数据
                (bool, string, Model.Model.LC_User)suser_vo = DAL.DAL.LC_User.GetUserDataFromOpenID(my_openid);
                if (!suser_vo.Item1)
                {
                    return(Show <TCommandState>(new
                    {
                        status = -10
                    }));
                }
                else
                {
                    suser = suser_vo.Item3;
                }
                break;
            }
            SetLogin(suser);

            return(Show <TCommandState>(new
            {
                status = 1,
                Open_ID = suser.WX_OpenID,
                Nick_Name = suser.WX_NickName,
                Head_Img_Url = suser.WX_HeadPic,
                ZType = suser.ZType.ConvertData <int>() //账号类型
            }));
        }
Exemplo n.º 28
0
        public void OnFileRequested(HttpRequest request, IDirectory directory)
        {
            //request.Response.SetHeader("Content-Type", "text/plain; charset=utf-8");
            request.Response.ResponseContent = new MemoryStream();
            StreamWriter  textwriter = new StreamWriter(request.Response.ResponseContent);
            SecondLife    client;
            AvatarTracker avatars;
            Events        events;
            StreamReader  reader  = new StreamReader(request.PostData);
            string        qstring = reader.ReadToEnd();

            reader.Dispose();
            Dictionary <string, string> POST = AjaxLife.PostDecode(qstring);

            // Pull out the session.
            if (!POST.ContainsKey("sid"))
            {
                textwriter.WriteLine("Need an SID.");
                textwriter.Flush();
                return;
            }
            Guid guid = new Guid(POST["sid"]);
            User user = new User();

            lock (this.users)
            {
                if (!this.users.ContainsKey(guid))
                {
                    textwriter.WriteLine("Error: invalid SID");
                    textwriter.Flush();
                    return;
                }
                user             = this.users[guid];
                client           = user.Client;
                avatars          = user.Avatars;
                events           = user.Events;
                user.LastRequest = DateTime.Now;
            }
            // Get the message type.
            string messagetype = POST["MessageType"];

            // Check that the message is signed if it should be.
            if (Array.IndexOf(REQUIRED_SIGNATURES, messagetype) > -1)
            {
                if (!VerifySignature(user, qstring))
                {
                    textwriter.WriteLine("Error: Received hash and expected hash do not match.");
                    textwriter.Flush();
                    return;
                }
            }

            // Right. This file is fun. It takes information in POST paramaters and sends them to
            // the server in the appropriate format. Some will return data immediately, some will return
            // keys to data that will arrive in the message queue, some return nothing but you get
            // something in the message queue later, and some return nother ever.
            //
            // The joys of dealing with multiple bizarre message types.

            switch (messagetype)
            {
            case "SpatialChat":
                client.Self.Chat(POST["Message"], int.Parse(POST["Channel"]), (ChatType)((byte)int.Parse(POST["Type"])));
                break;

            case "SimpleInstantMessage":
                if (POST.ContainsKey("IMSessionID"))
                {
                    client.Self.InstantMessage(new LLUUID(POST["Target"]), POST["Message"], new LLUUID(POST["IMSessionID"]));
                }
                else
                {
                    client.Self.InstantMessage(new LLUUID(POST["Target"]), POST["Message"]);
                }
                break;

            case "GenericInstantMessage":
                client.Self.InstantMessage(
                    client.Self.FirstName + " " + client.Self.LastName,
                    new LLUUID(POST["Target"]),
                    POST["Message"],
                    new LLUUID(POST["IMSessionID"]),
                    (InstantMessageDialog)((byte)int.Parse(POST["Dialog"])),
                    (InstantMessageOnline)int.Parse(POST["Online"]),
                    client.Self.SimPosition,
                    client.Network.CurrentSim.ID,
                    new byte[0]);
                break;

            case "NameLookup":
                client.Avatars.RequestAvatarName(new LLUUID(POST["ID"]));
                break;

            case "Teleport":
            {
                Hashtable hash = new Hashtable();
                bool      status;
                if (POST.ContainsKey("Landmark"))
                {
                    status = client.Self.Teleport(new LLUUID(POST["Landmark"]));
                }
                else
                {
                    status = client.Self.Teleport(POST["Sim"], new LLVector3(float.Parse(POST["X"]), float.Parse(POST["Y"]), float.Parse(POST["Z"])));
                }
                if (status)
                {
                    hash.Add("Success", true);
                    hash.Add("Sim", client.Network.CurrentSim.Name);
                    hash.Add("Position", client.Self.SimPosition);
                }
                else
                {
                    hash.Add("Success", false);
                    hash.Add("Reason", client.Self.TeleportMessage);
                }
                textwriter.WriteLine(MakeJson.FromHashtable(hash));
            }
            break;

            case "GoHome":
                client.Self.GoHome();
                break;

            case "GetPosition":
            {
                Hashtable hash = new Hashtable();
                hash.Add("Sim", client.Network.CurrentSim.Name);
                hash.Add("Position", client.Self.SimPosition);
                textwriter.WriteLine(JavaScriptConvert.SerializeObject(hash));
            }
            break;

            case "RequestBalance":
                client.Self.RequestBalance();
                break;

            case "GetStats":
            {
                Hashtable hash = new Hashtable();
                hash.Add("FPS", client.Network.CurrentSim.Stats.FPS);
                hash.Add("TimeDilation", client.Network.CurrentSim.Stats.Dilation);
                hash.Add("LSLIPS", client.Network.CurrentSim.Stats.LSLIPS);
                hash.Add("Objects", client.Network.CurrentSim.Stats.Objects);
                hash.Add("ActiveScripts", client.Network.CurrentSim.Stats.ActiveScripts);
                hash.Add("Agents", client.Network.CurrentSim.Stats.Agents);
                hash.Add("ChildAgents", client.Network.CurrentSim.Stats.ChildAgents);
                hash.Add("AjaxLifeSessions", users.Count);
                hash.Add("TextureCacheCount", AjaxLife.TextureCacheCount);
                hash.Add("TextureCacheSize", AjaxLife.TextureCacheSize);
                textwriter.WriteLine(MakeJson.FromHashtable(hash));
            }
            break;

            case "TeleportLureRespond":
                client.Self.TeleportLureRespond(new LLUUID(POST["RequesterID"]), bool.Parse(POST["Accept"]));
                break;

            case "GodlikeTeleportLureRespond":
            {
                LLUUID lurer   = new LLUUID(POST["RequesterID"]);
                LLUUID session = new LLUUID(POST["SessionID"]);
                client.Self.InstantMessage(client.Self.Name, lurer, "", LLUUID.Random(), InstantMessageDialog.AcceptTeleport, InstantMessageOnline.Offline, client.Self.SimPosition, LLUUID.Zero, new byte[0]);
                TeleportLureRequestPacket lure = new TeleportLureRequestPacket();
                lure.Info.AgentID       = client.Self.AgentID;
                lure.Info.SessionID     = client.Self.SessionID;
                lure.Info.LureID        = session;
                lure.Info.TeleportFlags = (uint)AgentManager.TeleportFlags.ViaGodlikeLure;
                client.Network.SendPacket(lure);
            }
            break;

            case "FindPeople":
            {
                Hashtable hash = new Hashtable();
                hash.Add("QueryID", client.Directory.StartPeopleSearch(DirectoryManager.DirFindFlags.People, POST["Search"], int.Parse(POST["Start"])));
                textwriter.WriteLine(MakeJson.FromHashtable(hash));
            }
            break;

            case "FindGroups":
            {
                Hashtable hash = new Hashtable();
                hash.Add("QueryID", client.Directory.StartGroupSearch(DirectoryManager.DirFindFlags.Groups, POST["Search"], int.Parse(POST["Start"])));
                textwriter.WriteLine(MakeJson.FromHashtable(hash));
            }
            break;

            case "GetAgentData":
                client.Avatars.RequestAvatarProperties(new LLUUID(POST["AgentID"]));
                break;

            case "StartAnimation":
                client.Self.AnimationStart(new LLUUID(POST["Animation"]), false);
                break;

            case "StopAnimation":
                client.Self.AnimationStop(new LLUUID(POST["Animation"]), true);
                break;

            case "SendAppearance":
                client.Appearance.SetPreviousAppearance(false);
                break;

            case "GetMapItems":
            {
                MapItemRequestPacket req = new MapItemRequestPacket();
                req.AgentData.AgentID   = client.Self.AgentID;
                req.AgentData.SessionID = client.Self.SessionID;
                GridRegion region;
                client.Grid.GetGridRegion(POST["Region"], GridLayerType.Objects, out region);
                req.RequestData.RegionHandle = region.RegionHandle;
                req.RequestData.ItemType     = uint.Parse(POST["ItemType"]);
                client.Network.SendPacket((Packet)req);
            }
            break;

            case "GetMapBlocks":
            {
                MapBlockRequestPacket req = new MapBlockRequestPacket();
                req.AgentData.AgentID   = client.Self.AgentID;
                req.AgentData.SessionID = client.Self.SessionID;
                req.PositionData.MinX   = 0;
                req.PositionData.MinY   = 0;
                req.PositionData.MaxX   = ushort.MaxValue;
                req.PositionData.MaxY   = ushort.MaxValue;
                client.Network.SendPacket((Packet)req);
            }
            break;

            case "GetMapBlock":
            {
                ushort x = ushort.Parse(POST["X"]);
                ushort y = ushort.Parse(POST["Y"]);
                MapBlockRequestPacket req = new MapBlockRequestPacket();
                req.AgentData.AgentID   = client.Self.AgentID;
                req.AgentData.SessionID = client.Self.SessionID;
                req.PositionData.MinX   = x;
                req.PositionData.MinY   = y;
                req.PositionData.MaxX   = x;
                req.PositionData.MaxY   = y;
                client.Network.SendPacket((Packet)req);
            }
            break;

            case "GetOfflineMessages":
            {
                RetrieveInstantMessagesPacket req = new RetrieveInstantMessagesPacket();
                req.AgentData.AgentID   = client.Self.AgentID;
                req.AgentData.SessionID = client.Self.SessionID;
                client.Network.SendPacket((Packet)req);
            }
            break;

            case "GetFriendList":
            {
                InternalDictionary <LLUUID, FriendInfo> friends = client.Friends.FriendList;
                List <Hashtable> friendlist = new List <Hashtable>();
                friends.ForEach(delegate(FriendInfo friend)
                    {
                        Hashtable friendhash = new Hashtable();
                        friendhash.Add("ID", friend.UUID.ToString());
                        friendhash.Add("Name", friend.Name);
                        friendhash.Add("Online", friend.IsOnline);
                        friendhash.Add("MyRights", friend.MyFriendRights);
                        friendhash.Add("TheirRights", friend.TheirFriendRights);
                        friendlist.Add(friendhash);
                    });
                textwriter.Write(MakeJson.FromObject(friendlist));
            }
            break;

            case "ChangeRights":
            {
                LLUUID uuid = new LLUUID(POST["Friend"]);
                client.Friends.GrantRights(uuid, (FriendRights)int.Parse(POST["Rights"]));
            }
            break;

            case "RequestLocation":
                client.Friends.MapFriend(new LLUUID(POST["Friend"]));
                break;

            case "RequestTexture":
            {
                // This one's confusing, so it gets some comments.
                // First, we get the image's UUID.
                LLUUID image = new LLUUID(POST["ID"]);
                // We prepare a query to ask if S3 has it. HEAD only to avoid wasting
                // GET requests and bandwidth.
                bool exists = false;
                // If we already know we have it, note this.
                if (AjaxLife.CachedTextures.Contains(image))
                {
                    exists = true;
                }
                else
                {
                    // If we're using S3, check the S3 bucket
                    if (AjaxLife.USE_S3)
                    {
                        // Otherwise, make that HEAD request and find out.
                        try
                        {
                            IThreeSharp query = new ThreeSharpQuery(AjaxLife.S3Config);
                            Affirma.ThreeSharp.Model.ObjectGetRequest s3request = new Affirma.ThreeSharp.Model.ObjectGetRequest(AjaxLife.TEXTURE_BUCKET, image.ToString() + ".png");
                            s3request.Method = "HEAD";
                            Affirma.ThreeSharp.Model.ObjectGetResponse s3response = query.ObjectGet(s3request);
                            if (s3response.StatusCode == System.Net.HttpStatusCode.OK)
                            {
                                exists = true;
                            }
                            s3response.DataStream.Close();
                        }
                        catch { }
                    }
                    // If we aren't using S3, just check the texture cache.
                    else
                    {
                        exists = File.Exists(AjaxLife.TEXTURE_CACHE + image.ToString() + ".png");
                    }
                }
                // If it exists, reply with Ready = true and the URL to find it at.
                if (exists)
                {
                    textwriter.Write("{Ready: true, URL: \"" + AjaxLife.TEXTURE_ROOT + image + ".png\"}");
                }
                // If it doesn't, request the image from SL and note its lack of readiness.
                // Notification will arrive later in the message queue.
                else
                {
                    client.Assets.RequestImage(image, ImageType.Normal, 125000.0f, 0);
                    textwriter.Write("{Ready: false}");
                }
            }
            break;

            case "AcceptFriendship":
                client.Friends.AcceptFriendship(client.Self.AgentID, POST["IMSessionID"]);
                break;

            case "DeclineFriendship":
                client.Friends.DeclineFriendship(client.Self.AgentID, POST["IMSessionID"]);
                break;

            case "OfferFriendship":
                client.Friends.OfferFriendship(new LLUUID(POST["Target"]));
                break;

            case "TerminateFriendship":
                client.Friends.TerminateFriendship(new LLUUID(POST["Target"]));
                break;

            case "SendAgentMoney":
                client.Self.GiveAvatarMoney(new LLUUID(POST["Target"]), int.Parse(POST["Amount"]));
                break;

            case "RequestAvatarList":
            {
                List <Hashtable> list = new List <Hashtable>();
                foreach (KeyValuePair <uint, Avatar> pair in avatars.Avatars)
                {
                    Avatar    avatar = pair.Value;
                    Hashtable hash   = new Hashtable();
                    hash.Add("Name", avatar.Name);
                    hash.Add("ID", avatar.ID);
                    hash.Add("LocalID", avatar.LocalID);
                    hash.Add("Position", avatar.Position);
                    //hash.Add("Rotation", avatar.Rotation);
                    hash.Add("Scale", avatar.Scale);
                    hash.Add("GroupName", avatar.GroupName);
                    list.Add(hash);
                }
                textwriter.Write(MakeJson.FromObject(list));
            }
            break;

            case "LoadInventoryFolder":
                client.Inventory.RequestFolderContents(new LLUUID(POST["UUID"]), client.Self.AgentID, true, true, InventorySortOrder.ByDate | InventorySortOrder.SystemFoldersToTop);
                break;

            case "RequestAsset":
            {
                try
                {
                    LLUUID transferid = client.Assets.RequestInventoryAsset(new LLUUID(POST["AssetID"]), new LLUUID(POST["InventoryID"]),
                                                                            LLUUID.Zero, new LLUUID(POST["OwnerID"]), (AssetType)int.Parse(POST["AssetType"]), false);
                    textwriter.Write("{TransferID: \"" + transferid + "\"}");
                }
                catch         // Try catching the error that sometimes gets thrown... but sometimes doesn't.
                {
                }
            }
            break;

            case "SendTeleportLure":
                client.Self.SendTeleportLure(new LLUUID(POST["Target"]), POST["Message"]);
                break;

            case "ScriptPermissionResponse":
                client.Self.ScriptQuestionReply(client.Network.CurrentSim, new LLUUID(POST["ItemID"]), new LLUUID(POST["TaskID"]), (ScriptPermission)int.Parse(POST["Permissions"]));
                break;

            case "ScriptDialogReply":
            {
                ScriptDialogReplyPacket packet = new ScriptDialogReplyPacket();
                packet.AgentData.AgentID   = client.Self.AgentID;
                packet.AgentData.SessionID = client.Self.SessionID;
                packet.Data.ButtonIndex    = int.Parse(POST["ButtonIndex"]);
                packet.Data.ButtonLabel    = Helpers.StringToField(POST["ButtonLabel"]);
                packet.Data.ChatChannel    = int.Parse(POST["ChatChannel"]);
                packet.Data.ObjectID       = new LLUUID(POST["ObjectID"]);
                client.Network.SendPacket((Packet)packet);
            }
            break;

            case "SaveNotecard":
                client.Inventory.RequestUploadNotecardAsset(Helpers.StringToField(POST["AssetData"]), new LLUUID(POST["ItemID"]), new InventoryManager.NotecardUploadedAssetCallback(events.Inventory_OnNoteUploaded));
                break;

            case "CreateInventory":
                client.Inventory.RequestCreateItem(new LLUUID(POST["Folder"]), POST["Name"], POST["Description"], (AssetType)int.Parse(POST["AssetType"]), LLUUID.Random(), (InventoryType)int.Parse(POST["InventoryType"]), PermissionMask.All, new InventoryManager.ItemCreatedCallback(events.Inventory_OnItemCreated));
                break;

            case "CreateFolder":
            {
                LLUUID folder = client.Inventory.CreateFolder(new LLUUID(POST["Parent"]), POST["Name"]);
                textwriter.Write("{FolderID: \"" + folder + "\"}");
            }
            break;

            case "EmptyTrash":
                client.Inventory.EmptyTrash();
                break;

            case "MoveItem":
                client.Inventory.MoveItem(new LLUUID(POST["Item"]), new LLUUID(POST["TargetFolder"]), POST["NewName"]);
                break;

            case "MoveFolder":
                client.Inventory.MoveFolder(new LLUUID(POST["Folder"]), new LLUUID(POST["NewParent"]));
                break;

            case "MoveItems":
            case "MoveFolders":
            {
                Dictionary <LLUUID, LLUUID> dict = new Dictionary <LLUUID, LLUUID>();
                string[] moves = POST["ToMove"].Split(',');
                for (int i = 0; i < moves.Length; ++i)
                {
                    string[] move = moves[i].Split(' ');
                    dict.Add(new LLUUID(move[0]), new LLUUID(move[1]));
                }
                if (messagetype == "MoveItems")
                {
                    client.Inventory.MoveItems(dict);
                }
                else if (messagetype == "MoveFolders")
                {
                    client.Inventory.MoveFolders(dict);
                }
            }
            break;

            case "DeleteItem":
                client.Inventory.RemoveItem(new LLUUID(POST["Item"]));
                break;

            case "DeleteFolder":
                client.Inventory.RemoveFolder(new LLUUID(POST["Folder"]));
                break;

            case "DeleteMultiple":
            {
                string[]      items    = POST["Items"].Split(',');
                List <LLUUID> itemlist = new List <LLUUID>();
                for (int i = 0; i < items.Length; ++i)
                {
                    itemlist.Add(new LLUUID(items[i]));
                }
                string[]      folders    = POST["Folders"].Split(',');
                List <LLUUID> folderlist = new List <LLUUID>();
                for (int i = 0; i < items.Length; ++i)
                {
                    folderlist.Add(new LLUUID(folders[i]));
                }
                client.Inventory.Remove(itemlist, folderlist);
            }
            break;

            case "GiveInventory":
            {
                client.Inventory.GiveItem(new LLUUID(POST["ItemID"]), POST["ItemName"], (AssetType)int.Parse(POST["AssetType"]), new LLUUID(POST["Recipient"]), true);
            }
            break;

            case "UpdateItem":
            {
                InventoryItem item = client.Inventory.FetchItem(new LLUUID(POST["ItemID"]), new LLUUID(POST["OwnerID"]), 1000);
                if (POST.ContainsKey("Name"))
                {
                    item.Name = POST["Name"];
                }
                if (POST.ContainsKey("Description"))
                {
                    item.Description = POST["Description"];
                }
                if (POST.ContainsKey("NextOwnerMask"))
                {
                    item.Permissions.NextOwnerMask = (PermissionMask)uint.Parse(POST["NextOwnerMask"]);
                }
                if (POST.ContainsKey("SalePrice"))
                {
                    item.SalePrice = int.Parse(POST["SalePrice"]);
                }
                if (POST.ContainsKey("SaleType"))
                {
                    item.SaleType = (SaleType)int.Parse(POST["SaleType"]);                                       // This should be byte.Parse, but this upsets mono's compiler (CS1002)
                }
                client.Inventory.RequestUpdateItem(item);
            }
            break;

            case "UpdateFolder":
            {
                UpdateInventoryFolderPacket packet = new UpdateInventoryFolderPacket();
                packet.AgentData.AgentID      = client.Self.AgentID;
                packet.AgentData.SessionID    = client.Self.SessionID;
                packet.FolderData             = new UpdateInventoryFolderPacket.FolderDataBlock[1];
                packet.FolderData[0]          = new UpdateInventoryFolderPacket.FolderDataBlock();
                packet.FolderData[0].FolderID = new LLUUID(POST["FolderID"]);
                packet.FolderData[0].ParentID = new LLUUID(POST["ParentID"]);
                packet.FolderData[0].Type     = sbyte.Parse(POST["Type"]);
                packet.FolderData[0].Name     = Helpers.StringToField(POST["Name"]);
                client.Network.SendPacket((Packet)packet);
            }
            break;

            case "FetchItem":
                client.Inventory.FetchItem(new LLUUID(POST["Item"]), new LLUUID(POST["Owner"]), 5000);
                break;

            case "ReRotate":
                user.Rotation = -Math.PI;
                break;

            case "StartGroupIM":
                AjaxLife.Debug("SendMessage", "RequestJoinGroupChat(" + POST["Group"] + ")");
                client.Self.RequestJoinGroupChat(new LLUUID(POST["Group"]));
                break;

            case "GroupInstantMessage":
                client.Self.InstantMessageGroup(new LLUUID(POST["Group"]), POST["Message"]);
                break;

            case "RequestGroupProfile":
                client.Groups.RequestGroupProfile(new LLUUID(POST["Group"]));
                break;

            case "RequestGroupMembers":
                client.Groups.RequestGroupMembers(new LLUUID(POST["Group"]));
                break;

            case "RequestGroupName":
                client.Groups.RequestGroupName(new LLUUID(POST["ID"]));
                break;

            case "JoinGroup":
                client.Groups.RequestJoinGroup(new LLUUID(POST["Group"]));
                break;

            case "LeaveGroup":
                client.Groups.LeaveGroup(new LLUUID(POST["Group"]));
                break;

            case "RequestCurrentGroups":
                client.Groups.RequestCurrentGroups();
                break;

            case "GetParcelID":
                textwriter.Write("{LocalID: " + client.Parcels.GetParcelLocalID(client.Network.CurrentSim, new LLVector3(float.Parse(POST["X"]), float.Parse(POST["Y"]), float.Parse(POST["Z"]))) + "}");
                break;

            case "RequestParcelProperties":
                client.Parcels.PropertiesRequest(client.Network.CurrentSim, int.Parse(POST["LocalID"]), int.Parse(POST["SequenceID"]));
                break;
            }
            textwriter.Flush();
        }