/** * 点击CustomerInfoList中选项时,显示选中客户编号的客户信息 * @param object sender * @param EvenArgs e * @return void * @author Rick **/ private void CustomInfoList_SelectedIndexChanged(object sender, EventArgs e) { this.data_clear_all(); //获取选中的客户编号值 string customerNo = this.CustomInfoList.SelectedItem.ToString().Split(' ')[3]; this.customer = new Customer(); this.countfeeinfo = new Countfeeinfo(); //查询该客户的信息 if ("" != customerNo) { if (Constant.OK == this.customerAction.getCustomerById(customerNo, ref customer)) { //将Customer类中的值显示在各个文本区中 //MessageBox.Show(customer.getCustomerName()); this.customerName.Text = customer.getCustomerName(); this.CustomerAddress.Text = customer.getCustomerAddress(); this.LineBox.SelectedValue = customer.getLine(); this.AreaBox.SelectedValue = customer.getArea(); this.InvoiceType.SelectedItem = customer.getInvoiceType(); this.ElectriType.SelectedItem = customer.getElectriCharacterName(); this.VoltageFlag.SelectedItem = customer.getVoltageFlag(); this.cbxAmmeterType1.SelectedItem = customer.getAmmeterType(); this.txtAmmeterNo1.Text = customer.getAmmeterNo(); this.BankCode.Text = customer.getBankCode(); this.Bank.Text = customer.getBankName(); this.BankAccount.Text = customer.getBankAccount(); if ("1" == customer.getSignFlag()) { this.Sign.Checked = true; this.UnSign.Checked = false; } else { this.Sign.Checked = false; this.UnSign.Checked = true; } this.txtPhoneNum.Text = customer.getPhoneNum(); if ("1" == customer.getLowProtectFlag().Trim()) { this.LowProtect.Checked = true; } else { this.LowProtect.Checked = false; } if ("1" == customer.getTranslossOrBaseprice().Trim()) { this.BasicEFee.Checked = true; } else { this.BasicEFee.Checked = false; } //this.line.Text = customer.getLine(); //this.area.Text = customer.getArea(); //this.invoiceNo.Text = customer.getInvoiceType(); //this.electriType.Text = customer.getElectriCharacterName(); //this.voltage.Text = customer.getVoltageFlag(); } //else //MessageBox.Show("error"); if (Constant.OK == this.customerAction.getCountFeeInfoById(customerNo, ref countfeeinfo)) { this.ammeterMutiple.Text = countfeeinfo.getAmmeterMulti(); this.lineChange.Text = countfeeinfo.getLineLoseRate(); this.Transformer.SelectedValue = countfeeinfo.getTransformerNo(); } //else //调试用 /// MessageBox.Show("error"); /* 查询电价信息 */ string priceSQL = "select PowerPriceNo, PriceRate from PriceRate where CustomerNo = '" + customerNo.Trim() + "'"; try { DataSet ds = SQLUtl.Query(priceSQL); DataTable dt = ds.Tables[0]; int rows = dt.Rows.Count; while (rows != 0) { //MessageBox.Show(rows.ToString()); switch (rows) { case 4: { this.PowerPrice_4.SelectedValue = dt.Rows[3].ItemArray[0]; this.PowerRate_4.Text = dt.Rows[3].ItemArray[1].ToString().Trim(); rows = rows - 1; break; } case 3: { this.PowerPrice_3.SelectedValue = dt.Rows[2].ItemArray[0]; this.PowerRate_3.Text = dt.Rows[2].ItemArray[1].ToString().Trim(); rows = rows - 1; break; } case 2: { this.PowerPrice_2.SelectedValue = dt.Rows[1].ItemArray[0]; this.PowerRate_2.Text = dt.Rows[1].ItemArray[1].ToString().Trim(); rows = rows - 1; break; } case 1: { this.PowerPrice_1.SelectedValue = dt.Rows[0].ItemArray[0]; this.PowerRate_1.Text = dt.Rows[0].ItemArray[1].ToString().Trim(); rows = rows - 1; break; } default: { //do nothing; break; } } } } catch (Exception) { //do nothing } } }