Пример #1
0
 private void btnSearch_Click(object sender, EventArgs e)
 {
     if (cbxItem.SelectedItem == null && txtSearchValue.Text == "")
     {
         cf.showErrorMessage("搜尋錯誤", "尚未設定搜尋條件");
     }
     else if (txtSearchValue.Text != "" && (cbxItem.SelectedItem == null || cbxItem.SelectedItem.ToString() == ""))
     {
         cf.showErrorMessage("搜尋錯誤", "請選擇搜尋條件");
     }
     else if (cbxItem.SelectedItem != null && cbxItem.SelectedItem.ToString() != "" && txtSearchValue.Text == "")
     {
         cf.showErrorMessage("搜尋錯誤", "請輸入搜尋內容");
     }
     else
     {
         if (cbxItem.SelectedItem != null)
         {
             var result = db.getInputlist(cbxItem.SelectedItem.ToString(), txtSearchValue.Text);
             if (result.Count() == 0) // 為了避免 indexoutofrange error
             {
                 cf.showErrorMessage("無符合資料", "無符合資料,請重新輸入搜尋內容");
             }
             else
             {
                 inputlistBindingSource.DataSource = result;
             }
         }
     }
 }
Пример #2
0
 private void getResult()
 {
     if (cbxItem.SelectedItem == null && txtSearchValue.Text == "")
     {
         cf.showErrorMessage("搜尋錯誤", "尚未設定搜尋條件");
     }
     else if (txtSearchValue.Text != "" && (cbxItem.SelectedItem == null || cbxItem.SelectedItem.ToString() == ""))
     {
         cf.showErrorMessage("搜尋錯誤", "請選擇搜尋條件");
     }
     else if (cbxItem.SelectedItem != null && cbxItem.SelectedItem.ToString() != "" && txtSearchValue.Text == "")
     {
         cf.showErrorMessage("搜尋錯誤", "請輸入搜尋內容");
     }
     else
     {
         if (cbxItem.SelectedItem != null)
         {
             var result = db.getMaterials(cbxItem.SelectedItem.ToString(), txtSearchValue.Text);
             materialsBindingSource.DataSource = result;
         }
     }
 }
Пример #3
0
        private void txtAmount_Leave(object sender, EventArgs e)
        {
            try
            {
                int intInputAmount = int.Parse(txtAmount.Text);

                if ((type == "Output" || type == "WIP") && (intInputAmount > int.Parse(txtCurrentAmount.Text)))
                {
                    cf.showErrorMessage("數量錯誤", "輸入量不得大於現有數量");
                }
            }
            catch
            {
                cf.showErrorMessage("輸入錯誤", "此欄位只能輸入數字");
                txtAmount.Focus();
            }
        }