private void tbOrderAuthCode_TextChanged(object sender, System.EventArgs e)
        {
            if (this.tbOrderAuthCode.Text.Length == 5)
            {
                RegisterSuccessInfo successInfo = new RegisterSuccessInfo();

                this.lbMessage.Text = string.Empty;
                this.lbMessage.Text = "提交中...";

                bool bIsSuccess = false;
                m_frmWaiting.MsgWait  = "已提交预约数据,正在等待服务端的响应...";
                m_frmWaiting.OnDoWork = (s, we) =>
                {
                    bIsSuccess = m_register.SaveOrderInfo(tbOrderAuthCode.Text, ref successInfo);
                };
                m_frmWaiting.ShowDialog();

                if (!bIsSuccess)
                {
                    lbMessage.Text       = m_register.GetLastError();
                    tbOrderAuthCode.Text = string.Empty;

                    RefreshAuthCode("预约数据提交失败,正在重新获取验证码...");
                    return;
                }

                Hide();
                SuccessForm successForm = new SuccessForm(successInfo);
                successForm.ShowDialog();
                successForm.Dispose();
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Beispiel #2
0
 public override bool SaveOrderInfo(string authCode, ref RegisterSuccessInfo successInfo)
 {
     try
     {
         m_httpItem.URL               = ORDER_SAVE_URL;
         m_httpItem.ResultType        = ResultType.String;
         m_httpItem.Method            = "POST";
         m_httpItem.Allowautoredirect = false;
         m_httpItem.Postdata          = m_postRegisterOrderData + "code=" + authCode;
         m_httpItem.PostEncoding      = Encoding.UTF8;
         m_httpItem.Encoding          = Encoding.UTF8;
         m_httpItem.ContentType       = "application/x-www-form-urlencoded";
         HttpResult html = m_httpHelper.GetHtml(m_httpItem);
         if (html.StatusCode == System.Net.HttpStatusCode.OK)
         {
             m_htmlDocument.LoadHtml(html.Html);
             HtmlNode htmlNode = m_htmlDocument.DocumentNode.SelectSingleNode(ORDER_SUCCESS_XPATH);
             if (htmlNode != null)
             {
                 HtmlNodeCollection htmlNodeCollection = htmlNode.SelectNodes("p/span");
                 successInfo.Passwd       = htmlNodeCollection[0].InnerHtml;
                 successInfo.Phone        = htmlNodeCollection[1].InnerHtml;
                 successInfo.DiagnoseTime = htmlNodeCollection[3].InnerHtml;
                 successInfo.DiagnoseNum  = htmlNodeCollection[5].InnerHtml;
             }
             else
             {
                 m_lastError = "预约订单提交失败:未找到预约成功信息";
                 Logger.WriteError(m_lastError);
                 return(false);
             }
         }
         else
         {
             m_lastError = string.Format("验证码提交失败:返回状态码 {0}", html.StatusCode);
             Logger.WriteError(m_lastError);
             return(false);
         }
     }
     catch (Exception err)
     {
         m_lastError = "预约订单提交失败:" + err.Message;
         Logger.WriteError("预约订单提交失败", err);
         return(false);
     }
     return(true);
 }
 /// <summary>
 /// 提交预约订单
 /// </summary>
 /// <param name="authCode"></param>
 /// <param name="successInfo"></param>
 /// <returns></returns>
 public abstract bool SaveOrderInfo(string authCode, ref RegisterSuccessInfo successInfo);
 public SuccessForm(RegisterSuccessInfo regSuccessInfo)
 {
     InitializeComponent();
     m_regSuccessInfo = regSuccessInfo;
 }