private void btnPad_Find_Click(object sender, EventArgs e) { try { string txtcode = tbPadCode.Text.Trim(); DataTable dt = PadBra.get_PadData(txtcode); gridControl1.DataSource = dt; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btn_Save_Click(object sender, EventArgs e) { try { string padCode = txtPadCode.Text.Trim(); string padArt = txtPadArt.Text.Trim(); string padColor = txtPadColor.Text.Trim(); string padSize = txtPadSize.Text.Trim(); string staff = tbStaff.Text.Trim(); if (string.IsNullOrEmpty(padCode) || string.IsNullOrEmpty(padArt) || string.IsNullOrEmpty(padColor) || string.IsNullOrEmpty(padSize)) { MessageBox.Show("ป้อนข้อมูลไม่ครบ!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (padCode.Split(' ').Length > 1) { MessageBox.Show("รหัส PAD CODE ห้ามมีช่องว่าง!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (!frm1.CheckStaff(staff)) { MessageBox.Show("ไม่พบรหัสพนักงาน!", "error", MessageBoxButtons.OK, MessageBoxIcon.Error); tbStaff.Text = string.Empty; tbStaff.Focus(); return; } else { string _result = PadBra.SaveMasterPAD("INSERT", padCode, padArt, padColor, padSize, staff); if (_result == "Duplicated") { MessageBox.Show("ข้อมูล PAD CODE นี้มีในระบบแล้ว!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { MessageBox.Show(_result, "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); xtraTabControl1.SelectedTabPage = xtraTabPage1; btnPad_Find_Click(null, null); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e) { try { string padCode = gridView1.GetRowCellDisplayText(gridView1.FocusedRowHandle, "PAD_CODE").ToString(); if (DialogResult.Yes == MessageBox.Show(string.Format("ต้องการลบ ({0}) ใช่หรือไม่?", padCode), "Confirm!", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) { string _result = PadBra.SaveMasterPAD("DELETE", padCode, "", "", "", ""); MessageBox.Show(_result, "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information); btnPad_Find_Click(null, null); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }