ChooseCard.cs 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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, sL_CertCodeType;
  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 (rbgCardType.SelectedIndex == 0)
  37. {
  38. sL_CertCodeType = "01" + cbBusinessType.Text.Trim().Substring(0, 3); //用码业务类型
  39. if (string.IsNullOrEmpty(tbID.Text.Trim()))
  40. {
  41. MessageBox.Show("请先扫电子医保码!");
  42. tbID.Focus();
  43. return;
  44. }
  45. else
  46. {
  47. Global.pat.ecCardNo = tbID.Text.Trim();
  48. }
  49. }
  50. if ((rbgOtherProv.SelectedIndex == 1) && (cbCBD.Text == ""))
  51. {
  52. MessageBox.Show("异地结算,请选择统筹区!");
  53. return;
  54. }
  55. // 身份证
  56. if (rbgCardType.SelectedIndex == 1)
  57. {
  58. if (tbID.Text == "")
  59. {
  60. ID = "";
  61. }
  62. else
  63. {
  64. ID = tbID.Text;
  65. }
  66. PatName = tbName.Text;
  67. }
  68. //社保卡
  69. if (rbgCardType.SelectedIndex == 2)
  70. {
  71. if (cbCardType.Text == "")
  72. {
  73. MessageBox.Show("读社保卡时需要选择卡类型!");
  74. return;
  75. }
  76. sL_CardType = int.Parse(cbCardType.Text.Trim().Substring(0, 1)); //卡类型
  77. }
  78. DialogResult = DialogResult.OK;
  79. }
  80. private void ChooseCard_Load(object sender, EventArgs e)
  81. {
  82. rbgCardType.SelectedIndex = 2; //身份证
  83. cbBusinessType.SelectedIndex = 0; //社保卡
  84. rbgOtherProv.SelectedIndex = 0; //本地
  85. }
  86. private void rbgCardType_ValueChanged(object sender, int index, string text)
  87. {
  88. if (rbgCardType.SelectedIndex == 0 || rbgCardType.SelectedIndex == 3)
  89. {
  90. // 电子凭证
  91. cbBusinessType.Enabled = true;
  92. lblNo.Text = "电子凭证号";
  93. tbID.Focus();
  94. }
  95. else
  96. {
  97. lblNo.Text = "身份证号";
  98. cbBusinessType.Enabled = false;
  99. }
  100. if (rbgCardType.SelectedIndex == 2)
  101. {
  102. cbCardType.SelectedIndex = 0;
  103. cbCardLevel.SelectedIndex = 2;
  104. cbCardType.Enabled = true;
  105. tbPassword.Enabled = true;
  106. //tbPassword.Text = "";
  107. }
  108. else
  109. {
  110. cbCardType.Enabled = false;
  111. tbPassword.Enabled = false;
  112. }
  113. if (rbgCardType.SelectedIndex != 1)
  114. {
  115. tbID.Text = "";
  116. }
  117. }
  118. private void btCancle_Click(object sender, EventArgs e)
  119. {
  120. DialogResult = DialogResult.Cancel;
  121. }
  122. /// <summary>
  123. /// 修改密码
  124. /// </summary>
  125. /// <param name="sender"></param>
  126. /// <param name="e"></param>
  127. private void uiButton1_Click(object sender, EventArgs e)
  128. {
  129. string errorMsg="";
  130. JObject joData = new JObject();
  131. joData.Add("", "");
  132. JObject joInput = new JObject();
  133. joInput.Add("data", joData);
  134. InvokeHelper invoker = new InvokeHelper();
  135. JObject joRtn =invoker.invokeCenterService(TradeEnum.ModifyPassword, joInput);
  136. if (JsonHelper.parseCenterRtnValue(joRtn, out errorMsg) != 0)
  137. {
  138. MessageBox.Show("修改卡密码失败:" + errorMsg);
  139. }
  140. else
  141. {
  142. MessageBox.Show("修改卡密码成功!");
  143. }
  144. }
  145. private void SearchAdmdvs()
  146. {
  147. JObject joAdmdvsInfo = new JObject();
  148. SearchAdmdvs Adm = new SearchAdmdvs();
  149. try
  150. {
  151. Global.pat.card.SearchAdmKey = cbCBD.Text;
  152. Adm.StartPosition = FormStartPosition.CenterParent;
  153. if (Adm.ShowDialog() == DialogResult.OK)
  154. {
  155. if (!string.IsNullOrEmpty(Global.pat.card.SearchAdmCode))
  156. {
  157. //自动选择异地
  158. if (Utils.isOtherCity(Global.pat.card.SearchAdmCode))
  159. {
  160. rbgOtherProv.SelectedIndex = 1;
  161. }
  162. }
  163. cbCBD.Text = Global.pat.card.SearchAdmName;
  164. }
  165. }
  166. catch (Exception ex)
  167. {
  168. MessageBox.Show("异常:" + ex.Message);
  169. return;
  170. }
  171. }
  172. private void cbCBD_DoEnter(object sender, EventArgs e)
  173. {
  174. //初始化
  175. Global.pat.card.SearchAdmCode = "";
  176. SearchAdmdvs();
  177. }
  178. }
  179. }