Exemplo n.º 1
0
        //发送消息
        public static bool succNotice(domain.Bill bill)
        {
            string     posData    = bill.ToString();
            HttpResult httpResult = postData(Constants.serverUrl + "/payIntf/terminal/receiveNoticeMsg", posData);
            string     jsonStr    = subResultHtml(httpResult.Html);

            Console.WriteLine(jsonStr);
            ServiceDataResult result = JSON.parse <ServiceDataResult>(jsonStr);

            if (result.code == "0")
            {
                BusWebFormE.log("发送消息成功: " + JSON.stringify(bill));
                //更新最后一条流水号
                BusWebFormE.serial = result.data;
                return(true);
            }
            else
            {
                lastError = result.msg;
                return(false);
            }

            //测试
            //Console.WriteLine("发送消息成功: " + JSON.stringify(bill));
            //BusWebFormE.serial = bill.Serial;
            //return true;
        }
Exemplo n.º 2
0
        public static bool login(string username, string pwd)
        {
            string     posData    = "loginName=" + username + "&pwd=" + pwd + "&serno=" + CpuHelper.GetCPUSerialNumber();
            HttpResult httpResult = postData(Constants.serverUrl + "/all/terminal/login", posData);

            try
            {
                ServiceDataResult result = JSON.parse <ServiceDataResult>(httpResult.Html);
                if (result.code == "0")
                {
                    token = result.data;
                    prop.Add("username", username);
                    prop.Add("pwd", pwd);
                    prop.save("./data.db");
                    return(true);
                }
                else
                {
                    lastError = result.msg;
                    return(false);
                }
            }
            catch
            {
                Console.WriteLine(httpResult.Html);
                return(false);
            }
        }
Exemplo n.º 3
0
        //获取最后一条流水号
        public static string getLastOrder(String collectionAccount)
        {
            string     posData    = "collectionAccount=" + collectionAccount;
            HttpResult httpResult = postData(Constants.serverUrl + "/payIntf/terminal/sendLatestOrder", posData);
            string     jsonStr    = subResultHtml(httpResult.Html);

            Console.WriteLine(jsonStr);
            ServiceDataResult result = JSON.parse <ServiceDataResult>(jsonStr);

            Console.WriteLine(result.data);
            if (result.code == "0")
            {
                return(result.data);
                //return "6666666666666666666666";
            }
            else
            {
                //lastError = result.msg;

                return(null);
            }
            //测试
            //return "20190524200040011100460064225800";
        }