/// <summary> /// Create a new DFOdata object. /// </summary> /// <param name="x">Initial value of the X property.</param> /// <param name="y">Initial value of the Y property.</param> /// <param name="u">Initial value of the U property.</param> /// <param name="v">Initial value of the V property.</param> /// <param name="id">Initial value of the Id property.</param> public static DFOdata CreateDFOdata(global::System.Double x, global::System.Double y, global::System.Double u, global::System.Double v, global::System.Int32 id) { DFOdata dFOdata = new DFOdata(); dFOdata.X = x; dFOdata.Y = y; dFOdata.U = u; dFOdata.V = v; dFOdata.Id = id; return(dFOdata); }
public void InsertNewDFOData() { var folderPath = GetDataFolderPath(); var xyFilePath = folderPath + "\\paresedXY.txt"; var velocityPath = folderPath + "\\parsedVelocity.txt"; var xyFileLines = File.ReadAllLines(xyFilePath); var velocityFileLines = File.ReadAllLines(velocityPath); try { using (var work = new UnitOfWork()) { var dfoDataRepository = RepositoryContainer.GetRepository <DataAccess.DFOdata>(work); for (int i = 0; i < xyFileLines.Count(); i++) { var xyFileLine = xyFileLines.ElementAt(i).Split(','); var velocityFileLine = velocityFileLines.ElementAt(i).Split(','); if (xyFileLine.Count() == 3 && velocityFileLine.Count() == 3) { var x = float.Parse(xyFileLine[1], CultureInfo.InvariantCulture.NumberFormat); var y = float.Parse(xyFileLine[2], CultureInfo.InvariantCulture.NumberFormat); var u = float.Parse(velocityFileLine[1], CultureInfo.InvariantCulture.NumberFormat); var v = float.Parse(velocityFileLine[2], CultureInfo.InvariantCulture.NumberFormat); var dfOdata = new DataAccess.DFOdata() { X = x, Y = y, U = u, V = v }; dfoDataRepository.Insert(dfOdata); Console.WriteLine(xyFileLine[0]); } else { throw new Exception("txt files is not in perfect format !"); } } Console.WriteLine("Saving new data"); work.SaveChanges(); Console.WriteLine("Done"); } } catch (Exception ex) { } }
public void InsertNewDFOData() { var folderPath = GetDataFolderPath(); var xyFilePath = folderPath + "\\paresedXY.txt"; var velocityPath = folderPath + "\\parsedVelocity.txt"; var xyFileLines = File.ReadAllLines(xyFilePath); var velocityFileLines = File.ReadAllLines(velocityPath); try { using (var work = new UnitOfWork()) { var dfoDataRepository = RepositoryContainer.GetRepository<DataAccess.DFOdata>(work); for (int i = 0; i < xyFileLines.Count(); i++) { var xyFileLine = xyFileLines.ElementAt(i).Split(','); var velocityFileLine = velocityFileLines.ElementAt(i).Split(','); if (xyFileLine.Count() == 3 && velocityFileLine.Count() == 3) { var x = float.Parse(xyFileLine[1], CultureInfo.InvariantCulture.NumberFormat); var y = float.Parse(xyFileLine[2], CultureInfo.InvariantCulture.NumberFormat); var u = float.Parse(velocityFileLine[1], CultureInfo.InvariantCulture.NumberFormat); var v = float.Parse(velocityFileLine[2], CultureInfo.InvariantCulture.NumberFormat); var dfOdata = new DataAccess.DFOdata() { X = x, Y = y, U = u, V = v }; dfoDataRepository.Insert(dfOdata); Console.WriteLine(xyFileLine[0]); } else { throw new Exception("txt files is not in perfect format !"); } } Console.WriteLine("Saving new data"); work.SaveChanges(); Console.WriteLine("Done"); } } catch (Exception ex) { } }
/// <summary> /// Create a new DFOdata object. /// </summary> /// <param name="x">Initial value of the X property.</param> /// <param name="y">Initial value of the Y property.</param> /// <param name="u">Initial value of the U property.</param> /// <param name="v">Initial value of the V property.</param> /// <param name="id">Initial value of the Id property.</param> public static DFOdata CreateDFOdata(global::System.Double x, global::System.Double y, global::System.Double u, global::System.Double v, global::System.Int32 id) { DFOdata dFOdata = new DFOdata(); dFOdata.X = x; dFOdata.Y = y; dFOdata.U = u; dFOdata.V = v; dFOdata.Id = id; return dFOdata; }
/// <summary> /// Deprecated Method for adding a new object to the DFOdatas EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToDFOdatas(DFOdata dFOdata) { base.AddObject("DFOdatas", dFOdata); }