本文整理汇总了C#中IDatabase.Insert方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.Insert方法的具体用法?C# IDatabase.Insert怎么用?C# IDatabase.Insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDatabase
的用法示例。
在下文中一共展示了IDatabase.Insert方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InsertEmployee
private void InsertEmployee(Employee employee, IDatabase database)
{
Action proc = () =>
{
database.Insert(employee);
};
database.ExecuteInTransaction(proc);
}
示例2: Entry
public static bool Entry(IDatabase database, string cardId, ILane lane)
{
var time = DateTime.Now;
var dailyDirectoryName = DailyDirectoryName(time);
if (!Directory.Exists(dailyDirectoryName))
{
Directory.CreateDirectory(dailyDirectoryName);
}
var prefixFileName = dailyDirectoryName +
Path.DirectorySeparatorChar +
lane.Name.ToUpper() + time.ToString("HHmmss") + EntryString;
var plateNumber = string.Empty;
var plateFileName = string.Empty;
var faceFileName = string.Empty;
if (lane.PlateCamera != null)
{
plateFileName = prefixFileName + SuffixPlateFileName;
if (!TakeAndSave(lane.PlateCamera, plateFileName))
{
// Error
}
// Todo: Get Plate number.
}
else
{
// Error
}
if (lane.FaceCamera != null)
{
faceFileName = prefixFileName + SuffixFaceFileName;
if (!TakeAndSave(lane.FaceCamera, faceFileName))
{
faceFileName = string.Empty;
}
}
if (CanEntry(database, cardId, plateNumber))
{
var paramater = new Dictionary<string, string>();
paramater["CardId"] = cardId;
paramater["EntryTime"] = time.ToString();
paramater["EntryPlateNumber"] = plateNumber;
paramater["EntryPlateImage"] = plateFileName.Remove(0, RootImageDirectoryName.Length);
paramater["EntryFaceImage"] = faceFileName.Remove(0, RootImageDirectoryName.Length);
return (database.Insert("EntryExit", paramater));
}
return (false);
}
示例3: Setup
public void Setup()
{
db = TestDbHelper.GetEmptyDatabase();
int currentFileId = 0;
var qulityProfile = new QualityProfile
{
Name = "TestProfile",
Allowed = new List<QualityTypes> { QualityTypes.DVD, QualityTypes.Bluray1080p },
Cutoff = QualityTypes.DVD
};
db.Insert(qulityProfile);
foreach (var _seriesId in seriesIds)
{
int seriesId = _seriesId;
var series = Builder<Series>.CreateNew()
.With(s => s.SeriesId = seriesId)
.With(s => s.Monitored = true)
.Build();
db.Insert(series);
foreach (var _seasonNumber in seasonsNumbers)
{
for (int i = 1; i <= Episodes_Per_Season; i++)
{
var epFileId = 0;
if (i < 10)
{
var epFile = Builder<EpisodeFile>.CreateNew()
.With(e => e.SeriesId = seriesId)
.And(e => e.SeasonNumber = _seasonNumber)
.And(e => e.Path = Guid.NewGuid().ToString())
.Build();
files.Add(epFile);
currentFileId++;
epFileId = currentFileId;
}
var episode = Builder<Episode>.CreateNew()
.With(e => e.SeriesId = seriesId)
.And(e => e.SeasonNumber = _seasonNumber)
.And(e => e.EpisodeNumber = i)
.And(e => e.Ignored = false)
.And(e => e.TvDbEpisodeId = episodes.Count + 1)
.And(e => e.EpisodeFileId = epFileId)
.And(e => e.AirDate = DateTime.Today.AddDays(-20))
.Build();
episodes.Add(episode);
}
}
}
db.InsertMany(episodes);
db.InsertMany(files);
}