Ejemplo n.º 1
0
 private void submitCharge()
 {
     while (true)
     {
         try
         {
             this.tbxLastRunTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             StateHandle handle    = new StateHandle();
             OrderInfo   phoneInfo = handle.submitOrderService(this);
             if (phoneInfo == null)
             {
                 Thread.Sleep(2000);
             }
             else
             {
                 Thread.Sleep(2000);
             }
         }
         catch (Exception ex)
         {
             View.write(Share.ExceptionToStringForView(ex));
             log.Debug(Share.ExceptionToStringForView(ex));
             Thread.Sleep(2000);//异常时休息
         }
     }
 }
Ejemplo n.º 2
0
 private void statusNotify()
 {
     while (true)
     {
         try
         {
             StateHandle      handle        = new StateHandle();
             List <OrderInfo> phoneInfoList = handle.statusNotify(this);
             if (phoneInfoList == null || phoneInfoList.Count <= 0)
             {
                 Thread.Sleep(2000);
             }
             else
             {
                 Thread.Sleep(2000);
             }
         }
         catch (Exception ex)
         {
             View.write(Share.ExceptionToStringForView(ex));
             log.Debug(Share.ExceptionToStringForView(ex));
             Thread.Sleep(1000);//异常时休息
         }
     }
 }
Ejemplo n.º 3
0
 private void query()
 {
     try
     {
         pageSize = Int32.Parse(tbxPage.Text.Trim());
         StateHandle handle = new StateHandle();
         int totalRows = handle.totalRows(dtpStart.Text.Trim(), dtpEnd.Text.Trim(), tbxOrderId.Text.Trim(), tbxPhoneNo.Text.Trim());
         int totalPage = totalRows % pageSize >= 1 ? totalRows / pageSize + 1 : totalRows / pageSize;
         if (pageIndex < 1)
         {
             pageIndex = 1;
         }
         if (pageIndex > totalPage) 
         {
             pageIndex = totalPage;
         }
         label5.Text = "总条数:" + totalRows;
         labelPage.Text = pageIndex.ToString() + "/" + totalPage;
         DataTable dt = handle.selectOrderList(dtpStart.Text.Trim(), dtpEnd.Text.Trim(), tbxOrderId.Text.Trim(), tbxPhoneNo.Text.Trim(), pageIndex, pageSize);
         dgvOrderShow.DataSource = dt;
     }
     catch (Exception ex)
     {
         MessageBox.Show("错误", ex.Message);
     }
 }
