本文整理汇总了C#中Eme.Model.Eme.EmeEntities.Entry方法的典型用法代码示例。如果您正苦于以下问题:C# EmeEntities.Entry方法的具体用法?C# EmeEntities.Entry怎么用?C# EmeEntities.Entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eme.Model.Eme.EmeEntities
的用法示例。
在下文中一共展示了EmeEntities.Entry方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateMessage
/// <summary>
/// 作者:Vincen
/// 时间:2014.04.30
/// 描述:创建消息
/// </summary>
/// <param name="model"></param>
/// <param name="loginUserId"></param>
/// <returns></returns>
public static bool CreateMessage(MessageModel model, int loginUserId)
{
try
{
using (var tran = new TransactionScope())
{
using (var edb = new EmeEntities())
{
var msg = new Message()
{
MessageType = model.MessageType,
Subject = model.Subject,
MContent = model.MContent,
Receivers = model.Receiver.Count,
Openers = 0,
Status = ConvertEnum.StatusTypeForActive,
CreateBy = model.CreateBy,
CreateTime = model.CreateTime
};
edb.Entry(msg).State = EntityState.Added;
edb.SaveChanges();
var receiver = from a in model.Receiver
select new MessageReceiver()
{
MessageId = msg.Id,
Receiver = a,
IsRead = false,
Status = ConvertEnum.StatusTypeForActive,
CreateBy = model.CreateBy,
CreateTime = model.CreateTime
};
foreach (var messageReceiver in receiver)
{
edb.Entry(messageReceiver).State = EntityState.Added;
}
var result = edb.SaveChanges() > 0;
tran.Complete();
return result;
}
}
}
catch (Exception e)
{
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("EmeBLL-CreateMessage:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = loginUserId,
CreateTime = DateTime.Now
});
return false;
}
}
示例2: CreateFollow
/// <summary>
/// 作者:Kylin
/// 时间:2014.03.21 PM
/// 描述:(学员)Follow Up (批量)发送
/// </summary>
/// <param name="model"></param>
/// <param name="followDetailLst"></param>
/// <param name="followAttachmentLst"></param>
/// <returns></returns>
public static bool CreateFollow(Follow model, List<FollowDetail> followDetailLst, List<FollowAttachment> followAttachmentLst)
{
using (var edb = new EmeEntities())
{
try
{
edb.Entry<Follow>(model).State = EntityState.Added;
foreach (var item in followDetailLst)
{
item.FollowId = model.Id;
edb.Entry<FollowDetail>(item).State = EntityState.Added;
var student = edb.Student.SingleOrDefault(p => p.Id == item.StudentId);
if (student != null)
{
var studentUserId = student.UserId;
// 发送队列消息
//EmeBLL.CreateMessageForSFollowUp(studentUserId, model.CreateBy);
var msg = new MessageModel()
{
MessageType = CommonHelper.To<int>(MessageType.System),
Subject = "Follow Up 查看提醒",
MContent = string.Format("您有SA新发送的FU,请注意查收;"),
Receiver = new List<int>(),
CreateBy = model.CreateBy,
CreateTime = DateTime.Now
};
msg.Receiver.Add(studentUserId);
// 将消息加入队列
Common.MSMQ.QueueManager.AddSystemMessage(msg);
}
}
foreach (var attachment in followAttachmentLst)
{
attachment.FollowId = model.Id;
edb.Entry(attachment).State = EntityState.Added;
}
var result = edb.SaveChanges() > 0;
return result;
}
catch (Exception ex)
{
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Message),
Message = string.Format("FollowBLL-CreateFollow:{0};{1};{2}", ex.Message, ex.InnerException, ex.HelpLink),
IsTreat = false,
CreateBy = model.CreateBy,
CreateTime = DateTime.Now
});
return false;
}
}
}
示例3: AddProductBranch
/// <summary>
/// 作者:Raymond
/// 日期:2014-4-22
/// 描述:新增中心产品
/// </summary>
/// <param name="pBranch"></param>
/// <param name="loginUserId"></param>
/// <returns></returns>
public static bool AddProductBranch(ProductBranch pBranch, int loginUserId)
{
using (var edb = new EmeEntities())
{
try
{
edb.Entry(pBranch).State = EntityState.Added;
var result = edb.SaveChanges() > 0;
return result;
}
catch (Exception e)
{
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("ProductBLL-AddProductBranch:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = loginUserId,
CreateTime = DateTime.Now
});
return false;
}
}
}
示例4: CreateClassroom
/// <summary>
/// 作者:Vincen
/// 时间:2014.03.28
/// 描述:创建教室
/// </summary>
/// <param name="model"></param>
/// <param name="createBy"></param>
/// <returns></returns>
public static bool CreateClassroom(Classroom model, int createBy)
{
using (var edb = new EmeEntities())
{
try
{
edb.Entry(model).State = EntityState.Added;
var result = edb.SaveChanges() > 0;
return result;
}
catch (Exception e)
{
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Message),
Message = string.Format("BranchBLL-CreateClassroom:{0};{1};{2}", e.Message, e.InnerException, e.HelpLink),
IsTreat = false,
UserHostAddress = WebHelper.GetCurrentIpAddress(),
CreateBy = createBy,
CreateTime = DateTime.Now
});
return false;
}
}
}
示例5: CheckContractDetail
/// <summary>
/// 作者:Vincen
/// 时间:2014.07.18
/// 描述:检查合同详情
/// </summary>
/// <returns></returns>
public static bool CheckContractDetail()
{
using (var edb = new EmeEntities())
{
try
{
foreach (var detail in
edb.ContractDetail.Where(
p => p.Status == ConvertEnum.StatusTypeForActive && p.EndDate < DateTime.Now && p.ContractStatusType == ConvertEnum.ContractStatusTypeForExcute))
{
// 更新结束的合同为结束状态
detail.ContractStatusType = ConvertEnum.ContractStatusTypeForOver;
edb.Entry(detail).State = EntityState.Modified;
}
var result = edb.SaveChanges() > 0;
return result;
}
catch (Exception e)
{
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("StudentBLL-CheckContractDetail:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = null,
CreateTime = DateTime.Now
});
return false;
}
}
}
示例6: CreateCourse
/// <summary>
/// 作者:Vincen
/// 时间:2014.04.01
/// 描述:创建课程
/// </summary>
/// <param name="course"></param>
/// <param name="loginUserId"></param>
/// <returns></returns>
public static Course CreateCourse(Course course, int loginUserId)
{
using (var edb = new EmeEntities())
{
try
{
edb.Entry(course).State = EntityState.Added;
edb.SaveChanges();
return course;
}
catch (Exception e)
{
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("CourseBLL-CreateCourse:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = loginUserId,
CreateTime = DateTime.Now
});
return null;
}
}
}
示例7: CreateReferral
/// <summary>
/// 作者:Raymond
/// 日期:2014-6-27
/// 描述:新增报备
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static bool CreateReferral(Referral model)
{
using (var edb = new EmeEntities())
{
edb.Entry(model).State = EntityState.Added;
return edb.SaveChanges() > 0;
}
}
示例8: CreateCourseware
/// <summary>
/// 作者:Primo
/// 时间:2014.07.02
/// 描述:创建课程附件
/// </summary>
/// <param name="courseware"></param>
/// <param name="coursewareDetail"></param>
/// <returns></returns>
public static bool CreateCourseware(Courseware courseware, CoursewareDetail coursewareDetail)
{
using (var tran = new TransactionScope())
{
using (var edb = new EmeEntities())
{
try
{
edb.Entry(courseware).State = EntityState.Added;
edb.SaveChanges();
coursewareDetail.CoursewareId = courseware.Id;
edb.Entry(coursewareDetail).State = EntityState.Added;
var result = edb.SaveChanges() > 0;
tran.Complete();
return result;
}
catch (Exception e)
{
tran.Dispose();
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("CourseBLL-CreateCourseware:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = courseware.CreateBy,
CreateTime = DateTime.Now
});
return false;
}
}
}
}
示例9: AddProductLevel
/// <summary>
/// 作者:Raymond
/// 日期:2014-3-5
/// 描述:新增课程级别 、明细
/// </summary>
/// <param name="pLevel"></param>
/// <param name="requiredCourse"></param>
/// <param name="electiveCourse"></param>
/// <param name="createBy"></param>
/// <returns></returns>
public static bool AddProductLevel(ProductLevel pLevel, string requiredCourse, string electiveCourse, int createBy)
{
using (var edb = new EmeEntities())
{
try
{
edb.Entry(pLevel).State = EntityState.Added;
var flag = edb.SaveChanges() > 0;
if (flag)
{
var productLevelId = pLevel.Id;
//处理必修课
if (requiredCourse.Length > 0)
{
var rList = requiredCourse.Split('&');
foreach (var item in rList)
{
var rListDetail = item.Split('^');
var pCourseTypeId = CommonHelper.To<int>(rListDetail[1]);
var courses = CommonHelper.To<int>(rListDetail[2]);
var students = CommonHelper.To<int>(rListDetail[3]);
var pLevelCourseType = new ProductLevelCourseType()
{
ProductLevelId = productLevelId,
ProductCourseTypeId = pCourseTypeId,
SelectivityType = CommonHelper.To<int>(SelectivityType.Required),
Courses = courses,
Students = students,
Status = CommonHelper.To<int>(StatusType.Active),
CreateBy = createBy,
CreateTime = DateTime.Now
};
edb.Entry(pLevelCourseType).State = EntityState.Added;
}
}
//处理选修课
if (electiveCourse.Length > 0)
{
var eList = electiveCourse.Split('&');
if (eList.Any())
{
foreach (var item in eList)
{
var eListDetail = item.Split('^');
var pCourseTypeId = CommonHelper.To<int>(eListDetail[1]);
var courses = CommonHelper.To<int>(eListDetail[2]);
var students = CommonHelper.To<int>(eListDetail[3]);
var pLevelCourseType = new ProductLevelCourseType()
{
ProductLevelId = productLevelId,
ProductCourseTypeId = pCourseTypeId,
SelectivityType = CommonHelper.To<int>(SelectivityType.Elective),
Courses = courses,
Students = students,
Status = CommonHelper.To<int>(StatusType.Active),
CreateBy = createBy,
CreateTime = DateTime.Now
};
edb.Entry(pLevelCourseType).State = EntityState.Added;
}
}
}
}
return edb.SaveChanges() > 0;
}
catch
{
return false;
}
}
}
示例10: CreateProductLevelCourseTypeForProductLevel
/// <summary>
/// 作者:Primo
/// 日期:2014.06.24
/// 描述:新增夸产品课节
/// </summary>
/// <param name="productLevelCourseTypeId"></param>
/// <param name="list"></param>
/// <param name="loginUserId"></param>
/// <returns></returns>
public static bool CreateProductLevelCourseTypeForProductLevel(int productLevelCourseTypeId, List<ProductLevelCourseTypeForProductLevel> list, int loginUserId)
{
using (var edb = new EmeEntities())
{
try
{
var result = false;
var model = edb.ProductLevelCourseTypeForProductLevel.Where(p => p.ProductLevelCourseTypeId == productLevelCourseTypeId);
foreach (var item in model)
{
edb.Entry(item).State = EntityState.Deleted;
}
foreach (var item in list)
{
edb.Entry(item).State = EntityState.Added;
}
result = edb.SaveChanges() > 0;
return result;
}
catch (Exception e)
{
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("ProductBLL-CreateProductLevelCourseTypeForProductLevel:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = loginUserId,
CreateTime = DateTime.Now
});
return false;
}
}
}
示例11: CreateProductLevelCourseTypeCourse
/// <summary>
/// 作者:Primo
/// 日期:2014.06.24
/// 描述:新增产品课节
/// </summary>
/// <param name="pLevelCourseTypeCourse"></param>
/// <param name="course"></param>
/// <returns></returns>
public static bool CreateProductLevelCourseTypeCourse(ProductLevelCourseTypeCourse pLevelCourseTypeCourse, Course course, int loginUserId)
{
using (var edb = new EmeEntities())
{
using (var tran = new TransactionScope())
{
try
{
var result = false;
var modelCourse = edb.Course.FirstOrDefault(p => p.CName == course.CName && p.Status == ConvertEnum.StatusTypeForActive);
var courseId = 0;
edb.Entry(course).State = EntityState.Added;
result = edb.SaveChanges() > 0;
courseId = course.Id;
pLevelCourseTypeCourse.CourseId = courseId;
edb.Entry(pLevelCourseTypeCourse).State = EntityState.Added;
result = edb.SaveChanges() > 0;
tran.Complete();
return result;
}
catch (Exception e)
{
tran.Dispose();
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("ProductBLL-CreateProductLevelCourseTypeCourse:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = loginUserId,
CreateTime = DateTime.Now
});
return false;
}
}
}
}
示例12: UpdateProductLevelCourseTypeCourseAndCourse
/// <summary>
/// 作者:Primo
/// 日期:2014.06.10
/// 描述:更改产品课节
/// </summary>
/// <param name="pLevelCourseTypeCourse"></param>
/// <param name="course"></param>
/// <param name="loginUserId"></param>
/// <returns></returns>
public static bool UpdateProductLevelCourseTypeCourseAndCourse(ProductLevelCourseTypeCourse pLevelCourseTypeCourse, Course course, int loginUserId)
{
using (var edb = new EmeEntities())
{
try
{
var courseObj = edb.Course.FirstOrDefault(p => p.Id == course.Id);
if (null != courseObj)
{
courseObj.CName = course.CName;
courseObj.EName = course.EName;
courseObj.ClassTime = course.ClassTime;
courseObj.Description = course.Description;
courseObj.StudyTypeId = course.StudyTypeId;
courseObj.UpdateBy = course.UpdateBy;
courseObj.UpdateTime = course.UpdateTime;
edb.Entry(courseObj).State = EntityState.Modified;
}
var pLevelCourseTypeCourseObj = edb.ProductLevelCourseTypeCourse.FirstOrDefault(p => p.Id == pLevelCourseTypeCourse.Id);
if (null != pLevelCourseTypeCourseObj)
{
pLevelCourseTypeCourseObj.ClassHour = pLevelCourseTypeCourse.ClassHour;
pLevelCourseTypeCourseObj.Stage = pLevelCourseTypeCourse.Stage;
pLevelCourseTypeCourseObj.Coding = pLevelCourseTypeCourse.Coding;
pLevelCourseTypeCourseObj.OrderNum = pLevelCourseTypeCourse.OrderNum;
pLevelCourseTypeCourseObj.UpdateBy = pLevelCourseTypeCourse.UpdateBy;
pLevelCourseTypeCourseObj.UpdateTime = pLevelCourseTypeCourse.UpdateTime;
edb.Entry(pLevelCourseTypeCourseObj).State = EntityState.Modified;
}
return edb.SaveChanges() > 0;
}
catch (Exception e)
{
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("ProductBLL-UpdateProductLevelCourseTypeCourseAndCourse:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = loginUserId,
CreateTime = DateTime.Now
});
return false;
}
}
}
示例13: UpdateProductLevelConfig
/// <summary>
/// 作者:Kylin
/// 时间:2014.03.27
/// 描述:更新产品级别配置
/// </summary>
/// <param name="model"></param>
/// <param name="loginUserId"></param>
/// <returns></returns>
public static bool UpdateProductLevelConfig(ProductLevelConfig model, int loginUserId)
{
using (var edb = new EmeEntities())
{
try
{
var modelObj = edb.ProductLevelConfig.FirstOrDefault(a => a.Id == model.Id && a.Status == ConvertEnum.StatusTypeForActive);
if (null == modelObj)
return false;
modelObj.Status = model.Status;
modelObj.UpdateBy = model.UpdateBy;
modelObj.UpdateTime = model.UpdateTime;
modelObj.ProductLevelId = model.ProductLevelId;
modelObj.IsOptional = model.IsOptional;
modelObj.Optional = model.Optional;
edb.Entry(modelObj).State = EntityState.Modified;
var result = edb.SaveChanges() > 0;
return result;
}
catch (Exception e)
{
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("ProductBLL-UpdateProductLevelConfig:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = loginUserId,
CreateTime = DateTime.Now
});
return false;
}
}
}
示例14: CreateContractTypeProductLevel
/// <summary>
/// 作者:Primo
/// 日期:2014.07.23
/// 描述:添加ContractTypeProductLevel
/// </summary>
/// <param name="model"></param>
/// <returns></returns>
public static bool CreateContractTypeProductLevel(ContractTypeProductLevel model)
{
using (var edb = new EmeEntities())
{
using (var tran = new TransactionScope())
{
try
{
//创建添加对象
var modelObj = new ContractTypeProductLevel()
{
BranchId = model.BranchId,
ContractTypeId = model.ContractTypeId,
ProductLevelId = model.ProductLevelId,
MajorTotal = model.MajorTotal,
ElectiveTotal = model.ElectiveTotal,
Absence = model.Absence,
Repair = model.Repair,
IsSystem = false,
Status = ConvertEnum.StatusTypeForActive,
CreateBy = model.CreateBy,
CreateTime = DateTime.Now
};
edb.Entry(modelObj).State = EntityState.Added;
var result = edb.SaveChanges() > 0;
tran.Complete();
return result;
}
catch (Exception e)
{
tran.Dispose();
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("StudentBLL-UpdateContractTypeProductLevel:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = model.UpdateBy,
CreateTime = DateTime.Now
});
return false;
}
}
}
}
示例15: CreateContractLevelCourseType
/// <summary>
/// 作者:Vincen
/// 时间:2014.05.02
/// 描述:创建合同级别课程类型(对应V3.0Topic自选)
/// </summary>
/// <param name="studentId"></param>
/// <param name="productLevelId"></param>
/// <param name="productLevelCourseTypeIdList"></param>
/// <param name="createBy"></param>
/// <returns></returns>
public static bool CreateContractLevelCourseType(int studentId, int productLevelId, string productLevelCourseTypeIdList, int createBy)
{
using (var edb = new EmeEntities())
{
using (var tran = new TransactionScope())
{
try
{
// 检验合同级别是否匹配
var contractLevel = edb.ContractLevel.FirstOrDefault(p => p.ContractDetail.Contract.StudentId == studentId && p.ProductLevelId == productLevelId && p.Status == ConvertEnum.StatusTypeForActive);
if (null == contractLevel) return false;
// 实例化 ContractLevelCourseType 集合
var plctlist = productLevelCourseTypeIdList.Trim().Trim(',').Split(',');
foreach (var item in plctlist.Select(a => new ContractLevelCourseType()
{
ContractLevelId = contractLevel.Id,
ProductLevelCourseTypeId = CommonHelper.To<int>(a),
Status = ConvertEnum.StatusTypeForActive,
CreateBy = createBy,
CreateTime = DateTime.Now
}))
{
edb.Entry(item).State = EntityState.Added;
}
var result = edb.SaveChanges() > 0;
tran.Complete();
return result;
}
catch (Exception e)
{
tran.Dispose();
// 异常日志消息队列
Common.MSMQ.QueueManager.AddExceptionLog(new ExceptionLogs()
{
ExceptionType = CommonHelper.To<int>(ExceptionType.Function),
Message = string.Format("StudentBLL-CreateContractLevelCourseType:{0};{1};{2}", e.Message, e.InnerException.Message, e.HelpLink),
IsTreat = false,
CreateBy = createBy,
CreateTime = DateTime.Now
});
return false;
}
}
}
}