/// <summary> /// Converts to HL7. /// </summary> /// <param name="ethnicity">The ethnicity.</param> /// <returns>A <see cref="HL7Generator.Infrastructure.Table.EthnicityCodeset"/></returns> internal static EthnicityCodeset ConvertToHl7(Ethnicity ethnicity) { // TODO: We do not have ethnicity name like 'HISPANIC OR LATINO' in corresponding table EthnicityCodeset ethnicityCodeset; if (ethnicity != null) { switch (ethnicity.Name.ToUpper()) { case "NOT HISPANIC OR LATINO": ethnicityCodeset = EthnicityCodeset.NotHispanicOrLatino; break; case "HISPANIC OR LATINO": ethnicityCodeset = EthnicityCodeset.HispanicOrLatino; break; default: ethnicityCodeset = EthnicityCodeset.Unknown; break; } } else { ethnicityCodeset = EthnicityCodeset.Unknown; } return(ethnicityCodeset); }
/// <summary> /// Constructor that initialises patient details /// </summary> /// <param name="a">Patient Age</param> /// <param name="e">Patient Ethnicity</param> /// <param name="g">Patient Gender</param> /// <param name="cl">Patient Creatinine Level</param> public Calculation(int a, Ethnicity e, Gender g, double cl) { Age = a; Ethnicity = e; Gender = g; CreatinineLevel = cl; }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { return(((Ethnicity != null ? Ethnicity.GetHashCode() : 0) * 397) ^ (DetailedEthnicity != null ? DetailedEthnicity.GetHashCode() : 0)); } }
//Remove double-spaces and reprocess the value public List <int> VerifyEthnicity() { var errors = new List <int>(); if (Ethnicity == null) { return(errors); } Ethnicity = Ethnicity.Trim().Replace(HidroConstants.DOUBLE_SPACE, HidroConstants.WHITE_SPACE); if (string.IsNullOrEmpty(Ethnicity) || string.IsNullOrWhiteSpace(Ethnicity)) { Ethnicity = null; return(errors); } Ethnicity = HelperProvider.CapitalizeFirstLetterOfEachWord(Ethnicity); var lenTest = new Regex(@".{1,30}"); if (!lenTest.IsMatch(Ethnicity)) { errors.Add(2); } var enTest = new Regex(@"^[A-Za-z\-.' ]*$"); if (!enTest.IsMatch(Ethnicity)) { errors.Add(3); } return(errors); }
public async Task <ResponseModel> Insert(EthnicityModel model) { ResponseModel response = new ResponseModel(); try { Ethnicity md = new Ethnicity(); md.Name = model.Name; md.Precedence = model.Precedence; md.IsActive = model.IsActive; md.CreateBy = base.UserId; md.CreateDate = DateTime.Now; md.Deleted = false; await _context.NationRepository.AddAsync(md).ConfigureAwait(true); await _context.SaveChangesAsync(); _memoryCachingService.Remove(CacheKey); } catch (Exception ex) { throw ex; } return(response); }
public async Task <ResponseModel> Delete(EthnicityModel model) { ResponseModel response = new ResponseModel(); try { Ethnicity md = await _context.NationRepository.FirstOrDefaultAsync(m => m.Id == model.Id); if (!md.RowVersion.SequenceEqual(model.RowVersion)) { response.ResponseStatus = Core.CommonModel.Enums.ResponseStatus.OutOfDateData; return(response); } md.Deleted = true; md.UpdateBy = base.UserId; md.UpdateDate = DateTime.Now; _context.NationRepository.Update(md); await _context.SaveChangesAsync(); _memoryCachingService.Remove(CacheKey); } catch (Exception ex) { throw ex; } return(response); }
public async Task <IActionResult> Edit(int id, [Bind("ID,EthnicityDescription")] Ethnicity ethnicity) { if (id != ethnicity.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(ethnicity); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!EthnicityExists(ethnicity.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(ethnicity)); }
public IHttpActionResult PutEthnicity(int id, Ethnicity ethnicity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != ethnicity.EthnicityId) { return(BadRequest()); } db.Entry(ethnicity).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EthnicityExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public EthnicityDTO InsertEthnicity(EthnicityDTO data) { Ethnicity dataToInsert = new Ethnicity(); dataToInsert = EthnicityRequestFormatter.ConvertRespondentInfoFromDTO(data); return(EthnicityRequestFormatter.ConvertRespondentInfoToDTO(_unitOfWork.EthnicityRepository.Create(dataToInsert))); }
private void dgEthnicity_CellEndEdit(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex != -1) { Ethnicity ethnicity = _list[e.RowIndex]; _changes.Add(ethnicity); } }
public int UpdateEthnicity(EthnicityDTO data) { Ethnicity dataToUpdate = EthnicityRequestFormatter.ConvertRespondentInfoFromDTO(data); int res = _unitOfWork.EthnicityRepository.Update(dataToUpdate); _unitOfWork.Save(); return(res); }
public ActionResult DeleteConfirmed(int id) { Ethnicity ethnicity = db.Ethnicities.Find(id); db.Ethnicities.Remove(ethnicity); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool DeleteEthnicity(Ethnicity e) { if (e != null && e.Persons.Count < 1) { this.ethnicityRepo.Delete(e); return(true); } return(false); }
public ActionResult DeleteConfirmed(int id) { Ethnicity ethnicity = db.Ethnicities.Find(id); db.Ethnicities.Remove(ethnicity); db.SaveChanges(); TempData["Success"] = "Ethnicities is deleted Successfully"; return(RedirectToAction("Create")); }
public void Initialize() { firstName = "Bob"; lastName = "Tester"; birthDate = DateTime.Now.Date.AddYears(-25); gender = new Gender(GenderType.Male); race = new Race(RaceType.White); ethnicity = new Ethnicity(EthnicityType.NotOfHispanicOrigin); }
public async Task <ActionResult> DeleteConfirmed(int id) { Ethnicity ethnicity = await _ctx.Ethnicity.FindAsync(id); _ctx.Ethnicity.Remove(ethnicity); await _ctx.SaveChangesAsync(); return(RedirectToAction("Default")); }
public ActionResult Edit(int id) { Ethnicity e = this.personTasks.GetEthnicity(id); if (e != null) { return(View(Mapper.Map(e, new EthnicityViewModel()))); } return(new HttpNotFoundResult()); }
public static EthnicityViewData Create(Ethnicity ethnicity) { return(ethnicity != null ? new EthnicityViewData { Id = ethnicity.Id, Code = ethnicity.Code, Name = ethnicity.Name, Description = ethnicity.Description } : null); }
public ActionResult Details(int id) { Ethnicity e = this.personTasks.GetEthnicity(id); if (e != null) { return(View(e)); } return(new HttpNotFoundResult()); }
public ActionResult Edit([Bind(Include = "ethnicityID,ethName")] Ethnicity ethnicity) { if (ModelState.IsValid) { db.Entry(ethnicity).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ethnicity)); }
public IHttpActionResult GetEthnicity(int id) { Ethnicity ethnicity = db.Ethnicities.Find(id); if (ethnicity == null) { return(NotFound()); } return(Ok(ethnicity)); }
public async Task <IActionResult> Create([Bind("ID,EthnicityDescription")] Ethnicity ethnicity) { if (ModelState.IsValid) { _context.Add(ethnicity); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(ethnicity)); }
public async Task <ActionResult> Edit(Ethnicity ethnicity) { if (ModelState.IsValid) { _ctx.Entry(ethnicity).State = EntityState.Modified; await _ctx.SaveChangesAsync(); return(RedirectToAction("Default")); } return(View(ethnicity)); }
public ActionResult Create([Bind(Include = "ethnicityID,ethName")] Ethnicity ethnicity) { if (ModelState.IsValid) { db.Ethnicities.Add(ethnicity); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ethnicity)); }
public async Task <ActionResult> Create(Ethnicity ethnicity) { if (ModelState.IsValid) { _ctx.Ethnicity.Add(ethnicity); await _ctx.SaveChangesAsync(); return(RedirectToAction("Default")); } return(View(ethnicity)); }
public async Task <string> ChangeUserEthnicity(ApplicationUser user, Ethnicity ethnicity) { if (user == null) { return(InvalidUser); } user.ModelInformation.Ethnicity = ethnicity; await this.appRepository.SaveChangesAsync(); return(SuccessfullyUpdated); }
public IHttpActionResult PostEthnicity(Ethnicity ethnicity) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Ethnicities.Add(ethnicity); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = ethnicity.EthnicityId }, ethnicity)); }
public ListCalculations(String nhs, int a, Ethnicity e, Gender g, double cl) { NHSNumber = nhs; Age = a; Ethnicity = e; Gender = g; CreatineLevel = cl; double eth = 1 + ((int)Ethnicity * 0.210); double gen = 1 - ((int)Gender * 0.258); Value = 186 * Math.Pow(CreatineLevel / 88.4, -1.154) * Math.Pow(Age, -0.203) * gen * eth; }
protected void AddEthnicity(Ethnicity value) { if (QueryParameters.ContainsKey(Constants.EthnicityKey)) { QueryParameters[Constants.EthnicityKey] = value == Ethnicity.None ? value : (Ethnicity)QueryParameters[Constants.EthnicityKey] | value; } else { QueryParameters.Add(Constants.EthnicityKey, value); } }
public static EthnicityDTO ConvertRespondentInfoToDTO(Ethnicity ethnicity) { Mapper.CreateMap <Ethnicity, EthnicityDTO>().ConvertUsing( m => { return(new EthnicityDTO { EthnicityName = m.EthnicityName, EthnicityId = m.EthnicityId }); }); return(Mapper.Map <Ethnicity, EthnicityDTO>(ethnicity)); }
/// <summary> /// Initializes the specified character profile. /// </summary> /// <param name="gender">The gender.</param> /// <param name="ethnicity">The ethnicity.</param> /// <param name="headGear">The head gear.</param> /// <param name="name">The name.</param> /// <param name="color">The color.</param> /// <param name="walkingSpeed">The walking speed.</param> public void Initialize(Gender gender, Ethnicity ethnicity, HeadGear headGear, string name, Color color, float walkingSpeed) { this.Gender = gender; this.Ethnicity = ethnicity; this.HeadGear = headGear; this.CharacterName = name; this.Color = color; this.WalkingSpeed = walkingSpeed; }
/// <summary> /// Converts to HL7. /// </summary> /// <param name="ethnicity">The ethnicity.</param> /// <returns>A <see cref="HL7Generator.Infrastructure.Table.EthnicityCodeset"/></returns> internal static EthnicityCodeset ConvertToHl7( Ethnicity ethnicity ) { // TODO: We do not have ethnicity name like 'HISPANIC OR LATINO' in corresponding table EthnicityCodeset ethnicityCodeset; if ( ethnicity != null ) { switch ( ethnicity.Name.ToUpper () ) { case "NOT HISPANIC OR LATINO": ethnicityCodeset = EthnicityCodeset.NotHispanicOrLatino; break; case "HISPANIC OR LATINO": ethnicityCodeset = EthnicityCodeset.HispanicOrLatino; break; default: ethnicityCodeset = EthnicityCodeset.Unknown; break; } } else { ethnicityCodeset = EthnicityCodeset.Unknown; } return ethnicityCodeset; }
ICreativeImagesSearch ICreativeImagesSearch.WithEthnicity(Ethnicity value) { return WithEthnicity(value); }
IBlendedImagesSearch IBlendedImagesSearch.WithEthnicity(Ethnicity value) { return WithEthnicity(value); }
IEditorialImagesSearch IEditorialImagesSearch.WithEthnicity(Ethnicity value) { return WithEthnicity(value); }
protected void btnConfidentialSurveyAccept_Click(object sender, EventArgs e) { int genderID = 0; string ethnicity = null; List<SurveyXRecruitmentSrc> RecruitmentSources = new List<SurveyXRecruitmentSrc>(); foreach (ListItem item in rbtnConfidentialSurveySex.Items) { if (item.Selected) //Find the selected gender and set the genderID to that value genderID = int.Parse(item.Value); } //Instead of grabbing each radio button individually, loop through the control tree of the current view and look for radio buttons foreach (Control c in viewConfidentialSurvey.Controls) { if (c is RadioButton) { RadioButton ethnicityButton = (RadioButton)c; if (ethnicityButton.Checked && ethnicityButton.GroupName == "Ethnicity") { ethnicity = ethnicityButton.Text; break; } } } //Look through each item in the recruitment source repeater foreach (RepeaterItem item in rptRecruitmentSource.Items) { CheckBox cbox = item.FindControl("chkRecruitmentSource") as CheckBox; if (cbox != null && cbox.Checked) //if we found a checked checkbox { SurveyXRecruitmentSrc recruitmentSource = new SurveyXRecruitmentSrc(); RecruitmentSrc example = new RecruitmentSrc(); Label source = item.FindControl("lblRecruitmentSource") as Label; TextBox specific = item.FindControl("txtSpecify") as TextBox; if (source != null) //Make sure we have a valid source { example.RecruitmentSource = source.Text; //Grab the matching recruitment source out (ignore the allow specify field) recruitmentSource.RecruitmentSrc = RecruitmentSrcBLL.GetUniqueByExample(example, "AllowSpecify"); recruitmentSource.RecruitmentSrcOther = string.IsNullOrEmpty(specific.Text) ? null : specific.Text; RecruitmentSources.Add(recruitmentSource); } } } //Save ethnicity, gender, and all of the recruitment sources Application application = currentApplication; using (var ts = new TransactionScope()) { //First make sure we have a survey if (application.Surveys.Count == 0) { Survey newSurvey = new Survey(); newSurvey.AssociatedApplication = application; application.Surveys.Add(newSurvey); } Survey currentSurvey = application.Surveys[0]; //Save the gender if the ID was set (non-zero), else save that is was null if (genderID > 0) { currentSurvey.Gender = GenderBLL.GetByID(genderID); } else { currentSurvey.Gender = null; } //Save the ethnicity if (ethnicity != null) { Ethnicity chosenEthnicity = new Ethnicity(); chosenEthnicity.EthnicityValue = ethnicity; currentSurvey.Ethnicity = EthnicityBLL.GetUniqueByExample(chosenEthnicity); currentSurvey.TribalAffiliation = string.IsNullOrEmpty(txtAmericanIndian.Text) ? null : txtAmericanIndian.Text; } else { currentSurvey.Ethnicity = null; currentSurvey.TribalAffiliation = null; } //Save each recruitment source & clear out existing sources if (currentSurvey.RecruitmentSources == null) currentSurvey.RecruitmentSources = new List<SurveyXRecruitmentSrc>(); currentSurvey.RecruitmentSources.Clear(); foreach (SurveyXRecruitmentSrc chosenRecruitmentSource in RecruitmentSources) { chosenRecruitmentSource.AssociatedSurvey = currentSurvey; currentSurvey.RecruitmentSources.Add(chosenRecruitmentSource); //Trace.Write(string.Format("Checked the source {0} with additional info {1}", s.RecruitmentSrc.RecruitmentSource, s.RecruitmentSrcOther) + Environment.NewLine); } //Finally, set this step to complete currentSurvey.Complete = true; currentSurvey.AssociatedApplication = application; ApplicationBLL.EnsurePersistent(application); ts.CommitTransaction(); } ReloadStepListAndSelectHome(STR_ConfidentialSurvey, true); }
/// <summary> /// Generates the ethnicity. /// </summary> /// <param name="ethnicities">The available ethnicities.</param> /// <returns> /// random ethnicity /// </returns> private Ethnicity GenerateEthnicity(Ethnicity[] ethnicities) { int items = 0; Ethnicity ethnicity = ethnicities[UnityEngine.Random.Range(0, ethnicities.Length - 1)]; while (UnityEngine.Random.value < 0.05 && items < 2) { ethnicity |= ethnicities[UnityEngine.Random.Range(0, ethnicities.Length - 1)]; items++; } return ethnicity; }
public decimal GraduateEthnicityPercent(Ethnicity ethnicity) { if (GraduateEthnicityCount.ContainsKey(ethnicity)) return GraduateEthnicityCount[ethnicity] / TotalStudents; return 0; }
public SearchImages WithEthnicity(Ethnicity value) { if (QueryParameters.ContainsKey(Constants.EthnicityKey)) { QueryParameters[Constants.EthnicityKey] = value == Ethnicity.None ? value : (Ethnicity) QueryParameters[Constants.EthnicityKey] | value; } else { QueryParameters.Add(Constants.EthnicityKey, value); } return this; }