Example #1
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.textEdit1.Text))
            {
                Model.Product product = productManager.SelectByBarCode(this.textEdit1.Text);
                if (product != null)
                {
                    this.textEdit2.EditValue = product.Id;
                    this.textEdit3.EditValue = product.ProductName;

                    DateTime dateStart            = this.dateEdit1.EditValue == null ? global::Helper.DateTimeParse.NullDate : this.dateEdit1.DateTime;
                    DateTime dateEnd              = this.dateEdit2.EditValue == null ? global::Helper.DateTimeParse.EndDate : this.dateEdit2.DateTime;
                    IList <Model.StockSeach> list = this.stockManager.SelectReaderByPro(product.ProductId, dateStart, dateEnd);
                    list = list.OrderBy(s => s.InvoiceDate).ToList <Model.StockSeach>();
                    this.bindingSource1.DataSource = list;
                }
                else
                {
                    this.textEdit2.EditValue       = null;
                    this.textEdit3.EditValue       = null;
                    this.bindingSource1.DataSource = null;
                    MessageBox.Show("根據輸入條碼未查詢到商品!", "提示!", MessageBoxButtons.OK);
                    return;
                }
            }
        }