本文整理汇总了C#中SidejobModel.SidejobEntities.DeleteObject方法的典型用法代码示例。如果您正苦于以下问题:C# SidejobEntities.DeleteObject方法的具体用法?C# SidejobEntities.DeleteObject怎么用?C# SidejobEntities.DeleteObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SidejobModel.SidejobEntities
的用法示例。
在下文中一共展示了SidejobEntities.DeleteObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmailAutomation
public void EmailAutomation()
{
using (var context = new SidejobEntities())
{
var message = (from c in context.AutomatedMessages
select c).ToList();
if (message.Count != 0)
{
foreach (var e in message)
{
try
{
SendEmail(e.EmailAddress, e.Title, e.MessageID.ToString(CultureInfo.InvariantCulture), Server.MapPath("~/EmailTemplates/AutomatedMessage.aspx"), Message.Automated);
}
catch (Exception emailexception)
{
var emailProblem = new AutomationEmailProblem
{
MessageID = e.MessageID,
EmailAddress = e.EmailAddress,
Title = e.Title,
Message = e.Message
};
context.AddToAutomationEmailProblems(emailProblem);
}
}
}
context.DeleteObject(message);
context.SaveChanges();
}
}
示例2: GetValue
//private void GetValue(SidejobEntities context)
//{
// var projectsecondchance = (from c in context.ProjectSecondChances
// where c.ProjectID == ProjectID
// select c).ToList();
// if (projectsecondchance.Count != 0)
// {
// foreach (var psc in projectsecondchance)
// {
// context.DeleteObject(psc);
// context.SaveChanges();
// }
// }
//}
private void GetValue(SidejobEntities context, ICollection somelist)
{
if (somelist.Count <= 0) return;
foreach (var item in somelist)
{
context.DeleteObject(item);
context.SaveChanges();
}
}
示例3: DeleteFromResponseDelay
public void DeleteFromResponseDelay(SidejobEntities context)
{
var rd = (from c in context.ResponseDelays
where c.ProjectID == ProjectID
select c).FirstOrDefault();
if ( rd != null)
{
context.DeleteObject(rd);
context.SaveChanges();
}
}
示例4: DeleteAllBids
public void DeleteAllBids(SidejobEntities context, int projectId, int bidderid)
{
var bids = (from c in context.Bids
where c.ProjectID == projectId
orderby c.AmountOffered descending
select c).ToList();
if (bids.Count != 0)
{
foreach (var b in bids)
{
context.DeleteObject(b);
}
}
context.SaveChanges();
}
示例5: AutomatedEmailProblemGridViewSelectedIndexChanged
protected void AutomatedEmailProblemGridViewSelectedIndexChanged(object sender, EventArgs e)
{
//Issue is fixed, then delete it
if (AutomatedEmailProblemGridView.SelectedDataKey == null) return;
var selected = (int)AutomatedEmailProblemGridView.SelectedDataKey.Value;
using (var context = new SidejobEntities())
{
var current = (from c in context.AutomationEmailProblems
where c.MessageID == selected
select c).FirstOrDefault();
if (current != null)
{
context.DeleteObject(current);
context.SaveChanges();
}
}
}
示例6: EmailSentExceptionGridViewSelectedIndexChanged
protected void EmailSentExceptionGridViewSelectedIndexChanged(object sender, EventArgs e)
{
//Issue is fixed, then delete it
if (EmailSentExceptionGridView.SelectedDataKey == null) return;
var selected = (int)EmailSentExceptionGridView.SelectedDataKey.Value;
using (var context = new SidejobEntities())
{
var current = (from c in context.EmailSentExceptions
where c.ID == selected
select c).FirstOrDefault();
if (current != null)
{
context.DeleteObject(current);
context.SaveChanges();
Response.Redirect(Context.Request.Url.ToString());
}
}
}
示例7: ArchiveRefund
protected void ArchiveRefund(int pdtid)
{
using (var context = new SidejobEntities())
{
var currentrefund = (from c in context.RefundCustomerSuccessfulPDTs
where c.PDTID == pdtid
select c).FirstOrDefault();
if(currentrefund != null)
{
var archivedrefund = new ArchivedRefundCustomerSuccessfulPDT
{
PDTID = currentrefund.PDTID,
GrossTotal = currentrefund.GrossTotal,
Invoice = currentrefund.Invoice,
PaymentStatus = currentrefund.PaymentStatus,
FirstName = currentrefund.FirstName,
LastName = currentrefund.LastName,
PaymentFee = currentrefund.PaymentFee,
BusinessEmail = currentrefund.BusinessEmail,
TxToken = currentrefund.TxToken,
ReceiverEmail = currentrefund.ReceiverEmail,
ItemName = currentrefund.ItemName,
CurrencyCode = currentrefund.CurrencyCode,
TransactionId = currentrefund.TransactionId,
Custom = currentrefund.Custom,
subscriberId = currentrefund.subscriberId,
CustomerID = currentrefund.CustomerID,
ProjectID = currentrefund.ProjectID
};
context.AddToArchivedRefundCustomerSuccessfulPDTs(archivedrefund);
context.DeleteObject(currentrefund);
context.SaveChanges();
Response.Redirect(Context.Request.Url.ToString());
}
}
}
示例8: AutomatedMessageProcessStart
public void AutomatedMessageProcessStart()
{
using (var context = new SidejobEntities())
{
var message = (from c in context.AutomatedMessages
select c).ToList();
if (message.Count == 0) return;
foreach (var m in message)
{
try
{
SendEmail(m.EmailAddress,
"http://www.my-side-job.com/Schedule/MySideJob/EmailTemplates/AutomatedMessage.aspx",
m.MessageID.ToString(CultureInfo.InvariantCulture));
context.DeleteObject(m);
}
catch (Exception)
{
CatchMessage(context, m);
}
}
}
}
示例9: RefundCustomer
public void RefundCustomer(int customerId)
{
//Check Successful PDT and Check ArchivedSuccessful PDT
using (var context = new SidejobEntities())
{
//Check Successful PDT
var e = (from c in context.CustomerSuccessfulPDTs
where c.CustomerID == customerId && c.ProjectID == ProjectID
select c).FirstOrDefault();
if (e == null)
{
CheckCustomerArchivedPDT(customerId, context);
}
else
{
CheckRefundedCustomerPDT(customerId, e, context);
context.DeleteObject(e);
context.SaveChanges();
}
}
}
示例10: CustomerWin
public void CustomerWin(Bid bidder)
{
var context = new SidejobEntities();
var customerwinbid = new CustomerWinBid
{
BidID = bidder.BidID,
CustomerID = bidder.BidderID,
NumberofBids = GetCustomerNumberofBids(bidder.BidderID)
};
context.AddToCustomerWinBids(customerwinbid);
context.DeleteObject(bidder);
context.SaveChanges();
}
示例11: ProWin
public void ProWin(Bid bidder)
{
var context = new SidejobEntities();
var professionalwinbid = new ProfessionalWinBid
{
BidID = bidder.BidID,
ProID = bidder.BidderID,
NumberofBids = GetProfessionalNumberofBids(bidder.BidderID)
};
context.AddToProfessionalWinBids(professionalwinbid);
context.DeleteObject(bidder);
context.SaveChanges();
}
示例12: PosterResponseDelayUpdate
public static void PosterResponseDelayUpdate(int projectid)
{
using (var context = new SidejobEntities())
{
var rd = (from c in context.ResponseDelays
where c.ProjectID == projectid
select c).FirstOrDefault();
context.DeleteObject(rd);
}
}
示例13: Process
private void Process()
{
using (var context = new SidejobEntities())
{
var newopportunity = (from cp in context.ProjectSecondChances
where cp.ProjectID == ProjectID
select cp);
if (newopportunity.Count() == 2)
{
//Save to ArchivedProjectSecondChance
SavedToArchivedProjectSecondChance(context, newopportunity);
//Delete Previous BidderWin and Bids
DeletePreviousBidderWin(context, ProjectID);
//Add Current BidderWin
AddNewBidderWin(context, ProjectID);
//update project
Updateproject(context);
//delete from Response Delay
DeleteFromResponseDelay(context);
foreach (ProjectSecondChance o in newopportunity.ToList())
{
context.DeleteObject(o);
}
}
context.SaveChanges();
}
}
示例14: ExtendProject
private static void ExtendProject(int projectid)
{
using (var context = new SidejobEntities())
{
//Extend Project ( Make statusInt = 0 and ouput message)
// Delete the previous bidder in Project
var newBidProcess = new NewProjectBidProcess(PreviousBidderID, ProjectID);
newBidProcess.DeleteAllBids(context, ProjectID, PreviousBidderID);
//Delete From ClosedProject
var closedproject = (from c in context.ClosedProjects
where c.ProjectID == projectid
select c).FirstOrDefault();
if (closedproject != null)
{
context.DeleteObject(closedproject);
}
//Delete From ResponseDelay
var rd = (from c in context.ResponseDelays
where c.ProjectID == projectid
select c).FirstOrDefault();
if (rd != null)
{
context.DeleteObject(rd);
context.SaveChanges();
}
//Update Project Requirement End Date to Today + 7 days
var projectrequirement = (from c in context.ProjectRequirements
where c.ProjectID == projectid
select c).FirstOrDefault();
if (projectrequirement != null)
{
projectrequirement.DatePosted = DateTime.UtcNow.Date.AddDays(7);
context.SaveChanges();
}
//Clear Project Winning Bid
var project = (from c in context.Projects
where c.ProjectID == projectid
select c).FirstOrDefault();
if (project == null) return;
project.StatusInt = 0;
project.Status = Resources.Resource.OPEN;
project.HighestBid = null;
project.HighestBidderID = null;
project.HighestBidUsername = null;
project.NumberofBids = 0;
context.SaveChanges();
}
}
示例15: ArchiveCancelledProject
//.........这里部分代码省略.........
};
context.AddToArchievedCancelledProjects(acp);
}
}
}
//for each record
foreach (var cp in currentprojectphoto)
{
if ((from c in context.ArchievedCancelledProjectPhotoes
where c.PhotoID == cp.PhotoID
select c).FirstOrDefault() == null)
{
var ac = new ArchievedCancelledProjectPhoto
{
PhotoID = cp.PhotoID,
ProjectID = cp.ProjectID,
PhotoPath = cp.PhotoPath,
Caption = cp.Caption,
AlbumID = cp.AlbumID,
PhotoRank = cp.PhotoRank
};
context.AddToArchievedCancelledProjectPhotoes(ac);
}
}
if (currentprojectpicture != null)
{
if ((from c in context.ArchievedCancelledProjectPictures
where c.AlbumID == currentprojectpicture.AlbumID
select c).FirstOrDefault() == null)
{
var acpi = new ArchievedCancelledProjectPicture
{
AlbumID = currentprojectpicture.AlbumID,
AlbumCaption = currentprojectpicture.AlbumCaption,
Numberofimages = currentprojectpicture.Numberofimages,
ProjectID = currentprojectpicture.ProjectID
};
context.AddToArchievedCancelledProjectPictures(acpi);
}
}
if (currentprojectrequirement != null)
{
if ((from c in context.ArchievedCancelledProjectRequirements
where c.ProjectID == currentprojectpicture.AlbumID
select c).FirstOrDefault() == null)
{
var acpr = new ArchievedCancelledProjectRequirement
{
ProjectID = currentprojectrequirement.ProjectID,
LCID = currentprojectrequirement.LCID,
CategoryID = currentprojectrequirement.CategoryID,
CategoryName = currentprojectrequirement.CategoryName,
JobID = currentprojectrequirement.JobID,
JobTitle = currentprojectrequirement.JobTitle,
ExperienceID = currentprojectrequirement.ExperienceID,
CrewNumberID = currentprojectrequirement.CrewNumberID,
LicensedID = currentprojectrequirement.LicensedID,
InsuredID = currentprojectrequirement.InsuredID,
RelocationID = currentprojectrequirement.RelocationID,
ProjectTitle = currentprojectrequirement.ProjectTitle,
StartDate = currentprojectrequirement.StartDate,
EndDate = currentprojectrequirement.EndDate,
AmountOffered = currentprojectrequirement.AmountOffered,
CurrencyID = currentprojectrequirement.CurrencyID,
Description = currentprojectrequirement.Description,
SpecialNotes = currentprojectrequirement.SpecialNotes,
Address = currentprojectrequirement.Address,
CountryID = currentprojectrequirement.CountryID,
CountryName = currentprojectrequirement.CountryName,
RegionID = currentprojectrequirement.RegionID,
RegionName = currentprojectrequirement.RegionName,
CityID = currentprojectrequirement.CityID,
CityName = currentprojectrequirement.CityName,
Zipcode = currentprojectrequirement.Zipcode,
DatePosted = currentprojectrequirement.DatePosted,
TimeLeft = currentprojectrequirement.TimeLeft
};
context.AddToArchievedCancelledProjectRequirements(acpr);
}
}
context.SaveChanges();
//delete from current project
if (currentprojectrequirement != null) context.DeleteObject(currentproject);
if (currentprojectphoto.Count != 0)
{
foreach (var cp in currentprojectphoto)
{
context.DeleteObject(cp);
}
}
if (currentprojectpicture != null) context.DeleteObject(currentprojectpicture);
if (currentprojectrequirement != null) context.DeleteObject(currentprojectrequirement);
context.SaveChanges();
}