frmModalGroupList.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace FPER
  9. {
  10. public partial class frmModalGroupList : Form
  11. {
  12. public int ReceiverID = 0;
  13. public frmModalGroupList(int ID) // cyim 2015.7.30 데이타베이스 접속 루틴 변경
  14. {
  15. InitializeComponent();
  16. ReceiverID = ID;
  17. }
  18. private SearchCodeVo searchCode;
  19. public SearchCodeVo SearchCode { get { return this.searchCode; } set { this.searchCode = value; } }
  20. private void frmModalGroupList_Load(object sender, EventArgs e)
  21. {
  22. try
  23. {
  24. dataGridView1.Rows.Clear();
  25. if (searchCode.CodeType != null)
  26. {
  27. if (searchCode.CodeType.Length < 1) searchCode.CodeType = null;
  28. }
  29. if (searchCode.CodeName != null)
  30. {
  31. if (searchCode.CodeName.Length < 1) searchCode.CodeName = null;
  32. }
  33. txtSearchKey.Text = searchCode.CodeName;
  34. get_Data(searchCode.CodeType, null);
  35. }
  36. catch (Exception ex)
  37. {
  38. Util.UErrorMessage(ex, 0, 0);
  39. }
  40. }
  41. private void btnOK_Click(object sender, EventArgs e)
  42. {
  43. try
  44. {
  45. String searchKey = txtSearchKey.Text;
  46. //if (searchKey.Length < 1)
  47. //{
  48. // MessageBox.Show("먼저 검색할 단어를 입력하세요.", Application.ProductName);
  49. // return;
  50. //}
  51. if (searchKey.Equals("")) searchKey = null;
  52. get_Data(searchCode.CodeType, searchKey);
  53. }
  54. catch (Exception ex)
  55. {
  56. Util.UErrorMessage(ex, 0, 0);
  57. }
  58. }
  59. private void get_Data(String CodeType, String SearchKey)
  60. {
  61. dataGridView1.Rows.Clear();
  62. try
  63. {
  64. if (searchCode != null)
  65. {
  66. DacMap dacMap = new DacMap(ReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
  67. DataTable dtable = dacMap.Group_Modal_Select(CodeType, SearchKey);
  68. if (dtable.Rows.Count > 0)
  69. {
  70. foreach (DataRow dr in dtable.Rows)
  71. {
  72. dataGridView1.Rows.Add(dr["GROUP_TYPE"].ToString(), dr["GROUP_ID"].ToString(), dr["GROUP_NAME"].ToString());
  73. }
  74. }
  75. }
  76. }
  77. catch (Exception ex)
  78. {
  79. Util.UErrorMessage(ex, 0, 0);
  80. }
  81. }
  82. private void btnCancel_Click(object sender, EventArgs e)
  83. {
  84. try
  85. {
  86. this.Close();
  87. }
  88. catch (Exception ex)
  89. {
  90. Util.UErrorMessage(ex, 0, 0);
  91. }
  92. }
  93. private void btnSaveOK_Click(object sender, EventArgs e)
  94. {
  95. try
  96. {
  97. if (dataGridView1.SelectedRows.Count > 0)
  98. {
  99. DataGridViewRow row = dataGridView1.SelectedRows[0];
  100. string CodeValue = row.Cells[1].Value.ToString();
  101. string CodeName = row.Cells[2].Value.ToString();
  102. this.searchCode.Code = CodeValue;
  103. this.searchCode.CodeName = CodeName;
  104. this.searchCode.SearchOK = true;
  105. this.Close();
  106. }
  107. else
  108. {
  109. MessageBox.Show("선택된 코드가 없습니다.", Application.ProductName);
  110. return;
  111. }
  112. }
  113. catch (Exception ex)
  114. {
  115. Util.UErrorMessage(ex, 0, 0);
  116. }
  117. }
  118. }
  119. }