public async Task <ge_data_table> NewFile(Guid Id, Guid templateId, string table, string sheet, IDataService _dataService) { string[] lines = null; ge_search template_loaded = null; ge_search template = await _dataService.GetFileAsClass <ge_search>(templateId); ge_data data_file = await _dataService.GetDataById(Id); int resp = loadTemplateAndLines(data_file, template, table, sheet, _dataService, out template_loaded, out lines); if (resp == -1) { return(null); } ge_data_table dt = NewFile(template_loaded, lines, Id, templateId); dt.search_template = template; dt.search_table = template_loaded.search_tables[0]; return(dt); }
private void saveGISFile(Guid projectId, string filename, string userId, string data_string, string ext) { ge_data_file b = new ge_data_file(); ge_data d = new ge_data(); b.data_string = data_string; ge_MimeTypes types = new ge_MimeTypes(); string stype; types.TryGetValue(ext, out stype); d.projectId = projectId; d.createdDT = DateTime.Now; d.createdId = userId; d.filename = filename + ext; d.filesize = data_string.Length; d.filetype = stype; d.filedate = DateTime.UtcNow; d.fileext = ext; d.encoding = "ascii"; d.operations = "Read;Download;Update;Delete"; d.file = b; _context.ge_data.Add(d); _context.SaveChanges(); // status = enumStatus.XMLSaved; }
private TGeom getLTMGeometry(EsriGeometry geom, TParent survey, int wkid) { TGeom geom2 = (TGeom)Activator.CreateInstance(typeof(TGeom)); // geom2.hole_id = survey.hole_id; // geom2.objectid = survey.objectid; geom2.x = geom.x; geom2.y = geom.y; ge_data g = new ge_data(); if (geom.x >= 0.001 & geom.y > 0.001) { if (wkid == Esri.esriOSGB36) { ge_projectionOSGB36 p = new ge_projectionOSGB36(g); g.locLongitude = geom.x; g.locLatitude = geom.y; if (p.calcEN_fromLatLong()) { ; geom2.East = g.locEast.Value; geom2.North = g.locNorth.Value; } } if (wkid == Esri.esriWGS84) { double height = 100; if (survey.surv_g_level != null) { height = survey.surv_g_level.Value; } Transform_WGS84_and_OSGB t = new Transform_WGS84_and_OSGB(); g = t.WGS84_Lat_Long_Height_to_OSGB_East_North(geom.y, geom.x, height); if (g != null) { geom2.East = g.locEast.Value; geom2.North = g.locNorth.Value; } } } // Transform_WGS84_and_OSGB t2 = new Transform_WGS84_and_OSGB(); // ge_data g4 = t2.WGS84_Lat_Long_Height_to_OSGB_East_North( 52.65797861194, // 1.71605201472, // 69.391); // ge_data g2 = new ge_data(); // g2.locLongitude = 0.3958734; // g2.locLatitude = 51.4894179; // ge_projectionOSGB36 p2 = new ge_projectionOSGB36(g2); // p2.calcEN_fromLatLong(); // string res = $"Lat:{g2.locLatitude} Long:{g2.locLongitude} N:{g2.locNorth} E:{g2.locEast}"; return(geom2); }
public async Task <ge_data> CreateData(Guid projectId, string UserId, IAGSGroupTables tables, string filename, string description, string format = "ags") { AGSWriter writer = new AGSWriter(tables); string s1 = writer.CreateAGS404String(null); var _data = new ge_data { Id = Guid.NewGuid(), projectId = projectId, createdId = UserId, createdDT = DateTime.Now, editedDT = DateTime.Now, editedId = UserId, filename = filename, filesize = s1.Length, fileext = ".ags", filetype = "text/plain", filedate = DateTime.Now, encoding = "utf-8", datumProjection = datumProjection.NONE, pstatus = PublishStatus.Uncontrolled, cstatus = ConfidentialityStatus.RequiresClientApproval, version = "P01.1", vstatus = VersionStatus.Intermediate, qstatus = QualitativeStatus.AECOMFactual, description = description, operations = "Read;Download;Update;Delete", file = new ge_data_file { data_string = s1 } }; return(await CreateData(_data)); }
protected override async Task <int> saveXML() { ge_data_file b = new ge_data_file(); data_xml = new ge_data(); b.data_xml = xml_data; ge_MimeTypes types = new ge_MimeTypes(); string stype; types.TryGetValue(FileExtension.XML, out stype); string filename = Path.GetFileNameWithoutExtension(data_ags.filename); data_xml.projectId = data_ags.projectId; data_xml.createdDT = DateTime.Now; data_xml.createdId = userId; data_xml.filename = filename + FileExtension.XML; data_xml.filesize = xml_data.Length; data_xml.filetype = stype; data_xml.filedate = DateTime.UtcNow; data_xml.fileext = FileExtension.XML; data_xml.encoding = "ascii"; data_xml.operations = "Read;Download;Update;Delete"; data_xml.file = b; await _dataService.CreateData(data_xml); return(1); }
public async Task SetProcessFlagAddEvents(Guid Id, int value, string add) { ge_data data = await _unitOfWork.Data.FindByIdAsync(Id); data.pflag = value; data.phistory += add; }
public bool write(ge_data data, XmlNode parent) { write_base(data, parent); write_location(data, parent); try { AddNode("Id", data.Id.ToString(), parent); AddNode("filename", data.filename, parent); AddNode("filesize", data.filesize.ToString(), parent); AddNode("fileext", data.fileext, parent); AddNode("filetype", data.filetype, parent); AddNode("filedate", data.filedate.ToString(), parent); AddNode("description", data.description, parent); AddNode("keywords", data.keywords, parent); AddNode("projectId", data.projectId.ToString(), parent); AddNode("cstatus", data.cstatus.ToString(), parent); AddNode("pstatus", data.pstatus.ToString(), parent); AddNode("qstatus", data.qstatus.ToString(), parent); AddNode("version", data.version, parent); AddNode("vstatus", data.vstatus.ToString(), parent); return(true); } catch { return(false); } }
public Boolean updateAll(string sourceCoordSystem) { if (_projectionDAL.datumProjection() == Constants.datumProjection.WGS84) { _projectionDAL.updateAll(sourceCoordSystem); if (_projectionDAL.location().locEast == null || _projectionDAL.location().locNorth == null) { return(false); } double height = 50; if (_projectionDAL.location().locNorth != null) { height = _projectionDAL.location().locNorth.Value; } Transform_WGS84_and_OSGB t = new Transform_WGS84_and_OSGB(); ge_data _wgs84 = t.OSGB_East_North_to_WGS84_Lat_Long_Height(_projectionDAL.location().locEast.Value, _projectionDAL.location().locNorth.Value, height); _projectionDAL.SetLatitudeLongitudeHeight(_wgs84.locLatitude.Value, _wgs84.locLongitude.Value, _wgs84.locHeight.Value); return(true); } else { return(_projectionDAL.updateAll(sourceCoordSystem)); } }
public async Task UpdateData(ge_data Exist, ge_data data) { ge_data exist = await _unitOfWork.Data.FindByIdAsync(Exist.Id); // Extensions.Extensions.Copy<ge_data>(exist,data); await _unitOfWork.CommitAsync(); }
public async Task <ge_data> CreateData(ge_data newData) { await _unitOfWork.Data.AddAsync(newData); await _unitOfWork.CommitAsync(); return(newData); }
public int loadTemplateAndLines(ge_data data_file, ge_search template, string table, string sheet, IDataService _dataService, out ge_search template_loaded, out string[] lines) { lines = null; template_loaded = null; if (data_file.fileext == ".csv") { var resp = _dataService.GetFileAsLines(data_file.Id); lines = (string[])resp.Result; SearchTerms st = new SearchTerms(); template_loaded = st.findSearchTerms(template, table, lines); if (template_loaded.search_tables.Count == 0) { return(-1); } } if (data_file.fileext == ".xlsx") { var resp = _dataService.GetFileAsMemoryStream(data_file.Id); using (MemoryStream ms = (MemoryStream)resp.Result) { ge_log_workbook wb = new ge_log_workbook(ms); SearchTerms st = new SearchTerms(); if (sheet.Contains(",")) { string[] sheets = sheet.Split(","); template_loaded = st.findSearchTerms(template, table, wb, sheets); } else { template_loaded = st.findSearchTerms(template, table, wb, sheet); } if (template_loaded.search_tables.Count == 0) { lines = null; return(-1); } wb.setWorksheet(template_loaded.search_tables[0].sheet); wb.evaluateSheet(); lines = wb.WorksheetToTable(50, true); wb.close(); return(1); } } return(-1); }
public async Task <ge_data> GetDataByIdWithFile(Guid Id) { ge_data d = await _unitOfWork.Data .FindByIdAsync(Id); d.file = await _unitOfWork.Data.GetFileAsync(Id); return(d); }
// public ge_data NewData() { // d.projectId = project.Id; // d.locEast = data.locEast; // d.locNorth = data.locNorth; // d.locLevel = data.locLevel; // d.locLatitude = data.locLatitude; // d.locLongitude =data.locLongitude; // d.locHeight = data.locHeight; // d.locMapReference = data.locMapReference; // d.locName = data.locName; // d.locAddress = data.locAddress; // d.locPostcode = data.locPostcode; // d.datumProjection = data.datumProjection ; // d.description = data.description; // d.keywords = data.keywords; // d.operations = data.operations; // } public async Task <ge_data> CreateData(ge_data newData, IFormFile formFile, ModelStateDictionary modelState, long MaxFileSize) { // newData.file = _unitOfWork.Data.GetFormFileString(formFile, modelState, MaxFileSize); // newData.file = _unitOfWork.Data.GetFormFileBinary(formFile, modelState, MaxFileSize); return(await CreateData(newData)); }
private async Task <IActionResult> addLoggerLayout101(ge_data data, string [] lines) { dbConnectDetails cd = await getConnectDetails(data.projectId, gINTTables.DB_DATA_TYPE); if (cd == null) { return(NotFound()); } int gINTProjectID = cd.ProjectId; string POINT_ID = "PointId"; string MOND_ID = "Monitoring Id"; string WATER_DEPTH = "Water Depth"; string DATE_TIME = "DateTime"; measurement mm = dict_measurement[WATER_DEPTH]; string[] header = lines[0].Split(","); int colPOINT_ID = header.findColumn(POINT_ID); int colMOND_ID = header.findColumn(MOND_ID); int colDATE_TIME = header.findColumn(DATE_TIME); int colWATER_DEPTH = header.findColumn(WATER_DEPTH); int row_start = 1; int col_start = colDATE_TIME + 1; for (int i = row_start; i < lines.Length; i++) { string[] line = lines[i].Split(","); try { var newMOND = new MOND(); newMOND.gINTProjectID = gINTProjectID; newMOND.PointID = line[colPOINT_ID]; newMOND.ItemKey = line[colMOND_ID]; MONG.sqlWhere("gINTProjectID=" + gINTProjectID + " and PointID='" + newMOND.PointID + "' and ItemKey='" + newMOND.ItemKey + "'"); MONG.getDataTable(); if (!MONG.EOF()) { DataRow row = MONG.FirstRow(); newMOND.MONG_DIS = Convert.ToDouble(row["MONG_DIS"]); } newMOND.DateTime = Convert.ToDateTime(line[colDATE_TIME]); newMOND.MOND_RDNG = line[colWATER_DEPTH]; newMOND.MOND_TYPE = mm.Type; newMOND.MOND_NAME = mm.Name; newMOND.MOND_UNIT = mm.Units; AddMOND(newMOND, true); } catch (Exception e) { Console.Write(e.Message); } } return(Ok()); }
public ge_data WGS84_Lat_Long_Height_to_OSGB_East_North(double _lat, double _long, double _height) { ge_data _wg84 = new ge_data(); _wg84.locLatitude = _lat; _wg84.locLongitude = _long; _wg84.locHeight = _height; return(WGS84_Lat_Long_Height_to_OSGB_East_North(_wg84)); }
public async Task <string> GetAllowedOperations(string userId, ge_data data) { ge_user_ops group_user = await _unitOfWork.UserOps.GetByUserIdGroupId(userId, data.project.groupId); ge_user_ops project_user = await _unitOfWork.UserOps.GetByUserIdProjectId(userId, data.projectId); operation_request req = new operation_request(data, group_user, project_user); return(req._effectiveData_ops); }
public async Task <operation_request> GetOperationRequest(string userId, ge_data data) { ge_user_ops group_user = await _unitOfWork.UserOps.GetByUserIdGroupId(userId, data.project.groupId); ge_user_ops project_user = await _unitOfWork.UserOps.GetByUserIdProjectId(userId, data.projectId); operation_request req = new operation_request(data, group_user, project_user); return(req); }
public async Task UpdateData(ge_data data) { ge_data exist = null; exist = await _unitOfWork.Data.FindByIdAsync(data.Id); Extensions.Extensions.Copy <ge_data>(data, exist); await _unitOfWork.CommitAsync(); }
public async Task <Boolean> AreDataOperationsAllowed(string userId, ge_data data, string request_ops) { ge_user_ops group_user = await _unitOfWork.UserOps.GetByUserIdGroupId(userId, data.project.groupId); ge_user_ops project_user = await _unitOfWork.UserOps.GetByUserIdProjectId(userId, data.projectId); operation_request req = new operation_request(data, group_user, project_user); return(req.AreDataOperationsAllowed(request_ops)); }
public ge_data OSGB_East_North_to_WGS84_Lat_Long_Height(double _east, double _north, double _height) { ge_data _osgb = new ge_data(); _osgb.locEast = _east; _osgb.locNorth = _north; _osgb.locHeight = _height; return(OSGB_East_North_to_WGS84_Lat_Long_Height(_osgb)); }
public async Task <int> GetProcessFlag(Guid Id) { ge_data data = await _unitOfWork.Data.FindByIdAsync(Id); if (data == null) { return(-1); } return(data.pflag); }
public ge_data NewData(Guid projectId, string UserId) { ge_data _data = new ge_data(); _data.projectId = projectId; _data.createdId = UserId; _data.createdDT = DateTime.Now; _unitOfWork.Data.AddAsync(_data); return(_data); }
public async Task <IActionResult> OnGetAsync(Guid projectId) { if (projectId == null) { return(NotFound()); } var project = await _context.projectFull(projectId).FirstOrDefaultAsync(); if (project == null) { return(NotFound()); } data = new ge_data(); data.project = project; var UserAuthorised = await IsUserCreateAuthorised(); if (IsCreateAllowed() != geOPSResp.Allowed) { return(RedirectToPageMessage(msgCODE.DATA_CREATE_PROHIBITED)); } if (!UserAuthorised.Succeeded) { return(RedirectToPageMessage(msgCODE.DATA_CREATE_USER_PROHIBITED)); } _logger.LogInformation("OnGetAsync called:" + projectId.ToString()); data.locEast = project.locEast; data.locNorth = project.locNorth; data.locLevel = project.locLevel; data.locName = project.locName; data.locAddress = project.locAddress; data.locPostcode = project.locPostcode; data.locLatitude = project.locLatitude; data.locLongitude = project.locLongitude; data.locHeight = project.locHeight; data.locMapReference = project.locMapReference; data.datumProjection = project.datumProjection; data.projectId = project.Id; data.operations = Constants.RUDD_OperationsArray[Constants.ReadDownloadUpdateDelete]; setViewData(); return(Page()); }
public async Task <ge_log_file> NewFile(Guid Id, Guid templateId, string table, string sheet, IDataService _dataService) { string[] lines = null; ge_search template_loaded = null; ge_search template = await _dataService.GetFileAsClass <ge_search>(templateId); ge_data data_file = await _dataService.GetDataById(Id); if (data_file.fileext == ".csv") { lines = await _dataService.GetFileAsLines(data_file.Id); SearchTerms st = new SearchTerms(); template_loaded = st.findSearchTerms(template, table, lines); if (template_loaded.search_tables.Count == 0) { return(null); } } if (data_file.fileext == ".xlsx") { using (MemoryStream ms = await _dataService.GetFileAsMemoryStream(data_file.Id)) { ge_log_workbook wb = new ge_log_workbook(ms); SearchTerms st = new SearchTerms(); if (sheet.Contains(",")) { string[] sheets = sheet.Split(","); template_loaded = st.findSearchTerms(template, table, wb, sheets); } else { template_loaded = st.findSearchTerms(template, table, wb, sheet); } if (template_loaded.search_tables.Count == 0) { return(null); } wb.setWorksheet(template_loaded.search_tables[0].sheet); wb.evaluateSheet(); lines = wb.WorksheetToTable(); wb.close(); } } return(NewFile(template_loaded, lines, Id, templateId)); }
public async Task <OtherDbConnections> GetOtherDbConnectionsByDataId(Guid Id) { ge_data data = await _unitOfWork.Data.GetWithProjectAsync(Id); if (data.project.otherDbConnectId == null) { return(null); } OtherDbConnections odb = await GetFileAsClass <OtherDbConnections>(data.project.otherDbConnectId.Value); return(odb); }
public async Task <ge_data> CreateData(Guid projectId, string UserId, ge_data_table dt_file, string filename, string description, string format) { ge_MimeTypes mtypes = new ge_MimeTypes(); string fileext = "xml"; string s1 = dt_file.SerializeToXmlStringUTF8 <ge_data_table>(); if (format == "xml") { fileext = ".xml"; } if (format == "json") { fileext = ".json"; } string filetype = mtypes[fileext]; var _data = new ge_data { Id = Guid.NewGuid(), projectId = projectId, createdId = UserId, createdDT = DateTime.Now, editedDT = DateTime.Now, editedId = UserId, filename = filename, filesize = s1.Length, fileext = fileext, filetype = filetype, filedate = DateTime.Now, encoding = "utf-8", datumProjection = datumProjection.NONE, pstatus = PublishStatus.Uncontrolled, cstatus = ConfidentialityStatus.RequiresClientApproval, version = "P01.1", vstatus = VersionStatus.Intermediate, qstatus = QualitativeStatus.AECOMFactual, description = description, operations = "Read;Download;Update;Delete", file = new ge_data_file { data_xml = s1 } }; return(await CreateData(_data)); }
private List <Placemark> GetPlacemarks(DataTable dt, table_map map) { List <Placemark> list = new List <Placemark>(); foreach (DataRow row in dt.Rows) { ge_data d = new ge_data(); d.locNorth = get_double("locNorth", row, dt, map); d.locEast = get_double("locEast", row, dt, map); d.locLevel = get_double("locLevel", row, dt, map); } return(list); }
public ge_data WGS84_Lat_Long_Height_to_OSGB_East_North(ge_data _wg84) { // Step 1 Convert WGS84 Latitude, longitude and Ellipsoidal height to WGS84 Cartesian XYZ wg84 = _wg84; ge_projectionWGS84 pwg84 = new ge_projectionWGS84(wg84); if (!pwg84.calcXYZ_fromLatLong()) { errorMsg = "Error pwg84.calcXYZ_fromLatLong()"; return(null); } ; // Step 2 Apply Helmert Datum Transformation (WGS84 to OSGB36) ge_projection_transform t = new WGS84_to_OSGB(); HelmertTransform ht = new HelmertTransform(t); ge_coords wg84_coords = new ge_coords(wg84); ge_coords osgb_coords = ht.Transform(wg84_coords); // Step 3 Convert OSGB36 Cartesian XYZ to OSGB36 Latitude, longitude and approx ODN height osg36 = new ge_data(); osg36.locX = osgb_coords.coord_x; osg36.locY = osgb_coords.coord_y; osg36.locZ = osgb_coords.coord_z; ge_projectionOSGB36 posgb36 = new ge_projectionOSGB36(osg36); if (!posgb36.calcLatLongH_fromXYZ()) { errorMsg = "Error posgb36.calcLatLongH_fromXYZ()"; return(null); } ; // Step 4 Convert OSGB36 Latitude and longitude to OSGB36 easting and northing if (!posgb36.calcEN_fromLatLong()) { errorMsg = "Error posgb36.calcEN_fromLatLong()"; return(null); } return(osg36); }
public async Task <IActionResult> Post(string log_file, string origin_data, string format) { ge_log_file f = null; ge_data d = null; ge_data_file b = new ge_data_file(); if (format == "json") { d = JsonConvert.DeserializeObject <ge_data>(origin_data); f = JsonConvert.DeserializeObject <ge_log_file>(log_file); d.filetype = "text/json"; d.fileext = ".json"; d.encoding = "utf-8"; b.data_string = log_file; } if (format == "xml") { d = (ge_data)origin_data.DeserializeFromXmlString <ge_data>(); f = (ge_log_file)log_file.DeserializeFromXmlString <ge_log_file>(); d.filetype = "text/xml"; d.fileext = ".xml"; d.encoding = "utf-8"; b.data_xml = log_file; } var user = await GetUserAsync(); d.Id = f.Id; string filename = d.filename.Substring(0, d.filename.IndexOf(".")) + ' ' + f.channel + ".xml"; d.filename = filename; d.filesize = log_file.Length; d.createdDT = DateTime.Now; d.editedDT = DateTime.Now; d.editedId = user.Id; d.createdId = user.Id; string s1 = d.SerializeToXmlString <ge_data>(); string s2 = b.SerializeToXmlString <ge_data_file>(); var resp_post = await new ge_dataController(_context, _authorizationService, _userManager, _env, _ge_config).Post(s1, s2, "xml"); return(resp_post); }
public ge_data OSGB_East_North_to_WGS84_Lat_Long_Height(ge_data _osg36) { ge_data wg84 = new ge_data(); // Step 1 Convert OSGB36 easting, northing and height to OSGB36 latitude and longitude osg36 = _osg36; ge_projectionOSGB36 posgb36 = new ge_projectionOSGB36(osg36); if (!posgb36.calcLatLong_fromEN()) { errorMsg = "Error: posgb36.calcLatLong_fromEN()"; return(null); } // Step 2 Convert OSGB36 latitude, longitude and approx ODN height to OSGB36 cartesian XYZ if (!posgb36.calcXYZ_fromLatLong()) { errorMsg = "Error: posgb36.calcXYZ_fromLatLong()"; return(null); } // Step 3 Apply Helmert Datum Transformation (OSGB36 to WGS84) ge_projection_transform t = new OSGB_to_WGS84(); HelmertTransform ht = new HelmertTransform(t); ge_coords osg36_coords = new ge_coords(osg36); ge_coords wg84_coords = ht.Transform(osg36_coords); wg84.locX = wg84_coords.coord_x; wg84.locY = wg84_coords.coord_y; wg84.locZ = wg84_coords.coord_z; // Step Convert WGS84 Cartesian XYZ to WGS84 Latitude, longitude and Ellipsoidal height ge_projectionWGS84 pwg84 = new ge_projectionWGS84(wg84); if (!pwg84.calcLatLongH_fromXYZ()) { errorMsg = "Error: pwg84.calcLatLongH_fromXYZ()"; return(null); } ; return(wg84); }