private void BindText() { Customers customer = new Customers(); customer.Customers_id = Convert.ToInt32(id); CustomersProvider provider = new CustomersProvider(); DataTable table = new DataTable(); table = provider.Select(customer); this.txt_address.Text = table.Rows[0]["customers_address"].ToString(); this.txt_code.Text = table.Rows[0]["customers_code"].ToString(); this.txt_fax.Text = table.Rows[0]["customers_fax"].ToString(); this.txt_name.Text = table.Rows[0]["customers_name"].ToString(); this.txt_network_address.Text = table.Rows[0]["customers_network_address"].ToString(); this.txt_one_cell.Text = table.Rows[0]["customers_person_one_cell"].ToString(); this.txt_one_email.Text = table.Rows[0]["customers_person_one_email"].ToString(); this.txt_person_one.Text = table.Rows[0]["customers_person_one"].ToString(); this.txt_person_two.Text = table.Rows[0]["customers_person_two"].ToString(); this.txt_phone.Text = table.Rows[0]["customers_phone"].ToString(); this.txt_region.Text = table.Rows[0]["customers_region"].ToString(); this.txt_telephone.Text = table.Rows[0]["customers_telephone"].ToString(); this.txt_two_cell.Text = table.Rows[0]["customers_person_two_cell"].ToString(); this.txt_two_email.Text = table.Rows[0]["customers_person_two_email"].ToString(); this.txt_type.Text = table.Rows[0]["customers_type"].ToString(); }
private int IsSame() { Customers customer = this.AddCustomers(); CustomersProvider provider = new CustomersProvider(); customer.Customers_code = this.txt_code.Text; DataTable table = new DataTable(); table = provider.Select(customer); if (table.Rows.Count != 0) { this.Alert("该客户代码已经存在,请重新输入!!!"); return(1); } else { return(0); } }
/// <summary> /// 绑定Customer信息的数据源 /// </summary> private void BindSource(int start, string name) { if (name != null) { Customers customer = new Customers(); customer.Customers_name = name; CustomersProvider provider = new CustomersProvider(); DataTable table = provider.Select(customer, start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } else { CustomersProvider provider = new CustomersProvider(); DataTable table = provider.GetAll(start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } }