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


C# eSARDAL.DCFIEntities类代码示例

本文整理汇总了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;

        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:28,代码来源:TimeslotDAO.cs

示例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;
        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:33,代码来源:BuildingDAO.cs

示例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;
 }
开发者ID:miaozhendaoren,项目名称:DCFIv4,代码行数:29,代码来源:UserDAO.cs

示例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;
        }
开发者ID:dansalan,项目名称:DCFIv5,代码行数:35,代码来源:GradeSectionDAO.cs

示例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;
        }
开发者ID:dansalan,项目名称:DCFIv3,代码行数:32,代码来源:TraitDAO.cs

示例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;
        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:31,代码来源:CurriculumDAO.cs

示例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;
        }
开发者ID:dansalan,项目名称:DCFIv5,代码行数:32,代码来源:RoomDAO.cs

示例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;
        }
开发者ID:dansalan,项目名称:DCFIv3,代码行数:31,代码来源:UserDAO.cs

示例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;
        }
开发者ID:dansalan,项目名称:DCFIv3,代码行数:35,代码来源:UserDAO.cs

示例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;
        }
开发者ID:dansalan,项目名称:DCFIv5,代码行数:35,代码来源:TraitDAO.cs

示例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;
        }
开发者ID:dansalan,项目名称:DCFIv5,代码行数:32,代码来源:TraitDAO.cs

示例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;
        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:30,代码来源:SubjectDAO.cs

示例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;
        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:28,代码来源:RoomDAO.cs

示例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;
 }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:35,代码来源:StudentEnrolmentDAO.cs

示例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;
        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:33,代码来源:StudentSubjectDAO.cs


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