private void GetLicenseCode() { DdlLicensCode.DataSource = GlobFuncs.GetDDL("LicenseLevelTable", "LicenseId", "LicenseName"); DdlLicensCode.DataTextField = "name"; DdlLicensCode.DataValueField = "id"; DdlLicensCode.DataBind(); }
private void GetCityList() { TxtCity.DataSource = GlobFuncs.GetDDL("CityTable", "CityId", "CityName"); TxtCity.DataTextField = "name"; TxtCity.DataValueField = "id"; TxtCity.DataBind(); }
//מתודה המקבלת רשימה נפתחת ומביאה את הנתונים שלו private DropDownList GetDropDownList(DropDownList ddl, string table, string idField, string textField) { ddl.DataSource = GlobFuncs.GetDDL(table, idField, textField); ddl.DataValueField = "id"; ddl.DataTextField = "name"; ddl.DataBind(); return(ddl); }
private void GetDdlCitys() { DdlPickupLocation.DataSource = GlobFuncs.GetDDL("CityTable", "CityId", "CityName"); DdlPickupLocation.DataTextField = "name"; DdlPickupLocation.DataValueField = "id"; DdlPickupLocation.DataBind(); DdlReturnLocation.DataSource = GlobFuncs.GetDDL("CityTable", "CityId", "CityName"); DdlReturnLocation.DataTextField = "name"; DdlReturnLocation.DataValueField = "id"; DdlReturnLocation.DataBind(); }
protected void getJson() { searchBLL search = (searchBLL)Session["search"]; string id = Request["search"]; if (id != null) { search = GlobFuncs.getSearchById(int.Parse(id)); } if (search == null) { Response.Redirect("search.aspx"); } if (search.PickupDate.Contains("/")) { search.PickupDate = search.PickupDate.Substring(0, 10); search.ReturnDate = search.ReturnDate.Substring(0, 10); string pickdate = search.PickupDate.Substring(6, 4); string retdate = search.ReturnDate.Substring(6, 4); pickdate = pickdate + "-"; retdate = retdate + "-"; pickdate = pickdate + search.PickupDate.Substring(0, 2); retdate = retdate + search.ReturnDate.Substring(0, 2); pickdate = pickdate + "-"; retdate = retdate + "-"; pickdate = pickdate + search.PickupDate.Substring(3, 2); retdate = retdate + search.ReturnDate.Substring(3, 2); search.PickupDate = pickdate; search.ReturnDate = retdate; } string ret = search.GetList(); LtlMsg.Text = "<script>var cars=JSON.parse(" + ret + ")\n var companys = " + GlobFuncs.GetCompanyList() + "</script>"; DdlPickupLocation.DataSource = GlobFuncs.GetDDL("CityTable", "CityId", "CityName"); DdlPickupLocation.DataTextField = "name"; DdlPickupLocation.DataValueField = "id"; DdlPickupLocation.DataBind(); DdlPickupLocation.SelectedValue = search.PickupLocation; DdlReturnLocation.DataSource = GlobFuncs.GetDDL("CityTable", "CityId", "CityName"); DdlReturnLocation.DataTextField = "name"; DdlReturnLocation.DataValueField = "id"; DdlReturnLocation.DataBind(); DdlReturnLocation.SelectedValue = search.ReturnLocarion; string date = search.PickupDate + " - " + search.ReturnDate; ReturnDate.Text = date.Substring(5, 2) + "/" + date.Substring(8, 2) + "/" + date.Substring(0, 4) + " - " + date.Substring(18, 2) + "/" + date.Substring(21, 2) + "/" + date.Substring(13, 4); if (ret.Length < 20) { showErrorMwssage(2009); } }
//פונקציה המקבלת אובייקת רשימה נפתחת וטבלת ערכים ומאתחלת את הרשימה private void getDdlSource(DropDownList dropDownList, string tableName, string idName, string valueName, string moreLine) { if (moreLine.Length > 0) { dropDownList.DataSource = GlobFuncs.addMoreLine(GlobFuncs.GetDDL(tableName, idName, valueName), moreLine); } else { dropDownList.DataSource = GlobFuncs.GetDDL(tableName, idName, valueName); } dropDownList.DataTextField = "name"; dropDownList.DataValueField = "id"; dropDownList.DataBind(); }
//פונקציה שרצה כאשר נבחר אחד מהשדות באחד מהרשימות הנפתחות protected void checkSelectedIndexChanged(object sender, EventArgs e) { DropDownList drop = (DropDownList)sender; if (drop.ID == "companyDdl") { //בדיקה האם נבחר שדה של חברה קיימת string index = companyDdl.SelectedValue; if (index != "-1" && index != "9999") { company company = new company(); company = systemFields.getComapnyData(int.Parse(index)); txtApiAddress.Text = company.apiAddress; txtCompanyLogo.Text = company.logo; txtCompanyName.Text = company.CompanyName; txtContuctName.Text = company.contact; txtRemarks.Text = company.remarks; txtSiteAddress.Text = company.siteAddress; } else if (companyDdl.SelectedValue == "9999")//במידה ונבחר הוספת חברה חדשה { txtApiAddress.Text = ""; txtCompanyLogo.Text = ""; txtCompanyName.Text = ""; txtContuctName.Text = ""; txtRemarks.Text = ""; txtSiteAddress.Text = ""; } companyBlok.Visible = true; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToCompanys()", true); } else if (drop.ID == "companyDdl1")//בדיקה האם מדובר ברשימת חברות שנפתחת כאשר רוצים לערוך סניף { branchDdl.DataSource = GlobFuncs.addMoreLine(GlobFuncs.getDDlWithCondition("BranchTable", "BranchId", "Address", "CompanyId", int.Parse(drop.SelectedValue)), " סניף נוסף "); branchDdl.DataTextField = "name"; branchDdl.DataValueField = "id"; branchDdl.DataBind(); brancDdlhBlok.Visible = true; ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToBranchs()", true); } else if (drop.ID == "branchDdl")//בדיקה האם מדובר ברשימה נפתחת של סניפים { branchBlok.Visible = true; if (branchDdl.SelectedValue != "9999" && branchDdl.SelectedValue != "-1")//בדיקה האם נבחר ערך של סניף קיים { configurationFields.branch branch = new configurationFields.branch(); branch = systemFields.getBranchData(int.Parse(branchDdl.SelectedValue)); txtBranchAddress.Text = branch.Address; txtBranchPhone.Text = branch.Phone; cityForBranchDdl.DataSource = GlobFuncs.GetDDL("CityTable", "CityId", "CityName"); cityForBranchDdl.DataTextField = "name"; cityForBranchDdl.DataValueField = "id"; cityForBranchDdl.DataBind(); cityForBranchDdl.SelectedValue = branch.CityId.ToString(); } else//במידה ולא נבחר ערך של סניף קיים { cityForBranchDdl.DataSource = GlobFuncs.GetDDL("CityTable", "CityId", "CityName"); cityForBranchDdl.DataTextField = "name"; cityForBranchDdl.DataValueField = "id"; cityForBranchDdl.DataBind(); txtBranchAddress.Text = ""; txtBranchPhone.Text = ""; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToBranchs()", true); } else if (drop.ID == "ddlCity")//בדיקה האם מדובר ברשימה נפתחת של ערים { cityBlok.Visible = true; if (ddlCity.SelectedValue != "9999" && ddlCity.SelectedValue != "-1") { txtCity.Text = systemFields.getCityName(int.Parse(ddlCity.SelectedValue)); } else { txtCity.Text = ""; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToCity()", true); } else if (drop.ID == "carLevelDdl")//בדיקה האם מדובר ברשימה נפתחת של דרגות רכבים { carLevelBlok.Visible = true; if (carLevelDdl.SelectedValue != "9999" && carLevelDdl.SelectedValue != "-1") { txtCarLevel.Text = systemFields.getCarLevelName(int.Parse(carLevelDdl.SelectedValue)); } else { txtCarLevel.Text = ""; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "navigate", "goToCarLevel()", true); } }