本文整理汇总了C#中CmsData.CMSDataContext.InsertDuplicate方法的典型用法代码示例。如果您正苦于以下问题:C# CMSDataContext.InsertDuplicate方法的具体用法?C# CMSDataContext.InsertDuplicate怎么用?C# CMSDataContext.InsertDuplicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CmsData.CMSDataContext
的用法示例。
在下文中一共展示了CMSDataContext.InsertDuplicate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
public ActionResult Find(string FromDate, string ToDate)
{
var fdt = FromDate.ToDate();
var tdt = ToDate.ToDate();
string host = Util.Host;
var runningtotals = new DuplicatesRun
{
Started = DateTime.Now,
Count = 0,
Processed = 0,
Found = 0
};
DbUtil.Db.DuplicatesRuns.InsertOnSubmit(runningtotals);
DbUtil.Db.SubmitChanges();
Alias.Task.Factory.StartNew(() =>
{
Thread.CurrentThread.Priority = ThreadPriority.Lowest;
var Db = new CMSDataContext(Util.GetConnectionString(host));
var rt = Db.DuplicatesRuns.OrderByDescending(mm => mm.Id).First();
Db.ExecuteCommand("delete duplicate");
var q = from p in Db.People
where p.CreatedDate > fdt
where p.CreatedDate < tdt.Value.AddDays(1)
select p.PeopleId;
rt.Count = q.Count();
Db.SubmitChanges();
foreach(var p in q)
{
var pids = Db.FindPerson4(p);
rt.Processed++;
Db.SubmitChanges();
if (pids.Count() == 0)
continue;
foreach(var pid in pids)
Db.InsertDuplicate(p, pid.PeopleId.Value);
rt.Found++;
}
rt.Completed = DateTime.Now;
Db.SubmitChanges();
});
return Redirect("/Manage/Duplicates/Progress");
}