private void show_pay_terms() { if (User.Identity.IsAuthenticated) { SqlConnection con1000 = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd1000 = new SqlCommand("select * from user_details where company_name='" + User.Identity.Name + "'", con1000); SqlDataReader dr1000; con1000.Open(); dr1000 = cmd1000.ExecuteReader(); if (dr1000.Read()) { company_id = Convert.ToInt32(dr1000["com_id"].ToString()); SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["connection"]); SqlCommand cmd = new SqlCommand("Select * from PaymentTerms where Com_Id='" + company_id + "' ORDER BY Pay_id asc", con); con.Open(); DataSet ds = new DataSet(); SqlDataAdapter da = new SqlDataAdapter(cmd); da.Fill(ds); ComboBox2.DataSource = ds; ComboBox2.DataTextField = "Payment_terms"; ComboBox2.DataValueField = "Pay_id"; ComboBox2.DataBind(); ComboBox2.Items.Insert(0, new ListItem("Select pay terms", "1")); con.Close(); } con1000.Close(); } }
//约束绑定项目 private void restrainBindPro() { sqlText = "select distinct DCS_PROJECTID, DCS_PROJECTID+'‖' +DCS_PROJECT as DCS_PROJECT "; sqlText += "from TBPM_DEPCONSHEET where DCS_DEPID in ('03','01') "; if (ddlstatus.SelectedValue != "0" && ddlpersons.SelectedValue != "-请选择-") { sqlText += "and DCS_TYPE='" + ddlstatus.SelectedValue + "' "; sqlText += "and DCS_EDITORID='" + ddlpersons.SelectedValue + "' "; } else if (ddlstatus.SelectedValue != "0" && ddlpersons.SelectedValue == "-请选择-") { sqlText += "and DCS_TYPE='" + ddlstatus.SelectedValue + "' "; } else if (ddlstatus.SelectedValue == "0" && ddlpersons.SelectedValue != "-请选择-") { sqlText += "and DCS_EDITORID='" + ddlpersons.SelectedValue + "' "; } DataTable dt = DBCallCommon.GetDTUsingSqlText(sqlText); ComboBox2.DataSource = dt; ComboBox2.DataTextField = "DCS_PROJECT"; ComboBox2.DataValueField = "DCS_PROJECTID"; ComboBox2.DataBind(); ComboBox2.Items.Insert(0, new ListItem("全部", "0")); ComboBox2.SelectedIndex = 0; }
protected void ConfigureHeaderTemplates() { ComboBox1.HeaderTemplate = new HeaderTemplate("CUSTOMERS"); ComboBox2.HeaderTemplate = new HeaderTemplate((ComboBox1.SelectedText != String.Empty ? ComboBox1.SelectedText : "")); ComboBox3.HeaderTemplate = new HeaderTemplate((ComboBox2.SelectedText != String.Empty ? "Order #" + ComboBox2.SelectedText : "")); ComboBox1.DataBind(); ComboBox2.DataBind(); ComboBox3.DataBind(); }
//初始化绑定项目 private void comboBoxPro() { sqlText = "select distinct DCS_PROJECTID, DCS_PROJECTID+'‖' +DCS_PROJECT as DCS_PROJECT "; sqlText += "from TBPM_DEPCONSHEET where DCS_DEPID in ('03','01') "; DataTable dt = DBCallCommon.GetDTUsingSqlText(sqlText); ComboBox2.DataSource = dt; ComboBox2.DataTextField = "DCS_PROJECT"; ComboBox2.DataValueField = "DCS_PROJECTID"; ComboBox2.DataBind(); ComboBox2.Items.Insert(0, new ListItem("全部", "0")); ComboBox2.SelectedIndex = 0; }
//绑定工程ID private void comboxEngID() { sqlText = "select TSA_ID, TSA_ENGNAME from TBPM_TCTSASSGN "; sqlText += "where TSA_TCCLERK='" + Session["UserID"] + "' "; sqlText += "and TSA_PJID='" + ComboBox1.SelectedItem.Text.Trim() + "' "; DataTable dt = DBCallCommon.GetDTUsingSqlText(sqlText); ComboBox2.DataSource = dt; ComboBox2.DataTextField = "TSA_ID"; ComboBox2.DataValueField = "TSA_ENGNAME"; ComboBox2.DataBind(); ComboBox2.Items.Insert(0, new ListItem("全部", "0")); ComboBox2.SelectedIndex = 0; }
protected void ComboBox1_OnSelectedIndexChanged(object sender, EventArgs e) { sds2.SelectParameters[0].DefaultValue = ComboBox1.SelectedValue; sds3.SelectParameters[0].DefaultValue = ""; ComboBox2.Enabled = true; ComboBox2.Items.Clear(); ComboBox2.SelectedIndex = -1; ComboBox2.SelectedValue = ""; ComboBox2.DataBind(); ComboBox3.Enabled = false; ComboBox3.Items.Clear(); ComboBox3.SelectedIndex = -1; }
void comboBoxData() { DataTable dt = new DataTable(); dt.Columns.Add("PT_PJID"); dt.Columns.Add("PT_PJNAME"); dt.Rows.Add("全部", "0"); string sql = "select distinct DCS_PROJECTID, DCS_PROJECT from TBPM_DEPCONSHEET";//读取所有的项目名称 SqlDataReader dr1 = DBCallCommon.GetDRUsingSqlText(sql); while (dr1.Read()) { DataRow dr = dt.NewRow(); dr[0] = dr1["DCS_PROJECTID"].ToString() + "|" + dr1["DCS_PROJECT"].ToString(); dr[1] = dr1["DCS_PROJECTID"].ToString(); dt.Rows.Add(dr); } dr1.Close(); ComboBox2.DataSource = dt; ComboBox2.DataTextField = "PT_PJID"; ComboBox2.DataValueField = "PT_PJNAME"; ComboBox2.DataBind(); }