private void SearchData() { this.txtCustomer.Text = ""; SearchFlow flow = new SearchFlow(); SearchCustomerData data = new SearchCustomerData(); data.CODE = this.txtCode.Text.Trim(); data.CUSTOMERTYPE = this.cmbCustomerType.SelectedItem.Value; data.FULLNAME = this.txtFullName.Text.Trim(); data.MEMBERTYPE = Convert.ToDouble(this.cmbMemberType.SelectedItem.Value); this.grvCustomer.DataSource = flow.GetCustomerList(data); this.grvCustomer.DataBind(); if (this.grvCustomer.SelectedValue == null) this.txtCustomer.Text = ""; else this.txtCustomer.Text = this.grvCustomer.SelectedValue.ToString(); }
private void txtCustomerCode_Leave(object sender, EventArgs e) { if (this.txtCustomerCode.Text.Trim() == "") { this.txtCustomerName.Text = ""; this.txtCustomer.Text = ""; CalculateGrandTotal(); } else { SearchFlow search = new SearchFlow(); ABB.Data.Search.SearchCustomerData data = new ABB.Data.Search.SearchCustomerData(); data.CODE = this.txtCustomerCode.Text.Trim(); data.FULLNAME = this.txtCustomerName.Text.Trim(); DataTable dt = search.GetCustomerList(data); if (dt.Rows.Count == 1) { SetCustomerDetail(Convert.ToDouble(dt.Rows[0]["LOID"])); } else { foreach (DataRow dRow in dt.Rows) { if (dRow["CODE"].ToString() == this.txtCustomerCode.Text.Trim()) { if (this.txtCustomer.Text != dRow["LOID"].ToString()) SetCustomerDetail(Convert.ToDouble(dRow["LOID"])); return; } } SearchCustomer(this.txtCustomerCode.Text.Trim()); if (Convert.ToDouble(this.txtCustomer.Text == "" ? "0" : this.txtCustomer.Text) <= 0) return;//e.Cancel = true; ##by nang } } }