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; } }
protected void lbRole3_Fill(string qrSobese) { sdsZakaz.ConnectionString = DBconnection.connection.ConnectionString.ToString(); sdsZakaz.SelectCommand = qrSobese; sdsZakaz.DataSourceMode = SqlDataSourceMode.DataReader; ListBox4.DataSource = sdsZakaz; ListBox4.DataTextField = "Название статуса"; ListBox4.DataValueField = "ID_Status"; ListBox4.DataBind(); }
private void Filldivisiondrp() { string strSql = "select OCE_ID,replace(convert(char(31),ltrim(OCE_DESCRIPTION ))+OCE_ID,' ','�' ) as DIVISIONNAME from ENT_ORG_COMMON_ENTITIES where OCE_ISDELETED='0' AND CEM_ENTITY_ID='DIV'"; 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); ListBox4.DataValueField = "oce_id"; ListBox4.DataTextField = "DIVISIONNAME"; ListBox4.DataSource = thisDataSet.Tables[0]; ListBox4.DataBind(); }
protected void ListBox3_SelectedIndexChanged(object sender, EventArgs e) { if (ListBox3.SelectedValue != "") { ListItem lt2 = new ListItem(); lt2.Value = ""; ListBox4.DataSource = new DAL.GoodsTypeDAO().getGoodsTypesByParentNum(ListBox3.SelectedValue); ListBox4.DataTextField = "goodsTypeName"; ListBox4.DataValueField = "goodsTypeNum"; ListBox4.DataBind(); ListBox4.Items.Add(lt2); ListBox4.SelectedValue = ""; } else { ListBox4.Items.Clear(); ListBox1.Items.Clear(); } }
protected void Page_Load(object sender, EventArgs e) { ListBox1.Items.Clear(); dt.Clear(); komanda = "EXEC listItems 'Dobavljac'"; da = new SqlDataAdapter(komanda, conn); da.Fill(dt); ListBox1.DataSource = dt; ListBox1.DataTextField = "Naziv"; ListBox1.DataBind(); ListBox2.Items.Clear(); dt.Clear(); komanda = "EXEC listItems 'Prodavnica'"; da = new SqlDataAdapter(komanda, conn); da.Fill(dt); ListBox2.DataSource = dt; ListBox2.DataTextField = "Naziv"; ListBox2.DataBind(); ListBox3.Items.Clear(); dt.Clear(); komanda = "EXEC listItems 'KatArt'"; da = new SqlDataAdapter(komanda, conn); da.Fill(dt); ListBox3.DataSource = dt; ListBox3.DataTextField = "Naziv"; ListBox3.DataBind(); ListBox3.SelectedIndex = 0; ListBox4.Items.Clear(); dt.Clear(); komanda = "SELECT Naziv FROM Artikal WHERE KatArtID='" + (ListBox3.SelectedIndex + 1).ToString() + "'"; da = new SqlDataAdapter(komanda, conn); da.Fill(dt); ListBox4.DataSource = dt; ListBox4.DataTextField = "Naziv"; ListBox4.DataBind(); dt.Clear(); }
public void bindTable(string table, DataTable dt, string colomn = "Naziv") { switch (table) { case "Artikal": ListBox4.DataSource = dt; ListBox4.DataTextField = colomn; ListBox4.DataValueField = "ID"; ListBox4.DataBind(); break; case "KatArt": KatArt.DataSource = ListBox3.DataSource = dt; KatArt.DataTextField = ListBox3.DataTextField = colomn; KatArt.DataValueField = ListBox3.DataValueField = "ID"; KatArt.DataBind(); ListBox3.DataBind(); ListBox3.SelectedIndex = 0; break; case "Dobavljac": Supplier.DataSource = ListBox1.DataSource = dt; Supplier.DataTextField = ListBox1.DataTextField = colomn; Supplier.DataValueField = ListBox1.DataValueField = "ID"; Supplier.DataBind(); ListBox1.DataBind(); break; case "Korisnik": ListBox2.DataSource = dt; ListBox2.DataTextField = colomn; ListBox2.DataValueField = "ID"; ListBox2.DataBind(); break; } }
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(); }
/// <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); } } }
private void fillEntities() { string mgrId = Session["uid"].ToString(); string levelId = Session["levelId"].ToString(); //SqlConnection con = new SqlCOConnection(m_connectons); if (conString.State == ConnectionState.Closed) { conString.Open(); } SqlCommand cmd = new SqlCommand("spFillEntities2", conString); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@levelid", levelId); SqlDataAdapter adpt = new SqlDataAdapter(cmd); DataSet thisDataSet = new DataSet(); adpt.Fill(thisDataSet); if (conString.State == ConnectionState.Open) { conString.Close(); } ListBox1.DataValueField = "EOD_EMPID"; ListBox1.DataTextField = "EmployeeName"; ListBox1.DataSource = thisDataSet.Tables[0]; ListBox1.DataBind(); ListBox7.DataValueField = "EOD_EMPID"; ListBox7.DataTextField = "EmployeeName"; ListBox7.DataSource = thisDataSet.Tables[0]; ListBox7.DataBind(); DataTable dtDivision = thisDataSet.Tables[3].DefaultView.ToTable(true, "DivisionID", "Division_NAME"); ListBox4.DataValueField = "DivisionID"; ListBox4.DataTextField = "Division_NAME"; ListBox4.DataSource = dtDivision; ListBox4.DataBind(); ListBox10.DataValueField = "DivisionID"; ListBox10.DataTextField = "Division_NAME"; ListBox10.DataSource = thisDataSet.Tables[3]; ListBox10.DataBind(); DataTable dtLocation = thisDataSet.Tables[1].DefaultView.ToTable(true, "LocationID", "Location_NAME"); ListBox3.DataValueField = "LocationID"; ListBox3.DataTextField = "Location_NAME"; ListBox3.DataSource = dtLocation; ListBox3.DataBind(); ListBox9.DataValueField = "LocationID"; ListBox9.DataTextField = "Location_NAME"; ListBox9.DataSource = thisDataSet.Tables[1]; ListBox9.DataBind(); }