ConsentSelectTabDailySearch.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596
  1. using System;
  2. using System.ComponentModel;
  3. using System.Windows.Forms;
  4. using CLIP.eForm.Consent.UI.ConsentSvcRef;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.Drawing;
  8. namespace CLIP.eForm.Consent.UI.ConsentListTabElements {
  9. public partial class ConsentSelectTabDailySearch : UserControl {
  10. private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
  11. private HospitalSvcRef.HospitalSvcSoapClient hospitalWebService = null;
  12. private IConsentMain consentMain = null;
  13. private ConsentCommandCtrl commandControl = null;
  14. public ConsentSelectTabDailySearch() {
  15. InitializeComponent();
  16. }
  17. /// <summary>
  18. /// 페이지 로딩 시 필요한 commandControl 및 웹 서비스 연결
  19. /// </summary>
  20. /// <param name="sender"></param>
  21. /// <param name="e"></param>
  22. private void ConsentSelectTabDailySearch_Load(object sender, EventArgs e) {
  23. if (this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
  24. return;
  25. }
  26. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  27. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  28. consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  29. hospitalWebService = WebMethodCommon.GetHospitalWebService(consentMain.PluginExecuteInfo["hospitalSvcUrl"]);
  30. InitDataGrid();
  31. this.fromdd.Value = DateTime.Now.AddMonths(-6);
  32. }
  33. /// <summary>
  34. /// 데이터그리드 초기화
  35. /// </summary>
  36. private void InitDataGrid() {
  37. // 초기 설정 추가
  38. this.gridConsentList.AllowUserToAddRows = false;
  39. //this.gridConsentList.CellPainting += new DataGridViewCellPaintingEventHandler(this.dataGridViewPatientSelectResult_CellPainting);
  40. this.gridConsentList.CellDoubleClick += new DataGridViewCellEventHandler(gridConsentList_CellDoubleClick);
  41. // 체크박스 컬럼을 추가
  42. CommonUtil.AddNewCheckBoxColumnToDataGridView(this.gridConsentList, "□", "colCheck", true, 25, DataGridViewContentAlignment.MiddleCenter);
  43. // 사용자에게 표시할 컬럼
  44. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "등록번호", "pid", true, 80);
  45. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "성명", "patientName", true, 80);
  46. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "OCRTAG", "ocrTag", true, 100, DataGridViewContentAlignment.MiddleCenter);
  47. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "동의서명", "formName", true, 180, DataGridViewContentAlignment.MiddleCenter);
  48. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "상태", "consentState", true, 60, DataGridViewContentAlignment.MiddleCenter);
  49. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "작성자", "modifyUserNm", true, 70, DataGridViewContentAlignment.MiddleCenter);
  50. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "작성일시", "modifyDatetime", true, 120, DataGridViewContentAlignment.MiddleCenter);
  51. // 사용자에게 표시하지 않을 컬럼
  52. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "인덱스", "idx", false);
  53. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "서식번호", "formId", false);
  54. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "서식코드", "formCode", false);
  55. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "서식출력명", "formPrntNm", false);
  56. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "출력매수", "printCnt", false);
  57. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "마스터RID", "consentMstRid", false);
  58. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "작성자 ID", "modifyUserId", false);
  59. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "부서 약어", "deptEngName", false);
  60. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "certPass", "certPass", false);
  61. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "createDatetime", "createDatetime", false);
  62. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "clnDate", "clnDate", false);
  63. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "cretNo", "cretNo", false);
  64. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "ordType", "ordType", false);
  65. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "deptCd", "deptCd", false);
  66. CommonUtil.AddNewColumnToDataGridView(this.gridConsentList, "mainDrId", "mainDrId", false);
  67. // 해당 컬럼 활성화 여부 제어
  68. //gridConsentList.Columns["idx"].Visible = false;
  69. //gridConsentList.Columns["formId"].Visible = false;
  70. //gridConsentList.Columns["formCode"].Visible = false;
  71. //gridConsentList.Columns["formPrntNm"].Visible = false;
  72. //gridConsentList.Columns["printCnt"].Visible = false;
  73. //gridConsentList.Columns["consentMstRid"].Visible = false;
  74. //gridConsentList.Columns["modifyUserId"].Visible = false;
  75. //gridConsentList.Columns["deptEngName"].Visible = false;
  76. }
  77. /// <summary>
  78. /// 동의서 리스트 체크 박스 이벤트
  79. /// </summary>
  80. /// <param name="sender"></param>
  81. /// <param name="e"></param>
  82. private void dataGridViewPatientSelectResult_CellPainting(object sender, DataGridViewCellPaintingEventArgs e) {
  83. //Image InfoIcon;
  84. //if (e.ColumnIndex == 0 && e.RowIndex == -1) {
  85. // // 체크박스 상태에 따른 아이콘 표시
  86. // if (gridConsentList.Columns[0].HeaderText.Equals("□")) {
  87. // //InfoIcon = Image.FromFile(@"../../Resources/uncheck.png");
  88. // InfoIcon = Properties.Resources.uncheck;
  89. // } else {
  90. // //InfoIcon = Image.FromFile(@"../../Resources/check.png");
  91. // InfoIcon = Properties.Resources.check;
  92. // }
  93. // e.Paint(e.CellBounds, DataGridViewPaintParts.All);
  94. // e.Graphics.DrawImage(InfoIcon, e.CellBounds);
  95. // e.Handled = true;
  96. //}
  97. }
  98. /// <summary>
  99. /// 동의서 선택 시 확인저장 된 동의서의 미리보기를 수행한다
  100. /// </summary>
  101. /// <param name="sender"></param>
  102. /// <param name="e"></param>
  103. private void gridConsentList_CellDoubleClick(object sender, DataGridViewCellEventArgs e) {
  104. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  105. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  106. // dbs227, 셀 클릭 시 더블클릭 인식되어 작동되는 경우 오류
  107. if (e.RowIndex < 0) {
  108. return;
  109. }
  110. ConsentVO vo = GetCurrentConsentSearchVO(e.RowIndex);
  111. if (vo != null) {
  112. // startFormCd 를 초기화 한다
  113. consentMain.preParamClean();
  114. // 동의서 미리보기
  115. ExecutePreviewWithSelectedConsent(vo);
  116. this.commandControl.setCompleteSaveTempButton(false);
  117. string otps = "";
  118. if (vo.consentState.Equals("임시") || vo.consentState.Equals("확인")) {
  119. otps += "FILE_SAVE=true";
  120. if (vo.consentState.Equals("임시")) {
  121. otps += ";FILE_TEMP_SAVE=true;FILE_TEMP_SAVE2=true";
  122. } else {
  123. otps += ";FILE_TEMP_SAVE=false;FILE_TEMP_SAVE2=false";
  124. }
  125. } else if (vo.consentState.Equals("인증")) {
  126. otps += "FILE_SAVE=true;FILE_TEMP_SAVE=false;FILE_TEMP_SAVE2=false";
  127. } else {
  128. otps += "FILE_SAVE=true;FILE_TEMP_SAVE=false;FILE_TEMP_SAVE2=false";
  129. }
  130. consentMain.setDualViewerButtonOtps(otps);
  131. switch (vo.consentState) {
  132. case "임시": // 임시
  133. case "확인": // 확인
  134. // 듀얼뷰어 상태일 때 동의서 로드
  135. RunConsentDualView();
  136. break;
  137. }
  138. }
  139. }
  140. /// <summary>
  141. /// 동의서 뷰어에 동의서 로드
  142. /// </summary>
  143. private void RunConsentDualView() {
  144. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  145. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  146. commandControl.RunConsentDualView();
  147. }
  148. private void ExecutePreviewWithSelectedConsent(ConsentVO vo) {
  149. if (consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  150. if (commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  151. Cursor currentCursor = this.Cursor;
  152. this.Cursor = Cursors.WaitCursor;
  153. //consentMain.ConsentExecuteInfo["patientId"] = vo.PatientCode;
  154. //consentMain.ConsentExecuteInfo["patientOrdtype"] = vo.VisitType;
  155. //consentMain.ConsentExecuteInfo["patientClnDept"] = vo.ClnDate.Replace("-", "");
  156. //consentMain.ConsentExecuteInfo["patientClnDept"] = vo.ClnDeptCd;
  157. //consentMain.ConsentExecuteInfo["cretno"] = vo.Cretno.ToString();
  158. //consentMain.ConsentExecuteInfo["opRsrvNo"] = vo.OpRsrvNo;
  159. consentMain.SetPatientInfo();
  160. commandControl.CurrentPreviewConsent = new PreviewConsent {
  161. FormRid = vo.formId.ToString(),
  162. FormCd = vo.formCode.ToString(),
  163. FormName = vo.formName,
  164. FormPrintName = vo.formPrntNm,
  165. PrntCnt = vo.printCnt,
  166. ConsentMstRid = vo.consentMstRid.ToString(),
  167. ConsentState = vo.consentState,
  168. Ocrcode = vo.ocrTag,
  169. certPass = vo.certPass,
  170. InputId = commandControl.CurrentEndUser.userId,
  171. InputNm = commandControl.CurrentEndUser.userName,
  172. ReissueConsentMstRid = 0,
  173. RewriteConsentMstRid = 0,
  174. OpDiagName = commandControl.CurrentTargetPatient.OpDiagName,
  175. VisitType = commandControl.CurrentTargetPatient.ordtype,
  176. OpName = commandControl.CurrentTargetPatient.OpName
  177. };
  178. try {
  179. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.formName);
  180. bool isReissueDocument = false;
  181. // API 를 호출하여 해당 서식이 재인증저장이 필요한지 확인
  182. // TODO, do something
  183. switch (commandControl.CurrentPreviewConsent.ConsentState) {
  184. case "임시":
  185. commandControl.ShowTempSaveConsent(consentMain);
  186. break;
  187. case "인증":
  188. // TODO, 인증저장 재인증 호출
  189. if (isReissueDocument) {
  190. // 재인증이 필요할 경우 호출
  191. commandControl.ShowTempSaveConsent(consentMain);
  192. } else {
  193. // 재인증이 필요없을 경우 이미지 호출하는 함수
  194. commandControl.ShowCompleteConsent(consentMain);
  195. }
  196. break;
  197. case "확인":
  198. commandControl.ShowTempSaveConsent(consentMain);
  199. break;
  200. default:
  201. break;
  202. }
  203. //if (IsConsentStateTempSave(vo) || IsConsentStateElectronicComplete(vo)) { // 임시저장 or 작성완료
  204. // commandControl.ShowTempSaveConsent(consentMain);
  205. //} else if (IsConsentStatePrintOut(vo)) { // 출력
  206. // if (this.dataGridViewConsentSelectResult.SelectedRows.Count > 0 &&
  207. // this.dataGridViewConsentSelectResult.SelectedRows[0].Tag != null &&
  208. // this.dataGridViewConsentSelectResult.SelectedRows[0].Tag.Equals("reissueTarget")) {
  209. // // TODO 재출력 기능 사용하지 않음. 요구사항 확인 필요
  210. // //재출력 하는 경우
  211. // //commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.ConsentMstRid;
  212. // commandControl.CurrentPreviewConsent.RewriteConsentMstRid = 0;
  213. // //CheckClnDateInfo(vo);
  214. // commandControl.PreviewConsent(consentMain);
  215. // } else {
  216. // //CheckClnDateInfo(vo);
  217. // commandControl.PreviewConsent(consentMain);
  218. // }
  219. //} else if (IsConsentStateCertifyComplete(vo)) { // 인증저장
  220. // commandControl.ShowCompleteConsent(consentMain);//이미지 호출하는 함수
  221. //} else if (IsConsentStateUnfinished(vo)) { //미작성
  222. // //CheckClnDateInfo(vo);
  223. // commandControl.PreviewConsent(consentMain); // consent_data에 데이터가 없을때 사용하는 함수
  224. //}
  225. } catch (Exception e) {
  226. throw e;
  227. } finally {
  228. this.Cursor = currentCursor;
  229. }
  230. }
  231. private ConsentVO GetCurrentConsentSearchVO(int rowIndex) {
  232. ConsentVO vo = null;
  233. if (rowIndex < 0) {
  234. return vo;
  235. }
  236. vo = this.gridConsentList.Rows[rowIndex].DataBoundItem as ConsentVO;
  237. return vo;
  238. }
  239. /// <summary>
  240. /// 컬럼 헤더 선택 시 colcheck 의 경우 전체 선택/해제 기능 동작
  241. /// </summary>
  242. /// <param name="sender"></param>
  243. /// <param name="e"></param>
  244. private void gridConsentList_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e) {
  245. if (e.ColumnIndex == 0 && e.RowIndex == -1) {
  246. bool chkStatus = false;
  247. if (gridConsentList.Columns[0].HeaderText.Equals("□")) {
  248. gridConsentList.Columns[0].HeaderText = "☑";
  249. chkStatus = true;
  250. } else {
  251. gridConsentList.Columns[0].HeaderText = "□";
  252. }
  253. foreach (DataGridViewRow r in gridConsentList.Rows) {
  254. r.Cells["colCheck"].Value = chkStatus;
  255. }
  256. gridConsentList.RefreshEdit();
  257. }
  258. }
  259. /// <summary>
  260. /// 동의서 목록을 조회한다.
  261. /// </summary>
  262. public void BindDataGridRows() {
  263. Cursor currentCursor = this.Cursor;
  264. try {
  265. if (this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  266. if (this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  267. if (this.consentWebService == null) this.consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  268. // 조회조건을 가져온다.
  269. this.Cursor = Cursors.WaitCursor;
  270. var leftFromddStr = this.fromdd.Value.ToString("yyyyMMdd");
  271. var leftToddStr = this.todd.Value.ToString("yyyyMMdd");
  272. // 동의서 목록을 조회한다
  273. ConsentVO[] resultData = null;
  274. //resultData = consentWebService.GetConsentList(patientCode
  275. // , userId
  276. // , sDate
  277. // , eDate
  278. // , consentState
  279. // , consentMain.ConsentExecuteInfo["dutinstcd"]);
  280. if (resultData == null) {
  281. return;
  282. }
  283. // 조회 결과가 있다면 화면을 갱신한다.
  284. this.gridConsentList.DataSource = resultData;
  285. // 작성중인 동의서는 clear 한다.
  286. consentMain.ClearPreviewConsent(true);
  287. } catch (Exception e) {
  288. MessageBox.Show(this, e.Message);
  289. } finally {
  290. this.Cursor = currentCursor;
  291. }
  292. }
  293. /// <summary>
  294. /// 조회버튼 클릭 시 우측 조회조건을 가져온다
  295. /// </summary>
  296. /// <param name="sender"></param>
  297. /// <param name="e"></param>
  298. private void btnSearch_Click(object sender, EventArgs e) {
  299. // 0 - 환자검색
  300. // 1 - 응급
  301. // 2 - 수술
  302. // 3 - 입원
  303. // 4 - 외래
  304. // 5 - 검사
  305. var selectedIndex = consentMain.PatientListCtrl.getSelectedTabIndex();
  306. Hashtable queryString = consentMain.PatientListCtrl.getQueryString(selectedIndex);
  307. string startDt = this.fromdd.Value.ToString("yyyyMMdd"); // 날짜별의 fromDd
  308. string endDt = this.todd.Value.ToString("yyyyMMdd"); // 날짜별의 toDd
  309. string pid = (string) queryString["pid"];
  310. string srchDd = (string) queryString["srchDd"]; // 환조 조회 화면의 fromDd
  311. string doctorId = (string) queryString["doctorId"];
  312. string ordDeptCd = (string) queryString["ordDeptCd"];
  313. string patientState = (string) queryString["patientState"];
  314. string ordType = (string) queryString["ordType"];
  315. string userId = this.commandControl.CurrentEndUser.userId;
  316. string srchYN = (string) queryString["srchYN"];
  317. string consentState = "'TEMP', 'ELECTR_CMP'";
  318. string instCd = "101";
  319. string toDd = "";
  320. string mainDr = "";
  321. string mainDrChecked = "";
  322. string supportBaseCd = "";
  323. string supportDeptCd = "";
  324. string wardCd = "";
  325. string myPatient = "";
  326. string drKind = string.Empty;
  327. if (selectedIndex == 3) {
  328. wardCd = (string) queryString["wardCd"];
  329. myPatient = (string) queryString["myPatient"];
  330. drKind = (string) queryString["drKind"];
  331. } else if (selectedIndex == 5) { // 검사
  332. toDd = (string) queryString["toDd"];
  333. mainDr = (string) queryString["mainDr"];
  334. mainDrChecked = (string) queryString["mainDrChecked"];
  335. supportBaseCd = (string) queryString["supportBaseCd"];
  336. supportDeptCd = (string) queryString["supportDeptCd"];
  337. }
  338. ConsentVO[] result = consentWebService.GetConsentDateList(srchDd, pid, userId, startDt, endDt, consentState, instCd, doctorId, ordDeptCd, patientState,
  339. ordType, myPatient, wardCd, drKind, srchYN, toDd, mainDr, mainDrChecked, supportBaseCd, supportDeptCd);
  340. if (result == null) {
  341. return;
  342. }
  343. this.gridConsentList.DataSource = result;
  344. }
  345. private void gridConsentList_CellContentClick(object sender, DataGridViewCellEventArgs e) {
  346. if(e.ColumnIndex == 0) {
  347. bool chkStatus = false;
  348. int i = 0;
  349. foreach (DataGridViewRow r in gridConsentList.Rows) {
  350. if(i++ == e.RowIndex) {
  351. chkStatus = (r.Cells["colCheck"].Value == null) ? false : (bool) r.Cells["colCheck"].Value;
  352. r.Cells["colCheck"].Value = !chkStatus;
  353. }
  354. }
  355. gridConsentList.RefreshEdit();
  356. }
  357. }
  358. private string ConsentImageSignature(string sCertTarget, string userId, string userName) {
  359. string resultValue = string.Empty;
  360. try {
  361. if (!string.IsNullOrEmpty(sCertTarget)) {
  362. // 공인인증 서명
  363. SignatureConfig sign = new SignatureConfig();
  364. string rtn = "";
  365. // 메모리에 본인 공인인증서가 아닐 경우
  366. string sSignIp = consentMain.PluginExecuteInfo["signatureServerUrl"];
  367. string sSignPort = consentMain.PluginExecuteInfo["signatureServerPort"];
  368. int iPort = 0;
  369. int.TryParse(sSignPort, out iPort);
  370. // 공인인증 서버 접속
  371. rtn = sign.SetSignServerInfo(sSignIp, iPort, userId);
  372. // 공인인증 서명
  373. resultValue = sign.SignatureExec(sCertTarget, rtn, userName, userId, this.consentMain.saveClickPoint);
  374. if (string.IsNullOrEmpty(resultValue) || resultValue == "-1") {
  375. // 공인인증 서명에 실패하였을 경우
  376. return "-50";
  377. }
  378. }
  379. } catch (Exception ex) {
  380. MessageBox.Show(string.Format(ex.Message)
  381. , string.Format(Properties.Resources.msg_caption_confirm),
  382. MessageBoxButtons.OK, MessageBoxIcon.Information);
  383. resultValue = "-99";
  384. }
  385. return resultValue;
  386. }
  387. private void checkUserSign() {
  388. SignatureConfig sign = new SignatureConfig();
  389. try {
  390. string saveResult = string.Empty;
  391. // 공인인증 처리용
  392. var sCertTarget = "autosave";
  393. // 공인인증 처리
  394. var sCertResult = ConsentImageSignature(sCertTarget, commandControl.CurrentEndUser.userId, commandControl.CurrentEndUser.userName);
  395. //sCertResult = "TEST";
  396. if (sCertResult == "-10") {
  397. // "로그인 사용자 정보를 통하여 공인인증서 정보가 정상적으로 조회되지 않았습니다."
  398. MessageBox.Show(Properties.Resources.msg_sign_user_info_fail
  399. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  400. MessageBoxButtons.OK, MessageBoxIcon.Error);
  401. saveResult = "-99";
  402. return;
  403. } else if (sCertResult == "-20") {
  404. // "공인인증 서버 접속에 실패하였을 하였습니다."
  405. MessageBox.Show(Properties.Resources.msg_sign_server_connection_fail
  406. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  407. MessageBoxButtons.OK, MessageBoxIcon.Error);
  408. saveResult = "-99";
  409. return;
  410. } else if (sCertResult == "-30") {
  411. // "공인인증 서버 접속에 실패하였을 하였습니다."
  412. MessageBox.Show(Properties.Resources.msg_sign_server_connection_fail
  413. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  414. MessageBoxButtons.OK, MessageBoxIcon.Error);
  415. saveResult = "-99";
  416. return;
  417. } else if (sCertResult == "-35") {
  418. // 공인인증 비밀번호 입력하지 않고 닫음
  419. saveResult = "-99";
  420. return;
  421. } else if (sCertResult == "-40") {
  422. // "공인인증서 비밀번호가 틀렸습니다.
  423. MessageBox.Show(Properties.Resources.msg_sign_password_fail
  424. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  425. MessageBoxButtons.OK, MessageBoxIcon.Error);
  426. saveResult = "-99";
  427. return;
  428. } else if (sCertResult == "-50") {
  429. // "공인인증서명 처리를 실패하였을 하였습니다."
  430. MessageBox.Show(Properties.Resources.msg_sign_exec_fail
  431. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  432. MessageBoxButtons.OK, MessageBoxIcon.Error);
  433. saveResult = "-99";
  434. return;
  435. } else if (sCertResult == "-99") {
  436. // "공인인증서명 처리를 실패하였을 하였습니다."
  437. MessageBox.Show(Properties.Resources.msg_sign_exec_fail
  438. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  439. MessageBoxButtons.OK, MessageBoxIcon.Error);
  440. saveResult = "-99";
  441. return;
  442. }
  443. } catch (Exception ex) {
  444. string exMessage = ex.Message;
  445. if (ex.InnerException != null) {
  446. exMessage += Environment.NewLine + ex.InnerException.Message;
  447. }
  448. MessageBox.Show(string.Format(exMessage)
  449. , string.Format("CLIP e-Form Consent-" + Properties.Resources.msg_caption_fail),
  450. MessageBoxButtons.OK, MessageBoxIcon.Error);
  451. return;
  452. }
  453. }
  454. private void btnAllCertifyEvent(object sender, EventArgs e) {
  455. string userId = commandControl.CurrentEndUser.userId;
  456. string userName = commandControl.CurrentEndUser.userName;
  457. string macAddress = Common.getMacAddress();
  458. string result = "";
  459. string saveAllFlag = string.Empty;
  460. SingleReturnData singleReturn = null;
  461. if(consentWebService != null) {
  462. singleReturn = consentWebService.getSaveAllFlag("101", userId);
  463. if(singleReturn != null) {
  464. saveAllFlag = singleReturn.responseData;
  465. }
  466. }
  467. if (string.IsNullOrEmpty(saveAllFlag) || !saveAllFlag.Equals("OK")) {
  468. MessageBox.Show("일괄인증을 사용할 수 없는 사용자 입니다. 전산정보부에 문의하세요.");
  469. return;
  470. }
  471. bool shouldPassCert = false;
  472. foreach (DataGridViewRow r in gridConsentList.Rows) {
  473. bool checkedStatus = (bool) (r.Cells["colCheck"].Value == null) ? false : (bool) r.Cells["colCheck"].Value;
  474. if (checkedStatus == true) {
  475. string consentState = (r.DataBoundItem as ConsentVO).consentState;
  476. string certPass = (r.DataBoundItem as ConsentVO).certPass;
  477. if (certPass.Equals("N")) {
  478. shouldPassCert = true;
  479. }
  480. if (consentState.Equals("확인")) {
  481. //arr.Add((r.DataBoundItem as ConsentVO));
  482. result += fastJSON.JSON.ToJSON(r.DataBoundItem as ConsentVO) + "|%%|";
  483. } else {
  484. MessageBox.Show("일괄인증은 확인저장 서식만 가능합니다. \n확인저장된 서식만 선택해주세요.");
  485. return;
  486. }
  487. }
  488. }
  489. if (shouldPassCert == true) {
  490. checkUserSign();
  491. }
  492. if(result.Length < 1) {
  493. MessageBox.Show("선택된 서식이 없습니다. 서식을 선택하여 주십시요.");
  494. return;
  495. }
  496. result = result.Substring(0, result.Length-4);
  497. consentWebService.SaveAutoCompleteAll(userId, userName, macAddress, result);
  498. btnSearch.PerformClick();
  499. }
  500. }
  501. }