Commit 7e6a3c71 authored by Kirill's avatar Kirill

?

parent 1ab47d25
using System; using System;
using System.IO; using System.IO;
using SQLite; using SQLite;
using TourDataManager.Entities;
namespace TourDataManager { namespace TourDataManager {
...@@ -28,8 +29,24 @@ namespace TourDataManager { ...@@ -28,8 +29,24 @@ namespace TourDataManager {
var databasePath = Path.Combine(rootPath,"sandbox.sqlite"); var databasePath = Path.Combine(rootPath,"sandbox.sqlite");
var db = new SQLiteConnection(databasePath); var db = new SQLiteConnection(databasePath);
db.CreateTable<Stock>(); db.Execute("PRAGMA foreign_keys=ON");
db.CreateTable<Valuation>();
for (int i = 0; i < 10; i++){
db.Insert(new Estate{Id = i, Title = $"Estate{i}", Created = "Vchera", TourCount = i * 2});
}
for (int i = 0; i < 2; i++){
db.Insert(new Tour{
Id = i,
Title = $"Tour{i}",
Created = "1 year ago",
State = 0,Type = "aws",
EstateId = 3
});
}
} }
} }
......
using SQLite;
namespace TourDataManager.Entities {
public class Estate {
/// Идентификатор объекта недвижимости
[PrimaryKey]
public long Id{ get; set; }
[NotNull]
public string Title{ get; set; }
[NotNull]
public int TourCount{ get; set; } //cnt_tours
public string Preview{ get; set; }
[NotNull]
public string Created{ get; set; }
}
}
\ No newline at end of file
using SQLite;
namespace TourDataManager.Entities {
public class Tour {
[PrimaryKey]
public long Id{ get; set; }
[NotNull]
public string Title{ get; set; }
public string Preview{ get; set; }
public string Screen{ get; set; }
[NotNull]
public int EstateId{ get; set; }
[NotNull]
public string Created{ get; set; }
[NotNull]
public string Updated{ get; set; }
[NotNull]
public string Type{ get; set; }
/// Состояние тура
[NotNull]
public int State{ get; set; }
}
}
\ No newline at end of file
...@@ -116,6 +116,8 @@ ...@@ -116,6 +116,8 @@
<Compile Include="CookieStorage.cs" /> <Compile Include="CookieStorage.cs" />
<Compile Include="Db.cs" /> <Compile Include="Db.cs" />
<Compile Include="Debug.cs" /> <Compile Include="Debug.cs" />
<Compile Include="Entities\Estate.cs" />
<Compile Include="Entities\Tour.cs" />
<Compile Include="IAuthenticator.cs" /> <Compile Include="IAuthenticator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TourDataManager.cs" /> <Compile Include="TourDataManager.cs" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment