protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["province"] != null && Request.QueryString["city"] != null) { Bll.SupplierBll sb = new Bll.SupplierBll(); DataTable dt = sb.GetAny("select * from tab_suppliers where province like N'" + Request.QueryString["province"] + "' and city like N'" + Request.QueryString["city"] + "'"); GMap1.Add(new GControl(GControl.preBuilt.GOverviewMapControl)); GMap1.Add(new GControl(GControl.preBuilt.LargeMapControl)); GMarker marker; GInfoWindow window; double lat, lng, clat = 0.0, clng = 0.0; foreach (DataRow dr in dt.Rows) { lat = Convert.ToDouble(dr["lat"]); lng = Convert.ToDouble(dr["lng"]); clat += lat; clng += lng; marker = new GMarker(new GLatLng(lat, lng)); window = new GInfoWindow(marker, "<center><b>" + dr["supplier"].ToString() + "</b><br />" + dr["branch"].ToString() + "</center>", false); GMap1.Add(window); } clat /= dt.Rows.Count; clng /= dt.Rows.Count; GMap1.enableHookMouseWheelToZoom = true; GMap1.setCenter(new GLatLng(clat, clng), 12); } } }
public void fillsupplier(Model.tab_customers modelCu, DropDownList com_Province, DropDownList com_City, DropDownList DropDownList1) { string s = "select distinct supplier from tab_suppliers where id in (" + comb.getavailablesupplier(modelCu.customerCompany) + ") and province like N'" + com_Province.SelectedValue + "'"; if (com_City.SelectedValue != (string)GetGlobalResourceObject("GResource", "com_CityResource1")) { s += " and city like N'" + com_City.SelectedValue + "'"; } if (modelCu.disablebranch != "") { s += " and supplier not in (" + modelCu.disablebranch + ")"; } DataTable dt = sb.GetAny(s); DropDownList1.DataTextField = "supplier";//DropDownList1 DropDownList1.DataValueField = "supplier"; DropDownList1.DataSource = dt.DefaultView; DropDownList1.DataBind(); DropDownList1.Items.Insert(0, new ListItem((string)GetGlobalResourceObject("GResource", "DropDownList1Resource1")));// }