本文整理汇总了C#中eSARDAL.DCFIEntities类的典型用法代码示例。如果您正苦于以下问题:C# DCFIEntities类的具体用法?C# DCFIEntities怎么用?C# DCFIEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DCFIEntities类属于eSARDAL命名空间,在下文中一共展示了DCFIEntities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetTimeSlot
public Timeslot GetTimeSlot(string timeslotCode)
{
Timeslot timeslot = new Timeslot();
timeslot = null;
try {
using (var DCEnt = new DCFIEntities())
{
timeslot = (from t in DCEnt.Timeslots
where t.TimeSlotCode == timeslotCode
select t).FirstOrDefault();
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return timeslot;
}
示例2: GetAllBuildings
public List<BuildingBDO> GetAllBuildings() {
List<BuildingBDO> bBDOList = new List<BuildingBDO>();
List<Building> bList = new List<Building>();
try
{
using (var DCEnt = new DCFIEntities())
{
var allBuildings = (DCEnt.Buildings);
bList = allBuildings.ToList<Building>();
foreach (Building b in bList) {
BuildingBDO bBDO = new BuildingBDO();
ConvertBuildingToBuildingBDO(b, bBDO);
bBDOList.Add(bBDO);
}
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return bBDOList;
}
示例3: GetUserBDO
public UserBDO GetUserBDO(int userId)
{
UserBDO userBDO = null;
UserTypeBDO utype = null;
using (var DCEnt = new DCFIEntities())
{
User user = (from u in DCEnt.Users
where u.UserId == userId
select u).FirstOrDefault();
if (user != null)
{
utype = new UserTypeBDO()
{
UserTypeCode = user.UserTypeCode
};
userBDO = new UserBDO()
{
UserId = user.UserId,
UserName = user.UserName,
Password = user.Password,
LastName = user.LastName,
FirstName = user.UserName,
MiddleName = user.MiddleName,
UserType = utype
};
}
}
return userBDO;
}
示例4: CreateGradeSection
public Boolean CreateGradeSection(ref GradeSectionBDO gsBDO, ref string message)
{
message = "Grade Section Added Successfully";
bool ret = true;
GradeSection gs = new GradeSection();
try{
ConvertGradeSectionBDOToGradeSection(gsBDO, gs);
using (var DCEnt = new DCFIEntities())
{
DCEnt.GradeSections.Attach(gs);
DCEnt.Entry(gs).State = System.Data.Entity.EntityState.Added;
int num = DCEnt.SaveChanges();
if (num != 1)
{
ret = false;
message = "Adding of Grade Section failed";
}
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return ret;
}
示例5: UpdateTrait
public Boolean UpdateTrait(ref TraitBDO tBDO, ref string message)
{
message = "Trait updated successfully.";
Boolean ret = true;
using (var DCEnt = new DCFIEntities())
{
var traitCode = tBDO.TraitCode;
Trait tInDB = (from t in DCEnt.Traits
where t.TraitCode == traitCode
select t).FirstOrDefault();
if (tInDB == null)
{
throw new Exception("No Trait with TraitCode " + tBDO.TraitCode);
}
DCEnt.Traits.Remove(tInDB);
tInDB.Description = tBDO.Description;
tInDB.GradeLevel = tBDO.GradeLevel;
tInDB.TraitCode = tBDO.TraitCode;
DCEnt.Traits.Attach(tInDB);
DCEnt.Entry(tInDB).State = System.Data.Entity.EntityState.Modified;
int num = DCEnt.SaveChanges();
if (num != 1)
{
ret = false;
message = "No trait is updated.";
}
}
return ret;
}
示例6: GetCurriculumSubjects
public List<CurriculumSubjectBDO> GetCurriculumSubjects(string curriculumCode)
{
List<CurriculumSubject> csList = new List<CurriculumSubject>();
List<CurriculumSubjectBDO> csbList = new List<CurriculumSubjectBDO>();
try
{
using (var DCEnt = new DCFIEntities())
{
var allCurrSub = (from cSub in DCEnt.CurriculumSubjects
where cSub.CurriculumCode == curriculumCode
select cSub).ToList<CurriculumSubject>();
csList = allCurrSub;
csbList = ToCurriculumSubjectBDOList(csList);
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return csbList;
}
示例7: GetAllRooms
public List<RoomBDO> GetAllRooms()
{
List<Room> roomList = new List<Room>();
List<RoomBDO> roomBDOList = new List<RoomBDO>();
try {
using (var DCEnt = new DCFIEntities())
{
var allRooms = (DCEnt.Rooms);
roomList = allRooms.ToList<Room>();
}
foreach (Room r in roomList)
{
RoomBDO roomBDO = new RoomBDO();
ConvertRoomToRoomBDO(r, roomBDO);
roomBDOList.Add(roomBDO);
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return roomBDOList;
}
示例8: ActivateUser
public Boolean ActivateUser(int userId, ref string message)
{
message = "User Activated successfully.";
Boolean ret = true;
using (var DCEnt = new DCFIEntities())
{
User userInDB = (from u in DCEnt.Users
where u.UserId == userId
select u).FirstOrDefault();
if (userInDB == null)
{
throw new Exception("No user with ID " + userId);
}
DCEnt.Users.Remove(userInDB);
userInDB.Deactivated = false;
DCEnt.Users.Attach(userInDB);
DCEnt.Entry(userInDB).State = System.Data.Entity.EntityState.Modified;
int num = DCEnt.SaveChanges();
if (num != 1)
{
ret = false;
message = "Activation Failed.";
}
}
return ret;
}
示例9: CreateUser
public Boolean CreateUser(ref UserBDO userBDO, ref string message)
{
message = "User Added Successfully";
bool ret = true;
UserType ut = new UserType()
{
UserType1 = userBDO.UserType.UsersType,
UserTypeCode = userBDO.UserType.UserTypeCode
};
User u = new User()
{
UserName = userBDO.UserName,
Password = userBDO.Password,
LastName = userBDO.LastName,
FirstName = userBDO.FirstName,
MiddleName = userBDO.MiddleName,
UserTypeCode = userBDO.UserType.UserTypeCode,
UserType = ut
};
using (var DCEnt = new DCFIEntities()) {
DCEnt.Users.Attach(u);
DCEnt.Entry(u).State = System.Data.Entity.EntityState.Added;
int num = DCEnt.SaveChanges();
userBDO.UserId = u.UserId;
if (num != 1) {
ret = false;
message = "Adding of User failed";
}
}
return ret;
}
示例10: CreateTrait
public Boolean CreateTrait(ref TraitBDO tBDO, ref string message)
{
message = "Trait Added Successfully";
bool ret = true;
Trait t = new Trait();
try {
ConvertTraitBDOToTrait(tBDO, t);
using (var DCEnt = new DCFIEntities())
{
DCEnt.Traits.Attach(t);
DCEnt.Entry(t).State = System.Data.Entity.EntityState.Added;
int num = DCEnt.SaveChanges();
if (num != 1)
{
ret = false;
message = "Adding of Trait failed";
}
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return ret;
}
示例11: GetAllTraits
public List<TraitBDO> GetAllTraits()
{
List<Trait> tList = new List<Trait>();
List<TraitBDO> tBDOList = new List<TraitBDO>();
try {
using (var DCEnt = new DCFIEntities())
{
var allTraits = (DCEnt.Traits);
tList = allTraits.ToList<Trait>();
}
foreach (Trait t in tList)
{
TraitBDO tBDO = new TraitBDO();
ConvertTraitToTraitBDO(t, tBDO);
tBDOList.Add(tBDO);
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return tBDOList;
}
示例12: GetSubject
public SubjectBDO GetSubject(string subjectCode)
{
SubjectBDO sbdo = new SubjectBDO();
Subject subj = new Subject();
try {
using (var DCEnt = new DCFIEntities())
{
var sub = (from s in DCEnt.Subjects
where s.SubjectCode == subjectCode
select s).FirstOrDefault();
subj = sub;
ConvertSubjectToSubjectBDO(subj, sbdo);
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return sbdo;
}
示例13: GetRoom
public RoomBDO GetRoom(string roomCode) {
Room room = null;
RoomBDO roomBDO = new RoomBDO();
try {
using (var DCEnt = new DCFIEntities())
{
room = (from r in DCEnt.Rooms
where r.RoomCode == roomCode
select r).FirstOrDefault();
}
ConvertRoomToRoomBDO(room,roomBDO);
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return roomBDO;
}
示例14: GetAllEnrollmentsForSy
public List<StudentEnrollmentBDO> GetAllEnrollmentsForSy(string sy)
{
List<StudentEnrollment> enrolList = new List<StudentEnrollment>();
List<StudentEnrollmentBDO> enrolBDOList = new List<StudentEnrollmentBDO>();
try {
using (var DCEnt = new DCFIEntities())
{
var allEnrols = (from enrol in DCEnt.StudentEnrollments
where enrol.SY == sy
select enrol);
enrolList = allEnrols.ToList<StudentEnrollment>();
}
foreach (StudentEnrollment a in enrolList)
{
StudentEnrollmentBDO enrolBDO = new StudentEnrollmentBDO();
ConvertEnrolToEnrolBDO(a, enrolBDO);
enrolBDOList.Add(enrolBDO);
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return enrolBDOList;
}
示例15: GetAllStudentSubjects
public List<StudentSubjectBDO> GetAllStudentSubjects()
{
List<StudentSubjectBDO> subjectBDOList = new List<StudentSubjectBDO>();
List<StudentSubject> subjectList = new List<StudentSubject>();
try {
using (var DCEnt = new DCFIEntities())
{
var allStudentSubjects = (DCEnt.StudentSubjects);
subjectList = allStudentSubjects.ToList<StudentSubject>();
foreach (StudentSubject s in subjectList)
{
StudentSubjectBDO subjectBDO = new StudentSubjectBDO();
ConvertStuSubjectsToStuSubjectsBDO(s, subjectBDO);
subjectBDOList.Add(subjectBDO);
}
}
}
catch (DbEntityValidationException dbEx)
{
foreach (var validationErrors in dbEx.EntityValidationErrors)
{
foreach (var validationError in validationErrors.ValidationErrors)
{
Trace.TraceInformation("Property: {0} Error: {1}",
validationError.PropertyName,
validationError.ErrorMessage);
}
}
}
return subjectBDOList;
}