本文整理汇总了C#中SidejobModel.SidejobEntities.SaveChanges方法的典型用法代码示例。如果您正苦于以下问题:C# SidejobEntities.SaveChanges方法的具体用法?C# SidejobEntities.SaveChanges怎么用?C# SidejobEntities.SaveChanges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SidejobModel.SidejobEntities
的用法示例。
在下文中一共展示了SidejobEntities.SaveChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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.Title, m.MessageID.ToString(CultureInfo.InvariantCulture));
// context.DeleteObject(m);
context.SaveChanges();
}
catch (Exception)
{
CatchMessage(context, m);
}
}
}
}
示例2: 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();
}
}
示例3: 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();
}
}
示例4: CatchMessage
public void CatchMessage(SidejobEntities context, AutomatedMessage m)
{
var messageProblem = new AutomationEmailProblem
{
MessageID = m.MessageID,
EmailAddress = m.EmailAddress,
Title = m.Title,
Message = m.Message
};
context.AddToAutomationEmailProblems(messageProblem);
context.SaveChanges();
}
示例5: 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();
}
}
示例6: AddNewBidderWin
public void AddNewBidderWin(SidejobEntities context, int projectId)
{
var newBid = GetCurrentNewBid(projectId, NewProID);
var newwin = new ProfessionalWinBid
{
BidID = newBid.BidID,
ProID = NewProID,
NumberofBids = GetNumberofBids(context)
};
context.AddToProfessionalWinBids(newwin);
context.SaveChanges();
}
示例7: BidderResponseDelayUpdate
public static void BidderResponseDelayUpdate(int projectid)
{
using (var context = new SidejobEntities())
{
var rd = (from c in context.ResponseDelays
where c.ProjectID == projectid
select c).FirstOrDefault();
if (rd != null)
{
rd.Status = 4;
context.SaveChanges();
}
}
}
示例8: 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();
}
示例9: 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();
}
}
}
示例10: 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());
}
}
}
示例11: AddNewBidderWin
public void AddNewBidderWin(SidejobEntities context, int projectId)
{
var newBid = GetCurrentNewBid(projectId, NewProID);
if (newBid == null) return;
try
{
var newwin = new ProfessionalWinBid
{
BidID = newBid.BidID,
ProID = NewProID,
NumberofBids = GetNumberofBids(context)
};
context.AddToProfessionalWinBids(newwin);
context.SaveChanges();
}
catch (Exception e)
{
var i = e;
}
}
示例12: AddToBidderCompletedProjectSucessPayment
public static void AddToBidderCompletedProjectSucessPayment(int projectid, int payerid, string payerole)
{
var context = new SidejobEntities();
var biddercompletedprojectsucesspayment = new CompletedProjectSucessPayment
{
PayerID = payerid,
PayerProjectRole = "BIDDER",
PayerRole = payerole,
ProjectID = projectid
};
context.AddToCompletedProjectSucessPayment(biddercompletedprojectsucesspayment);
context.SaveChanges();
//check to see if the poster has already made the payment:
var posterpayment = (from c in context.CompletedProjectSucessPayment
where c.ProjectID == projectid && c.PayerProjectRole == "POSTER"
select c).FirstOrDefault();
if (posterpayment != null)
{
//poster
PosterSuccessPayment(projectid, 4, posterpayment.PayerRole, posterpayment.PayerID);
}
}
示例13: CustomerGridViewSelectedIndexChanged
protected void CustomerGridViewSelectedIndexChanged(object sender, EventArgs e)
{
if (CustomerGridView.SelectedDataKey == null) return;
var selected = (int) CustomerGridView.SelectedDataKey.Value;
//Archive the refund
//After you did it manually through Paypal
using (var context = new SidejobEntities())
{
var current = (from c in context.RefundCustomerSuccessfulPDTs
where c.PDTID == selected
select c).FirstOrDefault();
if (current != null)
{
var archive = new ArchivedRefundCustomerSuccessfulPDT
{
PDTID = current.PDTID,
GrossTotal = current.GrossTotal,
Invoice = current.Invoice,
PaymentStatus = current.PaymentStatus,
FirstName = current.FirstName,
LastName = current.LastName,
PaymentFee = current.PaymentFee,
BusinessEmail = current.BusinessEmail,
TxToken = current.TxToken,
ReceiverEmail = current.ReceiverEmail,
ItemName = current.ItemName,
TransactionId = current.TransactionId,
Custom = current.Custom,
subscriberId = current.subscriberId,
CustomerID = current.CustomerID,
ProjectID = current.ProjectID
};
context.AddToArchivedRefundCustomerSuccessfulPDTs(archive);
context.SaveChanges();
}
}
}
示例14: 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());
}
}
}
示例15: CheckProfessionalArchivedPDT
public void CheckProfessionalArchivedPDT(int professionalId, SidejobEntities context)
{
//Check ArchivedSuccessful PDT
var e1 = (from c in context.ArchivedProfessionalSuccessfulPDTs
where c.ProID == professionalId && c.ProjectID == ProjectID
select c).FirstOrDefault();
if (e1 != null)
{
var transaction = e1.TransactionId;
//Insert the new refund from archieved table
//Check if Transaction exist in Refund
var exist = (from c in context.RefundProfessionalSuccessfulPDTs
where c.TransactionId == transaction
select c).FirstOrDefault();
if (exist == null)
{
//Check if Transaction exist in ArchivedRefund
var existarchived = (from c in context.ArchivedRefundProfessionalSuccessfulPDTs
where c.TransactionId == transaction
select c).FirstOrDefault();
if (existarchived == null)
{
//Check if Record exist
if ((from c in context.RefundProfessionalSuccessfulPDTs
where PDTID == e1.PDTID
select c).FirstOrDefault() == null)
{
//Insert the new record
var archivedrefund = new RefundProfessionalSuccessfulPDT
{
PDTID = e1.PDTID,
GrossTotal = e1.GrossTotal,
Invoice = e1.Invoice,
PaymentStatus = e1.PaymentStatus,
FirstName = e1.FirstName,
LastName = e1.LastName,
PaymentFee = e1.PaymentFee,
BusinessEmail = e1.BusinessEmail,
TxToken = e1.TxToken,
ReceiverEmail = e1.ReceiverEmail,
ItemName = e1.ItemName,
CurrencyCode = e1.CurrencyCode,
TransactionId = e1.TransactionId,
Custom = e1.Custom,
subscriberId = e1.subscriberId,
ProID = e1.ProID,
ProjectID = e1.ProjectID
};
context.AddToRefundProfessionalSuccessfulPDTs(archivedrefund);
context.SaveChanges();
PDTID = e1.PDTID;
}
}
}
}
}