public List<SimpleUser> SimplySearchUser(SearchUserDTO dto) { List<SimpleUser> list=new List<SimpleUser>(); SimpleUser sUser; try { SqlDataReader reader = ConnectionManager.GetCommand("sp0002simple", new Dictionary<string, SqlDbType>() { {"@userName", SqlDbType.NVarChar}, }, new List<object>() { dto.UserName }).ExecuteReader(); while (reader.Read()) { sUser=new SimpleUser(); sUser.UserID = reader["UserID"].ToString(); sUser.Username = reader["Username"].ToString(); list.Add(sUser); } reader.Close(); } catch (Exception e) { Log.Error("Error at AuthorDAO - GetAuthorByID", e); return null; } return list; }
private void btnSearch_Click(object sender, EventArgs e) { SearchUserDTO searchUserDto=new SearchUserDTO(); searchUserDto.UserName = txtUsername.Text; searchUserDto.Email = txtEmail.Text; searchUserDto.Isdn = txtIDSN.Text; searchUserDto.Status = (int)EnumHelper.Parse(typeof(UserStatus), cboxStatus.Text); searchUserDto.PageNumber = 1; SearchUserBUS searchUserBus =new SearchUserBUS(); grdUser.DataSource = searchUserBus.SearchUsers(searchUserDto); }
public List<UserDTO> SearchUsers(SearchUserDTO dto) { UserDTO user; List<UserDTO> list=new List<UserDTO>(); try { SqlDataReader reader = ConnectionManager.GetCommand("sp0002", new Dictionary<string, SqlDbType>() { {"@username", SqlDbType.NVarChar}, {"@status", SqlDbType.Int}, {"@eMail", SqlDbType.NVarChar}, {"@idsn", SqlDbType.NVarChar} }, new List<object>() { dto.UserName, dto.Status, dto.Email, dto.Isdn }).ExecuteReader(); while (reader.Read()) { user=new UserDTO(); user.UserId = reader["UserID"].ToString(); user.Username = reader["Username"].ToString(); //user.Password = reader["Password"].ToString(); user.RoleDescription = reader["RoleDescription"].ToString(); user.Birthday = (DateTime)reader["Birthday"]; user.Address = reader["Address"].ToString(); user.Phone = reader["Phone"].ToString(); user.Email = reader["Email"].ToString(); user.IDSN = reader["IDSN"].ToString(); user.IssuedDate = (DateTime)reader["IssuedDate"]; user.ExpiredDate = (DateTime)reader["ExpiredDate"]; int statusTemp; int.TryParse(reader["Status"].ToString(), out statusTemp); user.Status = (UserStatus)Enum.Parse(typeof(UserStatus), statusTemp.ToString()); list.Add(user); } reader.Close(); } catch (Exception e) { Log.Error("Error at UserDAO - GetUserByID", e); return null; } return list; }
public List<UserDTO> SearchUsers(SearchUserDTO dto) { SearchUserDAO dao=new SearchUserDAO(); //int pageSize = Options.NumberOfRecord; //int rowStart = 0; //if (dto.PageNumber == 1) //{ // rowStart = 1; //} //else //{ // rowStart = (dto.PageNumber - 1) * pageSize; //} //int rowEnd = rowStart - 1 + pageSize; if (dto.Status == 1) { return dao.SearchUsers(dto); } return null; }
private void btnSearch_Click(object sender, EventArgs e) { if(this.Type==1) { SearchUserDTO dto=new SearchUserDTO(); dto.UserName = txtInformation.Text; SearchUserBUS bus=new SearchUserBUS(); grdSimpleInfo.DataSource = bus.SearchSimpleUser(dto); } else if (this.Type == 2) { SearchBookDTO dto=new SearchBookDTO(); dto.Info1 = txtInformation.Text; SearchBookBUS bus=new SearchBookBUS(); grdSimpleInfo.DataSource = bus.SearchBarcode(dto); } else { SearchBookDTO dto = new SearchBookDTO(); dto.Info1 = txtInformation.Text; SearchBookBUS bus = new SearchBookBUS(); grdSimpleInfo.DataSource = bus.SearchCatalogue(dto); } }
public List<SearchUserDAO.SimpleUser> SearchSimpleUser(SearchUserDTO dto) { SearchUserDAO dao = new SearchUserDAO(); return dao.SimplySearchUser(dto); }