public IHttpActionResult PutPersonInformation(int id, PersonInformation personInformation) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != personInformation.PersonId) { return BadRequest(); } db.Entry(personInformation).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!PersonInformationExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
static void Main(string[] args) { var person = new PersonInformation { Name = "jenny", PhoneNumber = "867-5309" }; ref var name = ref GetName(ref person); //this needs to be a ref parameter then. MakeNameCapitalized(ref name); Console.WriteLine(person.Name); }
/// <summary> /// Возвращает похожего на person человека из personList в другой соцсети. /// </summary> /// <param name="person"></param> /// <param name="personList"></param> /// <returns></returns> public static PersonInformation GetSimilarPerson(PersonInformation person, List <PersonInformation> personList) { if (person == null) { throw new ArgumentNullException(nameof(person)); } List <PersonInformation> anotherSocialNetworkPersonList = new List <PersonInformation>(); foreach (var pers in personList) { if (pers.SocialNetwork != person.SocialNetwork) { anotherSocialNetworkPersonList.Add(pers); } } bool similarEducation = false; foreach (var pers in anotherSocialNetworkPersonList) { similarEducation = EducationAreSimilar(person, pers); if (similarEducation) { return(pers.Copy()); } } return(null); }
private static bool EducationAreSimilar(PersonInformation man, PersonInformation manFromList) { foreach (var firstEducation in man.Education) { foreach (var secondEducation in manFromList.Education) { if (IsItSchool(firstEducation, secondEducation)) { if (SchoolsAreEqual(firstEducation, secondEducation)) { return(true); } } else { if (firstEducation.Contains(secondEducation) || secondEducation.Contains(firstEducation)) { return(true); } } } } return(false); }
public IActionResult AddAsync(PersonInformation info) { Model.Information.Add(info); Model.SaveChanges(); ViewData["title"] = "Index"; return(View("/Views/Home/Index.cshtml")); }
private void CreateSummaryNode(XmlTextWriter writer, PersonInformation personInfo) { writer.WriteStartElement("name"); writer.WriteAttributeString("value", personInfo.NameValue); writer.WriteEndElement(); writer.WriteStartElement("age"); writer.WriteAttributeString("value", personInfo.AgeValue); writer.WriteEndElement(); writer.WriteStartElement("folderPath"); writer.WriteAttributeString("value", personInfo.FolderPathValue); writer.WriteEndElement(); writer.WriteStartElement("gender"); writer.WriteAttributeString("value", personInfo.GenderValue); writer.WriteEndElement(); writer.WriteStartElement("height"); writer.WriteAttributeString("value", personInfo.HeightValue); writer.WriteEndElement(); writer.WriteStartElement("kinectVersion"); writer.WriteAttributeString("value", personInfo.KinectVersionValue); writer.WriteEndElement(); writer.WriteStartElement("weight"); writer.WriteAttributeString("value", personInfo.WeightValue); writer.WriteEndElement(); writer.WriteStartElement("timestamp"); writer.WriteAttributeString("value", DateTime.Now.ToString()); // writer.WriteAttributeString("time", DateTime.Now.ToString()); writer.WriteEndElement(); }
protected override void MapAddress(PersonInformation person, string address) { var addressParts = address.Split(new[] { "\n" }, StringSplitOptions.None); person.Address = addressParts.Length > 0 ? addressParts[0] : null; person.City = addressParts.Length > 1 ? addressParts[1] : null; }
/// <summary> /// /// </summary> /// <param name="logger"></param> public WeatherForecastController(ILogger <WeatherForecastController> logger) { _logger = logger; data = new PersonInformation() { }; }
internal virtual PersonInformation Map(checkVatResponse body) { if (body == null) { throw new ArgumentNullException(nameof(body)); } var person = new PersonInformation { VatNumber = body.vatNumber, Country = body.countryCode }; if (CanMapName(body.name)) { MapName(person, body.name); } if (CanMapAddress(body.address)) { MapAddress(person, body.address); } return(person); }
//-----------------------管理人員資料新增----------------------------- public ActionResult ADDAD() { PCGEntities db = new PCGEntities(); PersonInformation ad = new PersonInformation(); List <PersonInformation> model = new List <PersonInformation>(); var query = from f in db.Factories join z in db.Zone on f.ZoneID equals z.ZoneID select new PersonInformation { FacID = f.FacID, FacName = f.FacName, FacNo = f.FacNo, ZoneID = f.ZoneID, Country = z.Country }; foreach (var item in query) { model.Add(new PersonInformation { FacID = item.FacID, FacName = item.FacName, FacNo = item.FacNo, ZoneID = item.ZoneID, Country = item.Country }); } return(View(model)); }
public List <PersonInformation> GetPersonInfo(DateTime dateTime) { string conString = System.Configuration.ConfigurationManager.ConnectionStrings["sqlConString"].ConnectionString; using (SqlConnection con = new SqlConnection(conString)) { SqlCommand cmd = new SqlCommand(@"SELECT [PersonID],[PersonName],[PersonPhoneNo],[PersonAddress] FROM [dbo].[PersonInformation] WHERE [CreateDate] > '" + dateTime + "' order by [CreateDate] DESC", con); if (con.State != System.Data.ConnectionState.Open) { con.Open(); } SqlDataAdapter da = new SqlDataAdapter(); da.SelectCommand = cmd; DataTable dt = new DataTable(); da.Fill(dt); List <PersonInformation> personList = new List <PersonInformation>(); for (int i = 0; i < dt.Rows.Count; i++) { PersonInformation person = new PersonInformation(); person.PersonID = Convert.ToInt32(dt.Rows[i]["PersonID"]); person.PersonName = dt.Rows[i]["PersonName"].ToString(); person.PersonPhoneNo = dt.Rows[i]["PersonPhoneNo"].ToString(); person.PersonAddress = dt.Rows[i]["PersonAddress"].ToString(); personList.Add(person); } return(personList); } }
public ActionResult DeleteConfirmed(int id) { PersonInformation personInformation = db.PersonInformations.Find(id); db.PersonInformations.Remove(personInformation); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool CheckForResultFileEntry(ResultFileID rfid, [NotNull] string loadTypeName, [NotNull] HouseholdKey householdKey, [CanBeNull] PersonInformation pi, [CanBeNull] string additionalFileIndex) { var key = ResultFileEntry.CalculateHashKey(rfid, _calcObjectName, loadTypeName, householdKey.Key, pi?.Name, additionalFileIndex); return(ResultFileList.ResultFiles.ContainsKey(key)); }
private PersonInformation GetPersonalInfoFromVoter(Voter v1) { PersonInformation pi = new PersonInformation(); pi.m_image = v1.ProfileImage; pi.m_sID = v1.lID.ToString(); pi.m_sName = v1.sName; return(pi); }
public async Task UpdatePerson(PersonInformation personToBeUpdated, PersonInformation person) { personToBeUpdated.FullName = person.FullName; personToBeUpdated.PhoneNumber = person.PhoneNumber; personToBeUpdated.Email = person.Email; personToBeUpdated.UpdateDate = DateTime.Now; await _unitOfWork.CommitAsync(); }
public async Task <PersonInformation> CreatePerson(PersonInformation newPerson) { await _unitOfWork.Persons .AddAsync(newPerson); await _unitOfWork.CommitAsync(); return(newPerson); }
/// <summary> /// Получить список имен и подписей /// </summary> private IResultCollection <ISignatureLibrary> GetSignatures() => _applicationMicrostation.AttachLibrary(_projectSignatureSettings.SignatureMicrostationFileName). ToResultCollectionFromApplication(). ResultVoid(_ => _messagingService.ShowMessage("Загрузка подписей")). ResultValueOk(libraryElements => libraryElements. Select(libraryElement => new SignatureLibrary(libraryElement.Name, PersonInformation.GetFromFullName(libraryElement.Description))). Where(signature => signature.PersonInformation.HasFullInformation). Cast <ISignatureLibrary>()). ToResultCollection();
public override int GetHashCode() { unchecked { var hashCode = (PersonInformation != null ? PersonInformation.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ArticleName != null ? ArticleName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ArticleRage.GetHashCode(); return(hashCode); } }
public IHttpActionResult GetPersonInformation(int id) { PersonInformation personInformation = db.PersonInformations.Find(id); if (personInformation == null) { return NotFound(); } return Ok(personInformation); }
public async Task DeletePerson(PersonInformation person) { var findPerson = _unitOfWork.Persons.Where(x => x.Id == person.Id).FirstOrDefault(); findPerson.IsDeleted = true; _unitOfWork.Persons.Update(findPerson); await _unitOfWork.CommitAsync(); }
public ActionResult Edit([Bind(Include = "Id,PFirstName,PLastName,PStreetAddress,PPostalCode,PCity,PPersonalNumber,PPhoneNumberHome,PPhoneNumberWork,PPhoneNumberMobile,PEmail,SFirstName,SLastName,SStreetAddress,SPostalCode,SCity,SOrganisationNumber,SPhoneNumber,SEmail")] PersonInformation personInformation) { if (ModelState.IsValid) { db.Entry(personInformation).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(personInformation)); }
public IHttpActionResult PostPersonInformation(PersonInformation personInformation) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.PersonInformations.Add(personInformation); db.SaveChanges(); return CreatedAtRoute("DefaultApi", new { id = personInformation.PersonId }, personInformation); }
public IHttpActionResult DeletePersonInformation(int id) { PersonInformation personInformation = db.PersonInformations.Find(id); if (personInformation == null) { return NotFound(); } db.PersonInformations.Remove(personInformation); db.SaveChanges(); return Ok(personInformation); }
private void MakeNewFile([NotNull] PersonInformation pi, [NotNull] HouseholdKey householdKey) { var thoughts = _fft.MakeFile <StreamWriter>("Thoughts." + householdKey + "." + pi.Name + ".csv", "Thoughts by " + pi.Name, true, ResultFileID.ThoughtsPerPerson, householdKey, TargetDirectory.Reports, _calcParameters.InternalStepsize, CalcOption.ThoughtsLogfile, null, pi); thoughts.WriteLine("Timestep" + _calcParameters.CSVCharacter + "Calender time" + _calcParameters.CSVCharacter + "Weekday" + _calcParameters.CSVCharacter + "Person" + _calcParameters.CSVCharacter + "Thought"); _thoughtsFiles.Add(new Tuple <HouseholdKey, string>(householdKey, pi.Name), thoughts); }
protected override void MapAddress(PersonInformation person, string address) { var addressParts = address.Split(new[] { "\n" }, StringSplitOptions.None); person.Address = addressParts.Length > 0 ? addressParts[0] : null; if (addressParts.Length > 1) { person.City = GetCity(addressParts[1]); person.PostalCode = GetPostalCode(addressParts[1]); person.Province = GetProvince(addressParts[1]); } }
public void displayInfoChoices(PersonInformation information) { dialogText.gameObject.SetActive(false); enableOptionBoxes(); dialogBG.gameObject.SetActive(true); information.currentTopResponse().advanceIndex(); accidentText.text = information.currentTopResponse().getCurrentText(); accidentText.gameObject.SetActive(true); information.currentBottomResponse().advanceIndex(); informationText.text = information.currentBottomResponse().getCurrentText(); informationText.gameObject.SetActive(true); }
// GET: PersonInformations/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } PersonInformation personInformation = db.PersonInformations.Find(id); if (personInformation == null) { return(HttpNotFound()); } return(View(personInformation)); }
public void NotValidateWrongEmailPerson() { var sut = new PersonValidator(); var person = new PersonInformation { Name = "John", Surname = "Doe", Email = "jdoedomain.tk", IdNumber = "x-1111111", PhoneNumber = "555123123" }; var actual = sut.Validate(person); Assert.False(actual); }
protected virtual void MapName(PersonInformation person, string name) { var nameParts = name.Split(new[] { " " }, StringSplitOptions.None); string lastName = nameParts.Length > 0 ? nameParts[0].Trim() : null; string firstName = null; if (nameParts.Length > 1) { firstName = string.Join(" ", nameParts.AsEnumerable().Skip(1).ToArray()).Trim(); } person.FirstName = firstName; person.LastName = lastName; }
public async Task <IActionResult> OnGetAsync(Guid?id) { if (id == null) { return(NotFound()); } Person = await _context.Persons.FirstOrDefaultAsync(m => m.Id == id); if (Person == null) { return(NotFound()); } return(Page()); }
public void ValidateNoEmailNoPhonePerson() { var sut = new PersonValidator(); var person = new PersonInformation { Name = "John", Surname = "Doe", Email = string.Empty, IdNumber = "x-1111111", PhoneNumber = null }; var actual = sut.Validate(person); Assert.True(actual); }
static void Main(string[] args) { var jenny = new PersonInformation { Name = "jenny", PhoneNumber = "867-5309" }; var steve = new PersonInformation { Name = "steve", PhoneNumber = "555-1212" }; ref var jennyName = ref GetName(jenny); ref var steveName = ref GetName(steve); jennyName = steveName; MakeNameCapitalized(ref jennyName); Console.WriteLine(jenny.Name); }
static ref string GetName(ref PersonInformation person) { return ref person.Name; }
static ref string GetName(PersonInformation person) => ref person.Name;