ChooseCard.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Data.SqlTypes;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using PTMedicalInsurance.Common;
  12. using PTMedicalInsurance.Helper;
  13. using Newtonsoft.Json.Linq;
  14. using PTMedicalInsurance.Forms;
  15. using PTMedicalInsurance.Variables;
  16. namespace PTMedicalInsurance.Forms
  17. {
  18. public partial class ChooseCard : Form
  19. {
  20. public string cardType;
  21. public string businessType;
  22. public string ID,PatName;
  23. public int sL_CardType;
  24. //设置业务实例
  25. InvokeHelper invoker = new InvokeHelper();
  26. public ChooseCard()
  27. {
  28. InitializeComponent();
  29. this.StartPosition = FormStartPosition.CenterParent;
  30. }
  31. private void btOk_Click(object sender, EventArgs e)
  32. {
  33. cardType = "0" + (rbgCardType.SelectedIndex +1).ToString();
  34. businessType = "01"+cbBusinessType.Text.Substring(0,3);
  35. Global.pat.OtherProv = rbgOtherProv.SelectedIndex;
  36. //if ((rbgOtherProv.SelectedIndex == 1)&&(cbCBD.Text==""))
  37. //{
  38. // MessageBox.Show("异地结算,请选择统筹区!");
  39. // return;
  40. //}
  41. // 身份证
  42. if (rbgCardType.SelectedIndex == 1)
  43. {
  44. ID = tbID.Text.Trim();
  45. PatName = tbName.Text;
  46. }
  47. //社保卡
  48. if (rbgCardType.SelectedIndex == 2)
  49. {
  50. if (cbCardType.Text == "")
  51. {
  52. MessageBox.Show("读社保卡时需要选择卡类型!");
  53. return;
  54. }
  55. sL_CardType = int.Parse(cbCardType.Text.Trim().Substring(0, 1)); //卡类型
  56. }
  57. DialogResult = DialogResult.OK;
  58. }
  59. private void ChooseCard_Load(object sender, EventArgs e)
  60. {
  61. rbgCardType.SelectedIndex = 2; //身份证
  62. cbBusinessType.SelectedIndex = 0; //社保卡
  63. rbgOtherProv.SelectedIndex = 0; //本地
  64. }
  65. private void rbgCardType_ValueChanged(object sender, int index, string text)
  66. {
  67. if (rbgCardType.SelectedIndex == 0)
  68. {
  69. // 电子凭证
  70. cbBusinessType.Enabled = true;
  71. lblNo.Text = "电子凭证号";
  72. tbID.Focus();
  73. }
  74. else
  75. {
  76. lblNo.Text = "身份证号";
  77. cbBusinessType.Enabled = false;
  78. }
  79. if (rbgCardType.SelectedIndex == 2)
  80. {
  81. cbCardType.SelectedIndex = 0;
  82. cbCardLevel.SelectedIndex = 2;
  83. cbCardType.Enabled = true;
  84. tbPassword.Enabled = true;
  85. //tbPassword.Text = "";
  86. }
  87. else
  88. {
  89. cbCardType.Enabled = false;
  90. tbPassword.Enabled = false;
  91. }
  92. if (rbgCardType.SelectedIndex != 1)
  93. {
  94. tbID.Text = "";
  95. }
  96. }
  97. private void btCancle_Click(object sender, EventArgs e)
  98. {
  99. DialogResult = DialogResult.Cancel;
  100. }
  101. /// <summary>
  102. /// 修改密码
  103. /// </summary>
  104. /// <param name="sender"></param>
  105. /// <param name="e"></param>
  106. private void uiButton1_Click(object sender, EventArgs e)
  107. {
  108. string errorMsg="";
  109. JObject joData = new JObject();
  110. joData.Add("", "");
  111. JObject joInput = new JObject();
  112. joInput.Add("data", joData);
  113. InvokeHelper invoker = new InvokeHelper();
  114. JObject joRtn =invoker.invokeCenterService(TradeEnum.ModifyPassword, joInput);
  115. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  116. {
  117. MessageBox.Show("修改卡密码失败:" + errorMsg);
  118. }
  119. else
  120. {
  121. MessageBox.Show("修改卡密码成功!");
  122. }
  123. }
  124. private void SearchAdmdvs()
  125. {
  126. JObject joAdmdvsInfo = new JObject();
  127. SearchAdmdvs Adm = new SearchAdmdvs();
  128. try
  129. {
  130. Global.pat.card.SearchAdmKey = cbCBD.Text;
  131. Adm.StartPosition = FormStartPosition.CenterParent;
  132. if (Adm.ShowDialog() == DialogResult.OK)
  133. {
  134. if (!string.IsNullOrEmpty(Global.pat.card.SearchAdmCode))
  135. {
  136. //自动选择异地
  137. if (Utils.isOtherCity(Global.pat.card.SearchAdmCode))
  138. {
  139. rbgOtherProv.SelectedIndex = 1;
  140. }
  141. }
  142. cbCBD.Text = Global.pat.card.SearchAdmName;
  143. }
  144. }
  145. catch (Exception ex)
  146. {
  147. MessageBox.Show("异常:" + ex.Message);
  148. return;
  149. }
  150. }
  151. private void cbCBD_DoEnter(object sender, EventArgs e)
  152. {
  153. //初始化
  154. Global.pat.card.SearchAdmCode = "";
  155. SearchAdmdvs();
  156. }
  157. }
  158. }