123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace LYFZ.Software.MainBusiness.FinancialManagement.TwoSalesOrder
- {
- public partial class FrmCustomerSelete : LYFZ.Software.UI.FinancialManagement.TwoSalesOrder.FrmCustomerSelete
- {
- public FrmCustomerSelete()
- {
- this.Shown += FrmCustomerSelete_Shown;
- this.txtkeyword.KeyDown += txtkeyword_KeyDown;
- this.btnQuery.Click += btnQuery_Click;
- this.dgvData.MouseDoubleClick += dgvData_MouseDoubleClick;
- this.btnOk.Click += btnOk_Click;
- this.ucPagerEx1.EventPaging += ucPagerEx1_EventPaging;
- }
-
-
-
- public string StrClientNumber;
-
-
-
-
-
- void FrmCustomerSelete_Shown(object sender, EventArgs e)
- {
- this.dgvData.DataColumns("客户编号,客户姓名,客户性别,客户电话,客户地址", strHideField: "客户编号");
- this.PublicFunctionRows();
- }
-
-
-
-
-
- void txtkeyword_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- { this.PublicFunctionRows(); }
- }
-
-
-
-
-
- void btnQuery_Click(object sender, EventArgs e)
- { this.PublicFunctionRows(); }
-
-
-
-
-
- void dgvData_MouseDoubleClick(object sender, EventArgs e)
- {
- if (this.dgvData.Rows.Count > 0)
- { this.btnOk_Click(this, null); }
- }
-
-
-
-
-
- void btnOk_Click(object sender, EventArgs e)
- {
- if (this.dgvData.SelectedRows.Count == 0)
- { MessageBoxCustom.Show("请选择你要客户!"); return; }
- this.StrClientNumber = this.dgvData.CurrentRow.Cells["客户编号"].Value.ToString();
- this.Close();
- }
-
-
-
- void PublicFunctionRows()
- {
- this.ucPagerEx1.PageCurrent = 1;
- this.ucPagerEx1.PageSize = 100;
- this.ucPagerEx1.Bind();
- }
-
-
-
-
-
- private int ucPagerEx1_EventPaging(UCPager.EventPagingArg e)
- {
- this.dgvData.Rows.Clear();
- string Strkeyword = txtkeyword.Text.Trim();
- DataTable dt = new DataTable();
- LYFZ.UCPager.PageData pageData = new LYFZ.UCPager.PageData();
- pageData.PageIndex = this.ucPagerEx1.PageCurrent;
- pageData.PageSize = this.ucPagerEx1.PageSize;
- LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
- {
- string StrWhere = "Cus_Type != '儿童'";
- if (!string.IsNullOrEmpty(txtkeyword.Text))
- { StrWhere += " And (Cus_Name like '%" + Strkeyword + "%' or Cus_Telephone like '%" + Strkeyword + "%' or Cus_NamePinyin like '%" + Strkeyword + "%' )"; }
- pageData.QueryCondition = StrWhere;
- pageData.TableName = "tb_ErpCustomer";
- pageData.QueryFieldName = " Cus_CustomerNumber,Cus_Name,Cus_Sex,Cus_Telephone,Cus_Address";
- pageData.OrderStr = " Cus_Name Asc";
- pageData.OrderType = 1;
- dt = pageData.QueryDataTable().Tables[0];
- this.Invoke(new LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.UpdateControl(delegate()
- {
- for (int t = 0; t < dt.Rows.Count; t++)
- {
- DataGridViewRow dgvr = new DataGridViewRow();
- DataGridViewCell cell = null;
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Cus_CustomerNumber"].ToString().Trim(); ;
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim(); ;
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = Convert.ToBoolean(dt.Rows[t]["Cus_Sex"]) ? "女" : "男";
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Cus_Telephone"].ToString().Trim();
- dgvr.Cells.Add(cell);
- cell = new DataGridViewTextBoxCell();
- cell.Value = dt.Rows[t]["Cus_Address"].ToString().Trim();
- dgvr.Cells.Add(cell);
- this.dgvData.Rows.Add(dgvr);
- }
- }));
- });
- try
- { this.ucPagerEx1.TbDataSource = dt; }
- catch
- { }
- this.dgvData.ClearSelection();
- this.dgvData.FillLastColumn();
- return pageData.TotalCount;
- }
- }
- }
|