/// <summary> /// /// </summary> /// <returns></returns> public List <User> Find(out int totalRecords, UserCriteria userCriteria = null, int currentRecordIndex = 0, int maxRecord = 0) { totalRecords = 0; List <User> resultList = null; IQueryable <ApplicationUser> rowList = _dbContext.Users; CriteriaTransformer.CompleteQuery(ref rowList, userCriteria); if (userCriteria == null || userCriteria.FieldSortList == null || userCriteria.FieldSortList.Count == 0) { rowList = rowList.OrderBy(u => u.UserName); } if (maxRecord > 0) { totalRecords = rowList.Count(); rowList = rowList.Skip(currentRecordIndex).Take(maxRecord); } if (rowList != null) { foreach (var applicationUserRow in rowList) { if (resultList == null) { resultList = new List <User>(); } resultList.Add(UserTransformer.ToBean(applicationUserRow)); } } return(resultList); }
public ChurchService() { _churchTransformer = new ChurchTransformer(); _massDetailTransformer = new MassDetailTransformer(); _userTransformer = new UserTransformer(); _churchReviewTransformer = new ChurchReviewTransformer(); _announcementTransformer = new AnnouncementTransformer(); }
public void loadUsers() { List <User> users = userService.getAllUsers(); List <UserDTO> userDTOs = new List <UserDTO>(); foreach (User it in users) { userDTOs.Add(UserTransformer.CreateDto(it)); } userTable.ItemsSource = userDTOs; }
public void initData(UserDTO userDto) { this.user = UserTransformer.CreateEntity(userDto); nameText.Text = user.Name; surnameText.Text = user.Surname; phoneText.Text = user.Phone; emailText.Text = user.Email; streetText.Text = user.Address.Street; streetNumText.Text = user.Address.Street_number; homeNumText.Text = user.Address.Home_number; postalCodeText.Text = user.Address.Postal_code; cityText.Text = user.Address.City; }
public CSUser GetUser(string email) { CSUser user = null; using (var db = new ManagementToolEntities()) { var resp = new UsersRepository(db); var dbUser = resp.GetFirstOrDefault(u => u.Email.Trim().ToLower() == email.Trim().ToLower()); UserTransformer transformer = new UserTransformer(); user = transformer.Transform(dbUser); } return(user); }
public List <CSUser> GetUsersByCompanyId(int companyId) { List <CSUser> users = null; using (var db = new ManagementToolEntities()) { var resp = new UsersRepository(db); var dbUsers = resp.GetAllUsersInCompany(companyId); if (dbUsers != null && dbUsers.Count() > 0) { UserTransformer transformer = new UserTransformer(); users = transformer.Transform(dbUsers); } } return(users); }
/// <summary> /// Get data in database /// </summary> /// <param name="key">Primary Key</param> /// <returns>read data</returns> public User Get(UserKey key) { if (key == null || string.IsNullOrWhiteSpace(key.Id)) { return(null); } User user = null; ApplicationUser row = _dbContext.Users.Where(m => m.Id == key.Id).FirstOrDefault(); if (row != null) { user = UserTransformer.ToBean(row); } return(user); }
/// <summary> /// Update data in database /// </summary> /// <param name="user">data</param> /// <returns>updated data</returns> public User Update(User user) { if (user == null || string.IsNullOrWhiteSpace(user.Id)) { return(null); } var row = _dbContext.Users.Where(m => m.Id == user.Id).FirstOrDefault(); if (row != null) { //Modify Data in database UserTransformer.ToRow(user, row); _dbContext.SaveChanges(); return(Get(user)); } return(null); }
public List <UserDTO> GetStudents(long facId) { List <UserDTO> retVal = null; UserTransformer userTransformer; List <USER> students; students = userRepository.GetForFaculty(facId); userTransformer = new UserTransformer(); if (CheckHelper.IsFilled(students)) { retVal = userTransformer.TransformToDTO(students); } return(retVal); }
public List <Tuple <ChurchInfo, User> > GetChurchFollowers(int churchId) { var churchTransformer = new ChurchTransformer(); var userTransformer = new UserTransformer(); var followers = new List <Tuple <ChurchInfo, User> >(); using (var dbconn = new SqlConnection(ConfigurationManager.ConnectionStrings["dbconn"].ConnectionString)) { if (dbconn.State == ConnectionState.Open) { dbconn.Close(); } dbconn.Open(); using (var cmd = new SqlCommand("spGetChurchFollowers", dbconn)) { try { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@churchID", churchId); var reader = cmd.ExecuteReader(); while (reader.Read()) { var church = churchTransformer.Transform(reader); var user = userTransformer.Transform(reader); var follower = new Tuple <ChurchInfo, User>(church, user); followers.Add(follower); } } catch (Exception) { // ignored } } } return(followers); }
public List <Tuple <Church, User> > GetChurchFollowers(int churchId) { var churchTransformer = new ChurchTransformer(); var userTransformer = new UserTransformer(); var followers = new List <Tuple <Church, User> >(); using (var sp = new StoredProcedure("")) { sp.SqlCommand.Parameters.AddWithValue("@churchID", churchId); var reader = sp.SqlCommand.ExecuteReader(); while (reader.Read()) { var church = churchTransformer.Transform(reader); var user = userTransformer.Transform(reader); var follower = new Tuple <Church, User>(church, user); followers.Add(follower); } } return(followers); }
public ChurchReviewService() { _churchReviewTransformer = new ChurchReviewTransformer(); _churchTransformer = new ChurchTransformer(); _userTransformer = new UserTransformer(); }
public DailyReflectionReflectionService() { _reflectionReflectionTransformer = new ReflectionReflectionTransformer(); _dailyReflectionTransformer = new DailyReflectionTransformer(); _userTransformer = new UserTransformer(); }
// TODO: CREATE A TRANSFORMER FOR STATUS. public VisitaIglesiaService() { _visitaIglesiaTransformer = new VisitaIglesiaTransformer(); _churchTransformer = new ChurchTransformer(); _userTransformer = new UserTransformer(); }
public NotificationService() { _notificationTransformer = new NotificationTransformer(); _userTransformer = new UserTransformer(); }
public UserService() { _userTransformer = new UserTransformer(); }
public DailyGospelReflectionService() { _dailyGospelReflectionTransformer = new GospelReflectionTransformer(); _dailyGospelTransformer = new DailyGospelTransformer(); _userTransformer = new UserTransformer(); }
public UserBuilder(ContextData contextData) : base(contextData, null, "users", UserTransformer.Yield()) { }
public SaintReflectionService() { _saintReflectionTransformer = new SaintReflectionTransformer(); _saintTransformer = new SaintTransformer(); _userTransformer = new UserTransformer(); }
public OrganizationReviewService() { _organizationReviewTransformer = new OrganizationReviewTransformer(); _organizationTransformer = new OrganizationTransformer(); _userTransformer = new UserTransformer(); }