ConsentSelectTabPageUnfinished.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518
  1. #region Copyright © 2015 CLIPSOFT Co.,Ltd. All Rights Reserved.
  2. //
  3. // All rights are reserved. Reproduction or transmission in whole or in part,
  4. // in any form or by any means, electronic, mechanical or otherwise, is
  5. // prohibited without the prior written consent of the copyright owner.
  6. //
  7. // Filename:ConsentSelectTabPageAll.cs
  8. //
  9. #endregion
  10. using System;
  11. using System.ComponentModel;
  12. using System.Windows.Forms;
  13. using System.Configuration;
  14. using CLIP.eForm.Consent.UI.ConsentSvcRef;
  15. namespace CLIP.eForm.Consent.UI {
  16. /// <summary>
  17. /// 동의서 미작성 탭 클래스
  18. /// </summary>
  19. /// <remarks>
  20. /// <p>[설계자]</p>
  21. /// <p> 클립소프트 연구소 홍지철 (jchong@clipsoft.co.kr)</p>
  22. /// <p>[원본 작성자]</p>
  23. /// <p> 클립소프트 기술부 4팀 이창훈 (chlee@clipsoft.co.kr)</p>
  24. /// <p>[수정 작성자]</p>
  25. /// <p> 클립소프트 기술부 이인희</p>
  26. /// <p>----------------------------------------------------------------------------------------</p>
  27. /// <p>[HISTORY]</p>
  28. /// <p> 2016-07-01 : 최초작성</p>
  29. /// <p>----------------------------------------------------------------------------------------</p>
  30. /// </remarks>
  31. public partial class ConsentSelectTabPageUnfinished : UserControl {
  32. private ConsentSvcRef.ConsentSvcSoapClient consentWebService = null;
  33. private IConsentMain consentMain = null;
  34. private ConsentCommandCtrl commandControl = null;
  35. public ConsentSelectTabPageUnfinished() {
  36. InitializeComponent();
  37. }
  38. private void ConsentSelectTabPageUnfinished_Load(object sender, EventArgs e) {
  39. if(this.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime) {
  40. return;
  41. }
  42. consentMain = ConsentMainControl.GetConsentMainInterface(this);
  43. commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  44. consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  45. InitDataGrid();
  46. }
  47. public void SelectAllUnfinishedConsents(int consentMstRid) {
  48. InitDataGrid();
  49. BindDataGridRows(consentMstRid);
  50. }
  51. /// <summary>
  52. /// 그리드 초기화
  53. /// </summary>
  54. private void InitDataGrid() {
  55. this.dataGridViewConsentSelectResult.DataSource = null;
  56. this.dataGridViewConsentSelectResult.Columns.Clear();
  57. if(rdoUser.Checked) {
  58. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "등록번호", "PatientCode", true, 60, DataGridViewContentAlignment.MiddleCenter);
  59. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "성명", "PatientName", true, 60, DataGridViewContentAlignment.MiddleCenter);
  60. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료형태", "VisitTypeName", true, 40, DataGridViewContentAlignment.MiddleCenter);
  61. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료/\n입원일", "ClnDate", true, 80, DataGridViewContentAlignment.MiddleCenter);
  62. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "ConsentName", true, 180);
  63. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "ConsentStateDisp", true, 60, DataGridViewContentAlignment.MiddleCenter);
  64. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "CreateUserName", true, 70, DataGridViewContentAlignment.MiddleCenter);
  65. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "CreateDateTime", true, 120, DataGridViewContentAlignment.MiddleCenter);
  66. }
  67. else {
  68. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서명", "ConsentName", true, 180);
  69. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태", "ConsentStateDisp", true, 60, DataGridViewContentAlignment.MiddleCenter);
  70. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자", "CreateUserName", true, 70, DataGridViewContentAlignment.MiddleCenter);
  71. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성일시", "CreateDateTime", true, 120, DataGridViewContentAlignment.MiddleCenter);
  72. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "등록번호", "PatientCode", false);
  73. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "성명", "PatientName", false);
  74. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료형태", "VisitTypeName", false);
  75. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료/\n입원일", "ClnDate", false);
  76. }
  77. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "기관코드", "HosType", false);
  78. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "생성번호", "Cretno", false);
  79. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료형태코드", "VisitType", false);
  80. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과코드", "ClnDeptCd", false);
  81. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료과", "ClnDeptNm", false);
  82. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "진료의", "Doctor", false);
  83. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병동", "Ward", false);
  84. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "병실", "RoomCd", false);
  85. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방번호", "OrderNo", false);
  86. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방코드", "OrderCd", false);
  87. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "처방", "OrderNm", false);
  88. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술진단명", "OpDiagName", false);
  89. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술명", "OpName", false);
  90. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "수술예약번호", "OpRsrvNo", false);
  91. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서고유ID", "FormGuid", false);
  92. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서ID", "FormRid", false);
  93. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서코드", "FormCd", false);
  94. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "동의서생성ID", "ConsentMstRid", false);
  95. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "상태코드", "ConsentState", false);
  96. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCR태그", "OcrNumber", false);
  97. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자ID", "CreateUserId", false);
  98. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "코사인의사ID", "CosignDcId", false);
  99. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "코사인의사", "CosignDcName", false);
  100. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력매수", "PrntCnt", false);
  101. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "OCR생성여부", "OcrTagYN", false);
  102. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력제목", "FormPrintName", false);
  103. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "작성자변경여부", "UserDrFlag", false);
  104. CommonUtil.AddNewColumnToDataGridView(this.dataGridViewConsentSelectResult, "출력전용", "PrntOnly", false);
  105. }
  106. /// <summary>
  107. /// 미작성, 임시저장 동의서 조회
  108. /// </summary>
  109. /// <param name="consentMstRid">The consent MST rid.</param>
  110. public void BindDataGridRows(int consentMstRid) {
  111. if(this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  112. if(this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  113. if(this.consentWebService == null) this.consentWebService = WebMethodCommon.GetConsentWebService(consentMain.PluginExecuteInfo["consentSvcUrl"]);
  114. try {
  115. string patientCode = string.Empty;
  116. if(commandControl.CurrentTargetPatient != null && !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode)) {
  117. patientCode = commandControl.CurrentTargetPatient.PatientCode;
  118. }
  119. string userId = string.Empty;
  120. if(rdoUser.Checked) {
  121. userId = consentMain.ConsentExecuteInfo["loginUserNo"];
  122. }
  123. if(!patientCode.Equals(string.Empty) || !userId.Equals(string.Empty)) {
  124. string sDate = consentMain.PluginExecuteInfo["ConsentSearchStartDate"].Replace("-", "");
  125. string eDate = DateTime.Now.ToShortDateString().Replace("-", "");
  126. // 검색할 조건을 미작성, 임시저장, 출력
  127. string consentState = "'UNFINISHED','TEMP','PAPER_OUT'";
  128. // 동의서 조회
  129. // TODO
  130. //ConsentFormListVO[] resultData = consentWebService.GetConsentList(patientCode
  131. // , sDate
  132. // , eDate
  133. // , consentState
  134. // , string.Empty
  135. // , consentMain.ConsentExecuteInfo["dutinstcd"]
  136. // , userId);
  137. /*if (resultData == null) */
  138. {
  139. return;
  140. }
  141. // 진료일 표시 형식 변경
  142. //foreach(ConsentVO v in resultData) {
  143. // if (v.ClnDate.Length == 8) {
  144. // v.ClnDate = v.ClnDate.Substring(0, 4) + "-" + v.ClnDate.Substring(4, 2) + "-" + v.ClnDate.Substring(6, 2);
  145. // }
  146. //}
  147. //this.dataGridViewConsentSelectResult.DataSource = new SortableBindingList<ConsentVO>(resultData);
  148. // 목록 조회 시 자동 선택 기능 제외
  149. consentMain.ClearPreviewConsent(true);
  150. /*
  151. //초기 전달받은 startFormCd 값이 있는 경우, 폼을 보여준다.
  152. if (!string.IsNullOrEmpty(consentMain.ConsentExecuteInfo["startFormCd"])) {
  153. for (int i = 0; i < resultData.Length; i++) {
  154. if (((ConsentVO)resultData[i]).FormCd == consentMain.ConsentExecuteInfo["startFormCd"].ToString()) {
  155. ConsentVO vo = GetCurrentConsentVO(i);
  156. if (vo != null) {
  157. ExecutePreviewWithSelectedConsent(vo);
  158. RunConsentDualView();
  159. }
  160. break;
  161. }
  162. }
  163. }
  164. // 조회할 MST_RID 가 있을 경우
  165. else if (consentMstRid > 0) {
  166. for (int i = 0; i < resultData.Length; i++) {
  167. if (((ConsentVO)resultData[i]).ConsentMstRid == consentMstRid) {
  168. ConsentVO vo = GetCurrentConsentVO(i);
  169. if (vo != null) {
  170. ExecutePreviewWithSelectedConsent(vo);
  171. RunConsentDualView();
  172. }
  173. break;
  174. }
  175. }
  176. }
  177. // 조회할 MST_RID 가 없을 경우 0번째 동의서를 미리보기 한다
  178. else {
  179. ConsentVO vo = GetCurrentConsentVO(0);
  180. if (vo != null) {
  181. ExecutePreviewWithSelectedConsent(vo);
  182. }
  183. }
  184. */
  185. }
  186. }
  187. catch(Exception ex) {
  188. throw ex;
  189. }
  190. }
  191. #region 동의서 미리보기
  192. //선택된 Row의 ConsentVO 객체를 반환한다.
  193. private ConsentVO GetCurrentConsentVO(int rowIndex) {
  194. ConsentVO vo = null;
  195. if(rowIndex < 0) {
  196. return vo;
  197. }
  198. if(dataGridViewConsentSelectResult != null && dataGridViewConsentSelectResult.Rows.Count > 0) {
  199. this.dataGridViewConsentSelectResult.Rows[rowIndex].Selected = true;
  200. //this.dataGridViewConsentSelectResult.CurrentCell = this.dataGridViewConsentSelectResult.Rows[rowIndex].Cells[0];
  201. vo = this.dataGridViewConsentSelectResult.Rows[rowIndex].DataBoundItem as ConsentVO;
  202. }
  203. return vo;
  204. }
  205. /// <summary>
  206. /// 선택된 ConsentVO 객체를 미리보기 실행한다.
  207. /// </summary>
  208. /// <param name="vo">The vo.</param>
  209. private void ExecutePreviewWithSelectedConsent(ConsentVO vo) {
  210. if(consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  211. if(commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  212. Cursor currentCursor = this.Cursor;
  213. this.Cursor = Cursors.WaitCursor;
  214. if(rdoUser.Checked) {
  215. consentMain.ConsentExecuteInfo["patientNo"] = vo.PatientCode;
  216. consentMain.ConsentExecuteInfo["clnDate"] = vo.clnDate.Replace("-", "");
  217. consentMain.ConsentExecuteInfo["visitType"] = vo.VisitType;
  218. consentMain.ConsentExecuteInfo["clnDept"] = vo.ClnDeptCd;
  219. consentMain.ConsentExecuteInfo["cretno"] = vo.cretNo.ToString();
  220. consentMain.ConsentExecuteInfo["opRsrvNo"] = vo.OpRsrvNo;
  221. consentMain.SetPatientInfo();
  222. }
  223. commandControl.CurrentPreviewConsent = new PreviewConsent {
  224. formRid = vo.FormRid.ToString(),
  225. formGuid = vo.FormGuid,
  226. formCd = vo.FormCd.ToString(),
  227. FormName = vo.ConsentName,
  228. formPrintName = vo.FormPrintName,
  229. prntCnt = vo.printCnt,
  230. consentMstRid = vo.consentMstRid.ToString(),
  231. consentStateEngnm = vo.consentState,
  232. orderNo = vo.OrderNo,
  233. ocrCode = vo.OcrNumber,
  234. inputId = vo.CreateUserId,
  235. inputNm = vo.CreateUserName,
  236. ReissueConsentMstRid = 0,
  237. RewriteConsentMstRid = 0,
  238. ordType = vo.VisitType,
  239. ocrtagPrntyn = vo.OcrTagYN,
  240. userDrFlag = vo.UserDrFlag,
  241. printOnly = vo.PrntOnly,
  242. opDiagName = vo.OpDiagName,
  243. //drOnly = vo.DrOnly,
  244. opName = vo.OpName
  245. };
  246. consentMain.PatientInfoCtrl.SetConsentDocumentName(vo.ConsentName);
  247. switch(vo.consentState.ToUpper()) {
  248. // 임시저장
  249. case "TEMP":
  250. commandControl.ShowTempSaveConsent(consentMain);
  251. break;
  252. // 출력, 미작성
  253. case "PAPER_OUT":
  254. case "UNFINISHED":
  255. //CheckClnDateInfo(vo);
  256. commandControl.PreviewConsent(consentMain);
  257. break;
  258. default:
  259. break;
  260. }
  261. //if (vo.ConsentState.ToUpper().Equals("TEMP")) {
  262. // commandControl.ShowTempSaveConsent(consentMain);
  263. //} else if (vo.ConsentState.ToUpper().Equals("PAPER_OUT")) {
  264. // CheckClnDateInfo(vo);
  265. // commandControl.PreviewConsent(consentMain);
  266. //} else if (vo.ConsentState.ToUpper().Equals("UNFINISHED")) {
  267. // CheckClnDateInfo(vo);
  268. // commandControl.PreviewConsent(consentMain);
  269. //}
  270. if (commandControl.CurrentTargetPatient.VisitType.Equals("O"))
  271. {
  272. commandControl.setCompleteSaveButton(true);
  273. }
  274. else
  275. {
  276. if (ConsentMainControl.SETTING_DATA["ELECTR_CMP"].Equals("Y") && commandControl.CurrentEndUser.JobKindCd.Substring(0, 2).Equals("03"))
  277. {
  278. commandControl.setCompleteSaveButton(true);
  279. }
  280. else
  281. {
  282. commandControl.setCompleteSaveButton(false);
  283. }
  284. }
  285. this.Cursor = currentCursor;
  286. }
  287. /// <summary>
  288. /// 동의서의 처방일자와 생성번호 등의 정보가 현재 정보와 일치하지 않은 경우
  289. /// 미리보기를 위해서 데이터를 재조회한다.
  290. /// </summary>
  291. /// <param name="vo">조회할 ConsentVO 인스턴스</param>
  292. private void CheckClnDateInfo(ConsentVO vo) {
  293. if(consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  294. if(commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  295. if(commandControl.CurrentTargetPatient == null) return;
  296. bool bSame = true;
  297. if(!string.IsNullOrEmpty(vo.clnDate) && !vo.clnDate.Replace("-", "").Equals(commandControl.CurrentTargetPatient.clnDate.Replace("-", "")))
  298. bSame = false;
  299. if(!vo.cretNo.ToString().Equals(commandControl.CurrentTargetPatient.cretno))
  300. bSame = false;
  301. if(!string.IsNullOrEmpty(vo.ClnDeptCd) && !vo.ClnDeptCd.Equals(commandControl.CurrentTargetPatient.clnDeptCode))
  302. bSame = false;
  303. if(!string.IsNullOrEmpty(vo.VisitType) && !vo.VisitType.Equals(commandControl.CurrentTargetPatient.VisitType))
  304. bSame = false;
  305. if(bSame == false) {
  306. //동의서 맵핑 정보를 상단의 선택된 진료일과 작성자 정보로 한다.
  307. consentMain.PatientInfoCtrl.SetPatientByConsentInfo(vo.clnDate.Replace("-", ""),
  308. vo.VisitType,
  309. vo.ClnDeptCd,
  310. vo.cretNo.ToString());
  311. }
  312. }
  313. #endregion
  314. #region 그리드 이벤트
  315. /// <summary>
  316. /// dataGridViewConsentSelectResult 그리드 컨트롤 셀 더블클릭 이벤트
  317. /// </summary>
  318. /// <param name="sender">The source of the event.</param>
  319. /// <param name="e">The <see cref="DataGridViewCellEventArgs"/> instance containing the event data.</param>
  320. private void dataGridViewConsentSelectResult_CellDoubleClick(object sender, DataGridViewCellEventArgs e) {
  321. if(commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  322. // dbs227, 셀 클릭 시 더블클릭 인식되어 작동되는 경우 오류
  323. if(e.RowIndex < 0) {
  324. return;
  325. }
  326. ConsentVO vo = GetCurrentConsentVO(e.RowIndex);
  327. // dbs227, 출력된 동의서는 미리보기를 하지 않는다
  328. if(vo.consentState.Equals("PAPER_OUT")) {
  329. MessageBox.Show(String.Format(Properties.Resources.msg_printed_consent),
  330. String.Format(Properties.Resources.title_printed_consent));
  331. return;
  332. }
  333. if(vo != null) {
  334. // 선택된 동의서가 현재 보여지고 있는 동의서와 다른 경우, 임시 저장 여부 확인
  335. if(!consentMain.ConsentExecuteInfo["readOnly"].Equals("Y") &&
  336. !string.IsNullOrEmpty(commandControl.CurrentTargetPatient.PatientCode) &&
  337. commandControl.CurrentPreviewConsent != null && !commandControl.CurrentPreviewConsent.formRid.Equals(vo.FormRid.ToString()) &&
  338. (commandControl.CurrentPreviewConsent.consentState == string.Empty || commandControl.CurrentPreviewConsent.consentState == "TEMP")) {
  339. // dbs227, 임시저장 팝업 사용 안함
  340. //DialogResult result = MessageBox.Show(string.Format(Properties.Resources.msg_confirm_tempsave)
  341. // , string.Format(Properties.Resources.msg_caption_confirm),
  342. // MessageBoxButtons.YesNo, MessageBoxIcon.Information);
  343. //if (result == DialogResult.Yes) {
  344. // // 임시저장 실행
  345. // consentMain.TempSave();
  346. //}
  347. }
  348. consentMain.preParamClean();
  349. ExecutePreviewWithSelectedConsent(vo);
  350. RunConsentDualView();
  351. }
  352. }
  353. /// <summary>
  354. /// dataGridViewConsentSelectResult 그리드 컨트롤 마우스 우클릭 이벤트
  355. /// </summary>
  356. /// <param name="sender">The source of the event.</param>
  357. /// <param name="e">The <see cref="DataGridViewCellContextMenuStripNeededEventArgs"/> instance containing the event data.</param>
  358. private void dataGridViewConsentSelectResult_CellContextMenuStripNeeded(object sender, DataGridViewCellContextMenuStripNeededEventArgs e) {
  359. // read only 로 실행 한 경우 우클릭 이벤트를 실행하지 않는다
  360. if(consentMain.ConsentExecuteInfo["readOnly"].Equals("Y")) {
  361. return;
  362. }
  363. if(e.RowIndex >= 0 && this.dataGridViewConsentSelectResult.Rows[e.RowIndex].Selected == true) {
  364. ConsentVO vo = GetCurrentConsentVO(e.RowIndex);
  365. if(commandControl.CurrentPreviewConsent != null && commandControl.CurrentEndUser.UserNo.Equals(vo.CreateUserId)) {
  366. // 임시저장의 경우 삭제의 메뉴와 이벤트를 할당한다
  367. if(vo.consentState.Equals("TEMP") || vo.consentState.Equals("ELECTR_CMP")) {
  368. ContextMenuStrip strip = new ContextMenuStrip();
  369. ToolStripMenuItem deleteRecord = new ToolStripMenuItem();
  370. deleteRecord.Text = "삭제";
  371. strip.Items.Add(deleteRecord);
  372. deleteRecord.Click += new EventHandler(deleteRecord_Click);
  373. e.ContextMenuStrip = strip;
  374. }
  375. }
  376. }
  377. }
  378. private void RunConsentDualView() {
  379. if(this.consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  380. if(this.commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  381. commandControl.RunConsentDualView();
  382. }
  383. /// <summary>
  384. /// dataGridViewConsentSelectResult 그리드 컨트롤의 data binding 이 끝난 후 이벤트
  385. /// 미작성인 경우, 배경색과 글씨색을 RED 로 변경.
  386. /// </summary>
  387. /// <param name="sender">The source of the event.</param>
  388. /// <param name="e">The <see cref="DataGridViewBindingCompleteEventArgs"/> instance containing the event data.</param>
  389. private void dataGridViewConsentSelectResult_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e) {
  390. foreach(DataGridViewRow row in dataGridViewConsentSelectResult.Rows) {
  391. if(!string.IsNullOrEmpty(row.Cells["consentStateEngnm"].Value.ToString())) {
  392. if(row.Cells["consentStateEngnm"].Value.ToString().ToUpper() == "UNFINISHED") {
  393. row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
  394. }
  395. }
  396. }
  397. }
  398. /// <summary>
  399. /// 동의서 삭제
  400. /// </summary>
  401. /// <param name="sender">The source of the event.</param>
  402. /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
  403. private void deleteRecord_Click(object sender, EventArgs e) {
  404. if(consentMain == null) consentMain = ConsentMainControl.GetConsentMainInterface(this);
  405. if(commandControl == null) commandControl = consentMain.ConsentCommandCtrl as ConsentCommandCtrl;
  406. bool bDel = true;
  407. ReasonForUseN reasonForUseN = new ReasonForUseN(bDel);
  408. if(reasonForUseN.ShowDialog() == DialogResult.OK) {
  409. string reason = reasonForUseN.GetReasonForUseN();
  410. reasonForUseN.Close();
  411. if(this.dataGridViewConsentSelectResult.SelectedRows.Count != 0) {
  412. Cursor currentCursor = this.Cursor;
  413. try {
  414. this.Cursor = Cursors.WaitCursor;
  415. ConsentVO vo = GetCurrentConsentVO(this.dataGridViewConsentSelectResult.SelectedRows[0].Index);
  416. commandControl.CurrentPreviewConsent.ReissueConsentMstRid = vo.consentMstRid;
  417. //consentMain.ConsentCommandCtrl.DeleteRecordOfDeleteConsent(reason);
  418. consentMain.ConsentListCtrl.InquiryConsentData(-1);
  419. }
  420. catch(Exception ex) {
  421. throw ex;
  422. }
  423. finally {
  424. this.Cursor = currentCursor;
  425. }
  426. MessageBox.Show(string.Format(Properties.Resources.msg_consent_record_deleted)
  427. , string.Format(Properties.Resources.msg_caption_confirm), MessageBoxButtons.OK, MessageBoxIcon.Information);
  428. }
  429. }
  430. }
  431. #endregion
  432. private void btnSearch_Click(object sender, EventArgs e) {
  433. btnSearch.Enabled = false;
  434. Application.DoEvents();
  435. InitDataGrid();
  436. BindDataGridRows(0);
  437. btnSearch.Enabled = true;
  438. }
  439. }
  440. }