private void main_page_FormClosing(object sender, FormClosingEventArgs e) { GF.doDebug(" ========== MAIN FORM IS NOW CLOSED !! ==========="); //clock.Dispose(); GF.closeChildren(this); GF.showLoading(this); //DB.logout(); GF.closeLoading(); }
private void last_btn_Click(object sender, EventArgs e) { GF.showLoading(); page_txt.Text = total_lbl.Text; int.TryParse(page_txt.Text, out GF.currentPage); GF.disableButton(last_btn); GF.disableButton(next_btn); if (page_txt.Text != "1") { GF.enableButton(first_btn); GF.enableButton(prev_btn); } onLastClick(EventArgs.Empty); }
public static void initPage(Form childPage, main_page mainPage) { GF.closeChildren(mainPage); GF.showLoading(mainPage); GF.doDebug("========== MAIN FORM :: " + childPage.Name + " =========="); GF.selected_id = 0; childPage.MdiParent = mainPage; if (childPage.Name.IndexOf("report_") != -1) { childPage.Dock = DockStyle.Fill; } else { childPage.Size = childPage.MdiParent.ClientSize; childPage.StartPosition = FormStartPosition.Manual; } childPage.WindowState = FormWindowState.Maximized; GF.addKeyUp(childPage); childPage.Load += (s, e) => { //((Form)s).Visible = true; }; childPage.LocationChanged += (s, e) => { if (childPage.Left != 0) { childPage.Left = -5; } if (childPage.Top != 0) { childPage.Top = 0; } }; if (!childPage.IsDisposed) { childPage.Show(); } GF.closeLoading(); }
private void DGV_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { e.Handled = true; GF.showLoading(this); string filename = DGV.SelectedRows[0].Cells["file_name"].Value.ToString(); using (viewer viewerPage = new viewer()) { viewerPage.Owner = this; viewerPage.filename = filename; GF.closeLoading(); viewerPage.Show(); } } }
public static void deleteTempAttachment(int owner_id, string owner_form) { GF.showLoading(); DataTable DT; String queryString = "SELECT FILE_NAME FROM ATTACHMENT WHERE OWNER_ID = " + owner_id.ToString() + " AND OWNER_FORM = " + owner_form; Dictionary <string, string> Params = new Dictionary <string, string>(); /*Params.Add("@owner_id", owner_id.ToString()); * Params.Add("@owner_form", owner_form);*/ using (DT = DB.getS(queryString, Params, "GET TEMP ATTACHMENT[OWNER_ID=" + owner_id.ToString() + " : OWNER_FORM=" + owner_form + "]", false)) { foreach (DataRow row in DT.Rows) { string fileName = row["file_name"].ToString(); //MessageBox.Show(fileName); if (FTP.delete(fileName, "ATTACHMENT")) { queryString = "DELETE FROM ATTACHMENT WHERE FILE_NAME LIKE '" + fileName + "'"; DB.beginTrans(); if (DB.set(queryString, "DELETE ATTACHMENT[" + fileName + "]")) { DB.close(); } else { MessageBox.Show("ERROR DELETE ATTACHMENT FROM DATABASE !!", "ERROR"); GF.closeLoading(); return; } } else { MessageBox.Show("CANNOT DELETE ATTACHMENT FILE via FTP !!", "ERROR"); GF.closeLoading(); return; } } GF.closeLoading(); return; } }
private void next_btn_Click(object sender, EventArgs e) { GF.showLoading(); page_txt.Text = (Convert.ToInt32(page_txt.Text) + 1).ToString(); int.TryParse(page_txt.Text, out GF.currentPage); if (page_txt.Text == total_lbl.Text) { GF.disableButton(last_btn); GF.disableButton(next_btn); } if (page_txt.Text != "1") { GF.enableButton(first_btn); GF.enableButton(prev_btn); } onNextClick(EventArgs.Empty); }
private void page_txt_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (page_txt.Text.Trim() == String.Empty) { page_txt.Text = "1"; } else { page_txt.Text = page_txt.Text.Trim(); } if (page_txt.Text.Trim() != "") { if (Convert.ToInt32(page_txt.Text) > Convert.ToInt32(total_lbl.Text) || Convert.ToInt32(page_txt.Text) == 0) { page_txt.Text = GF.currentPage.ToString(); return; } if (Convert.ToInt32(page_txt.Text) != GF.currentPage) { if (!int.TryParse(page_txt.Text, out GF.currentPage)) { MessageBox.Show("PAGE NUMBER MUST BE NUMBER ONLY !!"); page_txt.Select(); } else { GF.showLoading(); int.TryParse(page_txt.Text, out GF.currentPage); onPageNumberChanged(EventArgs.Empty); } } } } }
private void viewer_Load(object sender, EventArgs e) { GF.showLoading(this); if (hidePrint) { panel.Height += toolbar.Height; panel.Top = toolbar.Top; toolbar.Visible = false; } file = FTP.download(filename, folderName); double percentage = 0.00; if (file.Width > this.Width) { percentage = ((double)(Width) / (double)file.Width); } theWidth = file.Width; theHeight = file.Height; if (percentage != 0.00) { theWidth = (Int32)(theWidth * percentage) - 23; theHeight = (Int32)(theHeight * percentage); } else { theLeft = ((panel.Width - theWidth) / 2); } panel.AutoScrollMinSize = new Size(theWidth, theHeight); GF.closeLoading(); this.Focus(); }
private void print_preview_btn_Click(object sender, EventArgs e) { GF.showLoading(this); PRINT.initPrint(false, "ATTACHMENT", filename, this); }
private void card_print_FormClosing(object sender, FormClosingEventArgs e) { if (!print_card1_btn.Enabled && (!print_card2_btn.Enabled || !print_card2_btn.Visible) && (!attach_paper_btn.Enabled || !attach_paper_btn.Visible)) { GF.showLoading(this); if (!isReIssue) { switch (card_type) { case 0: case 1: // MEMBERCARD, MEMBERCARD LIMITED EDITION break; case 2: // GIFT_CERTIFICATE break; case 3: // GIFT_VOUCHER if (Owner.Name != "payment") { if ((VOUCHER.issue_e_voucher)Owner != null) { ((VOUCHER.issue_e_voucher)Owner).Close(); } } break; } } else { GF.showLoading(this); DB.beginTrans(); String queryString = ""; String tblName = ""; switch (card_type) { case 0: case 1: // MEMBERCARD queryString = "UPDATE MEMBERCARD SET ISSUE_DATE = CURRENT_TIMESTAMP, ISSUE_BY = " + GF.emp_id.ToString() + " WHERE MEMBERCARD_ID = " + GF.selected_id.ToString(); tblName = "MEMBERCARD"; break; case 2: // GIFT CERTIFICATE queryString = "UPDATE GIFT_CERTIFICATE SET ISSUE_DATE = CURRENT_TIMESTAMP, ISSUE_BY = " + GF.emp_id.ToString() + " WHERE GIFT_CERTIFICATE_ID = " + GF.selected_id.ToString(); tblName = "GIFT_CERTIFICATE"; break; case 3: // GIFT VOUCHER queryString = "UPDATE GIFT_VOUCHER SET ISSUE_DATETIME = CURRENT_TIMESTAMP, ISSUE_BY = " + GF.emp_id.ToString() + " WHERE GIFT_VOUCHER_ID = " + GF.selected_id.ToString(); tblName = "GIFT_VOUCHER"; break; } if (!DB.set(queryString, "UPDATE " + tblName + "[" + GF.selected_id.ToString() + "]")) { MessageBox.Show("ERROR UPDATE " + tblName + " !!", "ERROR"); GF.closeLoading(); } DB.close(); GF.closeLoading(); ((re_issue_card)((re_issue_card_approve)Owner).Owner).btn_dgv.search_btn.PerformClick(); ((re_issue_card_approve)Owner).Close(); } GF.closeLoading(); } //if (this.Owner.Name == "cashier") ((SPA_MANAGEMENT_SYSTEM.SHOP.cashier)this.Owner).new_bill_btn.PerformClick(); }
// DELEGATE PART :: END public void loadGridData() { GF.showLoading(this); this.btn_dgv.DGV.Visible = false; this.btn_dgv.DGV.Rows.Clear(); if (btn_dgv.DGV.Columns.Count == 0) { this.btn_dgv.DGV.Columns.Add("card_type_name", "CARD NAME"); this.btn_dgv.DGV.Columns.Add("owner_name", "OWNER NAME"); this.btn_dgv.DGV.Columns.Add("code", "CODE"); this.btn_dgv.DGV.Columns.Add("detail", "DETAIL"); this.btn_dgv.DGV.Columns.Add("issue_datetime", "ISSUED DATETIME"); this.btn_dgv.DGV.Columns.Add("status", "STATUS"); this.btn_dgv.DGV.Columns.Add("issue_by", "ISSUED BY"); this.btn_dgv.DGV.Columns.Add("card_type", "card_type"); this.btn_dgv.DGV.Columns.Add("card_id", "card_id"); this.btn_dgv.DGV.Columns["card_type"].Visible = false; this.btn_dgv.DGV.Columns["card_id"].Visible = false; this.btn_dgv.DGV.Columns["status"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; } // GET TOTAL PAGE Dictionary <string, string> Params = new Dictionary <string, string>(); String queryString = @" SELECT A.*, ISNULL(B.FULLNAME, 'S.A.') ISSUE_BY_NAME FROM ( (SELECT B.MEMBERCARD_TYPE_NAME CARD_TYPE_NAME, A.CARD_NO, Convert(NVARCHAR(MAX),A.PRICE) PRICE, A.ISSUE_DATE, CONVERT(NVARCHAR(MAX), A.ISSUE_DATE, 103) + ' ' + CONVERT(NVARCHAR(MAX), A.ISSUE_DATE, 108) ISSUE_DATETIME, A.ISSUE_BY, A.MEMBERCARD_TYPE_ID CARD_TYPE, A.MEMBERCARD_ID CARD_ID, C.CUSTOMER_NAME + '-' + C.TEL OWNER_NAME, NULL SPA_PROGRAM, A.IS_USE FROM MEMBERCARD A INNER JOIN MEMBERCARD_TYPE B ON A.MEMBERCARD_TYPE_ID = B.MEMBERCARD_TYPE_ID INNER JOIN CUSTOMER C ON A.CUSTOMER_ID = C.CUSTOMER_ID WHERE B.IS_USE = 1) UNION ALL (SELECT CASE A.SPA_PROGRAM_ID WHEN -1 THEN 'MONEY ' ELSE 'SPA MENU ' END + 'GIFT CERTIFICATE' CARD_TYPE_NAME, A.CARD_NO, Convert(NVARCHAR(MAX),A.PRICE) PRICE, A.ISSUE_DATE, CONVERT(NVARCHAR(MAX), A.ISSUE_DATE, 103) + ' ' + CONVERT(NVARCHAR(MAX), A.ISSUE_DATE, 108) ISSUE_DATETIME, A.ISSUE_BY, 50 CARD_TYPE, A.GIFT_CERTIFICATE_ID CARD_ID, B.CUSTOMER_NAME + '-' + B.TEL OWNER_NAME, C.PROGRAM_NAME SPA_PROGRAM, A.IS_USE FROM GIFT_CERTIFICATE A LEFT OUTER JOIN CUSTOMER B ON A.CUSTOMER_ID = B.CUSTOMER_ID LEFT OUTER JOIN SPA_PROGRAM C ON A.SPA_PROGRAM_ID = C.SPA_PROGRAM_ID ) UNION ALL (SELECT 'GIFT VOUCHER' CARD_TYPE_NAME, A.CARD_NO, '-' PRICE, A.ISSUE_DATETIME ISSUE_DATE, CONVERT(NVARCHAR(MAX), A.ISSUE_DATETIME, 103) + ' ' + CONVERT(NVARCHAR(MAX), A.ISSUE_DATETIME, 108) ISSUE_DATETIME, A.ISSUE_BY, 99 CARD_TYPE, A.GIFT_VOUCHER_ID, A.ISSUE_FOR OWNER_NAME, B.PROGRAM_NAME SPA_PROGRAM, A.IS_USE FROM GIFT_VOUCHER A INNER JOIN SPA_PROGRAM B ON A.SPA_PROGRAM_ID = B.SPA_PROGRAM_ID ) ) A LEFT OUTER JOIN EMPLOYEE B ON A.ISSUE_BY = B.EMP_ID WHERE 1=1"; if (((ComboItem)card_type.SelectedItem).Key != -1) { queryString += " AND A.CARD_TYPE = " + ((ComboItem)card_type.SelectedItem).Key.ToString(); //Params.Add("@card_type", ((ComboItem)card_type.SelectedItem).Key.ToString()); } if (!GF.emptyDate(issue_date.Text.Trim())) { queryString += " AND CONVERT(DATE, ISSUE_DATE) = CONVERT(DATE, '" + issue_date.Text + "', 103)"; //Params.Add("@issue_date", issue_date.Text); } GF.getTotalPage(btn_dgv, "SELECT COUNT(*) AS TOTAL FROM (" + queryString + ") AS TOTAL_ROW", Params); queryString = DB.insertRowNum("A.ISSUE_DATE DESC", queryString); GF.doDebug(">>>> " + queryString); DataTable myDT; using (myDT = DB.getS(queryString, Params, "GET ALL ISSUED CARDS")) { for (int rowNum = 0; rowNum < myDT.Rows.Count; rowNum++) { DataRow myRow = myDT.Rows[rowNum]; String detail = ""; if (myRow["SPA_PROGRAM"].ToString() != "") { detail = myRow["SPA_PROGRAM"].ToString(); } else { detail = GF.formatNumber(Convert.ToInt32(myRow["PRICE"].ToString())); } this.btn_dgv.DGV.Rows.Add( myRow["CARD_TYPE_NAME"].ToString(), myRow["OWNER_NAME"].ToString(), myRow["CARD_NO"].ToString(), detail, myRow["ISSUE_DATETIME"].ToString(), (myRow["IS_USE"].ToString() == "1" ? "ACTIVE": "INACTIVE"), myRow["ISSUE_BY_NAME"].ToString(), myRow["CARD_TYPE"].ToString(), myRow["CARD_ID"].ToString() ); btn_dgv.DGV.Rows[rowNum].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleLeft; if (myRow["IS_USE"].ToString() == "1") { btn_dgv.DGV.Rows[rowNum].Cells["status"].Style.ForeColor = Color.Green; } else { btn_dgv.DGV.Rows[rowNum].Cells["status"].Style.ForeColor = Color.Red; } this.btn_dgv.DGV.ClearSelection(); } } GF.updateRowNum(btn_dgv.DGV, true); this.btn_dgv.DGV.Refresh(); this.btn_dgv.DGV.Visible = true; GF.closeLoading(); }
public main_page() { InitializeComponent(); //File.WriteAllText(GF.path, String.Empty); GF.doDebug("===== MAIN FORM :: " + this.Name + " IS OPENED ====="); this.FormClosing += (s, e) => { GF.doDebug("===== MAIN FORM :: " + this.Name + " IS CLOSED ====="); }; GF.mainPage = this; GF.initLoading(); GF.showLoading(this); DB.initLocalVars(); switch (CultureInfo.CurrentCulture.Name) { case "th-TH": case "en-US": GF.dateSep = "/"; GF.thousandSep = ","; GF.decimalSep = "."; break; case "ru-RU": GF.dateSep = "."; GF.thousandSep = " "; GF.decimalSep = ","; break; } using (clock = new Timer()) { clock.Enabled = true; clock.Interval = 100; int count = 0; clock.Tick += (s, ee) => { count++; uint idleTime = 0; GF.LASTINPUTINFO lastInputInfo = new GF.LASTINPUTINFO(); lastInputInfo.cbSize = (uint)Marshal.SizeOf(lastInputInfo); lastInputInfo.dwTime = 0; uint envTicks = (uint)Environment.TickCount; if (GF.GetLastInputInfo(ref lastInputInfo)) { uint lastInputTick = lastInputInfo.dwTime; idleTime = envTicks - lastInputTick; } //GF.doDebug(">>>>>>>>>> " + idleTime.ToString()); if (Math.Floor(Convert.ToDouble(idleTime / 1000)) >= (10 * 60)) { logOutTopToolStripMenuItem.PerformClick(); } String language_txt = InputLanguage.CurrentInputLanguage.Culture.EnglishName; if (language_txt.ToUpper().IndexOf("ENGLISH") != -1) { language_txt = "ENGLISH"; } if (language_txt.ToUpper().IndexOf("THAI") != -1) { language_txt = "ไทย"; } if (language_txt.ToUpper().IndexOf("RUSSIAN") != -1) { language_txt = "РУССКИЙ"; } language.Text = language_txt; if (count % 10 == 0) { timenow.Text = GF.NOW(); count = 0; } GF.ClickButtonLabeledOK("Hotel lock system interface"); }; } if (!GF.is_logged_in) { this.Hide(); /*if (!DB.skipFileCheck) * { * using (progress progressPage = new progress()) * { * progressPage.Owner = this; * progressPage.ShowDialog(); * } * } * else * {*/ using (login loginPage = new login()) { loginPage.Owner = this; GF.closeLoading(); loginPage.ShowDialog(); } //} } }
protected override void OnKeyDown(KeyEventArgs e) { if (Text.Trim() != "") { if (e.KeyCode == Keys.Return) { if (!ModeList.Contains(Mode)) { MessageBox.Show("THE AUTOCOMPLETE IS UNDER CONSTRUCTION !!", "ERROR"); return; } if (Mode == "") { return; } String tmpQuery = queryString; currentID = -1; GF.showLoading(parentForm); Dictionary <string, string> Params; if (Mode == "CUSTOMER") { if (Text.Trim().Substring(0, 1) == "7") { Text = "8" + Text.Trim().Substring(1); } tmpQuery += "AND (CUSTOMER_NAME LIKE N'%' + @text + '%' OR RUS_NAME LIKE N'%' + @text + '%' OR TEL LIKE @text + '%')"; Params = new Dictionary <string, string>(); Params.Add("@text", Text); using (DT = DB.getS(tmpQuery, Params, "GET CUSTOMER NAME", false)) { if (DT.Rows.Count == 0) { GF.closeLoading(); MessageBox.Show("... NO RESULT ..."); } else if (DT.Rows.Count == 1) { DataRow row = DT.Rows[0]; SetText(Convert.ToInt32(row["CUSTOMER_ID"].ToString()), row["CUSTOMER_NAME"].ToString() + " - " + (row["GENDER"].ToString() == "1" ? "MALE" : "FEMALE") + " - " + row["TEL"].ToString()); GF.closeLoading(); } else { preventTextChanged = true; using (name_list searchResult = new name_list()) { searchResult.Load += (ss, ee) => { searchResult.Size = searchResult.resultTable.Size; }; if (searchResult.resultTable.Rows.Count > 0) { searchResult.resultTable.Rows.Clear(); } if (searchResult.resultTable.Columns.Count == 0) { searchResult.resultTable.Columns.Add("name", "NAME"); searchResult.resultTable.Columns.Add("rus_name", "RUS NAME"); searchResult.resultTable.Columns.Add("gender", "GENDER"); searchResult.resultTable.Columns.Add("tel", "TEL"); searchResult.resultTable.Columns.Add("note", "NOTE"); searchResult.resultTable.Columns.Add("customer_id", "customer_id"); searchResult.resultTable.Columns["note"].Visible = false; searchResult.resultTable.Columns["customer_id"].Visible = false; } foreach (DataRow row in DT.Rows) { searchResult.resultTable.Rows.Add(row["CUSTOMER_NAME"].ToString(), row["RUS_NAME"].ToString(), (row["GENDER"].ToString() == "1" ? "MALE" : "FEMALE"), row["TEL"].ToString(), row["NOTE"].ToString(), row["CUSTOMER_ID"].ToString()); } GF.updateRowNum(searchResult.resultTable); foreach (DataGridViewColumn column in searchResult.resultTable.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } GF.closeLoading(); searchResult.Owner = parentForm; searchResult.Mode = this.Mode; searchResult.ShowDialog(); searchResult.BringToFront(); } preventTextChanged = false; } } } if (Mode == "EMPLOYEE") { tmpQuery += "AND (FULLNAME LIKE '%' + @text + '%' OR CODE LIKE @text + '%')"; Params = new Dictionary <string, string>(); Params.Add("@text", Text); using (DT = DB.getS(tmpQuery, Params, "GET EMPLOYEE NAME", false)) { if (DT.Rows.Count == 0) { GF.closeLoading(); MessageBox.Show("... NO RESULT ..."); } else if (DT.Rows.Count == 1) { DataRow row = DT.Rows[0]; SetText(Convert.ToInt32(row["EMP_ID"].ToString()), row["CODE"].ToString() + " - " + row["FULLNAME"].ToString()); GF.closeLoading(); } else { preventTextChanged = true; using (name_list searchResult = new name_list()) { searchResult.Load += (ss, ee) => { searchResult.Size = searchResult.resultTable.Size; }; if (searchResult.resultTable.Rows.Count > 0) { searchResult.resultTable.Rows.Clear(); } if (searchResult.resultTable.Columns.Count == 0) { searchResult.resultTable.Columns.Add("fullname", "NAME"); searchResult.resultTable.Columns.Add("code", "CODE"); searchResult.resultTable.Columns.Add("emp_id", "emp_id"); searchResult.resultTable.Columns["emp_id"].Visible = false; } foreach (DataRow row in DT.Rows) { searchResult.resultTable.Rows.Add(row["FULLNAME"].ToString(), row["CODE"].ToString(), row["EMP_ID"].ToString()); } GF.updateRowNum(searchResult.resultTable); foreach (DataGridViewColumn column in searchResult.resultTable.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } GF.closeLoading(); searchResult.Owner = parentForm; searchResult.Mode = this.Mode; searchResult.ShowDialog(); } preventTextChanged = false; } } } if (Mode == "DEBTOR") { tmpQuery += "AND (A.NAME LIKE '%' + @text + '%' OR A.TEL LIKE '%' + @text + '%')"; Params = new Dictionary <string, string>(); Params.Add("@text", Text); using (DT = DB.getS(tmpQuery, Params, "GET DEBTOR NAME", false)) { if (DT.Rows.Count == 0) { GF.closeLoading(); MessageBox.Show("... NO RESULT ..."); } else if (DT.Rows.Count == 1) { DataRow row = DT.Rows[0]; SetText(Convert.ToInt32(row["DEBTOR_ID"].ToString()), "[" + row["DEBTOR_TYPE_NAME"].ToString() + "] " + row["NAME"].ToString() + " " + row["TEL"].ToString()); GF.closeLoading(); } else { preventTextChanged = true; using (name_list searchResult = new name_list()) { searchResult.Load += (ss, ee) => { searchResult.Size = searchResult.resultTable.Size; }; if (searchResult.resultTable.Rows.Count > 0) { searchResult.resultTable.Rows.Clear(); } if (searchResult.resultTable.Columns.Count == 0) { searchResult.resultTable.Columns.Add("debtor_name", "NAME"); searchResult.resultTable.Columns.Add("tel", "TEL NO."); searchResult.resultTable.Columns.Add("debtor_type_name", "TYPE"); searchResult.resultTable.Columns.Add("debtor_id", "debtor_id"); searchResult.resultTable.Columns["debtor_id"].Visible = false; } foreach (DataRow row in DT.Rows) { searchResult.resultTable.Rows.Add(row["NAME"].ToString(), row["TEL"].ToString(), row["DEBTOR_TYPE_NAME"].ToString(), row["DEBTOR_ID"].ToString()); } GF.updateRowNum(searchResult.resultTable); foreach (DataGridViewColumn column in searchResult.resultTable.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } GF.closeLoading(); searchResult.Owner = parentForm; searchResult.Mode = this.Mode; searchResult.ShowDialog(); } preventTextChanged = false; } } } if (Mode == "AGENT") { tmpQuery += "AND (A.AGENT_NAME LIKE '%' + @text + '%' OR A.TEL LIKE '%' + @text + '%')"; Params = new Dictionary <string, string>(); Params.Add("@text", Text); using (DT = DB.getS(tmpQuery, Params, "GET AGENT NAME", false)) { if (DT.Rows.Count == 0) { GF.closeLoading(); MessageBox.Show("... NO RESULT ..."); } else if (DT.Rows.Count == 1) { DataRow row = DT.Rows[0]; SetText(Convert.ToInt32(row["AGENT_ID"].ToString()), row["AGENT_NAME"].ToString() + " - " + row["TEL"].ToString()); GF.closeLoading(); } else { preventTextChanged = true; using (name_list searchResult = new name_list()) { searchResult.Load += (ss, ee) => { searchResult.Size = searchResult.resultTable.Size; }; if (searchResult.resultTable.Rows.Count > 0) { searchResult.resultTable.Rows.Clear(); } if (searchResult.resultTable.Columns.Count == 0) { searchResult.resultTable.Columns.Add("agent_name", "NAME"); searchResult.resultTable.Columns.Add("tel", "TEL NO."); searchResult.resultTable.Columns.Add("agent_type_name", "TYPE"); searchResult.resultTable.Columns.Add("agent_id", "agent_id"); searchResult.resultTable.Columns["agent_id"].Visible = false; } foreach (DataRow row in DT.Rows) { searchResult.resultTable.Rows.Add(row["AGENT_NAME"].ToString(), row["TEL"].ToString(), (row["AGENT_TYPE"].ToString() == "0" ? "COMPANY" : "PERSON"), row["AGENT_ID"].ToString()); } GF.updateRowNum(searchResult.resultTable); foreach (DataGridViewColumn column in searchResult.resultTable.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } GF.closeLoading(); searchResult.Owner = parentForm; searchResult.Mode = this.Mode; searchResult.ShowDialog(); } preventTextChanged = false; } } } if (Mode == "ITEM_TYPE") { tmpQuery += "AND A.ITEM_TYPE_NAME LIKE '%' + @text + '%'"; Params = new Dictionary <string, string>(); Params.Add("@text", Text); using (DT = DB.getS(tmpQuery, Params, "GET ITEM_TYPE_NAME", false)) { if (DT.Rows.Count == 0) { GF.closeLoading(); MessageBox.Show("... NO RESULT ..."); } else if (DT.Rows.Count == 1) { DataRow row = DT.Rows[0]; SetText(Convert.ToInt32(row["ITEM_TYPE_ID"].ToString()), row["ITEM_TYPE_NAME"].ToString()); GF.closeLoading(); } else { preventTextChanged = true; using (name_list searchResult = new name_list()) { searchResult.Load += (ss, ee) => { searchResult.Size = searchResult.resultTable.Size; }; if (searchResult.resultTable.Rows.Count > 0) { searchResult.resultTable.Rows.Clear(); } if (searchResult.resultTable.Columns.Count == 0) { searchResult.resultTable.Columns.Add("item_type_name", "ITEM TYPE NAME"); searchResult.resultTable.Columns.Add("item_type_id", "item_type_id"); searchResult.resultTable.Columns["item_type_id"].Visible = false; } foreach (DataRow row in DT.Rows) { searchResult.resultTable.Rows.Add(row["ITEM_TYPE_NAME"].ToString(), row["ITEM_TYPE_ID"].ToString()); } GF.updateRowNum(searchResult.resultTable); foreach (DataGridViewColumn column in searchResult.resultTable.Columns) { column.SortMode = DataGridViewColumnSortMode.NotSortable; } GF.closeLoading(); searchResult.Owner = parentForm; searchResult.Mode = this.Mode; searchResult.ShowDialog(); } preventTextChanged = false; } } } parentForm.Activate(); parentForm.BringToFront(); } } base.OnKeyDown(e); }