protected void btn_Update_Click(object sender, EventArgs e) { ibuckethead bucket = new ibuckethead(); string atm = bucket.cleanText(txt_atm); string location = bucket.cleanText(txt_location); string addressLine1 = bucket.cleanText(txt_addressline1); string addressLine2 = bucket.cleanText(txt_addressline2); string city = bucket.cleanText(txt_City);; string pinCode = bucket.cleanText(txt_Pin); string state = bucket.cleanText(txt_state); string bank = bucket.cleanText(txt_bank); string customer = bucket.cleanText(txt_customer); string siteNumber = bucket.cleanText(txt_sitenumber); string status = null; if (rdb_active.Checked) { status = "Active"; } else if (rdb_inactive.Checked) { status = "Inactive"; } if (atm == "NA") { checkErr(user_err, txt_atm); } else if (location == "NA") { checkErr(user_err0, txt_location); } else if (bank == "NA") { checkErr(user_err1, txt_bank); } else if (customer == "NA") { checkErr(user_err2, txt_customer); } else { string q = @"insert into ATMs(atmid, location, bankid, sitenumber, client, status, addressline1, addressline2, city, pin, state) values ('" + atm + "','" + location + "','" + bank + "','" + siteNumber + "','" + customer + "','" + status + "','" + addressLine1 + "','" + addressLine2 + "','" + city + "','" + pinCode + "','" + state + "')"; if (bucket.ExecuteQuery(q) == "Success") { Response.Redirect("Atms.aspx"); } else { Response.Write("Error"); } } }
protected void Page_Load(object sender, EventArgs e) { ibuckethead bucket = new ibuckethead(); //bucket.ExecuteQuery("Delete from DR_CTP where atmid='null' and vdate='null'"); string q1 = "select distinct COUNT(atmid) as 'atmid' from ATMs where atmstatus <> 'DEL' and atmstatus<>'Inactive'"; string[] a1 = bucket.verifyReader(q1, "atmid"); lbl_siteassigned.Text = a1[0]; }
protected void Page_Load(object sender, EventArgs e) { ibuckethead bucket = new ibuckethead(); if (!IsPostBack) { fillddstate(); fillddbank(); } }
public void drawmap(string users) { mapwithanimation = ""; string sb = ""; try { DataTable dt = new DataTable(); // Query to get the user longlat of User ibuckethead bucket = new ibuckethead(); //if (Request.QueryString["userid"] != "") //{ dt = bucket.BindoboutGrid(@"Select case when d.siteid='NA' then vid else d.siteid end , d.lat,d.long,ldate,ltime from distance d inner join users u on u.userid = d.userid left outer join atms a on a.siteid=d.siteid where d.userid like '" + users + @"' and ldate=Convert(date,'" + txt_frmDate.Text + @"') and d.lat <> '0' and d.long <> '0' order by Ltime "); /*Response.Write(@"Select case when d.siteid='NA' then vid else d.siteid end , * d.lat,d.long,ldate,ltime from distance d * inner join users u on u.userid = d.userid * left outer join atms a on a.siteid=d.siteid * where d.userid like '" + users + @"' * and ldate=Convert(date,'" + txt_frmDate.Text + @"') * and d.lat <> '0' and d.long <> '0'");*/ //} ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //GOOGLE MAP Specific Code will come here string usercoor = ""; string path = ""; if (dt.Rows.Count > 0) { // usercoor += "['" + dt.Rows[0][0].ToString() + "'," + dt.Rows[0][1].ToString() + "," + dt.Rows[0][2].ToString() + "],"; // usercoor += "['" + dt.Rows[0][0].ToString() + "'," + dt.Rows[dt.Rows.Count - 1][1].ToString() + "," + dt.Rows[dt.Rows.Count - 1][2].ToString() + "]"; for (int i = 0; i < dt.Rows.Count; i++) { //path += "{ lat: " + dt.Rows[i][1].ToString() + ", lng: " + dt.Rows[i][2].ToString() + "},"; usercoor += "['" + dt.Rows[i][0].ToString() + "'," + dt.Rows[i][1].ToString() + "," + dt.Rows[i][2].ToString() + "],"; } } string sql = @"select l_lat,l_long from locationhist where userid='" + users + @"' and convert(date,l_date)='" + txt_frmDate.Text + @"' and convert(time,l_time) between '" + dt.Rows[0][4].ToString() + "' and '" + dt.Rows[dt.Rows.Count - 1][4].ToString() + @"' order by CONVERT(time, replace(l_time,' ','')) asc"; dt = null; //Response.Write("-----------------"+sql); dt = bucket.BindoboutGrid(sql); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { path += "{ lat: " + dt.Rows[i][0].ToString() + ", lng: " + dt.Rows[i][1].ToString() + "},"; } } mapwithanimation = @"<script> try{ function initMap() { var userCoor = [ " + usercoor.TrimEnd(',') + @"]; var map = new google.maps.Map(document.getElementById('map'), { center: { lat: " + dt.Rows[0][0].ToString() + @", lng: " + dt.Rows[0][1].ToString() + @" }, zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP }); // Define the symbol, using one of the predefined paths ('CIRCLE') // supplied by the Google Maps JavaScript API. var a= 0; var lineSymbol = { path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW, scale: 2, strokeColor: '#0000FF' }; // Create the polyline and add the symbol to it via the 'icons' property. var line = new google.maps.Polyline({ path: [ " + path.TrimEnd(',') + @" ], // path: [ { lat: 18.45202353, lng: 73.81140579 }, { lat: 23.0921453, lng: 72.5901526 }], icons: [{ icon: lineSymbol, offset: '100%' }], strokeColor: '#FF0000', map: map }); var infowindow = new google.maps.InfoWindow({ //content: contentString }); for (i = 0; i < userCoor.length; i++) { if(userCoor[i][0]== 'PUNCHIN'){// if(i==0){ var marker = new google.maps.Marker({ position: new google.maps.LatLng(userCoor[i][1], userCoor[i][2]), map: map, title: '', icon: new google.maps.MarkerImage('./Image/green-dot.png') }); } else if(userCoor[i][0] == 'PUNCHOUT'){ //if(i == userCoor.length - 1){ var marker = new google.maps.Marker({ position: new google.maps.LatLng(userCoor[i][1], userCoor[i][2]), map: map, title: '', icon: new google.maps.MarkerImage('./Image/red-dot.png') }); } else { var marker = new google.maps.Marker({ position: new google.maps.LatLng(userCoor[i][1], userCoor[i][2]), map: map, title: '', icon: new google.maps.MarkerImage('./Image/blue-dot.png') }); } google.maps.event.addListener(marker, 'click', (function (marker, i) { return function () { var latlng = new google.maps.LatLng(userCoor[i][1],userCoor[i][2]); var geocoder = geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'latLng': latlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { var contentString = ' '; contentString = '<p> Siteid : ' + userCoor[i][0] +' <br />' +' Address : ' + results[1].formatted_address +'</p>'; // contentString = results[1].formatted_address; infowindow.setContent(contentString);//userCoor[i][0] infowindow.open(map, marker); } } }); } })(marker, i)); } animateCircle(line); } // Use the DOM setInterval() function to change the offset of the symbol // at fixed intervals. function animateCircle(line) { var count = 0; window.setInterval(function () { count = (count + 1) % 200; var icons = line.get('icons'); icons[0].offset = (count / 2) + '%'; line.set('icons', icons); }, 200); } } catch(ee) { alert(ee); } </script>"; } catch (Exception) { mapwithanimation = "No details found.."; } Session["sess_x"] = mapwithanimation; }
public void drawmap() { mapwithanimation = ""; try { DataTable dt = new DataTable(); ibuckethead bucket = new ibuckethead(); SqlCommand cmd = new SqlCommand(@"SELECT STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT '{ lat: ' + l_lat + ', lng:'+ l_long+'},' as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' ) alldata order by CONVERT(time, replace(l_time,' ','')) asc FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1 ' User ID : ' +userid +'<br/>Engineer Name : '+ username +'<br/> Mobile No : '+ contactno as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' ) alldata order by CONVERT(time, replace(l_time,' ','')) asc FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1 '[' + l_lat + ','+ l_long+'],' as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' order by CONVERT(time, replace(l_time,' ','')) asc ) alldata FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1 '[' + l_lat + ','+ l_long+'],' as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' order by CONVERT(time, replace(l_time,' ','')) desc ) alldata FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1000 '[' + lat + ','+ lon+ ', '+CHAR(39)+' PM Date Time : '+Convert(varchar(10),Convert(date,vdate),103)+' '+vtime+'<br/>ATMID : '+ATMID+ CHAR(39)+'],' as[Data],vtime,vdate,ATMID from DR_CTP where vdate ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(vtime,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' order by CONVERT(time, replace(vtime,' ','')) asc ) alldata FOR XML PATH('') ) , 1 , 0 , '' )"); // Response.Write(cmd.CommandText); cmd.CommandTimeout = 999999; dt = bucket.GetData(cmd); string usercoor = ""; string lat = ""; string lng = ""; string path = ""; string uadd = ""; string audits = ""; if (dt.Rows.Count > 0) { path += dt.Rows[0][0].ToString(); string[] parts = dt.Rows[0][2].ToString().Split(','); lat = parts[0].Replace('[', ' '); lng = parts[1].Replace(']', ' '); usercoor += dt.Rows[0][2].ToString() + dt.Rows[0][3].ToString(); uadd = dt.Rows[0][1].ToString(); try { audits += dt.Rows[0][4].ToString(); } catch (Exception ex) { } } mapwithanimation = @"<script> try{ function initMap() { var userCoor = [ " + usercoor.TrimEnd(',') + @"]; var auditCoor = [" + audits.TrimEnd(',') + @"] var uaddress = '" + uadd + @"'; var map = new google.maps.Map(document.getElementById('map'), { center: { lat: " + lat + @" ,lng: " + lng + @"}, zoom: 10, mapTypeId: google.maps.MapTypeId.ROADMAP }); // Define the symbol, using one of the predefined paths ('CIRCLE') // supplied by the Google Maps JavaScript API. var a= 0; var lineSymbol = { path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW, scale: 2, strokeColor: '#0000FF' }; // Create the polyline and add the symbol to it via the 'icons' property. var line = new google.maps.Polyline({ path: [ " + path.TrimEnd(',') + @" ], // path: [ { lat: 18.45202353, lng: 73.81140579 }, { lat: 23.0921453, lng: 72.5901526 }], icons: [{ icon: lineSymbol, offset: '100%' }], strokeColor: '#FF0000', map: map }); var infowindow = new google.maps.InfoWindow({ //content: contentString }); for (i = 0; i < userCoor.length; i++) { if(i==0){ var marker = new google.maps.Marker({ position: new google.maps.LatLng(userCoor[i][0], userCoor[i][1]), map: map, title: '', icon: new google.maps.MarkerImage('http://maps.google.com/mapfiles/ms/icons/green-dot.png') }); } else{ var marker = new google.maps.Marker({ position: new google.maps.LatLng(userCoor[i][0], userCoor[i][1]), map: map, title: '', icon: new google.maps.MarkerImage('http://maps.google.com/mapfiles/ms/icons/red-dot.png') }); } google.maps.event.addListener(marker, 'click', (function (marker, i) { return function () { var latlng = new google.maps.LatLng(userCoor[i][0],userCoor[i][1]); var geocoder = geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'latLng': latlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { var contentString = ' '; contentString = uaddress +'<p> Address : ' + results[1].formatted_address +'</p>';// results[1].formatted_address; infowindow.setContent(contentString);//userCoor[i][3] infowindow.open(map, marker); } } }); } })(marker, i)); } for (i = 0; i < auditCoor.length; i++) { if(auditCoor.length != 0){ var marker1 = new google.maps.Marker({ position: new google.maps.LatLng(auditCoor[i][0], auditCoor[i][1]), map: map, title: '', icon: new google.maps.MarkerImage('http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='+(i+1)+'|8E67FD|FFFFFF') }); } google.maps.event.addListener(marker1, 'click', (function (marker, i) { return function () { var latlng = new google.maps.LatLng(auditCoor[i][0],auditCoor[i][1]); var geocoder = geocoder = new google.maps.Geocoder(); geocoder.geocode({ 'latLng': latlng }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { if (results[1]) { var contentString = ' '; contentString = uaddress + '<br/>' + auditCoor[i][2] + '<p> Address : ' + results[1].formatted_address +'</p>';// results[1].formatted_address; infowindow.setContent(contentString);//userCoor[i][3] infowindow.open(map, marker); } } }); } })(marker1, i)); } animateCircle(line); } // Use the DOM setInterval() function to change the offset of the symbol // at fixed intervals. function animateCircle(line) { var count = 0; window.setInterval(function () { count = (count + 1) % 200; var icons = line.get('icons'); icons[0].offset = (count / 2) + '%'; line.set('icons', icons); }, 200); } } catch(ee) { alert(ee); } </script>"; } catch (Exception) { mapwithanimation = "No details found.."; } Session["sess_x"] = mapwithanimation; }
public void drawosmmap() { mapwithanimation = ""; try { DataTable dt = new DataTable(); ibuckethead bucket = new ibuckethead(); SqlCommand cmd = new SqlCommand(@"SELECT STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT 'ol.proj.transform([' + l_long + ','+ l_lat+'], 'EPSG:4326','EPSG:3857'),' as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' ) alldata order by CONVERT(time, replace(l_time,' ','')) asc FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1 ' User ID : ' +userid +'<br/>User Name : '+ username +'<br/> Mobile No : '+ mobile as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' ) alldata order by CONVERT(time, replace(l_time,' ','')) asc FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1 'ol.proj.transform([' + l_long + ','+ l_lat+'], 'EPSG:4326','EPSG:3857'),' as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' order by CONVERT(time, replace(l_time,' ','')) asc ) alldata FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1 'ol.proj.transform([' + l_long + ','+ l_lat+'], 'EPSG:4326','EPSG:3857'),' as[Data],l_time from [location30days] where l_date ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(l_time,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' order by CONVERT(time, replace(l_time,' ','')) desc ) alldata FOR XML PATH('') ) , 1 , 0 , '' ), STUFF( ( SELECT CAST([Data] AS XML) FROM ( SELECT top 1000 '[' + lat + ','+ lon+ ', '+CHAR(39)+'PM Date Time : '+Convert(varchar(10),Convert(date,vdate),103)+' '+vtime+'<br/>ATMID : '+ATMID+ CHAR(39)+']|' as[Data],vtime,vdate,ATMID from DR_CTP where vdate ='" + txt_frmDate.Text + @"' and userid = '" + uid + @"' and CONVERT(time, replace(vtime,' ','')) between '" + ddFromTime.SelectedValue + "' and '" + ddToTime.SelectedValue + @"' order by CONVERT(time, replace(vtime,' ','')) asc ) alldata FOR XML PATH('') ) , 1 , 0 , '' )"); // Response.Write(cmd.CommandText); cmd.CommandTimeout = 999999; dt = bucket.GetData(cmd); string dailyvisit = ""; DataTable dtcheckin = new DataTable(); // dtcheckin = bucket.BindoboutGrid(dailyvisit, out rows); string path = ""; string uadd = ""; string uaddlast = ""; string incoords = ""; string outcoords = ""; string daudits = ""; string auditcoords = ""; if (dt.Rows.Count > 0) { path += dt.Rows[0][0].ToString(); string[] inparts = dt.Rows[0][2].ToString().Split(','); incoords = inparts[0].Replace('[', ' ') + inparts[1].Replace(']', ' '); incoords = dt.Rows[0][2].ToString(); outcoords = dt.Rows[0][3].ToString(); uadd = dt.Rows[0][1].ToString(); uaddlast = dt.Rows[0][1].ToString(); // daudits = dt.Rows[0][4].ToString(); //auditcoords += "ol.proj.transform([" + dtcheckin.Rows[i][4].ToString() + ", " + dtcheckin.Rows[i][3].ToString() + "], 'EPSG:4326','EPSG:3857'),";//"[" + dt.Rows[i][3].ToString() + ", " + dt.Rows[i][4].ToString() + "],"; try { string[] inparts1 = new string[] { }; //string[] inparts1 = dt.Rows[0][4].ToString().Split(','); string[] inparts2 = dt.Rows[0][4].ToString().Split('|'); for (int i = 0; i < inparts2.Length; i++) { inparts1 = inparts2[i].Split(','); auditcoords += "ol.proj.transform([" + inparts1[1].Replace('[', ' ') + ", " + inparts1[0].Replace('[', ' ') + "], 'EPSG:4326','EPSG:3857'),";//"[" + dt.Rows[i][3].ToString() + ", " + dt.Rows[i][4].ToString() + "],"; //daudits += inparts1[2].Replace(']', ' '); daudits += "[" + inparts1[2] + ","; } } catch (Exception ex) { } } mapwithanimation = @"<script> try{ setTimeout(function(){ debugger; var sourceFeatures = new ol.source.Vector(), layerFeatures = new ol.layer.Vector({ source: sourceFeatures }); var container = document.getElementById('popup'); var content = document.getElementById('popup-content'); var closer = document.getElementById('popup-closer'); var overlay = new ol.Overlay(/** @type {olx.OverlayOptions} */({ element: container, autoPan: true, autoPanAnimation: { duration: 250 } })); closer.onclick = function () { document.getElementById('popup-content').innerHTML = ''; overlay.setPosition(undefined); closer.blur(); return false; }; var lineString = new ol.geom.LineString([]); var layerRoute = new ol.layer.Vector({ source: new ol.source.Vector({ features: [ new ol.Feature({ geometry: lineString }) ] }), style: [ new ol.style.Style({ stroke: new ol.style.Stroke({ width: 3, color: 'rgba(255, 0, 0, 1)' //lineDash: [.1, 5] }), zIndex: 2 }) ], updateWhileAnimating: true }); var loc = [" + incoords + @"]; var map = new ol.Map({ target: 'map', view: new ol.View({ center: loc[0], zoom: 4, minZoom: 2, maxZoom: 20 }), layers: [ new ol.layer.Tile({ source: new ol.source.OSM(), opacity: 0.6 }), layerRoute, layerFeatures ], overlays: [overlay] }); var iconFeatures = []; var view = map.getView(); var extent = ol.extent.boundingExtent([" + path.TrimEnd(',') + @"]); var size = map.getSize(); view.fit(extent, size); if (view.getZoom() > 16) { view.setZoom(9); } var CheckInloc=[" + incoords.TrimEnd(',') + @"]; var CheckIniconFeature = new ol.Feature({ geometry: new ol.geom.Point(CheckInloc[0]),//ol.proj.transform([-72.0704, 46.678], 'EPSG:4326','EPSG:3857')), name: '" + uadd + @"', type:'user', population: 4000, rainfall: 500 }); CheckIniconFeature.setStyle(new ol.style.Style({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */({ //color: '#8959A8', //crossOrigin: 'anonymous', anchor: [0.5, 30], anchorXUnits: 'fraction', anchorYUnits: 'pixels', src: 'http://maps.google.com/mapfiles/ms/icons/green-dot.png' })) })); iconFeatures.push(CheckIniconFeature); var CheckOutloc=[" + outcoords.TrimEnd(',') + @"]; var CheckouticonFeature = new ol.Feature({ geometry: new ol.geom.Point(CheckOutloc[0]),//ol.proj.transform([-72.0704, 46.678], 'EPSG:4326','EPSG:3857')), name: '" + uaddlast + @"', type:'user', population: 4000, rainfall: 500 }); CheckouticonFeature.setStyle(new ol.style.Style({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */({ //color: '#8959A8', //crossOrigin: 'anonymous', anchor: [0.5, 30], anchorXUnits: 'fraction', anchorYUnits: 'pixels', src: 'http://maps.google.com/mapfiles/ms/icons/red-dot.png' })) })); iconFeatures.push(CheckouticonFeature); var auditCoor = [ " + daudits.TrimEnd(',') + @"]; var j=1; var loc1 = [" + auditcoords.TrimEnd(',') + @"]; for (i = 0; i < auditCoor.length; i++) { debugger; var iconFeature = new ol.Feature({ geometry: new ol.geom.Point(loc1[i]),//ol.proj.transform([-72.0704, 46.678], 'EPSG:4326','EPSG:3857')), name: auditCoor[i], type:'audit', population: 4000, rainfall: 500 }); iconFeature.setStyle(new ol.style.Style({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */({ //color: '#8959A8', //crossOrigin: 'anonymous', anchor: [0.5, 30], anchorXUnits: 'fraction', anchorYUnits: 'pixels', src: 'http://chart.apis.google.com/chart?chst=d_map_pin_letter&chld='+(j)+'|8E67FD|FFFFFF' })) })); iconFeatures.push(iconFeature); j++; } var vectorSource = new ol.source.Vector({ features: iconFeatures //add an array of features }); var iconStyle = new ol.style.Style({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */({ anchor: [0.5, 46], anchorXUnits: 'fraction', anchorYUnits: 'pixels', opacity: 0.75, src: 'http://openlayers.org/en/v3.9.0/examples/data/icon.png', })) }); var vectorLayer = new ol.layer.Vector({ source: vectorSource, //style: iconStyle }); map.addOverlay(vectorLayer); var markerEl = document.getElementById('geo-marker'); var marker = new ol.Overlay({ positioning: 'center-center', offset: [5, 0], element: markerEl, stopEvent: false }); var element = document.getElementById('popupinfo'); var popup = new ol.Overlay({ element: element, positioning: 'bottom-center', stopEvent: false, offset: [9, -21] }); map.addOverlay(popup); map.on('click', function (evt) { debugger; var feature = map.forEachFeatureAtPixel(evt.pixel, function (feature) { return feature; }); if (feature) { var coordinates = feature.getGeometry().getCoordinates(); var longlat = ol.proj.transform(coordinates, 'EPSG:3857', 'EPSG:4326'); popup.setPosition(coordinates); var sid = GetResults(longlat[1], longlat[0]); //var sid='brijesh'; // content.innerHTML = '<p>'+ feature.O.name+ '<br/>'+'Address : '+ sid.display_name+'</p>'; content.innerHTML = '<p>'+ feature.get('name')+ '<br/>'+'Address : '+ sid.display_name+'</p>'; overlay.setPosition(coordinates); } else { overlay.setPosition(undefined); closer.blur(); } }); map.addOverlay(marker); var fill = new ol.style.Fill({ color: 'rgba(255,255,255,1)' }), stroke = new ol.style.Stroke({ color: 'rgba(0,0,0,1)' }), style1 = [ new ol.style.Style({ image: new ol.style.Circle({ radius: 6, fill: fill, stroke: stroke }), zIndex: 4 }) ]; //a simulated path var path = [ " + path.TrimEnd(',') + @" ]; var feature_start = new ol.Feature({ geometry: new ol.geom.Point(path[0]) }), feature_end = new ol.Feature({ geometry: new ol.geom.Point(path[path.length - 1]) }); feature_start.setStyle(style1); feature_end.setStyle(style1); sourceFeatures.addFeatures([feature_start, feature_end]); lineString.setCoordinates(path); //fire the animation map.once('postcompose', function (event) { interval = setInterval(animation, 100); }); var i = 0, interval; var animation = function () { if (i == path.length) { i = 0; } marker.setPosition(path[i]); i++; }; }, 300); } catch(ee) { alert(ee); } function GetResults(lat, long) { var jsonObjectInstance = $.parseJSON($.ajax({ url: 'https://locationiq.org/v1/reverse.php?format=json&key=9c73f8c9ed5d47&lat=' + lat + '&lon=' + long, async: false, dataType: 'json' }).responseText); return jsonObjectInstance } </script>"; } catch (Exception) { mapwithanimation = "<div style='font-size:x-large;text-align:center;font-family:Cambria, Cochin, Georgia, Times;color:#696969;'>No details found..</div>" + @"<script> var container = document.getElementById('popup'); var geo = document.getElementById('geo-marker'); container.style.display = 'none'; geo.style.display = 'none'; </script>"; } // map.InnerHtml = mapwithanimation; Session["sess_x"] = mapwithanimation; }
public string drawmap() { string mapstr = ""; try { ibuckethead bucket = new ibuckethead(); string rows; string qry = @"select u.username,l.l_lat,l.l_long,l.Rem_Battery, case when l.rem_battery <=5 then 'Batterylow' else case when DATEDIFF(MINUTE,CONVERT(VARCHAR(19), GETDATE(),120),replace(l.b_date,'/','-') + ' ' + l.l_time) < -60 then 'Offline' else 'Online' end end as[Status],substring(b_date,4,3) + substring(b_date,1,2)+ substring(b_date,6,5) + ' ' + b_time as [Last Updated On] from location l inner join users u on l.userid = u.userid where l_lat <>'0' and l_long <>'0'"; if (Session["sess_role"].ToString() == "AO") { qry += " and u.userid in (select userid from AreaUserMap where area in (select area from AreaUserMap where userid='" + Session["sess_userid"].ToString() + "'))"; } else if (Session["sess_role"].ToString() == "BM") { qry += " and u.Branch in (Select Branch from users where userid = '" + Session["sess_userid"].ToString() + "')"; } else if (Session["sess_role"].ToString() == "REGION") { qry += " and u.REGION in (Select REGION from users where userid = '" + Session["sess_userid"].ToString() + "')"; } SqlCommand cmd = new SqlCommand(qry); DataTable dt = bucket.GetData(cmd); string usercoor = ""; string marker = ""; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { //usercoor += "ol.proj.transform([" + dt.Rows[i][4].ToString() + "," + dt.Rows[i][3].ToString() + "], 'EPSG:4326','EPSG:3857'),"; usercoor += "ol.proj.transform([" + dt.Rows[i][2].ToString() + "," + dt.Rows[i][1].ToString() + "], 'EPSG:4326','EPSG:3857'),"; marker += @"var iconFeature" + i + @" = new ol.Feature({ geometry: new ol.geom.Point(loc[" + i + @"]), name: '" + dt.Rows[i][0].ToString() + @"', LastUpdatedOn: '" + dt.Rows[i][5].ToString() + @"', rainfall: 501 }); iconFeature" + i + @".setStyle(new ol.style.Style({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */({ // color: '#8959A8', //crossOrigin: 'anonymous', anchor: [0.5, 30], anchorXUnits: 'fraction', anchorYUnits: 'pixels', "; if (dt.Rows[i][4].ToString() == "Batterylow") { marker += "src: '../Image/man-orange.png'"; } else if (dt.Rows[i][4].ToString() == "Offline") { marker += "src: '../Image/man-red.png'"; } else if (dt.Rows[i][4].ToString() == "Online") { marker += "src: '../Image/man-green.png'"; } marker += @" })) })); iconFeatures.push(iconFeature" + i + @");"; } } mapstr = @"<script> setTimeout(function(){ var container = document.getElementById('popup'); var content = document.getElementById('popup-content'); var closer = document.getElementById('popup-closer'); var overlay = new ol.Overlay(/** @type {olx.OverlayOptions} */({ element: container, autoPan: true, autoPanAnimation: { duration: 250 } })); closer.onclick = function () { document.getElementById('popup-content').innerHTML = ''; overlay.setPosition(undefined); closer.blur(); return false; }; var lineString = new ol.geom.LineString([]); var layerRoute = new ol.layer.Vector({ source: new ol.source.Vector({ features: [ new ol.Feature({ geometry: lineString }) ] }), style: [ new ol.style.Style({ stroke: new ol.style.Stroke({ width: 3, color: 'rgba(255, 0, 0, 1)' }), zIndex: 2 }) ], updateWhileAnimating: true }); var loc = [" + usercoor + @"]; var map = new ol.Map({ target: 'map', view: new ol.View({ center: loc[0], zoom: 16, minZoom: 2, maxZoom: 20 }), layers: [ new ol.layer.Tile({ source: new ol.source.OSM(), opacity: 0.6 }) ], overlays: [overlay] }); var view = map.getView(); var extent = ol.extent.boundingExtent([" + usercoor + @"]); var size = map.getSize(); view.fit(extent, size); if (view.getZoom() > 16) { view.setZoom(9); } var iconFeatures = []; " + marker + @" var vectorSource = new ol.source.Vector({ features: iconFeatures //add an array of features }); var iconStyle = new ol.style.Style({ image: new ol.style.Icon(/** @type {olx.style.IconOptions} */({ anchor: [0.5, 46], anchorXUnits: 'fraction', anchorYUnits: 'pixels', opacity: 0.75, src: 'http://openlayers.org/en/v3.9.0/examples/data/icon.png', })) }); var vectorLayer = new ol.layer.Vector({ source: vectorSource, //style: iconStyle }); map.addOverlay(vectorLayer); var markerEl = document.getElementById('geo-marker'); var marker = new ol.Overlay({ positioning: 'center-center', offset: [5, 0], element: markerEl, stopEvent: false }); var element = document.getElementById('popupinfo'); var popup = new ol.Overlay({ element: element, positioning: 'bottom-center', stopEvent: false, offset: [9, -21] }); map.addOverlay(popup); map.on('click', function (evt) { var feature = map.forEachFeatureAtPixel(evt.pixel, function (feature) { return feature; }); if (feature) { var coordinates = feature.getGeometry().getCoordinates(); var longlat = ol.proj.transform(coordinates, 'EPSG:3857', 'EPSG:4326'); popup.setPosition(coordinates); var sid = GetResults(longlat[1], longlat[0]); //var sid = ''; content.innerHTML = '<p>User Name : '+ feature.get('name')+ '<br/>Last Updated On : '+feature.get('LastUpdatedOn')+'<br/>'+'Address : '+ sid.display_name+'</p>'; overlay.setPosition(coordinates); } else { overlay.setPosition(undefined); closer.blur(); } }); map.addOverlay(marker); var fill = new ol.style.Fill({ color: 'rgba(255,255,255,1)' }), stroke = new ol.style.Stroke({ color: 'rgba(0,0,0,1)' }), style1 = [ new ol.style.Style({ image: new ol.style.Circle({ radius: 6, fill: fill, stroke: stroke }), zIndex: 4 }) ]; }, 300); function GetResults(lat, long) { var jsonObjectInstance = $.parseJSON($.ajax({ url: 'https://locationiq.org/v1/reverse.php?format=json&key=9c73f8c9ed5d47&lat=' + lat + '&lon=' + long, async: false, dataType: 'json' }).responseText); return jsonObjectInstance } </script>"; } catch (Exception) { mapstr = "No details found.." + @"<script> var container = document.getElementById('popup'); var geo = document.getElementById('geo-marker'); container.style.display = 'none'; geo.style.display = 'none'; </script>"; } return(mapstr); // map.InnerHtml = mapstr; }
protected void btn_Update_Click(object sender, EventArgs e) { ibuckethead bucket = new ibuckethead(); string userid = bucket.cleanText(txt_user); string password = bucket.cleanText(txt_password); string role = bucket.cleanText(txt_Role); string ao = bucket.cleanText(txt_AO); string oc = bucket.cleanText(txt_oc); string fc = bucket.cleanText(txt_fc); string om = bucket.cleanText(txt_OM); string status = null; if (rdb_active.Checked) { status = "Active"; } else if (rdb_inactive.Checked) { status = "Inactive"; } if (userid == "NA") { checkErr(user_err, txt_user); } else if (password == "NA") { checkErr(Panel1, txt_password); } else if (role == "NA") { checkErr(Panel2, txt_Role); } else if (ao == "NA") { checkErr(Panel3, txt_AO); } else if (oc == "NA") { checkErr(Panel4, txt_oc); } else if (fc == "NA") { checkErr(Panel5, txt_fc); } else if (om == "NA") { checkErr(Panel6, txt_OM); } else { Response.Write("Reached."); string q1 = @"insert into sa_ma3.users(userid, password, role, ao, oc, fc, om, status, datastatus) values ('" + userid + "','" + password + "','" + role + "','" + ao + "','" + oc + "','" + om + "','" + fc + "','" + status + "','CRE')"; if (bucket.ExecuteQuery(q1) == "Success") { Response.Redirect("Users.aspx"); } else { Response.Write("Error"); } } }
/*public void bindGrid(string query,string dsID, GridView g, Page p) * { * SqlDataSource sql = new SqlDataSource(System.Configuration.ConfigurationManager.ConnectionStrings["SQLConnstr"].ConnectionString, query); * sql.ID = dsID; * sql.DataBind(); * sql.Dispose(); * p.Controls.Add(sql); * g.DataSourceID = dsID; * g.AllowPaging = true; * g.AllowSorting = true; * g.DataBind(); * }*/ protected void Page_Load(object sender, EventArgs e) { ibuckethead bucket = new ibuckethead(); bucket.BindGrid("select atmid from atms", "atmsid", GridView1, this.Page); }
protected void btn_go_Click(object sender, EventArgs e) { ibuckethead bucket = new ibuckethead(); string username = bucket.cleanText(txt_login); string pwd = bucket.cleanText(txt_pwd); string q1 = ""; string[] a1; Session["sess_Date"] = ""; q1 = "Select userid,password,role,username,status from users where userid='" + username + "'"; a1 = bucket.verifyReader(q1, "userid", "password", "role", "username", "status"); if (a1[4].Trim() == "DEL") { Response.Write("<script>alert('User deactivated')</script>"); } else if (username != "" || pwd != "") { try { if (a1[0].Trim() == username && a1[1].Trim() == pwd) { Session["sess_userid"] = a1[0]; Session["sess_role"] = a1[2]; if (Session["sess_role"].ToString() == "admin") { Session["sess_userid"] = a1[0]; Session["sess_role"] = a1[2]; Session["sess_username"] = a1[3]; Response.Redirect("FieldTracker.aspx?Offline=True"); } else if (Session["sess_role"].ToString() == "RCM") { Session["sess_userid"] = a1[0]; Session["sess_role"] = a1[2]; Session["sess_username"] = a1[3]; Response.Redirect("RCM/FieldTracker.aspx?Offline=True"); } else if (Session["sess_role"].ToString() == "RM") { Session["sess_userid"] = a1[0]; Session["sess_role"] = a1[2]; Session["sess_username"] = a1[3]; Response.Redirect("RM/FieldTracker.aspx?Offline=True"); } else if (Session["sess_role"].ToString() == "CH") { Session["sess_userid"] = a1[0]; Session["sess_role"] = a1[2]; Session["sess_username"] = a1[3]; Response.Redirect("CH/FieldTracker.aspx?Offline=True"); } else if (Session["sess_role"].ToString() == "BANK") { Session["sess_userid"] = a1[0]; Session["sess_role"] = a1[2]; Session["sess_username"] = a1[3]; Response.Redirect("bank/currentaudit1.aspx"); } else { Response.Write("<script>alert('Login Restricted.')</script>"); } } else { Response.Write("<script>alert('Invalid userid or password.')</script>"); } } catch { Response.Write("<script>alert('Invalid userid or password.')</script>"); } } else { Response.Write("<script>alert('Invalid userid or password.')</script>"); } }