protected void ddlBaseLocation_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlBaseLocation.SelectedIndex != 0)
            {
                DataSet dsblcn = new DataSet();
                dsblcn = (DataSet)ViewState["ContactNumber"];
                DataView dv = new DataView(dsblcn.Tables[0], "Location_ID =" + Convert.ToInt32(ddlBaseLocation.SelectedItem.Value), "Contact_Number", DataViewRowState.CurrentRows);
                txtContactNumber.Text = dv[0]["Contact_Number"].ToString();
                txtLatitude.Text      = dv[0]["latitude"].ToString();
                txtLongitude.Text     = dv[0]["longitude"].ToString();
                ClsGeneral csg       = new ClsGeneral();
                DataTable  dtVehData = new DataTable();
                dtVehData = csg.getVehiclesinRadius(txtLatitude.Text, txtLongitude.Text, ConfigurationSettings.AppSettings["Locateveh"].ToString());

                if (dtVehData.Rows.Count > 0)
                {
                    lblVeh.Text = "Vehicles that are under " + ConfigurationSettings.AppSettings["Locateveh"].ToString() + "KMs to base location ";
                    grdVehicleData.DataSource = dtVehData;
                    grdVehicleData.DataBind();
                }
            }
            else
            {
                txtContactNumber.Text = "";
                txtLatitude.Text      = "";
                txtLongitude.Text     = "";
            }
        }
Beispiel #2
0
    protected void ddlBaseLocation_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (ddlBaseLocation == null)
        {
            return;
        }
        try
        {
            switch (ddlBaseLocation.SelectedIndex)
            {
            case 0:
                txtContactNumber.Text = "";
                txtLatitude.Text      = "";
                txtLongitude.Text     = "";
                break;

            default:
                var dsblcn = (DataSet)ViewState["ContactNumber"];
                var dv     = new DataView(dsblcn.Tables[0], "Location_ID =" + Convert.ToInt32(ddlBaseLocation.SelectedItem.Value), "Contact_Number", DataViewRowState.CurrentRows);
                txtContactNumber.Text = dv[0]["Contact_Number"].ToString();
                txtLatitude.Text      = dv[0]["latitude"].ToString();
                txtLongitude.Text     = dv[0]["longitude"].ToString();
                var csg       = new ClsGeneral();
                var dtVehData = csg.getVehiclesinRadius(txtLatitude.Text, txtLongitude.Text, ConfigurationManager.AppSettings["Locateveh"]);
                if (dtVehData.Rows.Count > 0)
                {
                    lblVeh.Text = "Vehicles that are under " + ConfigurationManager.AppSettings["Locateveh"] + "KMs to base location ";
                    grdVehicleData.DataSource = dtVehData;
                    grdVehicleData.DataBind();
                }

                break;
            }
        }
        catch (Exception ex)
        {
            _helper.ErrorsEntry(ex);
        }
    }