Ejemplo n.º 4
0
        private void loop(HttpListener httpListenner)
        {
            while (startMark)
            {
                HttpListenerRequest  request  = null;
                HttpListenerResponse response = null;
                StreamWriter         writer   = null;
                try
                {
                    HttpListenerContext context = httpListenner.GetContext();
                    request = context.Request;
                    //分析插入订单
                    StateHandle handle    = new StateHandle();
                    OrderInfo   phoneInfo = new OrderInfo();
                    phoneInfo.vender_id     = request.QueryString["venderId"];
                    phoneInfo.order_id      = request.QueryString["orderId"];
                    phoneInfo.face_price    = request.QueryString["facePrice"];
                    phoneInfo.phone_no      = request.QueryString["phoneNo"];
                    phoneInfo.provider      = request.QueryString["provider"];
                    phoneInfo.province_code = request.QueryString["provinceCode"];
                    phoneInfo.city_code     = request.QueryString["cityCode"];
                    phoneInfo.order_status  = "0";
                    String        inTime = request.QueryString["inTime"];
                    String        sign   = request.QueryString["sign"];
                    StringBuilder sb     = new StringBuilder();
                    sb.Append("venderId=").Append(phoneInfo.vender_id)
                    .Append("&orderId=").Append(phoneInfo.order_id)
                    .Append("&phoneNo=").Append(phoneInfo.phone_no)
                    .Append("&facePrice=").Append(phoneInfo.face_price)
                    .Append("&provider=").Append(phoneInfo.provider)
                    .Append("&provinceCode=").Append(phoneInfo.province_code)
                    .Append("&cityCode=").Append(phoneInfo.city_code)
                    .Append("&inTime=").Append(inTime)
                    .Append("&key=").Append(Config.md5Key);
                    String _sign = Share.MD5(sb.ToString()).ToLower();
                    String res   = "";
                    if (phoneInfo.vender_id == null || "".Equals(phoneInfo.vender_id) || phoneInfo.order_id == null || "".Equals(phoneInfo.order_id) ||
                        phoneInfo.face_price == null || "".Equals(phoneInfo.face_price) || phoneInfo.phone_no == null || "".Equals(phoneInfo.phone_no) ||
                        inTime == null || "".Equals(inTime) || sign == null || "".Equals(sign)
                        )
                    {
                        res = "000001";
                    }
                    else if (!_sign.Equals(sign))
                    {
                        res = "000005";
                    }
                    else
                    {
                        //验证时间戳(略)

                        //验证订单号
                        int count = handle.selectCountByOrderId(phoneInfo);
                        if (count <= 0)
                        {
                            int insertCount = handle.insertOrderService(phoneInfo);
                            if (insertCount > 0)
                            {
                                res = "000000";
                            }
                            else
                            {
                                res = "000003";
                            }
                        }
                        else
                        {
                            res = "000004";
                        }
                    }
                    response            = context.Response;
                    response.StatusCode = 200;
                    writer = new StreamWriter(response.OutputStream);
                    writer.Write(res);
                    writer.Close();
                    response.Close();
                    View.write("收单接口orderId:" + phoneInfo.order_id + ",录入结果:" + res);
                    log.Debug("收单接口orderId:" + phoneInfo.order_id + ",录入结果:" + res);
                }
                catch (Exception ex)
                {
                    log.Debug("收单接口异常:" + ex);
                }
                finally
                {
                    try
                    {
                        if (writer != null)
                        {
                            writer.Close();
                        }
                        if (response != null)
                        {
                            response.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Debug("收单接口异常:" + ex);
                        View.write("收单接口异常:" + ex);
                    }
                }
            }
        }
Ejemplo n.º 5
0
 private void statusNotify()
 {
     while (true)
     {
         try
         {
             StateHandle handle = new StateHandle();
             List<OrderInfo> phoneInfoList = handle.statusNotify(this);
             if (phoneInfoList == null || phoneInfoList.Count <= 0)
             {
                 Thread.Sleep(2000);
             }
             else
             {
                 Thread.Sleep(2000);
             }
         }
         catch (Exception ex)
         {
             View.write(Share.ExceptionToStringForView(ex));
             log.Debug(Share.ExceptionToStringForView(ex));
             Thread.Sleep(1000);//异常时休息
         }
     }
 }
Ejemplo n.º 6
0
 private void submitCharge()
 {
     while (true)
     {
         try
         {
             this.tbxLastRunTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
             StateHandle handle = new StateHandle();
             OrderInfo phoneInfo = handle.submitOrderService(this);
             if (phoneInfo == null)
             {
                 Thread.Sleep(2000);
             }
             else
             {
                 Thread.Sleep(2000);
             }
         }
         catch (Exception ex)
         {
             View.write(Share.ExceptionToStringForView(ex));
             log.Debug(Share.ExceptionToStringForView(ex));
             Thread.Sleep(2000);//异常时休息
         }
     }
 }
Ejemplo n.º 7
0
        private void loop(HttpListener httpListenner)
        {
            while (startMark)
            {
                HttpListenerRequest request = null;
                HttpListenerResponse response = null;
                StreamWriter writer = null;
                try
                {
                    HttpListenerContext context = httpListenner.GetContext();
                    request = context.Request;
                    //分析插入订单
                    StateHandle handle = new StateHandle();
                    OrderInfo phoneInfo = new OrderInfo();
                    phoneInfo.vender_id = request.QueryString["venderId"];
                    phoneInfo.order_id = request.QueryString["orderId"];
                    phoneInfo.face_price = request.QueryString["facePrice"];
                    phoneInfo.phone_no = request.QueryString["phoneNo"];
                    phoneInfo.provider = request.QueryString["provider"];
                    phoneInfo.province_code = request.QueryString["provinceCode"];
                    phoneInfo.city_code = request.QueryString["cityCode"];
                    phoneInfo.order_status = "0";
                    String inTime = request.QueryString["inTime"];
                    String sign = request.QueryString["sign"];
                    StringBuilder sb = new StringBuilder();
                    sb.Append("venderId=").Append(phoneInfo.vender_id)
                    .Append("&orderId=").Append(phoneInfo.order_id)
                    .Append("&phoneNo=").Append(phoneInfo.phone_no)
                    .Append("&facePrice=").Append(phoneInfo.face_price)
                    .Append("&provider=").Append(phoneInfo.provider)
                    .Append("&provinceCode=").Append(phoneInfo.province_code)
                    .Append("&cityCode=").Append(phoneInfo.city_code)
                    .Append("&inTime=").Append(inTime)
                    .Append("&key=").Append(Config.md5Key);
                    String _sign = Share.MD5(sb.ToString()).ToLower();
                    String res = "";
                    if (phoneInfo.vender_id == null || "".Equals(phoneInfo.vender_id) || phoneInfo.order_id == null || "".Equals(phoneInfo.order_id)
                        || phoneInfo.face_price == null || "".Equals(phoneInfo.face_price) || phoneInfo.phone_no == null || "".Equals(phoneInfo.phone_no)
                        || inTime == null || "".Equals(inTime) || sign == null || "".Equals(sign)
                        )
                    {
                        res = "000001";
                    }
                    else if (!_sign.Equals(sign))
                    {
                        res = "000005";
                    }
                    else
                    {
                        //验证时间戳(略)

                        //验证订单号
                        int count = handle.selectCountByOrderId(phoneInfo);
                        if (count <= 0)
                        {
                            int insertCount = handle.insertOrderService(phoneInfo);
                            if (insertCount > 0)
                            {
                                res = "000000";
                            }
                            else
                            {
                                res = "000003";
                            }
                        }
                        else
                        {
                            res = "000004";
                        }
                    }
                    response = context.Response;
                    response.StatusCode = 200;
                    writer = new StreamWriter(response.OutputStream);
                    writer.Write(res);
                    writer.Close();
                    response.Close();
                    View.write("收单接口orderId:" + phoneInfo.order_id + ",录入结果:" + res);
                    log.Debug("收单接口orderId:" + phoneInfo.order_id + ",录入结果:" + res);
                }
                catch (Exception ex)
                {
                    log.Debug("收单接口异常:" + ex);
                }
                finally
                {
                    try
                    {
                        if (writer != null)
                        {
                            writer.Close();
                        }
                        if (response != null)
                        {
                            response.Close();
                        }
                    }
                    catch (Exception ex)
                    {
                        log.Debug("收单接口异常:" + ex);
                        View.write("收单接口异常:" + ex);
                    }
                }
            }
        }