protected void DropDownListTipo_SelectedIndexChanged(object sender, EventArgs e) { try { DropDownListArea.DataSource = new ManterRegiaoAtendimento().ConsultaRegiaoAtendimentos(); DropDownListArea.DataTextField = "Regiao"; DropDownListArea.DataValueField = "Id"; DropDownListArea.DataBind(); DropDownListArea.Items.Insert(0, new ListItem("Selecione a regiao", "0")); DropDownListEspec.DataSource = new ManterEspecialidade().ConsultaEspecialidades(); DropDownListEspec.DataTextField = "NomeEspec"; DropDownListEspec.DataValueField = "Id"; DropDownListEspec.DataBind(); DropDownListEspec.Items.Insert(0, new ListItem("Selecione a especialidade", "0")); DropDownListEmpresa.DataSource = new ManterEmpresa().ConsultaEmpresas(); DropDownListEmpresa.DataTextField = "NomeEmpresa"; DropDownListEmpresa.DataValueField = "Id"; DropDownListEmpresa.DataBind(); DropDownListEmpresa.Items.Insert(0, new ListItem("Selecione a empresa", "0")); } catch (Exception Ex) { LogException.InsereLogBd(Ex); MsgLabel.Text = LogException.CodigoErroBd(); } }
protected void getData() { //绑定粉碎部品数据表 string inputArea = "inputArea = 2"; string sqlselect = string.Format(sqlquery, inputArea); Debug.WriteLine(sqlselect); DataTable dt = new DataTable(); dt = cmd.ExecuteDataTable(sqlselect); GridView1.DataSource = dt; GridView1.DataBind(); string[] produceArea = new string[] { "品检不良品", "工程内不良品" }; DropDownListArea.DataSource = produceArea; DropDownListArea.DataBind(); //金额 string sqlmoney1 = string.Format(sqlmoney, inputArea); Debug.WriteLine(sqlmoney1); double moneySum = 0; if (!(DBNull.Value.Equals(cmd.ExecuteScalar(sqlmoney1)))) { moneySum = Convert.ToDouble(cmd.ExecuteScalar(sqlmoney1)); } lblMoney.InnerText = string.Format("总金额:{0}", moneySum); getRoot(inputArea); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string[] produceArea = new string[] { projectBad, returnBad }; DropDownListArea.DataSource = produceArea; DropDownListArea.DataBind(); Debug.WriteLine(sql); DataTable dt = new SelectCommandBuilder().ExecuteDataTable(sql); GridView1.DataSource = dt; GridView1.DataBind(); string sqltableSign = @"select distinct top 10 tableSign from shatter_Parts where tableSign is not null and(inputArea = 1) order by tableSign desc "; DataTable dtSign = new SelectCommandBuilder().ExecuteDataTable(sqltableSign); DataColumn sign = new DataColumn(); sign.ColumnName = "Sign"; sign.DataType = System.Type.GetType("System.String"); dtSign.Columns.Add(sign); var i = 1; foreach (DataRow dr in dtSign.Rows) { dr["Sign"] = string.Format("{0}", i++); } DropDownListIndex.DataSource = dtSign; DropDownListIndex.DataValueField = "tableSign"; DropDownListIndex.DataTextField = "Sign"; DropDownListIndex.DataBind(); } }