ChooseCard.cs 5.6 KB

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