void InitData() { DataTable tblRegions = SubscribeInfoManager.RetrieveRegions(); //得到所有的地区 DataTable tblEmployees = EmployeeManager.RetrieveAllEmployees(); //得到所有的业务员 this.txtNumber.Text = "1"; //bind data to region comboBox this.cmbRegion.DataSource = tblRegions; this.cmbRegion.DisplayMember = "name"; this.cmbRegion.ValueMember = "name"; //bind data to payment comboBox this.cmbPayment.Items.Add(" "); this.cmbPayment.Items.Add("现金支付"); this.cmbPayment.Items.Add("银行转帐"); this.cmbPayment.Items.Add("邮局汇款"); this.cmbPayment.Items.Add("网上支付"); this.cmbPayment.Items.Add("货到付款"); this.cmbPayment.SelectedIndex = 0; //bind data to client comboBox this.cmbOperator.DataSource = tblEmployees; this.cmbOperator.DisplayMember = "name"; this.cmbOperator.ValueMember = "name"; //add items to subscription comboBox this.cmbSubscription.Items.Add(" "); this.cmbSubscription.Items.Add("订阅"); this.cmbSubscription.Items.Add("赠阅"); this.cmbSubscription.SelectedIndex = 0; //add items to clientCategory comboBox this.cmbClient.Items.Add(" "); this.cmbClient.Items.Add("A"); this.cmbClient.Items.Add("B"); this.cmbClient.Items.Add("C"); this.cmbClient.SelectedIndex = 0; //add items to bonus comboBox this.cmbBonus.Items.Add(" "); this.cmbBonus.Items.Add("已提"); this.cmbBonus.Items.Add("未提"); this.cmbBonus.SelectedIndex = 0; //add years items this.cmbStartYear.Items.AddRange(new string[] { "", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015" }); this.cmbEndYear.Items.AddRange(new string[] { "", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015" }); this.cmbGiveYear.Items.AddRange(new string[] { "", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015" }); //add month items this.cmbStartMonth.Items.AddRange(new string[] { "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }); this.cmbEndMonth.Items.AddRange(new string[] { "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }); this.cmbGiveMonth.Items.AddRange(new string[] { "", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12" }); this.cmbStartYear.SelectedIndex = 0; this.cmbEndYear.SelectedIndex = 0; this.cmbGiveYear.SelectedIndex = 0; this.cmbStartMonth.SelectedIndex = 0; this.cmbEndMonth.SelectedIndex = 0; this.cmbGiveMonth.SelectedIndex = 0; }
private void BindToComboBox() { DataTable tblRegions = SubscribeInfoManager.RetrieveRegions(); this.comboBox1.DataSource = tblRegions; this.comboBox1.DisplayMember = "name"; this.comboBox1.ValueMember = "Id"; }