public EventDetailBusinessModel GetEventDetailById(int id) { EventDetail eventEntity = new EventDetail(); EventDetailBusinessModel eventItem; try { eventEntity = applicationLevelDataBaseOps.GetEventDetailById(id); eventItem = new EventDetailBusinessModel { EventName = eventEntity.EventName, EventDate = eventEntity.EventDate, EventDescription = eventEntity.EventDescription, EventDetailID = eventEntity.EventDetailID, EventType = eventEntity.EventType, CollageID = eventEntity.CollageID }; } catch (Exception ex) { eventItem = new EventDetailBusinessModel(); ExceptionTracker.SendErrorToText(ex); } return(eventItem); }
/// <summary> /// convert to the eventdetail entity and pass to the data base layer to update /// </summary> /// <param name="eventDetails"></param> /// <returns></returns> public bool CreateEvent(EventDetailBusinessModel eventDetails) { EventDetail eventDetailToUpdate = new EventDetail(); bool isEventCreated = false; if (eventDetails != null) { try { EventDetail newEvent = new EventDetail { CreateDate = DateTime.Now, MdifiedDate = DateTime.Now, EventDate = eventDetails.EventDate, EventDescription = eventDetails.EventDescription, EventName = eventDetails.EventName, EventType = eventDetails.EventType, CollageID = eventDetails.CollageID }; adminDataBaseOperation.CreateEvent(newEvent); isEventCreated = true; } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); isEventCreated = false; } } return(isEventCreated); }
public List <RolesBusinessModel> GetAllRole() { List <RolesBusinessModel> usermodel = new List <RolesBusinessModel>(); List <Role> userRoles = new List <Role>(); try { userRoles = applicationLevelDataBaseOps.GetAllRoles(); foreach (Role item in userRoles) { RolesBusinessModel newRole = new RolesBusinessModel { RoleID = item.RoleID, RoleName = item.RoleName }; usermodel.Add(newRole); } } catch (Exception ex) { usermodel = new List <RolesBusinessModel>(); ExceptionTracker.SendErrorToText(ex); } return(usermodel); }
public void CreaeUser(UserBusinessModel userDetail) { User UserDetails = applicationLevelDataBaseOps.GetUserDetailByUserName(userDetail.UserName); if (UserDetails != null) { try { User user = new User { FirstName = userDetail.FirstName, LastName = userDetail.LastName, Password = ApplicationLEvelBusinessOperation.Encrypt(userDetail.Password.Trim()), UserName = userDetail.UserName, CollageID = userDetail.CollageID, CreateDate = DateTime.Now, MdifiedDate = DateTime.Now }; adminDataBaseOperation.CreaeUser(user); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } } }
public List <EventRegistrationBusinessModel> UserEventRegistration(int id) { List <EventRegistrationBusinessModel> EventRegistrationList = new List <EventRegistrationBusinessModel>(); List <EventRegistration> EventRegistrationListEntity = new List <EventRegistration>(); try { EventRegistrationListEntity = teacherBaseOperation.ListofEventRegistration(id); foreach (EventRegistration item in EventRegistrationListEntity) { EventRegistrationBusinessModel EventRegistrationItemt = new EventRegistrationBusinessModel { EventRegistrationID = item.EventRegistrationID, EventDetailsID = item.EventDetailsID, UserID = item.UserID, UserAttendance = item.UserAttendance }; EventRegistrationList.Add(EventRegistrationItemt); } } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(EventRegistrationList); }
public void UpdateAttendance(EventRegistration attendance) { try { db.EventEventRegistrations.Add(attendance); db.SaveChanges(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } }
public void CreateEvent(EventDetail eventdetail) { try { db.EventDetails.Add(eventdetail); db.SaveChanges(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } }
public void CreaeUser(User userDetail) { try { db.Users.Add(userDetail); db.SaveChanges(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } }
/// <summary> /// Get user detail by user name this will use in different places in the application /// </summary> /// <param name="username"></param> /// <returns></returns> public User GetUserDetailByUserName(string username) { User userdetails = new User(); try { userdetails = db.Users.First(c => c.UserName == username); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(userdetails); }
public List <Collage> GetAllCollage() { List <Collage> listofCollage = new List <Collage>(); try { listofCollage = db.Collages.ToList(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(listofCollage); }
public Role GetRoleDetailsByID(int roleID) { Role role = new Role(); try { role = db.Roles.Where(c => c.RoleID == roleID).FirstOrDefault(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(role); }
public List <Role> GetAllRoles() { List <Role> userRoles = new List <Role>(); try { userRoles = db.Roles.ToList(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(userRoles); }
public EventRegistration UserEventRegistration(EventRegistration eventRegistration) { try { db.EventEventRegistrations.Add(eventRegistration); db.SaveChanges(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(eventRegistration); }
public EventDetail GetEventDetailById(int id) { EventDetail eventDetail = new EventDetail(); try { eventDetail = db.EventDetails.Where(c => c.EventDetailID == id).FirstOrDefault(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(eventDetail); }
public User GetUserDetailByUserId(int id) { User UserDetail = new User(); try { UserDetail = db.Users.Where(c => c.UserID == id).FirstOrDefault(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(UserDetail); }
/// <summary> /// This will use in different places in the application and userrole will return user details and role details /// </summary> /// <param name="userID"></param> /// <returns></returns> public UserRole GetUserRolebyUserID(int userID) { UserRole userdetails = new UserRole(); try { userdetails = db.UserRoles.First(c => c.User.UserID == userID); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(userdetails); }
public List <EventDetail> GetAllEventDetail() { List <EventDetail> listofEvents = new List <EventDetail>(); try { listofEvents = db.EventDetails.ToList(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(listofEvents); }
public UserRole CreateUserRole(UserRole userRole) { try { db.UserRoles.Add(userRole); db.SaveChanges(); return(userRole); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); return(new UserRole()); } }
public List <EventRegistration> ListofEventRegistration(int id) { List <EventRegistration> EventRegistrationList = new List <EventRegistration>(); try { EventRegistrationList = db.EventEventRegistrations.Where(c => c.EventDetailsID == id).ToList(); } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(EventRegistrationList); }
public void CreateEvent(EventDetail eventdetail) { try { EventDetail eventDetail = new EventDetail { EventDate = eventdetail.EventDate, EventDescription = eventdetail.EventDescription, EventName = eventdetail.EventName, EventType = eventdetail.EventType, }; } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } }
public void CreaeUser(UserBusinessModel userDetail) { User UserDetails = applicationLevelDataBaseOps.GetUserDetailByUserName(userDetail.UserName); int roleID = Convert.ToInt32(userDetail.RoleID); UserBusinessModel returnObject = new UserBusinessModel(); if (UserDetails != null) { try { User user = new User { FirstName = userDetail.FirstName, LastName = userDetail.LastName, Password = ApplicationLEvelBusinessOperation.Encrypt(userDetail.Password.Trim()), UserName = userDetail.UserName, CollageID = userDetail.CollageID, CreateDate = DateTime.Now, MdifiedDate = DateTime.Now }; List <User> userEntity = new List <User>(); userEntity.Add(adminDataBaseOperation.CreaeUser(user)); returnObject = StaticBusinessMethods.userDetailConvertTOBModel(userEntity).FirstOrDefault(); //UserRole userRole = applicationLevelDataBaseOps.GetUserRolebyUserID(1002); Role role = applicationLevelDataBaseOps.GetRoleDetailsByID(roleID); UserRole newUserRole = new UserRole { RoleID = roleID, UderID = returnObject.UserID, CreateDate = DateTime.Now, MdifiedDate = DateTime.Now }; if (role != null) { adminDataBaseOperation.CreateUserRole(newUserRole); } } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } } }
public UserBusinessModel GetUserDetailByUserName(string username) { User userdetails = new User(); UserBusinessModel userModelDetails; try { userdetails = applicationLevelDataBaseOps.GetUserDetailByUserName(username); userModelDetails = new UserBusinessModel { UserID = userdetails.UserID }; } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); userModelDetails = new UserBusinessModel(); } return(userModelDetails); }
public UserBusinessModel GetUserDetailByUserId(int id) { User UserDetail = new User(); UserBusinessModel userBusinessModel; try { UserDetail = applicationLevelDataBaseOps.GetUserDetailByUserId(id); userBusinessModel = new UserBusinessModel { FirstName = UserDetail.FirstName, LastName = UserDetail.LastName, UserID = UserDetail.UserID }; } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); userBusinessModel = new UserBusinessModel(); } return(userBusinessModel); }
/// <summary> /// check valid user or not and if valid user it will pass the user ID to track his sessions /// </summary> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="userID"></param> /// <returns></returns> public bool IsValidUser(string userName, string password, out int userID) { bool isValidUser = false; User entityUserDetails = new User(); try { entityUserDetails = applicationLevelDataBaseOps.GetUserDetailByUserName(userName); if (string.Equals(entityUserDetails.UserName, userName) && string.Equals(Decrypt(entityUserDetails.Password), password)) { isValidUser = true; } } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } userID = entityUserDetails != null ? entityUserDetails.UserID : 0; return(isValidUser); }
public List <CollageBusinessModel> GetAllCollage() { List <Collage> listofCollage = new List <Collage>(); List <CollageBusinessModel> allCollages = new List <CollageBusinessModel>(); try { listofCollage = applicationLevelDataBaseOps.GetAllCollage().ToList(); foreach (Collage item in listofCollage) { CollageBusinessModel collageItem = new CollageBusinessModel { CollageID = item.CollageID, CollageName = item.CollageName }; allCollages.Add(collageItem); } } catch (Exception ex) { ExceptionTracker.SendErrorToText(ex); } return(allCollages); }
public UserRoleBusinessModel GetUserRolebyUserID(int userID) { UserRoleBusinessModel usermodel; try { UserRole userRole = applicationLevelDataBaseOps.GetUserRolebyUserID(userID); Role role = applicationLevelDataBaseOps.GetRoleDetailsByID(userRole.RoleID); usermodel = new UserRoleBusinessModel { RoleID = userRole.RoleID, UderID = userRole.UderID, UserRoleID = userRole.UserRoleID, RoleName = role.RoleName }; } catch (Exception ex) { usermodel = new UserRoleBusinessModel(); ExceptionTracker.SendErrorToText(ex); } return(usermodel); }