private void tbOrderAuthCode_TextChanged(object sender, System.EventArgs e) { if (this.tbOrderAuthCode.Text.Length == 5) { this.lbMessage.Text = string.Empty; //string result = this.m_regHelper.CheckOrderCode(this.m_infoOrder.Doctor.HospitalId, this.m_numId, this.tbOrderAuthCode.Text); //if (result != "success") //{ // this.lbMessage.Text = "验证失败,来自服务端的返回结果:" + result; // this.tbOrderAuthCode.Text = string.Empty; // this.pbAuthCode.Image = this.m_regHelper.GetOrderCode(this.m_infoOrder.Doctor.HospitalId, this.m_numId); // return; //} this.lbMessage.Text = "提交中..."; OrderSuccessInfo orderSuccessInfo = this.m_regHelper.OrderSave(this.m_orderPost + "code=" + this.tbOrderAuthCode.Text); if (orderSuccessInfo.ResResult != ResponseReuslt.SUCCESS) { this.lbMessage.Text = "验证码校验失败"; this.tbOrderAuthCode.Text = string.Empty; this.pbAuthCode.Image = this.m_regHelper.GetOrderCode(this.m_infoOrder.Doctor.HospitalId, this.m_numId); return; } base.Hide(); this.lbMessage.Text = "提交成功"; SuccessForm successForm = new SuccessForm(orderSuccessInfo); successForm.ShowDialog(); successForm.Dispose(); Log.WriteInfo("恭喜预约成功!"); base.Close(); } }
public OrderSuccessInfo OrderSave(string post) { OrderSuccessInfo orderSuccessInfo = new OrderSuccessInfo(); try { this._httpItem.URL = "http://www.zj12580.cn/order/save"; this._httpItem.ResultType = ResultType.String; this._httpItem.Method = "POST"; this._httpItem.Allowautoredirect = false; this._httpItem.Postdata = post; this._httpItem.PostEncoding = System.Text.Encoding.UTF8; this._httpItem.Encoding = System.Text.Encoding.UTF8; this._httpItem.ContentType = "application/x-www-form-urlencoded"; HttpResult html = this._httpHelper.GetHtml(this._httpItem); if (html.StatusCode == System.Net.HttpStatusCode.OK) { this._htmlDoc.LoadHtml(html.Html); HtmlNode htmlNode = this._htmlDoc.DocumentNode.SelectSingleNode("/html/body/div[@id='middle']/div[@class='m_b']/div[@class='m_r']/div[@class='succe']"); if (htmlNode != null) { orderSuccessInfo.ResResult = ResponseReuslt.SUCCESS; HtmlNodeCollection htmlNodeCollection = htmlNode.SelectNodes("p/span"); orderSuccessInfo.Passwd = htmlNodeCollection[0].InnerHtml; orderSuccessInfo.Phone = htmlNodeCollection[1].InnerHtml; orderSuccessInfo.ResTime = htmlNodeCollection[3].InnerHtml; orderSuccessInfo.ResNum = htmlNodeCollection[5].InnerHtml; } else { orderSuccessInfo.ResResult = ResponseReuslt.ERROR_FAIL; Log.WriteError("验证码提交失败:手速太慢"); } } else { Log.WriteError(string.Format("验证码提交失败:返回状态码 {0}", html.StatusCode)); orderSuccessInfo.ResResult = ResponseReuslt.NON_NET; } } catch (System.Exception err) { orderSuccessInfo.ResResult = ResponseReuslt.ERROR_UNKNOW; Log.WriteError("订单预约失败", err); } return(orderSuccessInfo); }
public SuccessForm(OrderSuccessInfo infoOrderSuccess) { this.InitializeComponent(); this.m_infoOrderSuccess = infoOrderSuccess; }