private int IsSame() { Company company = new Company(); CompanyProvider provider = new CompanyProvider(); company.Company_num = Convert.ToInt32(this.txt_company_num.Text); DataTable table = new DataTable(); table = provider.Select(company); if (table.Rows.Count != 0) { this.Alert("该编号已经存在,请重新输入!!!"); return(1); } else { return(0); } }
/// <summary> /// 绑定Company信息的数据源 /// </summary> private void BindSource(int start, string name) { if (name != null) { Company company = new Company(); company.Company_name = name; CompanyProvider provider = new CompanyProvider(); DataTable table = provider.Select(company, start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } else { CompanyProvider provider = new CompanyProvider(); DataTable table = provider.GetAll(start, this.ListPager1.PageSize); this.GridView1.DataSource = table.DefaultView; this.GridView1.DataBind(); } }
private void BindText() { Company company = new Company(); company.Company_id = Convert.ToInt32(id); CompanyProvider provider = new CompanyProvider(); DataTable table = new DataTable(); table = provider.Select(company); this.txt_company_address.Text = table.Rows[0]["company_address"].ToString(); this.txt_company_cell.Text = table.Rows[0]["company_cell"].ToString(); this.txt_company_city.Text = table.Rows[0]["company_city"].ToString(); this.txt_company_email.Text = table.Rows[0]["company_email"].ToString(); this.txt_company_fax.Text = table.Rows[0]["company_fax"].ToString(); this.txt_company_manager.Text = table.Rows[0]["company_manager"].ToString(); this.txt_company_name.Text = table.Rows[0]["company_name"].ToString(); this.txt_company_nation.Text = table.Rows[0]["company_nation"].ToString(); this.txt_company_num.Text = table.Rows[0]["company_num"].ToString(); this.txt_company_phone.Text = table.Rows[0]["company_phone"].ToString(); this.txt_company_postcode.Text = table.Rows[0]["company_postcode"].ToString(); this.txt_company_pro.Text = table.Rows[0]["company_pro"].ToString(); }