本文整理汇总了C#中UpsilabEntities.SaveChanges方法的典型用法代码示例。如果您正苦于以下问题:C# UpsilabEntities.SaveChanges方法的具体用法?C# UpsilabEntities.SaveChanges怎么用?C# UpsilabEntities.SaveChanges使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UpsilabEntities
的用法示例。
在下文中一共展示了UpsilabEntities.SaveChanges方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateCpteSupportHistory
public static ag_upsideo_cptrelsupports_histo UpdateCpteSupportHistory(ag_upsideo_cptrelsupports_histo histo)
{
try
{
using (Data.Model.UpsilabEntities context = new UpsilabEntities())
{
if (histo.Id > 0)
{
var updatehisto = context.ag_upsideo_cptrelsupports_histo.FirstOrDefault(x => x.Id == histo.Id);
updatehisto.datemaj = DateTime.Now;
updatehisto.pru = histo.pru;
updatehisto.qte = histo.qte;
updatehisto.vl = histo.vl;
context.SaveChanges();
return updatehisto;
}
else
{
context.ag_upsideo_cptrelsupports_histo.AddObject(histo);
context.SaveChanges();
return histo;
}
}
}
catch (Exception e)
{
Log.Log.AppendException(e);
throw new Exception("SavingError");
}
}
示例2: AddFournisseurRetour
public static AgregFournisseurModel AddFournisseurRetour(ag_upsideo_fournisseur frn, ag_upsideo_fournisseur_code frncode)
{
using (Data.Model.UpsilabEntities context = new UpsilabEntities())
{
context.Connection.Open();
using (var dbContextTransaction = context.Connection.BeginTransaction())
{
try
{
frn.deleted = "n";
context.ag_upsideo_fournisseur.AddObject(frn);
context.SaveChanges();
//
//
//
frncode.idfrontfournisseur = frn.idfrontfournisseur;
context.ag_upsideo_fournisseur_code.AddObject(frncode);
context.SaveChanges();
//
//
//
dbContextTransaction.Commit();
}
catch (Exception e)
{
dbContextTransaction.Rollback();
Log.Log.AppendException(e);
throw new Exception("SavingError");
}
}
}
return AgregFournisseurModel.Ag_upsideo_fournisseurToFournisseurModel(frn, frncode);
}
示例3: Update
public static void Update(
int idSubscription,
bool isSingle,
DateTime? datePaiement,
string periodicite,
decimal? montant,
DateTime? datePremierEcheance,
decimal? premierVersement,
DateTime? datePremierVersement,
int? idMode
)
{
using (UpsilabEntities context = new UpsilabEntities())
{
var record = context.PaymentLog.FirstOrDefault(x => x.idSubscription == idSubscription);
if (record == null)
{
//ADD
record = new PaymentLog
{
idSubscription = idSubscription,
DatePayment = datePaiement,
DateFirstPaymentDeadline = datePremierEcheance,
DateFirstDeposit = datePremierVersement,
TotalAmount = montant,
AmountFirstDeposit = premierVersement,
Periodicity = periodicite,
IsSinglePayment = isSingle,
IdPaymentMode = idMode,
ReturnCode = "",
};
context.PaymentLog.AddObject(record);
context.SaveChanges();
return;
}
//Update
record.IsSinglePayment = isSingle;
record.DatePayment = datePaiement;
record.Periodicity = periodicite;
record.TotalAmount = montant;
record.DateFirstPaymentDeadline = datePremierEcheance;
record.AmountFirstDeposit = premierVersement;
record.DateFirstDeposit = datePremierVersement;
record.IdPaymentMode = idMode;
context.SaveChanges();
}
}
示例4: CreateUser
public static Upsilab.Data.Model.User CreateUser(Upsilab.Data.Model.User user, String pasword)
{
user.UserPassword = UserBL.Encrypt(pasword);
using (UpsilabEntities context = new UpsilabEntities())
{
var _user = new Data.Model.User();
_user.idUser = user.idUser;
_user.idUserProfile = user.idUserProfile;
_user.UserLogin = user.UserLogin;
_user.UserPassword = user.UserPassword;
_user.UserName = user.UserName;
_user.UserFirstName = user.UserFirstName;
_user.UserMobilePhone = user.UserMobilePhone;
_user.UserEmail = user.UserEmail;
_user.IsActive = user.IsActive;
_user.IsDeleted = user.IsDeleted;
_user.DateCreated = DateTime.Now;
_user.IdLicenseReport = user.IdLicenseReport;
_user.IdLicenseLab = user.IdLicenseLab;
//context.User.AddObject(user);
context.User.AddObject(_user);
context.SaveChanges();
}
return user;
}
示例5: Log
/// <summary>
/// Log ONLY sent Emails, doesn't take care of any errors !!!
/// </summary>
/// <param name="IDSender">NULLABLE especially for System </param>
/// <param name="EmailSender"></param>
/// <param name="IDRecipient">NULLABLE</param>
/// <param name="EmailRecipient"></param>
/// <param name="RecipientType"></param>
/// <param name="EmailType"></param>
/// <param name="IDRecipientCC">NULLABLE</param>
/// <param name="EmailRecipientCC">NULLABLE</param>
public static void Log(Guid? IDSender, string EmailSender, Guid? IDRecipient, string EmailRecipient, TypeDestinataire RecipientType, string EmailType, Guid? IDRecipientCC = null, string EmailRecipientCC = null)
{
try
{
using (UpsilabEntities context = new UpsilabEntities())
{
EmailLog pEmailLog = new EmailLog();
if (IDSender != null)
pEmailLog.IDSender = IDSender.Value;
pEmailLog.EmailSender = EmailSender;
if (IDRecipient != null)
pEmailLog.IDRecipient = IDRecipient.Value;
if (IDRecipientCC != null)
pEmailLog.IDRecipientCC = IDRecipientCC.Value;
pEmailLog.EmailRecipient = EmailRecipient;
pEmailLog.EmailRecipientCC = EmailRecipientCC;
pEmailLog.RecipientType = RecipientType.ToString();
pEmailLog.EmailType = EmailType.ToString();
pEmailLog.DateCreated = DateTime.Now;
context.EmailLog.AddObject(pEmailLog);
context.SaveChanges();
}
}
catch { }
}
示例6: UpdateMessage
public ActionResult UpdateMessage(string idmessage)
{
using (UpsilabEntities context = new UpsilabEntities())
{
var result = new {Status = "OK", Message = string.Empty};
try
{
int idMessage = 0;
int.TryParse(idmessage, out idMessage);
if (idMessage > 0)
{
// set message to read
User currentUser = SessionManager.GetUserSession();
Message ms = context.Message.FirstOrDefault(m => m.idMessage == idMessage && m.idUser == currentUser.idUser);
if (ms != null)
{
ms.Read = true;
ms.DateUpdated = DateTime.Now;
context.SaveChanges();
}
}
}
catch (Exception ex)
{
Log.AppendException(ex);
result = new { Status = "KO", Message = ex.Message};
}
return Json(result,JsonRequestBehavior.AllowGet);
}
}
示例7: CreateReportAlert
public static void CreateReportAlert(Guid idReport, int idAlert, String reason)
{
var existingReportAlert = ReportAlertBL.HasExistingReportAlert(idReport, idAlert);
if (existingReportAlert == null)
{
var reportAlert = new ReportAlert() { idAlert = idAlert, idReport = idReport, JustifyingReason = reason };
using (UpsilabEntities context = new UpsilabEntities())
{
context.ReportAlert.Attach(reportAlert);
context.ObjectStateManager.ChangeObjectState(reportAlert, System.Data.EntityState.Added);
context.SaveChanges();
}
}
else
{
existingReportAlert.JustifyingReason = reason;
using (UpsilabEntities context = new UpsilabEntities())
{
context.ReportAlert.Attach(existingReportAlert);
context.ObjectStateManager.ChangeObjectState(existingReportAlert, System.Data.EntityState.Modified);
context.SaveChanges();
}
}
}
示例8: InsertSignatureTransaction
//static UpsilabEntities context = new UpsilabEntities();
public static void InsertSignatureTransaction(SignatureTransaction signatureTransaction)
{
using (UpsilabEntities context = new UpsilabEntities())
{
context.SignatureTransaction.AddObject(signatureTransaction);
context.SaveChanges();
}
}
示例9: Save
public static void Save(PaymentLog paymentLog)
{
using (UpsilabEntities context = new UpsilabEntities())
{
context.PaymentLog.AddObject(paymentLog);
context.SaveChanges();
}
}
示例10: Add
public static void Add(CreditAddLog creditAddLog)
{
using (UpsilabEntities context = new UpsilabEntities())
{
context.CreditAddLog.AddObject(creditAddLog);
context.SaveChanges();
}
}
示例11: InsertLABModel
public static void InsertLABModel(LABModel labModel)
{
using (UpsilabEntities context = new UpsilabEntities())
{
context.LABModel.AddObject(labModel);
context.SaveChanges();
}
}
示例12: Update
public static void Update(Data.Model.DER objDer)
{
using (UpsilabEntities context = new UpsilabEntities())
{
context.DER.Attach(objDer);
context.ObjectStateManager.ChangeObjectState(objDer, System.Data.EntityState.Modified);
context.SaveChanges();
}
}
示例13: Addcompte
public static ag_upsideo_compte Addcompte(ag_upsideo_compte compte)
{
using (UpsilabEntities context = new UpsilabEntities())
{
context.ag_upsideo_compte.AddObject(compte);
context.SaveChanges();
return compte;
}
}
示例14: InsertEvents
public static void InsertEvents(Events newEvent)
{
using (UpsilabEntities db = new UpsilabEntities())
{
db.Events.Attach(newEvent);
db.ObjectStateManager.ChangeObjectState(newEvent, System.Data.EntityState.Added);
db.SaveChanges();
}
}
示例15: UpdateSignatureTransaction
public static void UpdateSignatureTransaction(SignatureTransaction signatureTransaction)
{
using (UpsilabEntities context = new UpsilabEntities())
{
context.SignatureTransaction.Attach(signatureTransaction);
context.ObjectStateManager.ChangeObjectState(signatureTransaction, System.Data.EntityState.Modified);
context.SaveChanges();
}
}