/// <summary> /// Gets the doctors by name. /// </summary> /// <param name="name">The name.</param> /// <param name="on">The on.</param> /// <returns></returns> public IList <LightDoctorDto> GetDoctorsByNameLight(string name, SearchOn on) { IList <Doctor> result = new List <Doctor>(); switch (on) { case SearchOn.FirstName: result = this.GetDoctorsByFirstName(name); break; case SearchOn.LastName: result = this.GetDoctorsByLastName(name); break; case SearchOn.FirstAndLastName: result = this.GetDoctorsByFirstAndLastName(name); break; default: Assert.FailOnEnumeration(on); break; } return(Mapper.Map <IList <Doctor>, IList <LightDoctorDto> >(result) .ToList()); }
private IList <Patient> GetPatientEntities(string criterium, SearchOn search) { if (string.IsNullOrEmpty(criterium)) { return(new List <Patient>().ToList()); } criterium = criterium.ToLower(); var result = new List <Patient>(); switch (search) { case SearchOn.FirstName: { result = GetPatientsByFirstName(criterium); break; } case SearchOn.LastName: { result = GetPatientsByLastName(criterium); break; } case SearchOn.FirstAndLastName: { result = GetPatientsByFirstAndLastName(criterium); break; } default: { Assert.FailOnEnumeration(search); break; } } return(result); }
public static string Translate(this SearchOn searchType) { var result = string.Empty; switch (searchType) { case SearchOn.FirstName: result = Messages.SearchOn_FirstName; break; case SearchOn.LastName: result = Messages.SearchOn_LastName; break; case SearchOn.FirstAndLastName: result = Messages.SearchOn_Both; break; default: Assert.FailOnEnumeration(searchType); break; } return(result); }
private void BindGrid(SearchOn searchOn,string searchTerm=null,int startRowIndex=0, int maximumRows=0) { var dbContext = new ProspectDataContext(); var listProspects = dbContext.Prospects.OrderBy(x => x.LastActivityDate).ToList(); if (!string.IsNullOrEmpty(searchTerm)) { switch (searchOn) { case SearchOn.Company: listProspects = listProspects.Where(p => p.Company.ToLower().Contains(searchTerm)).ToList(); break; case SearchOn.ContactEmail: listProspects = listProspects.Where(p => p.ContactEmail.ToLower().Contains(searchTerm)).ToList(); break; case SearchOn.ContactName: listProspects = listProspects.Where(p => p.ContactName.ToLower().Contains(searchTerm)).ToList(); break; case SearchOn.ContactPhone: listProspects = listProspects.Where(p => p.ContactPhone.ToLower().Contains(searchTerm)).ToList(); break; case SearchOn.ContactCity: listProspects = listProspects.Where(p => p.ContactCity.ToLower().Contains(searchTerm)).ToList(); break; case SearchOn.ContactState: listProspects = listProspects.Where(p => p.ContactState.ToLower().Contains(searchTerm)).ToList(); break; } } gvProspects.DataSource = listProspects; gvProspects.DataBind(); if (gvProspects.Rows.Count == 0) { gvProspects.DataSource = ReturnEmptyDataTable(); gvProspects.DataBind(); lblMsg.Text = "No records found"; } else { lblMsg.Text = listProspects.Count + " records found."; } gvProspects.SelectedIndex = -1; divComments.Style.Add(HtmlTextWriterStyle.Display, "none"); }
/// <summary> /// Gets the doctors that can be linked to the specified doctor. /// </summary> /// <param name="patient">The patient.</param> /// <param name="criteria">The criteria.</param> /// <param name="on">Indicate where the search should be executed.</param> /// <returns> /// A list of doctor /// </returns> public IEnumerable<LightDoctorDto> GetNotLinkedDoctorsFor(LightPatientDto patient, string criteria, SearchOn searchOn) { var patientEntity = this.Session.Get<Patient>(patient.Id); List<Doctor> result = new List<Doctor>(); if (criteria == "*") { result = this.GetAllDoctors(); } else { switch (searchOn) { case SearchOn.FirstName: result = this.SearchDoctorOnFirstName(criteria); break; case SearchOn.LastName: result = this.SearchDoctorOnLastName(criteria); break; case SearchOn.FirstAndLastName: result = this.SearchDoctorOnFirstNameAndLastName(criteria); break; default: Assert.FailOnEnumeration(searchOn); break; } } result = this.RemoveDoctorsOfPatient(result, patientEntity); return Mapper.Map<IList<Doctor>, IList<LightDoctorDto>>(result); }
public IList <LightPatientDto> GetPatientsByNameLight(string criteria, SearchOn searchOn) { return(new Selector(this.Session).GetPatientByNameLight(criteria, searchOn)); }
public IList<LightPatientDto> GetPatientsByNameLight(string criterium, SearchOn search) { return new Selector(this.Session).GetPatientByNameLight(criterium, search); }
/// <summary> /// Gets the doctors that can be linked to the specified doctor. /// </summary> /// <param name="patient">The patient.</param> /// <param name="criteria">The criteria.</param> /// <param name="on">Indicate where the search should be executed.</param> /// <returns> /// A list of doctor /// </returns> public IEnumerable <LightDoctorDto> GetNotLinkedDoctorsFor(LightPatientDto patient, string criteria, SearchOn searchOn) { var patientEntity = this.Session.Get <Patient>(patient.Id); List <Doctor> result = new List <Doctor>(); if (criteria == "*") { result = this.GetAllDoctors(); } else { switch (searchOn) { case SearchOn.FirstName: result = this.SearchDoctorOnFirstName(criteria); break; case SearchOn.LastName: result = this.SearchDoctorOnLastName(criteria); break; case SearchOn.FirstAndLastName: result = this.SearchDoctorOnFirstNameAndLastName(criteria); break; default: Assert.FailOnEnumeration(searchOn); break; } } result = this.RemoveDoctorsOfPatient(result, patientEntity); return(Mapper.Map <IList <Doctor>, IList <LightDoctorDto> >(result)); }
/// <summary> /// Get all the patient respecting the criteria and the search mode which /// aren't in the family of the specified patient /// </summary> /// <param name="patient">The patient connected into the session</param> /// <param name="criteria">The search criteria</param> /// <param name="search">The search mode</param> /// <returns>A list of patient</returns> public IList<LightPatientDto> GetPatientNotFamilyMembers(LightPatientDto patient, string criteria, SearchOn search) { var result = new Selector(this.Session).GetPatientByNameLight(criteria, search); return this.RemoveFamilyMembers(result, patient); }
public IList <LightPatientDto> GetPatientByNameLight(string criterium, SearchOn search) { var result = this.GetPatientEntities(criterium, search); return(Mapper.Map <IList <Patient>, IList <LightPatientDto> >(result)); }
/// <summary> /// Get all the patient respecting the criteria and the search mode which /// aren't in the family of the specified patient /// </summary> /// <param name="patient">The patient connected into the session</param> /// <param name="criteria">The search criteria</param> /// <param name="search">The search mode</param> /// <returns>A list of patient</returns> public IList <LightPatientDto> GetPatientNotFamilyMembers(LightPatientDto patient, string criteria, SearchOn search) { var result = new Selector(this.Session).GetPatientByNameLight(criteria, search); return(this.RemoveFamilyMembers(result, patient)); }
protected override void Initialize() { SearchOn.Initialize(this); base.Initialize(); }