protected void databind3() { string text = ListBox5.SelectedItem.ToString(); ListBox6.DataSource = Roles.GetUsersInRole(text); ListBox6.DataBind(); }
private void Fillshiftdrp() { string strSql = "select SHIFT_ID,replace(convert(char(31),ltrim(SHIFT_ID))+SHIFT_DESCRIPTION,' ','�' ) as SHIFTNAME from ta_shift where SHIFT_ISDELETED='0'"; SqlConnection con = new SqlConnection(m_connectons); con.Open(); SqlCommand cmd = new SqlCommand(strSql, con); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet thisDataSet = new DataSet(); adpt.Fill(thisDataSet); ListBox6.DataValueField = "SHIFT_ID"; ListBox6.DataTextField = "SHIFTNAME"; ListBox6.DataSource = thisDataSet.Tables[0]; ListBox6.DataBind(); }
protected void Button5_Click(object sender, EventArgs e) // all pair { var accounts1 = new Dictionary <string, int>(); accounts1["Gilgit"] = 0; accounts1["Chitral"] = 1; accounts1["Dasu"] = 2; accounts1["Dir"] = 3; accounts1["Malakand"] = 4; accounts1["Noshera"] = 5; accounts1["Mansehra"] = 6; accounts1["Hassan Abdal"] = 7; accounts1["Peshawar"] = 8; accounts1["Attock"] = 9; accounts1["Kohat"] = 10; accounts1["Islamabad"] = 11; accounts1["Murree"] = 12; accounts1["Rawat"] = 13; accounts1["Balkasar"] = 14; accounts1["Chakwal"] = 15; accounts1["Mianwali"] = 16; accounts1["Bhera"] = 17; accounts1["Sargoda"] = 18; accounts1["Pindi Bhattian"] = 19; accounts1["Jhang"] = 20; accounts1["Faisalabad"] = 21; accounts1["Lahore"] = 22; accounts1["Dina"] = 23; accounts1["Gujranwala"] = 24; accounts1["Multan"] = 25; accounts1["DG Khan"] = 26; accounts1["Bahwalpur"] = 27; accounts1["Sukkur"] = 28; accounts1["Rajanpur"] = 29; accounts1["Loralai"] = 30; accounts1["Jacobabad"] = 31; accounts1["Quetta"] = 32; accounts1["Khuzdar"] = 33; accounts1["Karachi"] = 34; accounts1["Lasbela"] = 35; accounts1["Gwadar"] = 36; accounts1["Awaran"] = 37; accounts1["Turbat"] = 38; var accounts = new Dictionary <int, string>(); accounts[0] = "Gilgit"; accounts[1] = "Chitral"; accounts[2] = "Dasu"; accounts[3] = "Dir"; accounts[4] = "Malakand"; accounts[5] = "Noshera"; accounts[6] = "Mansehra"; accounts[7] = "Hassan Abdal"; accounts[8] = "Peshawar"; accounts[9] = "Attock"; accounts[10] = "Kohat"; accounts[11] = "Islamabad"; accounts[12] = "Murree"; accounts[13] = "Rawat"; accounts[14] = "Balkasar"; accounts[15] = "Chakwal"; accounts[16] = "Mianwali"; accounts[17] = "Bhera"; accounts[18] = "Sargoda"; accounts[19] = "Pindi Bhattian"; accounts[20] = "Jhang"; accounts[21] = "Faisalabad"; accounts[22] = "Lahore"; accounts[23] = "Dina"; accounts[24] = "Gujranwala"; accounts[25] = "Multan"; accounts[26] = "DG Khan"; accounts[27] = "Bahwalpur"; accounts[28] = "Sukkur"; accounts[29] = "Rajanpur"; accounts[30] = "Loralai"; accounts[31] = "Jacobabad"; accounts[32] = "Quetta"; accounts[33] = "Khuzdar"; accounts[34] = "Karachi"; accounts[35] = "Lasbela"; accounts[36] = "Gwadar"; accounts[37] = "Awaran"; accounts[38] = "Turbat"; string src = TextBox4.Text; string dst = TextBox5.Text; int src1 = accounts1[src]; int dst1 = accounts1[dst]; string res = findpath(D, src1, dst1, 39); string[] values = res.Split(','); for (int i = 0; i < values.Length; i++) { values[i] = values[i].Trim(); } //Label1.Text = values[0]; // Label2.Text = accounts[3]; for (int i = 0; i < values.Length - 1; i++) { values[i] = accounts[Convert.ToInt32(values[i])]; } ListBox6.DataSource = values; ListBox6.DataBind(); Page.ClientScript.RegisterStartupScript(this.GetType(), "script", " <script>allpairoshrt();</script>"); }
/// <summary> /// 绑定下拉框的数据 /// </summary> public void refredatabind() { ListItem lt1 = new ListItem(); lt1.Value = ""; /* 绑定供应商 */ List <Provider> ps = new DAL.ProviderDAO().getAllProviders(); ListBox6.DataSource = ps; ListBox6.DataTextField = "providerName"; ListBox6.DataValueField = "providerNum"; ListBox6.DataBind(); ListBox6.Items.Add(lt1); ListBox6.SelectedValue = ""; /* 绑定库柜 */ List <Chest> cs = new DAL.ChestDAO().getAllChests(); ListBox4.DataSource = cs; ListBox4.DataTextField = "chestName"; ListBox4.DataValueField = "chestNum"; ListBox4.DataBind(); ListBox4.Items.Add(lt1); ListBox4.SelectedValue = ""; /* 绑定经办人 */ List <SysUser> sys = new DAL.SysUserDAO().getAllUsers(); ListBox5.DataSource = sys; ListBox5.DataTextField = "userId"; ListBox5.DataValueField = "staffnum"; ListBox5.DataBind(); ListBox5.Items.Add(lt1); ListBox5.SelectedValue = ""; /* 绑定物品类别第一项 */ List <GoodsType> gts = new DAL.GoodsTypeDAO().getParentGoodsTypes(); ListBox1.DataSource = gts; ListBox1.DataTextField = "goodsTypeName"; ListBox1.DataValueField = "goodsTypeNum"; ListBox1.DataBind(); ListBox1.Items.Add(lt1); ListBox1.SelectedValue = ""; /* 绑定gridview数据源 */ BoundField bf1 = new BoundField(); bf1.HeaderText = "序号"; BoundField bf2 = new BoundField(); bf2.DataField = "inID"; bf2.HeaderText = "编号"; BoundField bf3 = new BoundField(); bf3.DataField = "goods.goodsName"; bf3.HeaderText = "物品名称"; BoundField bf4 = new BoundField(); bf4.DataField = "goods.goodsType.goodsTypeName"; bf4.HeaderText = "物品类别"; BoundField bf5 = new BoundField(); bf5.DataField = "position.positionNum"; bf5.HeaderText = "库位编号"; BoundField bf6 = new BoundField(); bf6.DataField = "date"; bf6.HeaderText = "入库时间"; BoundField bf7 = new BoundField(); bf7.DataField = "inAmount"; bf7.HeaderText = "入库量"; BoundField bf8 = new BoundField(); bf8.DataField = "batch.provider.providername"; bf8.HeaderText = "供应商"; BoundField bf9 = new BoundField(); bf9.DataField = "sysuser.staff.staffname"; bf9.HeaderText = "经办人"; GridView1.Columns.Add(bf1); GridView1.Columns.Add(bf2); GridView1.Columns.Add(bf3); GridView1.Columns.Add(bf4); GridView1.Columns.Add(bf5); GridView1.Columns.Add(bf6); GridView1.Columns.Add(bf7); GridView1.Columns.Add(bf8); GridView1.Columns.Add(bf9); BoundField bf11 = new BoundField(); bf11.HeaderText = "序号"; BoundField bf12 = new BoundField(); bf12.DataField = "ouID"; bf12.HeaderText = "编号"; BoundField bf13 = new BoundField(); bf13.DataField = "goods.goodsName"; bf13.HeaderText = "物品名称"; BoundField bf14 = new BoundField(); bf14.DataField = "goods.goodsType.goodsTypeName"; bf14.HeaderText = "物品类别"; BoundField bf15 = new BoundField(); bf15.DataField = "position.positionNum"; bf15.HeaderText = "库位编号"; BoundField bf16 = new BoundField(); bf16.DataField = "date"; bf16.HeaderText = "出库时间"; BoundField bf17 = new BoundField(); bf17.DataField = "outAmount"; bf17.HeaderText = "出库量"; BoundField bf18 = new BoundField(); bf18.DataField = "batch.receiver.receivername"; bf18.HeaderText = "收货商"; BoundField bf19 = new BoundField(); bf19.DataField = "sysuser.staff.staffname"; bf19.HeaderText = "经办人"; GridView2.Columns.Add(bf11); GridView2.Columns.Add(bf12); GridView2.Columns.Add(bf13); GridView2.Columns.Add(bf14); GridView2.Columns.Add(bf15); GridView2.Columns.Add(bf16); GridView2.Columns.Add(bf17); GridView2.Columns.Add(bf18); GridView2.Columns.Add(bf19); }