本文整理匯總了C#中SidejobModel.SidejobEntities.AddToResponseDelays方法的典型用法代碼示例。如果您正苦於以下問題:C# SidejobEntities.AddToResponseDelays方法的具體用法?C# SidejobEntities.AddToResponseDelays怎麽用?C# SidejobEntities.AddToResponseDelays使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SidejobModel.SidejobEntities
的用法示例。
在下文中一共展示了SidejobEntities.AddToResponseDelays方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: UpdateResponseDelay
public void UpdateResponseDelay(int action, ClosedProject cp, SidejobEntities context)
{
if (action == 0) return;
switch (action)
{
case 1:
var rd = new ResponseDelay
{
BidderID = BidderID,
CurrencyID = cp.CurrencyID,
BidderRole = BidderRole,
DateFinished = DateTime.UtcNow.Date,
HighestBid = cp.HighestBid,
PosterID = PosterID,
ReminderLevel = 1,
Status = 3
};
context.AddToResponseDelays(rd);
context.SaveChanges();
break;
case 2:
var rd2 = (from c in context.ResponseDelays
where c.BidderID == BidderID
&& c.PosterID == PosterID && c.Status == 3
select c).FirstOrDefault();
if (rd2 != null)
{
rd2.Status = 4;
context.SaveChanges();
}
break;
case 3:
ArchiveProject(context);
var rd3 = (from c in context.ResponseDelays
where c.BidderID == BidderID
&& c.PosterID == PosterID
select c).FirstOrDefault();
if (rd3 != null)
{
context.DeleteObject(rd3);
context.DeleteObject(cp);
var p = (from c in context.Projects
where c.ProjectID == ProjectID
select c).FirstOrDefault();
if (p != null)
{
p.StatusInt = 6;
context.SaveChanges();
}
}
break;
}
}
示例2: AddToResponseDelay
/////////////////////ADD TO CLOSED PROJECT/////////////////////////
/////////////////////ADD TO RESPONSE DELAY/////////////////////////
public void AddToResponseDelay(int projectId, ClosedProject cp)
{
//Added the new record with status = 3
//because the first time it will be for bidder
//Check if exist already in the tables
using (var context = new SidejobEntities())
{
var rd = (from c in context.ResponseDelays
where c.ProjectID == projectId
select c).FirstOrDefault();
if (rd == null)
{
var newResponseDelay = new SidejobModel.ResponseDelay
{
ProjectID = projectId,
DateFinished = DateTime.Now.Date,
PosterID = cp.PosterID,
PosterRole = cp.PosterRole,
BidderID = cp.BidderID,
BidderRole = cp.BidderRole,
HighestBid = cp.HighestBid,
CurrencyID = cp.CurrencyID,
Status = 3
};
context.AddToResponseDelays(newResponseDelay);
context.SaveChanges();
}
}
}