当前位置: 首页>>代码示例>>C#>>正文


C# UpsilabEntities.SaveChanges方法代码示例

本文整理汇总了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");
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:30,代码来源:AgregCompteSupportHistoryBL.cs

示例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);
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:34,代码来源:AgregFournisseurBL.cs

示例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();
            }
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:49,代码来源:PaymentLogBL.cs

示例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;
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:27,代码来源:UserBL_.cs

示例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 { }
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:38,代码来源:EmailLogBL.cs

示例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);
            }
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:34,代码来源:MessageController.cs

示例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();
                }
            }
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:26,代码来源:ReportAlertBL.cs

示例8: InsertSignatureTransaction

        //static UpsilabEntities context = new UpsilabEntities();

        public static void InsertSignatureTransaction(SignatureTransaction signatureTransaction)
        {
            using (UpsilabEntities context = new UpsilabEntities())
            {
                context.SignatureTransaction.AddObject(signatureTransaction);
                context.SaveChanges();
            }
        }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:10,代码来源:SignatureTransactionBL.cs

示例9: Save

 public static void Save(PaymentLog paymentLog)
 {
     using (UpsilabEntities context = new UpsilabEntities())
     {
         context.PaymentLog.AddObject(paymentLog);
         context.SaveChanges();
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:8,代码来源:PaymentLogBL.cs

示例10: Add

 public static void Add(CreditAddLog creditAddLog)
 {
     using (UpsilabEntities context = new UpsilabEntities())
     {
         context.CreditAddLog.AddObject(creditAddLog);
         context.SaveChanges();
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:8,代码来源:CreditAddLogBL.cs

示例11: InsertLABModel

 public static void InsertLABModel(LABModel labModel)
 {
     using (UpsilabEntities context = new UpsilabEntities())
     {
         context.LABModel.AddObject(labModel);
         context.SaveChanges();
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:8,代码来源:LABModelBL.cs

示例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();
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:9,代码来源:DerBL.cs

示例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;
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:9,代码来源:agupsideocompteBL.cs

示例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();
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:9,代码来源:EventsBL.cs

示例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();
     }
 }
开发者ID:tojoirinah,项目名称:Refonte-Recueil-One,代码行数:9,代码来源:SignatureTransactionBL.cs


注:本文中的UpsilabEntities.SaveChanges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。