123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Text;
- using System.Windows.Forms;
- namespace FPER
- {
- public partial class frmModalGroupList : Form
- {
- public int ReceiverID = 0;
- public frmModalGroupList(int ID) // cyim 2015.7.30 데이타베이스 접속 루틴 변경
- {
- InitializeComponent();
- ReceiverID = ID;
- }
- private SearchCodeVo searchCode;
- public SearchCodeVo SearchCode { get { return this.searchCode; } set { this.searchCode = value; } }
- private void frmModalGroupList_Load(object sender, EventArgs e)
- {
- try
- {
- dataGridView1.Rows.Clear();
- if (searchCode.CodeType != null)
- {
- if (searchCode.CodeType.Length < 1) searchCode.CodeType = null;
- }
- if (searchCode.CodeName != null)
- {
- if (searchCode.CodeName.Length < 1) searchCode.CodeName = null;
- }
- txtSearchKey.Text = searchCode.CodeName;
- get_Data(searchCode.CodeType, null);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnOK_Click(object sender, EventArgs e)
- {
- try
- {
- String searchKey = txtSearchKey.Text;
- //if (searchKey.Length < 1)
- //{
- // MessageBox.Show("먼저 검색할 단어를 입력하세요.", Application.ProductName);
- // return;
- //}
- if (searchKey.Equals("")) searchKey = null;
- get_Data(searchCode.CodeType, searchKey);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void get_Data(String CodeType, String SearchKey)
- {
- dataGridView1.Rows.Clear();
- try
- {
- if (searchCode != null)
- {
- DacMap dacMap = new DacMap(ReceiverID);// cyim 2015.7.30 데이타베이스 접속 루틴 변경
- DataTable dtable = dacMap.Group_Modal_Select(CodeType, SearchKey);
- if (dtable.Rows.Count > 0)
- {
- foreach (DataRow dr in dtable.Rows)
- {
- dataGridView1.Rows.Add(dr["GROUP_TYPE"].ToString(), dr["GROUP_ID"].ToString(), dr["GROUP_NAME"].ToString());
- }
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnCancel_Click(object sender, EventArgs e)
- {
- try
- {
- this.Close();
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- private void btnSaveOK_Click(object sender, EventArgs e)
- {
- try
- {
- if (dataGridView1.SelectedRows.Count > 0)
- {
- DataGridViewRow row = dataGridView1.SelectedRows[0];
- string CodeValue = row.Cells[1].Value.ToString();
- string CodeName = row.Cells[2].Value.ToString();
- this.searchCode.Code = CodeValue;
- this.searchCode.CodeName = CodeName;
- this.searchCode.SearchOK = true;
- this.Close();
- }
- else
- {
- MessageBox.Show("선택된 코드가 없습니다.", Application.ProductName);
- return;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- }
- }
|