private void txtJanCD_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (!string.IsNullOrWhiteSpace(txtJanCD.Text)) { DataTable dtSKU = SelectSKUData(txtJanCD.Text); if (dtSKU.Rows.Count > 0) { if (dtSKU.Rows.Count == 1) { txtJanCD.Text = dtSKU.Rows[0]["JanCD"].ToString(); lblItemName.Text = dtSKU.Rows[0]["SKUName"].ToString(); lblColorSize.Text = dtSKU.Rows[0]["ColorName"].ToString() + " . " + dtSKU.Rows[0]["SizeName"].ToString(); if (lblItemName.Width > 300) { lblItemName.MaximumSize = new Size(760, 50); } lblColorSize.Visible = true; lblItemName.Visible = true; } else { frmSearch_SKU frmsku = new frmSearch_SKU(txtJanCD.Text, dtSKU); frmsku.ShowDialog(); if (!frmsku.flgCancel) { lblItemName.Text = frmsku.SKUName; lblColorSize.Text = frmsku.SizeColorName; lblColorSize.Visible = true; lblItemName.Visible = true; } } } else { tempoRegiGenkaKakunin_bl.ShowMessage("E101"); txtJanCD.Focus(); } } else { tempoRegiGenkaKakunin_bl.ShowMessage("E102"); lblItemName.Text = string.Empty; lblColorSize.Text = string.Empty; txtJanCD.Focus(); } } }
private void SearchData() { if (!string.IsNullOrWhiteSpace(txtCD.Text)) { if (RdoJanCD.Checked) { DataTable dtSKU = SelectSKUData(txtCD.Text); if (dtSKU.Rows.Count > 0) { if (dtSKU.Rows.Count == 1) { txtCD.Text = dtSKU.Rows[0]["JanCD"].ToString(); lblAdminNO.Text = dtSKU.Rows[0]["AdminNO"].ToString(); lblSearchName.Text = dtSKU.Rows[0]["SKUName"].ToString(); } else { frmSearch_SKU frmsku = new frmSearch_SKU(txtCD.Text, dtSKU); frmsku.ShowDialog(); if (!frmsku.flgCancel) { lblAdminNO.Text = frmsku.AdminNO; lblSearchName.Text = frmsku.SKUName; } } lblSearchName.Visible = true; txtBtnNameDown.Focus(); } else { lblSearchName.Text = string.Empty; lblAdminNO.Text = string.Empty; mnrk_bl.ShowMessage("E101"); txtCD.Focus(); } } else if (RdoCustomerCD.Checked) { DataTable dtCusto = SelectCustomerData(txtCD.Text); if (dtCusto.Rows.Count > 0) { DataRow[] dr = dtCusto.Select("DeleteFlg=1"); if (dr.Count() == 0) { if (dtCusto.Rows.Count == 1) { txtCD.Text = dtCusto.Rows[0]["CustomerCD"].ToString(); lblSearchName.Text = dtCusto.Rows[0]["CustomerName"].ToString(); } lblSearchName.Visible = true; lblAdminNO.Text = string.Empty; txtBtnNameDown.Focus(); } else { lblSearchName.Text = ""; lblAdminNO.Text = string.Empty; mnrk_bl.ShowMessage("E119"); txtCD.Focus(); } } else { lblSearchName.Text = ""; lblAdminNO.Text = string.Empty; mnrk_bl.ShowMessage("E101"); txtCD.Focus(); } } if (!cd.Equals(txtCD.Text.ToString())) { cd = txtCD.Text.ToString(); string skuName = lblSearchName.Text.ToString(); int len = Convert.ToInt32(Encoding.GetEncoding(932).GetByteCount(skuName)); while (len > 18) { skuName = skuName.Remove(skuName.Length - 1, 1); len = Convert.ToInt32(Encoding.GetEncoding(932).GetByteCount(skuName)); } txtBtnNameDown.Text = skuName; } } else { lblSearchName.Text = string.Empty; lblAdminNO.Text = string.Empty; txtBtnNameDown.Focus(); } }