public DataTable CheckPreviousGPXTrackPoints(int UserId, int SchoolId, int ClassId, DataTable dtNew) { DataTable result = new DataTable(); int similarrows = 0; DataTable dtPrv = objStudent.GetGpxTractPoints(0, Convert.ToInt32(Session["UserRoleId"]), Convert.ToInt32(ddlClass.SelectedValue)); if (dtPrv.Rows.Count > 0) { for (int i = 0; i < dtPrv.Rows.Count; i++) { DataRow[] _dr; _dr = dtNew.Select("Lat='" + dtPrv.Rows[i]["lat"].ToString() + "' AND Lon='" + dtPrv.Rows[i]["lon"].ToString() + "' AND Time='" + dtPrv.Rows[i]["TrackTime"].ToString() + "'"); if (_dr.Length != 0) { int oldRows = 0; if (dtPrv.Rows[i]["TrackPointCount"] != "") { oldRows = Convert.ToInt32(dtPrv.Rows[i]["TrackPointCount"]); } int newRows = dtNew.Rows.Count; if (newRows > oldRows) { for (int j = 0; j < (newRows - (newRows - oldRows)) - 1; j++) { dtNew.Rows[0].Delete(); } result = dtNew; for (int j = 0; j < dtPrv.Rows.Count; j++) { DataRow[] _drNew; _drNew = dtNew.Select("Lat='" + dtPrv.Rows[j]["lat"].ToString() + "' AND Lon='" + dtPrv.Rows[j]["lon"].ToString() + "' AND Time='" + dtPrv.Rows[j]["TrackTime"].ToString() + "'"); if (_drNew.Length != 0) { result = new DataTable(); break; } } } break; } else { result = dtNew; } } } else { result = dtNew; } return(result); }
public DataTable CheckPreviousGPXTrackPoints(int UserId, int SchoolId, int ClassId, DataTable dtNew) { DataTable result = new DataTable(); //int similarrows = 0; //bool IsOverlapping = false; DataTable dtPrv = objStudent.GetGpxTractPoints(UserId, UserRoleId, ClassId); if (dtPrv.Rows.Count > 0) { for (int i = 0; i < dtPrv.Rows.Count; i++) { DataRow[] _dr; _dr = dtNew.Select("Lat='" + dtPrv.Rows[i]["lat"].ToString() + "' AND Lon='" + dtPrv.Rows[i]["lon"].ToString() + "' AND Time='" + dtPrv.Rows[i]["TrackTime"].ToString() + "'"); if (_dr.Length != 0) { int oldRows = 0; if (dtPrv.Rows[i]["TrackPointCount"].ToString() != "") { oldRows = Convert.ToInt32(dtPrv.Rows[i]["TrackPointCount"]); } int newRows = dtNew.Rows.Count; if (newRows > oldRows) { for (int j = 0; j < (newRows - (newRows - oldRows)) - 1; j++) { dtNew.Rows[0].Delete(); } result = dtNew; for (int j = 0; j < dtPrv.Rows.Count; j++) { DataRow[] _drNew; _drNew = dtNew.Select("Lat='" + dtPrv.Rows[j]["lat"].ToString() + "' AND Lon='" + dtPrv.Rows[j]["lon"].ToString() + "' AND Time='" + dtPrv.Rows[j]["TrackTime"].ToString() + "'"); if (_drNew.Length != 0) { result = new DataTable(); break; } } } break; } else { if (!objStudent.CheckGPXFile(dtNew, ClassId, UserId)) { dtNew.Clear(); return(dtNew); } result = dtNew; } } } else { if (!objStudent.CheckGPXFile(dtNew, ClassId, UserId)) { dtNew.Clear(); return(dtNew); } result = dtNew; } return(result); }