ChooseCard.cs 5.9 KB

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