public void bindTable(string table, DataTable dt, string colomn = "Naziv") { switch (table) { case "Artikal": ListBox4.DataSource = chgStanjeArt.DataSource = newStanjeArt.DataSource = dt; ListBox4.DataTextField = chgStanjeArt.DataTextField = newStanjeArt.DataTextField = colomn; ListBox4.DataValueField = chgStanjeArt.DataValueField = newStanjeArt.DataValueField = "ID"; ListBox4.DataBind(); chgStanjeArt.DataBind(); newStanjeArt.DataBind(); break; case "KatArt": ListBox3.DataSource = newItemsCatArt.DataSource = updItemsCatArt.DataSource = dt; ListBox3.DataTextField = newItemsCatArt.DataTextField = updItemsCatArt.DataTextField = colomn; ListBox3.DataValueField = newItemsCatArt.DataValueField = updItemsCatArt.DataValueField = "ID"; ListBox3.DataBind(); newItemsCatArt.DataBind(); updItemsCatArt.DataBind(); break; case "Dobavljac": ListBox1.DataSource = updItemsSupplier.DataSource = newItemsSupplier.DataSource = dt; ListBox1.DataTextField = updItemsSupplier.DataTextField = newItemsSupplier.DataTextField = colomn; ListBox1.DataValueField = updItemsSupplier.DataValueField = newItemsSupplier.DataValueField = "ID"; ListBox1.DataBind(); updItemsSupplier.DataBind(); newItemsSupplier.DataBind(); break; case "Korisnik": ListBox5.DataSource = dt; ListBox5.DataTextField = colomn; ListBox5.DataValueField = "ID"; ListBox5.DataBind(); break; case "Prodavnica": ListBox2.DataSource = chgStanjeShop.DataSource = newStanjeShop.DataSource = dt; ListBox2.DataTextField = chgStanjeShop.DataTextField = newStanjeShop.DataTextField = colomn; ListBox2.DataValueField = chgStanjeShop.DataValueField = newStanjeShop.DataValueField = "ID"; ListBox2.DataBind(); chgStanjeShop.DataBind(); newStanjeShop.DataBind(); break; case "Grad": newSupplierCity.DataSource = updSupplierCity.DataSource = newShopCity.DataSource = updShopCity.DataSource = newUserCity.DataSource = updUserCity.DataSource = dt; newSupplierCity.DataTextField = updSupplierCity.DataTextField = newShopCity.DataTextField = updShopCity.DataTextField = newUserCity.DataTextField = updUserCity.DataTextField = colomn; newSupplierCity.DataValueField = updSupplierCity.DataValueField = newShopCity.DataValueField = updShopCity.DataValueField = newUserCity.DataValueField = updUserCity.DataValueField = "ID"; updUserCity.DataBind(); newUserCity.DataBind(); newShopCity.DataBind(); updShopCity.DataBind(); updSupplierCity.DataBind(); newSupplierCity.DataBind(); break; } }
private void Filldepartmentdrp() { string strSql = "select OCE_ID, replace(convert(char(31),ltrim(OCE_DESCRIPTION ))+OCE_ID,' ','�' ) as DEPARTMENTNAME from ENT_ORG_COMMON_ENTITIES where OCE_ISDELETED='0' AND CEM_ENTITY_ID='DEP'"; 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); ListBox5.DataValueField = "oce_id"; ListBox5.DataTextField = "DEPARTMENTNAME"; ListBox5.DataSource = thisDataSet.Tables[0]; ListBox5.DataBind(); }
protected void ListBox4_OnTextChanged() { string conn = System.Configuration.ConfigurationSettings.AppSettings["DBCONN_Meeting"]; string sql_process = combine_List_box(ListBox4); string sql = "select distinct(t.layer) as layer from tlms_main t where t.PROCESS in(" + sql_process + ") and t.layer is not null"; ListBox5.Items.Clear(); ListBox5.DataTextField = "layer"; ListBox5.DataValueField = "layer"; DataSet ds_process = new DataSet(); ds_process = func.get_dataSet_access(sql, conn); ListBox5.DataSource = ds_process.Tables[0]; ListBox5.DataBind(); }
protected void Button4_Click(object sender, EventArgs e) // single pair { Label1.Text = "hi"; 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 = TextBox3.Text; int src1 = accounts1[src]; List <dstthrough> throughlist = new List <dstthrough>(); for (int i = 0; i < mygraph.Vertices.Count(); i++) { dstthrough obj; if (!src.Equals(mygraph.Vertices[i].Name)) { int dst = accounts1[mygraph.Vertices[i].Name.ToString()]; obj.dstination = mygraph.Vertices[i].Name; string res = findpath(D, dst, src1, 39); obj.throughdst = res; throughlist.Add(obj); } } List <string> dstt = new List <string>(); List <string> pth = new List <string>(); for (int i = 0; i < throughlist.Count(); i++) { string thr = ""; dstt.Add(throughlist[i].dstination); string[] values = throughlist[i].throughdst.Split(','); for (int j = 0; j < values.Length - 1; j++) { Label2.Text = values[j]; thr += accounts[Convert.ToInt32(values[j])] + "->"; } pth.Add(thr); } //Label1.Text = dstt[37]; ListBox4.DataSource = dstt; ListBox4.DataBind(); ListBox5.DataSource = pth; ListBox5.DataBind(); Page.ClientScript.RegisterStartupScript(this.GetType(), "script", " <script>singledstgraph();</script>"); // Label2.Text = throughlist.Count().ToString(); }
protected void lst2() { ListBox5.DataSource = Roles.GetAllRoles(); ListBox5.DataBind(); }
/// <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); }
private void Lst_SelectedIndexChanged(object sender, EventArgs e) { ListBox listBox = (ListBox)sender; ListBox list = new ListBox(); if (listBox == ListBox1) { ListBox2.Items.Clear(); ListBox3.Items.Clear(); ListBox4.Items.Clear(); ListBox5.Items.Clear(); cat_2.Visible = false; cat_3.Visible = false; cat_4.Visible = false; cat_5.Visible = false; list = ListBox2; IEnumerable <kategori> sonuc = ktg.list(Convert.ToInt32(listBox.SelectedValue)); if (sonuc.Any()) { cat_2.Visible = true; list.DataSource = sonuc; list.DataTextField = "kategoriAdi"; list.DataValueField = "kategoriId"; list.DataBind(); devam.Enabled = false; } else { Label lbl = new Label(); lbl.Text = "Seçim Tamamlandı !"; lbl.Attributes["class"] = "tamam"; Panel pnl = new Panel(); pnl.Attributes["class"] = "col-xs-12 col-sm-2"; pnl.Controls.Add(lbl); cats.Controls.Add(pnl); ViewState["id"] = Convert.ToInt32(ListBox1.SelectedValue); devam.Enabled = true; } } else if (listBox == ListBox2) { ListBox3.Items.Clear(); ListBox4.Items.Clear(); ListBox5.Items.Clear(); cat_3.Visible = false; cat_4.Visible = false; cat_5.Visible = false; list = ListBox3; // Her ik tablodan da bilgi çekiyoruz ilk önce kategoriTur tablosundaki verileri karşılaştırıyoruz. IEnumerable <object> sonuclar = (IEnumerable <object>)ktgT.list(1, ListBox2.SelectedValue); IEnumerable <kategori> sonuc = ktg.list(Convert.ToInt32(ListBox2.SelectedValue)); if (sonuclar.Any()) // kategoriTur tablosunda satılık kiralık vb. değeri var mı { cat_3.Visible = true; foreach (object key in sonuclar.ToList()) { if (key.ToString() == "{ turId = 1 }") { ListItem li = new ListItem(); li.Text = "Satılık"; li.Value = "1"; ListBox3.Items.Add(li); } if (key.ToString() == "{ turId = 2 }") { ListItem li = new ListItem(); li.Text = "Kiralık"; li.Value = "2"; ListBox3.Items.Add(li); } if (key.ToString() == "{ turId = 3 }") { ListItem li = new ListItem(); li.Text = "Günlük Kiralık"; li.Value = "3"; ListBox3.Items.Add(li); } if (key.ToString() == "{ turId = 4 }") { ListItem li = new ListItem(); li.Text = "Devren"; li.Value = "4"; ListBox3.Items.Add(li); } if (key.ToString() == "{ turId = 5 }") { ListItem li = new ListItem(); li.Text = "Devren Kiralık"; li.Value = "5"; ListBox3.Items.Add(li); } if (key.ToString() == "{ turId = 6 }") { ListItem li = new ListItem(); li.Text = "Devren Satılık Konut"; li.Value = "6"; ListBox3.Items.Add(li); } } devam.Enabled = false; } else if (sonuc.Any()) // kategori tablosunda alt kategoriler var mı { cat_3.Visible = true; ListBox3.DataSource = sonuc; ListBox3.DataTextField = "kategoriAdi"; ListBox3.DataValueField = "kategoriId"; ListBox3.DataBind(); devam.Enabled = false; } else { Label lbl = new Label(); lbl.Text = "Seçim Tamamlandı !"; lbl.Attributes["class"] = "tamam"; Panel pnl = new Panel(); pnl.Attributes["class"] = "col-xs-12 col-sm-2"; pnl.Controls.Add(lbl); cats.Controls.Add(pnl); ViewState["id"] = Convert.ToInt32(ListBox2.SelectedValue); devam.Enabled = true; } } else if (listBox == ListBox3) { ListBox4.Items.Clear(); ListBox5.Items.Clear(); cat_4.Visible = false; cat_5.Visible = false; list = ListBox4; IEnumerable <object> sonuclar = (IEnumerable <object>)ktgT.list(2, ListBox2.SelectedValue, ListBox3.SelectedValue); IEnumerable <kategori> sonuc = ktg.list(Convert.ToInt32(ListBox3.SelectedValue)); if (sonuclar.Any()) { cat_4.Visible = true; ListBox4.DataSource = sonuclar; ListBox4.DataTextField = "kategoriAdi"; ListBox4.DataValueField = "kategoriId"; ListBox4.DataBind(); devam.Enabled = false; ViewState["ilanTur"] = Convert.ToInt32(ListBox3.SelectedValue); } else if (ListBox1.SelectedValue != "1" || (ListBox2.SelectedValue != "4" && ListBox2.SelectedValue != "5")) // emlak kategorisi değiise veya (arsa ve bina değilse) { if (sonuc.Any()) { cat_4.Visible = true; ListBox4.DataSource = sonuc; ListBox4.DataTextField = "kategoriAdi"; ListBox4.DataValueField = "kategoriId"; ListBox4.DataBind(); devam.Enabled = false; } else { Label lbl = new Label(); lbl.Text = "Seçim Tamamlandı !"; lbl.Attributes["class"] = "tamam"; Panel pnl = new Panel(); pnl.Attributes["class"] = "col-xs-12 col-sm-2"; pnl.Controls.Add(lbl); cats.Controls.Add(pnl); devam.Enabled = true; ViewState["id"] = Convert.ToInt32(ListBox3.SelectedValue); } } else { Label lbl = new Label(); lbl.Text = "Seçim Tamamlandı !"; lbl.Attributes["class"] = "tamam"; Panel pnl = new Panel(); pnl.Attributes["class"] = "col-xs-12 col-sm-2"; pnl.Controls.Add(lbl); cats.Controls.Add(pnl); devam.Enabled = true; ViewState["ilanTur"] = Convert.ToInt32(ListBox3.SelectedValue); ViewState["id"] = Convert.ToInt32(ListBox2.SelectedValue); } } else if (listBox == ListBox4) { ListBox5.Items.Clear(); cat_5.Visible = false; list = ListBox5; IEnumerable <kategori> sonuc = ktg.list(Convert.ToInt32(ListBox4.SelectedValue)); if (sonuc.Any()) { cat_5.Visible = true; ListBox5.DataSource = sonuc; ListBox5.DataTextField = "kategoriAdi"; ListBox5.DataValueField = "kategoriId"; ListBox5.DataBind(); devam.Enabled = false; } else { Label lbl = new Label(); lbl.Text = "Seçim Tamamlandı !"; lbl.Attributes["class"] = "tamam"; Panel pnl = new Panel(); pnl.Attributes["class"] = "col-xs-12 col-sm-2"; pnl.Controls.Add(lbl); cats.Controls.Add(pnl); devam.Enabled = true; ViewState["id"] = Convert.ToInt32(ListBox4.SelectedValue); } } }