• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# eSARDAL.DCFIEntities类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中eSARDAL.DCFIEntities的典型用法代码示例。如果您正苦于以下问题:C# DCFIEntities类的具体用法?C# DCFIEntities怎么用?C# DCFIEntities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DCFIEntities类属于eSARDAL命名空间,在下文中一共展示了DCFIEntities类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: GetAllGradeSections

 public List<GradeSectionBDO> GetAllGradeSections(string currentSY)
 {
     List<GradeSection> gsList = new List<GradeSection>();
     List<GradeSectionBDO> gsBDOList = new List<GradeSectionBDO>();
     try { 
     using (var DCEnt = new DCFIEntities())
     {
         var allGradeSections = (from gs in DCEnt.GradeSections
                                 where gs.SY == currentSY
                                 orderby gs.GradeLevel, gs.Class
                                 select gs);
         gsList = allGradeSections.ToList<GradeSection>();
             
     foreach (GradeSection gs in gsList)
     {
         GradeSectionBDO gsBDO = new GradeSectionBDO();
         ConvertGradeSectionToGradeSectionBDO(gs, gsBDO);
         gsBDOList.Add(gsBDO);
     }
     }
     }
     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 gsBDOList;
 }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:35,代码来源:GradeSectionDAO.cs


示例17: GetAllCurriculums

        public List<CurriculumBDO> GetAllCurriculums()
        {
            List<Curriculum> currList = new List<Curriculum>();
            List<CurriculumBDO> currBDOList = new List<CurriculumBDO>();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                var allCurr = (DCEnt.Curriculums);
                currList = allCurr.ToList<Curriculum>();
            

           
            foreach (Curriculum c in currList)
            {
                CurriculumBDO currBDO = new CurriculumBDO();
                ConvertCurriculumToCurriculumBDO(c, currBDO);
                currBDOList.Add(currBDO);
            }
            }
            }
            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 currBDOList;
        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:34,代码来源:CurriculumDAO.cs


示例18: GetGradeSectionBDO

        public GradeSectionBDO GetGradeSectionBDO(int gradesectioncode)
        {
            GradeSection gsec = new GradeSection();
            GradeSectionBDO gsBDO = new GradeSectionBDO();
            try { 
            using (var DCEnt = new DCFIEntities())
            {
                gsec = (from gs in DCEnt.GradeSections
                                        where gs.GradeSectionCode == gradesectioncode
                                        select gs).FirstOrDefault<GradeSection>();

                 ConvertGradeSectionToGradeSectionBDO(gsec, gsBDO);
             }
            }
            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 gsBDO;
        }
开发者ID:RazenRyne,项目名称:eSAR,代码行数:28,代码来源:GradeSectionDAO.cs


示例19: GetAllLogs

        public List<LogBDO> GetAllLogs()
        {
            List<LogBDO> logblist = new List<LogBDO>();
            List<Log> logslist = new List<Log>();

            try
            {
                using (var DCEnt = new DCFIEntities())
                {
                    var allLogs = (DCEnt.Logs);
                    logslist = allLogs.ToList<Log>();

                    foreach (Log b in logslist)
                    {
                        LogBDO lBDO = new LogBDO();
                        ConvertLogToLogBDO(b, lBDO);
                        logblist.Add(lBDO);
                    }
                }
            }
            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 logblist;
        }
开发者ID:dansalan,项目名称:DCFIv5,代码行数:34,代码来源:LogDAO.cs


示例20: DeleteSY

        public Boolean DeleteSY(string schoolyear, ref string message)
        {
            message = "SY " + schoolyear + " Deleted successfully.";
            Boolean ret = true;

            using (var DCEnt = new DCFIEntities())
            {
                SchoolYear SYInDB = (from u in DCEnt.SchoolYears
                                 where u.SY == schoolyear
                                 select u).FirstOrDefault();

                if (SYInDB == null)
                {
                    throw new Exception("No SY " + schoolyear + " existed");
                }

                DCEnt.SchoolYears.Remove(SYInDB);
                DCEnt.Entry(SYInDB).State = System.Data.Entity.EntityState.Deleted;
                int num = DCEnt.SaveChanges();
                if (num != 1)
                {
                    ret = false;
                    message = "Deletion of SY Failed.";
                }
            }
            return ret;
        }
开发者ID:dansalan,项目名称:DCFIv3,代码行数:27,代码来源:SchoolYearDAO.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Model.StationContext类代码示例发布时间:2022-05-26
下一篇:
C# DAL.eRestaurantContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap