Esempio n. 1
0
 public static bool AddLog(SmsLogs log)
 {
     using (var dbContext = new EmeLogsEntities())
     {
         dbContext.Entry(log).State = EntityState.Added;
         return dbContext.SaveChanges() > 0;
     }
 }
Esempio n. 2
0
        /// <summary>
        /// 作者:Vincen
        /// 时间:2014.05.27
        /// 描述:新增操作日志信息
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public static bool CreateExceptionLogs(ExceptionLogs model)
        {
            using (var ldb = new EmeLogsEntities())
            {
                var elog = new ExceptionLogs()
                {
                    ExceptionType = model.ExceptionType,
                    Message = model.Message,
                    IsTreat = false,
                    UserHostAddress = WebHelper.GetCurrentIpAddress(),
                    CreateBy = model.CreateBy,
                    CreateTime = model.CreateTime,
                    Remark = model.Remark
                };

                ldb.Entry(elog).State = EntityState.Added;
                return ldb.SaveChanges() > 0;
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 作者:Kylin
 /// 时间:2014.08.26
 /// 描述:创建SA下学员学习累积进度详情
 /// </summary>
 /// <param name="list"></param>
 /// <returns></returns>
 public static bool CreateSAStudentStudyProgressDetail(List<StudentStudyProgressDetail> list)
 {
     try
     {
         using (var edb = new EmeReportsEntities())
         {
             // using (var tran = new TransactionScope(TransactionScopeOption.Required))
             {
                 foreach (var model in list)
                 {
                     if (
                         !edb.StudentStudyProgressDetail.Any(p => p.BranchId == model.BranchId && p.SAId == model.SAId && EntityFunctions.DiffDays(p.OprDate, model.OprDate) == 0 && p.ProductSCode == model.ProductSCode && p.RateCourses == model.RateCourses.Value))
                     {
                         edb.Entry(model).State = EntityState.Added;
                     }
                 }
                 var result = edb.SaveChanges() > 0;
                 // tran.Complete();
                 return result;
             }
         }
     }
     catch (Exception ex)
     {
         var edb = new EmeLogsEntities();
         var exceptrionLog = new ExceptionLogs()
         {
             ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
             Message = string.Format("ServiceReportBLL-CreateSAStudentStudyProgressDetail:{0};{1};{2}", ex.Message, ex.InnerException.Message, ex.HelpLink),
             IsTreat = false,
             CreateBy = null,
             CreateTime = DateTime.Now
         };
         edb.Entry(exceptrionLog).State = EntityState.Added;
         edb.SaveChanges();
         return false;
     }
 }