public List <StartAdmissionModel> UpdateStartAdmissionList(List <StartAdmissionModel> startAdmissionModels)
        {
            try
            {
                using (GEEDbContext context = new GEEDbContext())
                {
                    foreach (var item in startAdmissionModels)
                    {
                        AdmissionStatu admissionStatus = context.AdmissionStatus.Where(a => a.AdmissionStatus_id == item.AdmissionStatus_id).FirstOrDefault();
                        if (admissionStatus != null)
                        {
                            admissionStatus.AdmissionCode    = item.AdmissionCode;
                            admissionStatus.AdmissionStatus  = item.AdmissionStatus;
                            admissionStatus.Startdate        = item.Startdate;
                            admissionStatus.FromDOB          = item.FromDOB;
                            admissionStatus.TODOB            = item.TODOB;
                            admissionStatus.ApplicaitonFees  = item.ApplicaitonFees;
                            admissionStatus.RegistrationFees = item.RegistrationFees;

                            context.Entry(admissionStatus).State = EntityState.Modified;
                            context.SaveChanges();
                        }
                    }
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
 /// <summary>
 /// This is for Update Application no and IsSubmited Prop
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public ApplicationModel UpdateApplicationNo(ApplicationModel entity)
 {
     using (GEEDbContext context = new GEEDbContext())
     {
         Application application = context.Applications.Where(a => a.Enquiry_ID == entity.Enquiry_ID).FirstOrDefault();
         if (application != null)
         {
             //If isSubmitted false
             if (!entity.IsSubmitted)
             {
                 application.ApplicaitonNo       = entity.ApplicaitonNo;
                 application.ApplicationSoldDate = DateTime.Now;
             }
             else
             {
                 application.IsSubmitted = entity.IsSubmitted;
                 application.SubmitDate  = DateTime.Now;
             }
             context.Entry(application).State = EntityState.Modified;
             context.SaveChanges();
         }
     }
     return(new ApplicationModel {
         Application_ID = entity.Application_ID
     });
 }
示例#3
0
        /// <summary>
        /// This methoda is used for update is deleted column
        /// Added by Jiya
        /// addedWehn 28 July 2019
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>

        public int DeleteEmployeeDetails(EmployeeMasterModel entity)
        {
            GEEDbContext objGEEDbContext = new GEEDbContext();
            var          EmployeeData    = objGEEDbContext.EmployeeMasters.Where(a => a.EmployeeMasterID == entity.EmployeeMasterID).SingleOrDefault();

            EmployeeData.Modifiedby_ID = entity.ModifiedBy_ID;
            EmployeeData.ModifiedDate  = DateTime.Now;
            EmployeeData.IsDeleted     = true;
            objGEEDbContext.Entry(EmployeeData).State = System.Data.Entity.EntityState.Modified;
            return(objGEEDbContext.SaveChanges());
        }
示例#4
0
 public Enquiry Save(Enquiry enquiry)
 {
     try
     {
         _context.Enquiries.Add(enquiry);
         _context.SaveChanges();
         return(enquiry);
     }
     catch
     {
         return(null);
     }
 }
 /// <summary>
 /// This is for Update Registration no and IsSubmitedDate Prop
 /// </summary>
 /// <param name="entity"></param>
 /// <returns></returns>
 public RegistrationModel UpdateRegistrationNo(RegistrationModel entity)
 {
     using (GEEDbContext context = new GEEDbContext())
     {
         Registration registration = context.Registrations.Where(a => a.Enquiry_ID == entity.Enquiry_ID).FirstOrDefault();
         if (registration != null)
         {
             registration.RegistrationNo = entity.RegistrationNo;
             registration.IsSubmitedDate = DateTime.Now;
         }
         context.Entry(registration).State = EntityState.Modified;
         context.SaveChanges();
         return(new RegistrationModel {
             Registration_ID = entity.Registration_ID
         });
     }
 }
        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeActivate(int id)
        {
            bool isDelete = false;

            try
            {
                GEEDbContext objGEEDbContext = new GEEDbContext();
                var          UserData        = objGEEDbContext.AssessmentStructureAssessmentTypeMappings.Where(a => a.AssessmentStructureAssessmentTypeMapping_Id == id).FirstOrDefault();
                UserData.IsDeleted = true;
                objGEEDbContext.Entry(UserData).State = System.Data.Entity.EntityState.Modified;
                //objGEEDbContext.Entry(UserData).Property(x => x.CUserId).IsModified = false;
                if (objGEEDbContext.SaveChanges() > 0)
                {
                    isDelete = true;
                }
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
        /// <summary>
        /// Delete
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public bool DeActivateCourse(int id)
        {
            bool isDelete = false;

            try
            {
                GEEDbContext objGEEDbContext = new GEEDbContext();
                var          _Data           = objGEEDbContext.CourseMasters.Where(a => a.CourseMaster_ID == id).FirstOrDefault();
                _Data.IsDeleted = true;
                objGEEDbContext.Entry(_Data).State = System.Data.Entity.EntityState.Modified;
                //objGEEDbContext.Entry(UserData).Property(x => x.CUserId).IsModified = false;
                if (objGEEDbContext.SaveChanges() > 0)
                {
                    isDelete = true;
                }
            }
            catch (Exception)
            {
                isDelete = false;
            }
            return(isDelete);
        }
示例#8
0
        public AspNetUserModel Update(AspNetUserModel entity)
        {
            int          cuid            = Convert.ToInt32(entity.CUserId);
            GEEDbContext objGEEDbContext = new GEEDbContext();
            var          UserData        = objGEEDbContext.AspNetUsers.Where(a => a.CUserId == cuid).FirstOrDefault();

            UserData.Email          = entity.Email;
            UserData.PasswordHash   = entity.PasswordHash;
            UserData.PhoneNumber    = entity.PhoneNumber;
            UserData.UserName       = entity.UserName;
            UserData.FirstName      = entity.FirstName;
            UserData.LastName       = entity.LastName;
            UserData.UserGroupId    = entity.UserGroupId;
            UserData.StuStaffTypeId = entity.StuStaffTypeId;
            objGEEDbContext.Entry(UserData).State = System.Data.Entity.EntityState.Modified;
            objGEEDbContext.Entry(UserData).Property(x => x.CUserId).IsModified = false;
            int i = objGEEDbContext.SaveChanges();

            return(new Model.Admin.AspNetUserModel {
                CUserId = i
            });
        }
示例#9
0
        public RoomModel Update(RoomModel entity)
        {
            ///Updated by jiya 10--Aug-2019
            ///Cause: Code breaking while data not available.
            GEEDbContext objGEEDbContext = new GEEDbContext();
            var          roomMaster      = objGEEDbContext.RoomMasters.Where(a => a.RoomMaster_ID == entity.RoomMaster_ID).FirstOrDefault();

            roomMaster.Building_ID     = entity.Building_ID;
            roomMaster.Modifiedby_ID   = Convert.ToInt32(entity.ModifiedBy_ID);
            roomMaster.ModifiedDate    = DateTime.Now;
            roomMaster.Name            = entity.Name;
            roomMaster.Code            = entity.Code;
            roomMaster.SeatingCapicity = entity.SeatingCapicity;
            roomMaster.Remarks         = entity.Remarks;
            roomMaster.GeoCoordinates  = entity.GeoCoordinates;
            objGEEDbContext.Entry(roomMaster).State = System.Data.Entity.EntityState.Modified;
            objGEEDbContext.SaveChanges();


            return(new RoomModel {
                RoomMaster_ID = roomMaster.RoomMaster_ID
            });
        }
        /// <summary>
        /// This method is used to save the data for user group permission.
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public int Save(PermissionParentModel entity)
        {
            int          isSave          = 0;
            GEEDbContext objGEEDbContext = new GEEDbContext();

            int menuid = 0;

            foreach (var item in entity.PermissionChildModelList)
            {
                Navmenu_asprole_permisison_UserGroup_mapping objPermission = new Navmenu_asprole_permisison_UserGroup_mapping();
                var _pMapping = objGEEDbContext.Navmenu_asprole_permisison_UserGroup_mapping.Where(a => a.Navrolepermisisonmapping_ID == item.Navrolepermisisonmapping_ID && a.UserGroup_ID == entity.Group_Id).SingleOrDefault();
                if (_pMapping != null)
                {
                    bool isPermisssion = item.IsPermission == 1 ? false : true;
                    if (_pMapping.ISDeleted != isPermisssion)
                    {
                        _pMapping.ISDeleted     = item.IsPermission == 1 ? false : true;
                        _pMapping.AcitiveEdit   = true;//This flag is for user role maaping procedure.
                        _pMapping.ModifiedBy_ID = entity.CreatedBy_ID;
                        entity.ModifiedDate     = DateTime.Now;
                        objGEEDbContext.Entry(_pMapping).State = System.Data.Entity.EntityState.Modified;
                        isSave = objGEEDbContext.SaveChanges();
                    }
                }
                else
                {
                    objPermission.Navrolepermisisonmapping_ID = item.Navrolepermisisonmapping_ID;
                    objPermission.SchoolID     = entity.SchoolID;
                    objPermission.CreatedDate  = DateTime.Now;
                    objPermission.ISDeleted    = item.IsPermission == 1 ? false : true;
                    objPermission.UserGroup_ID = entity.Group_Id;
                    objPermission.CreatedBy_ID = entity.CreatedBy_ID;
                    objPermission.AcitiveEdit  = true;//This flag is for user role maaping procedure.
                    objGEEDbContext.Navmenu_asprole_permisison_UserGroup_mapping.Add(objPermission);
                    isSave = objGEEDbContext.SaveChanges();
                }
                if (menuid != item.NavigationMenu_Id)
                {
                    menuid = item.NavigationMenu_Id;
                    var data = entity.PermissionChildModelList.Where(a => a.NavigationMenu_Id == menuid & a.IsPermission == 1).ToList();
                    UserGroupNavigationMenuMapping objUserGroupNavigationMenuMapping = new UserGroupNavigationMenuMapping();
                    var checkDataExists = objGEEDbContext.UserGroupNavigationMenuMappings.Where(a => a.NavigationMenuId == menuid && a.UserGroupId == entity.Group_Id).SingleOrDefault();

                    if (checkDataExists != null)
                    {
                        checkDataExists.UserGroupId      = entity.Group_Id;
                        checkDataExists.NavigationMenuId = menuid;
                        checkDataExists.SchoolID         = entity.SchoolID;
                        checkDataExists.GroupID          = entity.GroupID;
                        if (data.Count > 0)
                        {
                            checkDataExists.ISDeleted = false;
                        }
                        else
                        {
                            checkDataExists.ISDeleted = true;
                        }

                        checkDataExists.ModifiedBy_ID = entity.CreatedBy_ID;
                        checkDataExists.ModifiedDate  = DateTime.Now;
                        objGEEDbContext.Entry(checkDataExists).State = System.Data.Entity.EntityState.Modified;
                        isSave = objGEEDbContext.SaveChanges();
                    }
                    else
                    {
                        if (data.Count > 0)
                        {
                            objUserGroupNavigationMenuMapping.UserGroupId      = entity.Group_Id;
                            objUserGroupNavigationMenuMapping.NavigationMenuId = menuid;
                            objUserGroupNavigationMenuMapping.SchoolID         = entity.SchoolID;
                            objUserGroupNavigationMenuMapping.GroupID          = entity.GroupID;
                            objUserGroupNavigationMenuMapping.CreatedBy_ID     = entity.CreatedBy_ID;
                            objUserGroupNavigationMenuMapping.CreatedDate      = DateTime.Now;
                            objGEEDbContext.UserGroupNavigationMenuMappings.Add(objUserGroupNavigationMenuMapping);
                            isSave = objGEEDbContext.SaveChanges();
                        }
                    }
                }
            }
            using (GEEDbContext context = new GEEDbContext())
            {
                byte ActionID = 1;
                var  UId      = new SqlParameter("@CUserId", entity.CreatedBy_ID);
                var  MId      = new SqlParameter("@Action", ActionID);
                context.Database.ExecuteSqlCommand("RoleMappingToAspNetUserRole @CUserId, @Action", UId, MId);
            }


            return(isSave);
        }