private void edtMobile_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { //调用查询 memberInfo = CanDaoMemberClient.QueryBalance(Globals.branch_id, "", edtMobile.Text, edtPwd.Text); if (!memberInfo.Retcode.Equals("0")) { Warning(memberInfo.Retinfo); return; } edtName.Text = memberInfo.Name; edtAmount.Text = memberInfo.Storecardbalance.ToString(); edtPoint.Text = memberInfo.Integraloverall.ToString(); try { dtpBirthday.Value = DateTime.Parse(memberInfo.Birthday.ToString()); } catch { } if (memberInfo.Gender.ToString().Equals("0")) { rgpGender.SelectedIndex = 0; } else { rgpGender.SelectedIndex = 1; } //生日 btnModify.Enabled = true; btnStore.Enabled = true; btnCardLose.Enabled = true; btndelete.Enabled = true; } }
public static void ShowMemberStored(TCandaoMemberInfo memberInfo) { frmMemberStored inputtext = new frmMemberStored(); inputtext._memberInfo = memberInfo; inputtext.edtMobile.Text = memberInfo.Mobile; inputtext.ShowDialog(); return; }
/// <summary> /// 会员查询 /// </summary> /// <param name="branch_id"></param> /// <param name="securitycode"></param> /// <param name="cardno"></param> /// <param name="password"></param> /// <returns></returns> public static TCandaoMemberInfo QueryBalance(string branch_id, string securitycode, string cardno, string password) { TCandaoMemberInfo ret = new TCandaoMemberInfo(); string address = String.Format("http://{0}/member/memberManager/findByParams", WebServiceReference.Candaomemberserver); StringWriter sw = new StringWriter(); JsonWriter writer = new JsonTextWriter(sw); writer.WriteStartObject(); writer.WritePropertyName("branch_id"); writer.WriteValue(branch_id); writer.WritePropertyName("securityCode"); writer.WriteValue(securitycode); writer.WritePropertyName("cardno"); writer.WriteValue(cardno); writer.WritePropertyName("password"); writer.WriteValue(password); writer.WriteEndObject(); writer.Flush(); AllLog.Instance.I(string.Format("【QueryBalance】 reqeust:{0}。", sw)); String jsonResult = RestClient.Post_Rest(address, sw); AllLog.Instance.I(string.Format("【QueryBalance】 result:{0}。", jsonResult)); JObject ja = null; ret.Ret = true; try { ja = (JObject)JsonConvert.DeserializeObject(jsonResult); } catch { ret.Ret = false; return(ret); } try { String Retcode = ja["Retcode"].ToString(); String RetInfo = ja["RetInfo"].ToString(); if (Retcode.Equals("1")) { ret.Ret = false; ret.Retcode = "1"; ret.Retinfo = RetInfo; return(ret); } } catch { } try { ret.Mcard = ja["CardList"].ToString();//mobile MCard } catch { ret.Ret = false; ret.Retcode = "1"; ret.Retinfo = "查询失败,服务器未返回数据!"; return(ret); } if (ret.Mcard.Equals("")) { ret.Ret = false; ret.Retcode = "1"; ret.Retinfo = "查询失败,服务器未返回会员卡号!"; return(ret); } ret.Retcode = "0"; ret.Ret = ret.Retcode.Equals("0"); ret.Retinfo = ""; ret.Storecardbalance = decimal.Parse(ja["StoreCardBalance"].ToString()); ret.Integraloverall = decimal.Parse(ja["IntegralOverall"].ToString()); try { ret.Couponsoverall = decimal.Parse(ja["CouponsOverall"].ToString()); } catch { ret.Couponsoverall = 0; } ret.Ticketinfo = ja["TicketInfo"].ToString(); ret.Ticketinfo = ja["TraceCode"].ToString(); try { ret.Cardtype = int.Parse(ja["CardType"].ToString()); } catch { ret.Cardtype = 0; } ret.Regdate = ja["RegDate"].ToString(); ret.Cardlist = ja["CardList"].ToString(); ret.Member_avatar = ja["member_avatar"].ToString(); ret.Cardlevel = "0";// ja["CardLevel"].ToString(); try { ret.Cardlevel = ja["CardLevel"].ToString(); } catch { } JArray jr = (JArray)JsonConvert.DeserializeObject(ret.Cardlist); JObject jaCard = (JObject)jr[0]; ret.Mcard = jaCard["cardno"].ToString(); ret.Mobile = ja["mobile"].ToString(); ret.Name = ja["name"].ToString(); try { ret.Gender = int.Parse(ja["gender"].ToString()); } catch { ret.Gender = 0; } ret.Birthday = ja["birthday"].ToString(); ret.Memberaddress = ja["MemberAddress"].ToString(); ret.Cardno = jaCard["cardno"].ToString(); return(ret); }