page_load()
{
....
SimpleMarkerOverlay smMarkerOverlay = new SimpleMarkerOverlay("simplevehiclelayer");
Map1.CustomOverlays.Add(smMarkerOverlay);
getVehicleData(cihazid);
}
private void getVehicleData(string _cihazid)
{
SimpleMarkerOverlay smMarkerOverlay = (SimpleMarkerOverlay)Map1.CustomOverlays["simplevehiclelayer"];
db db = null;
DataTable dt = new DataTable();
try
{
db = new db("AracTakip");
dbQueryDetails QueryDetails = new dbQueryDetails();
string fields = "CLIENTS.FLEETID, CLIENTS.PLAKA,CLIENTS.CIHAZID, CLIENTS.ARACTIPID, KONUMLAR.X," +
"KONUMLAR.Y, CLIENTS.STATUS, CLIENTS.ROLANTI, CLIENTS.KONTAK, " +
"KONUMLAR.SPEED, KONUMLAR.DATE, KONUMLAR.GPS, KONUMLAR.DIRECTION, KONUMLAR.SAT_COUNT, KONUMLAR.INSERTDATE," +
"CASE WHEN KONUMLAR.LOCATION IS NULL THEN KONUMLAR.LOCATION2 ELSE KONUMLAR.LOCATION END AS LOCATION";
string sql = String.Format("SELECT {0} FROM CLIENTS LEFT OUTER JOIN KONUMLAR ON CLIENTS.KONUMID = KONUMLAR.ID " +
"WHERE CLIENTS.CIHAZID =@CIHAZID AND CLIENTS.Silindi=0 AND (KONUMLAR.X <> 0 AND KONUMLAR.Y <>0) " +
"AND (KONUMLAR.X >= -90 AND KONUMLAR.X <= 90) AND (KONUMLAR.Y>= -90 AND KONUMLAR.Y <= 90) AND (KONUMLAR.X IS NOT NULL AND KONUMLAR.Y IS NOT NULL)", fields);
QueryDetails.CommandText = sql;
QueryDetails.addParam("CIHAZID", _cihazid);
dt = db.FillDataTable(QueryDetails);
List<double></double> lx = new List<double></double>();
List<double></double> ly = new List<double></double>();
useGoogle = false;
smMarkerOverlay.Markers.Clear();
for (int i = 0; i < dt.Rows.Count; i++)
{
if ((Convert.ToDouble(dt.Rows["X"].ToString()) != 0) && (Convert.ToDouble(dt.Rows["Y"].ToString()) != 0))
{
double xCoord = 0;
double.TryParse(dt.Rows["X"].ToString(), out xCoord);
double yCoord = 0;
double.TryParse(dt.Rows["Y"].ToString(), out yCoord);
int kontak = (int)dt.Rows["KONTAK"];
int aractip = (int)dt.Rows["ARACTIPID"];
bool rolanti = (bool)dt.Rows["ROLANTI"];
bool status = Convert.ToInt32(dt.Rows["STATUS"]) != 0;
double aci = 0;
double.TryParse(dt.Rows["DIRECTION"].ToString(), out aci);
//------ 01-06-2009 Not : ilgili aracın baglantı kopukluğu 60 dk ve uzeri ise arıcı baglantısı kopuk gosteriyoruz ------//
DateTime InsertDate = Convert.ToDateTime(dt.Rows["INSERTDATE"].ToString());
int iStatus = 0;
TimeSpan tm = DateTime.Now - InsertDate;
if ((!status) && (tm.TotalMinutes >= 60))
{
iStatus = 4;
}
else
{
if (kontak == 1 && !rolanti) iStatus = 1;
else if (kontak == 1 && rolanti) iStatus = 2;
else if (kontak == 0) iStatus = 3;
}
if (dt.Rows["gps"].ToString() == "1")
{
switch (iStatus)
{
case 1: lblDurum.Text = "Kontak Açık"; break;
case 2: lblDurum.Text = "Araç rölantide"; break;
case 3: lblDurum.Text = "Kontak Kapalı"; break;
default: lblDurum.Text = "Veri alınamadı"; break;
}
}
else
{
lblDurum.Text = "GPS bağlantısı yok";
}
lblHiz.Text = dt.Rows["SPEED"].ToString() + " km/s";
lblKonum.Text = dt.Rows["LOCATION"].ToString();
lblPlaka.Text = dt.Rows["PLAKA"].ToString();
lblTarih.Text = dt.Rows["DATE"].ToString();
lblX.Text = dt.Rows["X"].ToString();
lblY.Text = dt.Rows["Y"].ToString();
lblYon.Text = Convert.ToInt16(dt.Rows["DIRECTION"]).ToString() + " derece";
HiddenField1.Value = Convert.ToInt16(dt.Rows["DIRECTION"]).ToString();
string vStatus = String.Format("{0:000}", iStatus);
string vFolder = (aractip > 0) ? aractip.ToString() + "/" : "";
string imagePath = String.Format("images/vTypes/{0}{1}.gif", vFolder, vStatus);
Vertex v = MapGlobals.ConvertCoord(xCoord, yCoord, true);
lx.Add(v.X);
ly.Add(v.Y);
Marker vm = new Marker(v.X, v.Y);
if (useGoogle == false)
{
Feature feature = new Feature(vm.Position);
if (!turkeyShape.Contains(feature))
{
mapType = "google";
useGoogle = true;
}
else
{
mapType = "asis";
}
}
vm.WebImage = new WebImage(imagePath);
smMarkerOverlay.Markers.Add(vm);
Marker vm2 = new Marker(v.X, v.Y);
string imagePath2 = (!true) ? "images/pointer/001.gif" : "rotate.aspx?aci=" + aci.ToString() + "&durum=" + iStatus.ToString();
vm2.WebImage = new WebImage(imagePath2);
smMarkerOverlay.Markers.Add(vm2);
}
}
lx.Sort();
ly.Sort();
if (lx.Count > 0)
{
double x1 = lx[0];
double y1 = ly[0];
double x2 = lx.Last<double></double>();
double y2 = ly.Last<double></double>();
//if (!IsPostBack)
Map1.CurrentExtent = new RectangleShape(x1, y2, x2, y1);
}
PointShape point = Map1.CurrentExtent.GetCenterPoint(); // new PointShape();
// Map1.CenterAt(point);
Map1.ZoomTo(point, Map1.ClientZoomLevelScales[12]);
}
finally
{
if (db != null) db.Dispose();
}
}
protected void Timer1_Tick(object sender, EventArgs e)
{
getVehicleData(cihazid);
// Response.Redirect(Request.Url.ToString());
}
After the page fully loaded the timer occurs in each 30 seconds, when I redirect the page to the same url in timer event it works fine but calling "getVehicleData" in timer event and when I use google map I get theese errors. (NOT : with our map files it works)
İleti: 'null', null veya bir nesne değil
Satır: 780
Karakter: 167
Kod: 0
URI: localhost:52442/opl_GeoResource.axd
and
İleti: Sys.WebForms.PageRequestManagerServerErrorException: Verilen anahtar sözlükte yoktu.
Satır: 4723
Karakter: 21
Kod: 0
URI: 213.144.99.143/ScriptResource.axd?d=viONE7k43dmNs2aFCUXk_NAtyO6j4IdG_fJAk4ja8C_G4WTP7_2wqIgKToCezzCHVUy_um1UXkiLctrfKkh7XxWcHNrJgW7sTFVXKsfHSGs1&t=ffffffffec2d9970
I also put these scripts after the form opening tag but still I get same errors
opl_GeoResource.axd, extension_GeoResource.axd,helper_GeoResource.axd,
parser_GeoResource.axd,func_GeoResource.axd,cm_GeoResource.axd
you can try this link...
213.144.99.143/watchlive3.aspx?cihazid=20100064&sid=304123498765&uid=304&mapType=asis
just wait 30 secconds.
Thanks.