public DataSet Search(StudentSearch student) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_StudentSearch"); db.AddInParameter(command, "FirstName", DbType.String, student.FirstName); db.AddInParameter(command, "MiddleName", DbType.String, student.MiddleName); db.AddInParameter(command, "LastName", DbType.String, student.LastName); db.AddInParameter(command, "Zip", DbType.String, student.Zip); db.AddInParameter(command, "Gender", DbType.String, student.Gender); db.AddInParameter(command, "Status", DbType.String, student.Status); db.AddInParameter(command, "SchoolName", DbType.String, student.SchoolName); return(db.ExecuteDataSet(command)); }
public DataSet Search(StudentSearch student) { Database db = DatabaseFactory.CreateDatabase(Constants.CONNECTIONSTRING); DbCommand command = db.GetStoredProcCommand("usp_StudentSearch"); db.AddInParameter(command, "FirstName", DbType.String, student.FirstName); db.AddInParameter(command, "MiddleName", DbType.String, student.MiddleName); db.AddInParameter(command, "LastName", DbType.String, student.LastName); db.AddInParameter(command, "Zip", DbType.String, student.Zip); db.AddInParameter(command, "Gender", DbType.String, student.Gender); db.AddInParameter(command, "Status", DbType.String, student.Status); db.AddInParameter(command, "SchoolName", DbType.String, student.SchoolName); return db.ExecuteDataSet(command); }
protected void FindStudent_Click(object sender, EventArgs e) { HouseSearchresults.Visible = false; RHP.StudentManagement.StudentSearch student = new RHP.StudentManagement.StudentSearch(); StudentDAO studentDAO = new StudentDAO(); student.FirstName = string.IsNullOrEmpty(FirstName.Text.Trim()) ? null : FirstName.Text.Trim(); student.MiddleName = string.IsNullOrEmpty(MiddleName.Text.Trim()) ? null : MiddleName.Text.Trim(); student.LastName = string.IsNullOrEmpty(LastName.Text.Trim()) ? null : LastName.Text.Trim(); student.SchoolName = string.IsNullOrEmpty(DrpSchoolName.Text.Trim()) ? null : DrpSchoolName.Text.Trim(); student.Zip = string.IsNullOrEmpty(Zipcode2.Text.Trim()) ? null : Zipcode2.Text.Trim(); if (DrpGender.SelectedItem.Value != "-1") { student.Gender = DrpGender.SelectedItem.Value; } else { student.Gender = null; } if (DrpStatus.SelectedItem.Value != "-1") { student.Status = DrpStatus.SelectedItem.Value; } else { student.Status = null; } DataSet ds; ds = studentDAO.Search(student); if (ds != null) { DataListStudentSearchresults.DataSource = ds.Tables[0]; DataListStudentSearchresults.DataBind(); StudentSearchresults.Visible = true; } else { Searchresults.Visible = true; } }