public void CreatePeople_ListAllPeople_ShouldListCreatedPeopleCorrectly() { // Arrange -> prepare a few people objects TestingEngine.CleanDatabase(); var peopleToAdd = new PersonModel[] { new PersonModel() { Name = "Albert Einstein"}, new PersonModel() { Name = "Michael Jordan"}, new PersonModel() { Name = "Woody Allan"}, }; // Act -> submit a few people objects foreach (var person in peopleToAdd) { var httpPostResponse = TestingEngine.CreatePersonHttpPost(person.Name); // Assert -> ensure each person is successfully created Assert.AreEqual(HttpStatusCode.Created, httpPostResponse.StatusCode); } // Assert -> list the people and assert their count, order and content are correctAnswer var httpResponse = TestingEngine.HttpClient.GetAsync("/api/people/all").Result; Assert.AreEqual(HttpStatusCode.OK, httpResponse.StatusCode); var peopleFromService = httpResponse.Content.ReadAsAsync<List<PersonModel>>().Result; Assert.AreEqual(peopleToAdd.Count(), peopleFromService.Count); var reversedAddedPeople = peopleToAdd.Reverse().ToList(); for (int i = 0; i < reversedAddedPeople.Count; i++) { Assert.IsTrue(peopleFromService[i].Id != 0); Assert.AreEqual(reversedAddedPeople[i].Name, peopleFromService[i].Name); } }
public PersonModel Get(int id) { try { var person = _personManager.GetPersonById(id); // TODO:Automapper var model = new PersonModel { Age = person.Age, DateOfBirth = person.DateOfBirth, DateOfDeath = person.DateOfDeath, FamilyName = person.FamilyName, GivenName = person.GivenName, Height = person.Height, Id = person.Id, MiddleNames = person.MiddleNames, PlaceOfBirth = person.PlaceOfBirth, TwitterId = person.TwitterId }; return model; } catch (Exception) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.BadRequest)); } }
public static CensusService.Models.SimplePerson CreatePerson(PersonModel.Person person, int censusYear) { if (person == null) { return null; } SimplePerson simplePerson = new SimplePerson(); simplePerson.Id = person.Id.Pid; simplePerson.FullName = person.Name; simplePerson.Gender = person.Gender.ToString(); if (person.Births.Best != null) { simplePerson.BirthYear = person.Births.Best.NormalizedDate.Year; } if (person.Deaths.Best != null) { simplePerson.DeathYear = person.Deaths.Best.NormalizedDate.Year; } simplePerson.CensusYear = censusYear; simplePerson.Age = simplePerson.CensusYear - simplePerson.BirthYear; return simplePerson; }
public PersonControllerTest() { _person = PersonModelBuilderForTest.DefaultPerson(1).Build(); _personManagerMock = MockRepository.GenerateMock<IPersonManager>(); _loggerMock = MockRepository.GenerateMock<ILogger<PersonsController>>(); _personController = new PersonsController(_personManagerMock, _loggerMock); }
public ActionResult Delete(long Id) { using (var db = new NespeDbContext()) { var drc = db.PersonSet; var dr = (from t in drc where t.Id == Id select t).FirstOrDefault(); if (dr == null) { base.ModelState.AddModelError("Action.Delete.Invalid.Id", "Invalid Id"); return RedirectToAction("Index"); } var model = new PersonModel { Selected = dr }; return View(model); } }
public AttendeeModel(Attendee att) { AttendeeID = att.AttendeeID; PersonID = att.PersonID; WeddingID = att.WeddingID; WeddingRole = att.WeddingRole; Relationship = att.Relationship; Side = att.Side; Attending = att.Attending; PartyMember = att.PartyMember; PartyMemberBlurb = att.PartyMemberBlurb; RSVPStatus = att.RSVPStatus; NumberofRSVPs = att.NumberofRSVPs; Person = new PersonModel(att.Person); }
/// <summary> /// Read the row data read using repeated readOneRow() calls and build a DataColumnCollection with types and column names /// </summary> /// <param name="headerRow">True if the first row contains headers</param> /// <returns>System.Data.DataTable object populated with the row data</returns> public List<PersonModel> readAllRows(bool headerRow) { // Read the CSV data into rows List<List<string>> rows = new List<List<string>>(); List<string> readRow = null; List<string> columnNames = new List<string>(); List<PersonModel> weavePeople = new List<PersonModel>(); bool headerRead = false; while ((readRow = readOneRow()) != null) { rows.Add(readRow); } // The names (if headerRow is true) will be stored in these lists // Read the column names from the header row (if there is one) if (headerRow){ foreach (object name in rows[0]){ columnNames.Add(name.ToString()); } } // Add the data from the rows foreach (List<string> row in rows){ if (headerRead || !headerRow) { PersonModel newWeavePerson = new PersonModel(); for (int i = 0; i < row.Count; i++) { newWeavePerson.SetAnswerForQuestion(columnNames[i], row[i]); // Debug.Log(">> " + i + "Answer <" + columnNames[i] + "> =" + row[i] ); } weavePeople.Add(newWeavePerson); } else{ headerRead = true; } } return weavePeople; }
public ActionResult Delete(PersonModel model, FormCollection formCollection) { if (ModelState.IsValid) { using (var db = new NespeDbContext()) { var drc = db.PersonSet; var dr = (from t in drc where t.Id == model.Selected.Id select t).FirstOrDefault(); if (dr == null) { base.ModelState.AddModelError("Action.Delete.Invalid.Id", "Invalid Id"); return RedirectToAction("Index"); } drc.Remove(dr); db.SaveChanges(); } return RedirectToAction("Index"); } return View(model); }
public string GetFormattedAnswer(PersonModel person) { string answertext = ""; string answerformat = _questionConfig.GetVal("answerformat"); char[] delimiterChars = { '~' }; string[] answerbits = answerformat.Split(delimiterChars); bool isKeyText = false; for(int i=0; i< answerbits.Length; i++) { if (!isKeyText) { // regular text just add it to the answertext answertext += answerbits[i]; } else { string keyval = answerbits[i]; if(keyval == "newline") { answertext += "\n"; } else if (keyval == "space") { answertext += " "; } else { // this is a key for a question answertext += person.GetAnswerForQuestion(keyval); } } isKeyText = !isKeyText; // alternate between key and non-key text } return answertext; }
public ActionResult Create(PersonModel model, FormCollection formCollection) { if (ModelState.IsValid) { using (var db = new NespeDbContext()) { var drc = db.PersonSet; var selected = model.Selected; var dr = (from t in drc where t.FirstName == selected.FirstName && t.FirstName == selected.FirstName select t).FirstOrDefault(); if (dr != null && dr.Id > 0) { return RedirectToAction("Edit", new { Id = dr.Id }); } else { drc.Add(model.Selected); } db.SaveChanges(); } return RedirectToAction("Index"); } return View(model); }
public async Task AddPerson(PersonModel person) { PersonList.Add(person); await SerializeList(); }
public KursRepository(PersonModel personModel) { // Skapa DbContext genom dependency injection. Använd en DbContext per tjänsteanrop! Återanvänd i de olika Repositories. Se http://mehdi.me/ambient-dbcontext-in-ef6/ PersonModel = personModel; internalGenericRepository = new Repository <Kurs, PersonModel>(PersonModel); }
public ActionResult Split(int id) { var p = DbUtil.Db.LoadPersonById(id); var f = new Family { CreatedDate = Util.Now, CreatedBy = Util.UserId1, AddressLineOne = p.PrimaryAddress, AddressLineTwo = p.PrimaryAddress2, CityName = p.PrimaryCity, StateCode = p.PrimaryState, ZipCode = p.PrimaryZip, HomePhone = p.Family.HomePhone }; f.People.Add(p); DbUtil.Db.Families.InsertOnSubmit(f); DbUtil.Db.SubmitChanges(); DbUtil.LogActivity("Splitting Family for {0}".Fmt(p.Name)); var m = new PersonModel(id); return Content("/Person2/" + id); }
public PersonViewModel() { Person = new PersonModel(); Person.ValidationObservable.Subscribe(x => IsValid = this.Person.IsObjectValid()); }
public ActionResult Create(IntakeRelationItem intakeRelationItem) { var currentUser = (User)Session["CurrentUser"]; var userName = string.Empty; if (currentUser != null) { userName = currentUser.User_Name; } var personModel = new PersonModel(); var personItem = new Person(); var dateCreated = DateTime.Now; const string createdBy = "jhendrikse"; var dateLastModified = DateTime.Now; const string modifiedBy = "jhendrikse"; const bool isActive = true; const bool isDeleted = false; var addToPerson = personModel.GetSpecificPerson(intakeRelationItem.Person_Id); var clientId = addToPerson.Clients.First().Client_Id; // Determine if a new Person has been added, or if an existing Person's details must be edited. if (intakeRelationItem.CreatePerson.Person.Person_Id == -1) { var newPersonDetail = intakeRelationItem.CreatePerson.Person; var physicalAddress = intakeRelationItem.CreatePerson.PhysicalAddress; var postalAddress = intakeRelationItem.CreatePerson.PostalAddress; // Create New Person personItem = personModel.CreatePerson(newPersonDetail.First_Name, newPersonDetail.Last_Name, newPersonDetail.Known_As, newPersonDetail.Identification_Type_Id, newPersonDetail.Identification_Number, false, null, newPersonDetail.Date_Of_Birth, newPersonDetail.Age, newPersonDetail.Is_Estimated_Age, newPersonDetail.Sexual_Orientation_Id, newPersonDetail.Language_Id, newPersonDetail.Gender_Id, newPersonDetail.Marital_Status_Id, newPersonDetail.Religion_Id, newPersonDetail.Preferred_Contact_Type_Id, newPersonDetail.Phone_Number, newPersonDetail.Mobile_Phone_Number, newPersonDetail.Email_Address, newPersonDetail.Population_Group_Id, newPersonDetail.Nationality_Id, newPersonDetail.Disability_Type_Id, newPersonDetail.Citizenship_Id, dateCreated, createdBy, isActive, isDeleted); //var PersonDisability = personModel.CreatePersonDisability(newPersonDetail.Person_Id, newPersonDetail.SelectedDisabilityId, userName); if (personItem != null) { personModel.AddAddress(personItem.Person_Id, (int)AddressTypeEnum.PhysicalAddress, physicalAddress.Address_Line_1, physicalAddress.Address_Line_2, physicalAddress.Town_Id, physicalAddress.Postal_Code); personModel.AddAddress(personItem.Person_Id, (int)AddressTypeEnum.PostalAddress, postalAddress.Address_Line_1, postalAddress.Address_Line_2, postalAddress.Town_Id, postalAddress.Postal_Code); } } else { var editPersonDetail = intakeRelationItem.CreatePerson.Person; // Edit Person personItem = personModel.EditPerson(editPersonDetail.Person_Id, editPersonDetail.First_Name, editPersonDetail.Last_Name, editPersonDetail.Known_As, editPersonDetail.Identification_Type_Id, editPersonDetail.Identification_Number, editPersonDetail.Date_Of_Birth, editPersonDetail.Age, editPersonDetail.Is_Estimated_Age, editPersonDetail.Sexual_Orientation_Id, editPersonDetail.Language_Id, editPersonDetail.Gender_Id, editPersonDetail.Marital_Status_Id, editPersonDetail.Religion_Id, editPersonDetail.Preferred_Contact_Type_Id, editPersonDetail.Phone_Number, editPersonDetail.Mobile_Phone_Number, editPersonDetail.Email_Address, editPersonDetail.Population_Group_Id, editPersonDetail.Nationality_Id, editPersonDetail.Disability_Type_Id, editPersonDetail.Citizenship_Id, dateLastModified, modifiedBy, isActive, isDeleted); //var PersonDisability = personModel.CreatePersonDisability(editPersonDetail.Person_Id, editPersonDetail.SelectedDisabilityId,userName); } var status = "OK"; var message = "The education details have been successfully added"; if (personItem != null) { switch (intakeRelationItem.Relation_Type_Id) { case (int)RelationTypeEnum.AdoptiveParents: var clientAdoptionModel = new ClientAdoptiveParentModel(); var newAdoptiveParent = clientAdoptionModel.CreateClientAdoptiveParent(clientId, personItem.Person_Id, intakeRelationItem.IsDeceased, string.IsNullOrEmpty(intakeRelationItem.DateDeceased) ? (DateTime?)null : DateTime.Parse(intakeRelationItem.DateDeceased), dateCreated, createdBy, isActive, isDeleted); if (newAdoptiveParent == null) { status = "Error"; message = "A technical error has occurred! Please try again later"; } break; case (int)RelationTypeEnum.BiologicalParents: var clientBiologicalModel = new ClientBiologicalParentModel(); var newBiologicalParent = clientBiologicalModel.CreateClientBiologicalParent(clientId, personItem.Person_Id, intakeRelationItem.IsDeceased, string.IsNullOrEmpty(intakeRelationItem.DateDeceased) ? (DateTime?)null : DateTime.Parse(intakeRelationItem.DateDeceased), dateCreated, createdBy, isActive, isDeleted); if (newBiologicalParent == null) { status = "Error"; message = "A technical error has occurred! Please try again later"; } break; case (int)RelationTypeEnum.Caregivers: var clientCaregiverModel = new ClientCareGiverModel(); var newClientCareverModel = clientCaregiverModel.CreateClientCaregiver(clientId, personItem.Person_Id, intakeRelationItem.Relation_Type_Id, dateCreated, createdBy, isActive, isDeleted); if (newClientCareverModel == null) { status = "Error"; message = "A technical error has occurred! Please try again later"; } break; case (int)RelationTypeEnum.FamilyMembers: var clientFamilymemberModel = new ClientFamilyMemberModel(); var newClientFamilyMember = clientFamilymemberModel.CreateClientFamilyMember(clientId, personItem.Person_Id, intakeRelationItem.Relation_Type_Id, dateCreated, createdBy, isActive, isDeleted); if (newClientFamilyMember == null) { status = "Error"; message = "A technical error has occurred! Please try again later"; } break; case (int)RelationTypeEnum.FosterParents: var clientFosterParentModel = new ClientFosterParentModel(); var newFosterParent = clientFosterParentModel.CreateClientFosterParent(clientId, personItem.Person_Id, intakeRelationItem.IsDeceased, string.IsNullOrEmpty(intakeRelationItem.DateDeceased) ? (DateTime?)null : DateTime.Parse(intakeRelationItem.DateDeceased), dateCreated, createdBy, isActive, isDeleted); if (newFosterParent == null) { status = "Error"; message = "A technical error has occurred! Please try again later"; } break; case (int)RelationTypeEnum.ProspectiveAdoptiveParents: var clientProspectiveAdoptiveParentsModel = new ProspectiveAdoptiveParentModel(); var newClientProspectiveAdoptiveParentModel = clientProspectiveAdoptiveParentsModel.CreateClientProspectiveAdoptiveParents(clientId, personItem.Person_Id, intakeRelationItem.Relation_Type_Id, dateCreated, createdBy, isActive, isDeleted); if (newClientProspectiveAdoptiveParentModel == null) { status = "Error"; message = "A technical error has occurred! Please try again later"; } break; } } return(new JsonResult { Data = new { status, message } }); }
public void UpdatePersonInGroupChat(GroupChatModel groupChat, PersonModel oldPerson, PersonModel newPerson) { TraceRemotingCall(groupChat, oldPerson, newPerson); MethodBase mb = Trace.GetMethodBase(); Gtk.Application.Invoke(delegate { TraceRemotingCall(mb, groupChat, oldPerson, newPerson); try { GroupChatView groupChatView = (GroupChatView)_ChatViewManager.GetChat(groupChat); if (groupChatView == null) { #if LOG4NET _Logger.Fatal( String.Format( "UpdatePersonInGroupChat(): " + "_ChatViewManager.GetChat(groupChat) " + "groupChat.Name: {0} returned null!", groupChat.Name ) ); #endif return; } groupChatView.UpdatePerson(oldPerson, newPerson); } catch (Exception ex) { Frontend.ShowException(ex); } }); }
public async Task <ObjectResult> AddPerson([FromBody] PersonModel model) { await db.AddPerson(model); return(Created("/api/People/AddPerson", model)); }
// // GET: /Person/ public ActionResult Index() { using (var db = new NespeDbContext()) { var drc = db.PersonSet; var model = new PersonModel { }; model.Items = (from t in drc select t).ToList(); return View(model); } }
public ActionResult Create() { var model = new PersonModel { Selected = new Person { } }; return View(model); }
public ActionResult Edit(PersonModel model, FormCollection formCollection) { if (ModelState.IsValid) { using (var db = new NespeDbContext()) { var selected = model.Selected; var drc = db.PersonSet; //drc.Attach(model.Selected); var dr = (from t in drc where t.Id == model.Selected.Id select t).FirstOrDefault(); if (dr != null) { dr.Copy(selected); selected = dr; } else drc.Add(selected); db.SaveChanges(); } return RedirectToAction("Index"); } return View(model); }
private void CreateStagePerson(PersonModel person) { //Debug.Log("CreateStagePerson"); Vector3 position = new Vector3((3f - (peopleCounter * 1.5f)), 0f, 0f); //Debug.Log("stagePersonToCopy = " + stagePersonToCopy); GameObject newStagePerson = (GameObject)Instantiate(stagePersonToCopy, position, Quaternion.identity); GameObject _listOfStagePeople = GameObject.Find("4ListOfStagePeople"); //pull name string name = person.GetName(); string url = person.GetPhotoURL(); /*if (name == "\n") { Destroy(newStagePerson); } else {*/ // Debug.Log("**** url = " + url); newStagePerson.transform.FindChild("StagePersonGO").GetComponent<StagePerson>().setName(name); newStagePerson.transform.FindChild("StagePersonGO").GetComponent<PhotoGrabber>().url = url; // REFATOR NO PUBLIC VARIABLES!! newStagePerson.transform.FindChild("StagePersonGO").GetComponent<StagePerson>().SetPersonModel(person); stagePersonCounter = stagePersonCounter + 1; // Debug.Log("CreateStagePerson >> " + name + " _stagepersoncounter: " + stagePersonCounter); allStagePersonObjectsList.Add(newStagePerson); //Stage Person Added Transform per = newStagePerson.transform.FindChild("StagePersonGO"); GameObject rings = GameObject.Find("MiniRingV2"); string tagger = "rings" + stagePersonCounter.ToString(); rings.name = tagger; per.GetComponent<MeshRenderer>().enabled = false; _listOfStagePeople.GetComponent<ListOfStagePeople>().addToList(per); newStagePerson.name = stagePersonCounter.ToString(); newStagePerson.GetComponent<Vessel>().setVesselNumber(stagePersonCounter); newStagePerson.GetComponentInChildren<StagePerson>().setVesselName(stagePersonCounter.ToString()); newStagePerson.transform.parent = _listOfStagePeople.transform; Transform ring = per.transform.FindChild("Ring"); }
public AXAPersonController(IUnityContainer container, IdPayloadManager idManager, ApplicationModel applicationModel, IInsuranceDirectoryServiceHandler insuranceDirectoryService, PersonModel personModel, IdRetrievalManager retrievalManager, AppModel appModel, IInsuranceDirectoryViewResolver viewresolver, IShellRulesHelper rulesHelper, IMetadataClientService metadataService) : base(idManager, applicationModel, insuranceDirectoryService, personModel, retrievalManager, appModel, viewresolver, rulesHelper, container, metadataService, null) { }
public ActionResult Reverse(int id, string field, string value, string pf) { var m = new PersonModel(id); m.Reverse(field, value, pf); return View("ChangesGrid", m); }
public async Task <PersonModel> InsertPerson(PersonModel person) => await _mediatR.Send(new InsertPersonCommand(person.FirstName, person.LastName));
"Password=Password1"; // Password public static int Add(PersonModel person) { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); // Open connection SqlTransaction transaction = connection.BeginTransaction(); // Create transaction SqlCommand command = connection.CreateCommand(); // Create command command.Transaction = transaction; // Assign transaction to command try { // INSERT for person command.CommandText = $"INSERT INTO Person VALUES (" + $"'{person.Id}', " + $"'{person.Firstname}', " + $"'{person.Lastname}'," + $"'{person.Age}'," + $"'{person.Gender}'" + ");"; command.ExecuteNonQuery(); // INSERT for ContactInfo command.CommandText = $"INSERT INTO ContactInfo VALUES (" + $"'{person.ContactInfo.Id}'," + $"'{person.Id}'," + $"'{person.ContactInfo.FK_Country}'," + $"'{person.ContactInfo.Number}'," + $"'{person.ContactInfo.Ext}'," + $"'{person.ContactInfo.Email}'" + ");"; command.ExecuteNonQuery(); // INSERT for Address command.CommandText = "INSERT INTO Address VALUES (" + $"'{person.Address.Id}', " + $"'{person.Id}', " + $"'{person.Address.AddrLine1}', " + $"'{person.Address.AddrLine2}', " + $"'{person.Address.City}', " + $"'{person.Address.State}', " + $"'{person.Address.FK_Country}', " + $"'{person.Address.Zipcode}'" + ");"; command.ExecuteNonQuery(); // Commit transaction transaction.Commit(); } catch (Exception ex) { logger.Info($"PersonSqlDbAccess.Add threw: {ex.Message}"); try { // Roll back if exception transaction.Rollback(); } catch (Exception exRollback) { Console.WriteLine(exRollback.Message); } } } return(-1); }
public ActionResult RelatedFamilies(int id) { var m = new PersonModel(id); return View(m); }
public ActionResult Add([Bind(Include = "person_id,first_name,last_name,dob,single_married,spouse_id,primary_address,phone_number,phone_number_2,address_id, address, primary_address, record_id")] Person person, MainViewModel mainViewModel, FormCollection fc) { //MainViewModel model = new MainViewModel(); List <Address> al = mainViewModel.allAddresses; PersonModel personModel = mainViewModel.personModel; //List<Address> al = model.allAddresses; string selectedRadio = fc["primary"]; int radio = Convert.ToInt32(selectedRadio); DateTime now = DateTime.Today; Person newPerson = new Person(); newPerson.first_name = personModel.first_name; newPerson.last_name = personModel.last_name; newPerson.dob = personModel.dob; int result = DateTime.Compare(now, newPerson.dob); if (result < 0) { ViewBag.Message = "Please select proper date!"; return(PartialView("_AddPerson", mainViewModel)); } newPerson.phone_number = personModel.phone_number; newPerson.phone_number_2 = personModel.phone_number_2; //Person newPerson = new Person(); //newPerson.first_name = fc["personModel.first_name"]; //newPerson.last_name = fc["personModel.last_name"]; //newPerson.dob = Convert.ToDateTime(fc["personModel.dob"]); //newPerson.phone_number = fc["personModel.phone_number"]; newPerson.primary_address = al[radio].address1; if (newPerson.primary_address == null) { ViewBag.Message = "Please select primary address!"; return(PartialView("_AddPerson", mainViewModel)); } if (ModelState.IsValid) { db.Persons.Add(newPerson); foreach (var a in al) { if (a.address1 != null) { db.Addresses.Add(a); } } for (int i = 0; i < al.Count(); i++) { if (al[i].address1 != null) { var personAddress = new Person_Address(); personAddress.Person = newPerson; personAddress.Address = al[i]; db.Person_Address.Add(personAddress); } } db.SaveChanges(); ModelState.Clear(); return(JavaScript("success()")); } //change to person if not working! return(PartialView("_AddPerson", mainViewModel)); }
public ActionResult Index(int? id) { if (!id.HasValue) return Content("no id"); if (!DbUtil.Db.UserPreference("newlook3", "false").ToBool() || !DbUtil.Db.UserPreference("newpeoplepage", "false").ToBool()) { var url = Regex.Replace(Request.RawUrl, @"(.*)/(Person2(/Index)*)/(\d*)", "$1/Person/Index/$4", RegexOptions.IgnoreCase); return Redirect(url); } var m = new PersonModel(id.Value); if (m.Person == null) return Content("person not found"); if (!User.IsInRole("Access")) if (m.Person == null || !m.Person.CanUserSee) return Content("no access"); if (Util2.OrgMembersOnly) { var omotag = DbUtil.Db.OrgMembersOnlyTag2(); if (!DbUtil.Db.TagPeople.Any(pt => pt.PeopleId == id && pt.Id == omotag.Id)) { DbUtil.LogActivity("Trying to view person: {0}".Fmt(m.Person.Name)); return Content("<h3 style='color:red'>{0}</h3>\n<a href='{1}'>{2}</a>" .Fmt("You must be a member one of this person's organizations to have access to this page", "javascript: history.go(-1)", "Go Back")); } } else if (Util2.OrgLeadersOnly) { var olotag = DbUtil.Db.OrgLeadersOnlyTag2(); if (!DbUtil.Db.TagPeople.Any(pt => pt.PeopleId == id && pt.Id == olotag.Id)) { DbUtil.LogActivity("Trying to view person: {0}".Fmt(m.Person.Name)); return Content("<h3 style='color:red'>{0}</h3>\n<a href='{1}'>{2}</a>" .Fmt("You must be a leader of one of this person's organizations to have access to this page", "javascript: history.go(-1)", "Go Back")); } } ViewData["Comments"] = Util.SafeFormat(m.Person.Comments); ViewData["PeopleId"] = id.Value; Util2.CurrentPeopleId = id.Value; Session["ActivePerson"] = m.Person.Name; DbUtil.LogActivity("Viewing Person: {0}".Fmt(m.Person.Name)); InitExportToolbar(id); return View(m); }
public async Task <IActionResult> AddPerson(PersonModel model) { return(Ok(await personManager.AddPersonAsync(model))); }
public ActionResult Details(long Id) { using (var db = new NespeDbContext()) { var drc = db.PersonSet; var dr = (from t in drc where t.Id == Id select t).FirstOrDefault(); if (dr == null) { base.ModelState.AddModelError("Action.Details.Invalid.Id", "Invalid Id"); return RedirectToAction("Index"); } var model = new PersonModel { Selected = dr }; model.DepartmentModel = new PersonDepartmentModel { Items = (from t in db.PersonDepartmentSet where t.Person_Id == Id select t).ToList() }; var q = (from o in (from t in db.DepartmentSet select t).Except((from t in model.DepartmentModel.Items select t.Department)) select o); foreach(var o in q) model.DepartmentModel.Items.Add(new PersonDepartment { Person=dr, Department=o}); return View(model); } }
private void CreateNewFamily() { // Create a personmodel PersonModel personModel = new PersonModel(); personModel.FirstName = "First Name"; personModel.LastName = "Last Name"; personModel.Gender = "Not Specified"; personModel.DOB = DateTime.Now; personModel.GenerationIndex = 0; personModel.SiblingIndex = 0; // Create a familymodel and add the personmodel FamilyModel newFamily = new FamilyModel(); newFamily.PersonSettings = new PersonSettings(); newFamily.RelationshipSettings = new RelationshipSettings(); newFamily.Tree = new Tree(); newFamily.Members = new ObservableCollection<PersonModel>() { }; newFamily.Relationships = new ObservableCollection<RelationshipModel>() { }; newFamily.Members.Add(personModel); // Mark the personmodel as selected newFamily.Tree.SelectedPersonId = personModel.Id; // Restore this new familymodel into the workspace RestoreFamilyModel(newFamily); newFamily.CopyProperties(GetCurrentFamilyModel()); SavedFamilyModel = newFamily; SavedFamilyModel.CopyProperties(GetCurrentFamilyModel()); // Set the title Title = "Family Explorer - NewFamily.fex"; // Clear undo-redo records RecordedFamilyModels.Clear(); UndoneFamilyModels.Clear(); }
public void SetPersonModel(PersonModel persondata) { personModel = persondata; }
public void PopulatePerson() { using (RelationEntities dbEntities = new RelationEntities()) { var raltionList = dbEntities.People.ToList(); foreach (var relation in raltionList) { PersonModel item = new PersonModel { PersonName = relation.Name, PersonId = Convert.ToInt32(relation.PersonID) }; _personList.Add(item); } } }
public IActionResult Post([FromBody] PersonModel person) { return(new ObjectResult(_personAppService.Add(person))); }
public async Task <IActionResult> PostMessage([FromBody] PersonModel personModel) { await _queueService.SendMessageAsync <PersonModel>(personModel, "personqueue", ServiceBusType.Queue); return(Created("", null)); }
public ActionResult Snapshot(int id) { var m = new PersonModel(id); return(View(m)); }
public async Task SetPerson(int index, PersonModel person) { PersonList[index] = person; await SerializeList(); }
public ActionResult ChangesGrid(int id) { var m = new PersonModel(id); return(View(m)); }
private async Task <PromptOptions> GenerateOptionsForEmail(WaterfallStepContext sc, PersonModel confirmedPerson, ITurnContext context, bool isSinglePage = true) { var state = await EmailStateAccessor.GetAsync(context); var pageIndex = state.ShowRecipientIndex; var pageSize = ConfigData.GetInstance().MaxDisplaySize; var skip = pageSize * pageIndex; var emailList = confirmedPerson.Emails; // Go back to the last page when reaching the end. if (skip >= emailList.Count && pageIndex > 0) { state.ShowRecipientIndex--; state.ReadRecipientIndex = 0; pageIndex = state.ShowRecipientIndex; skip = pageSize * pageIndex; await sc.Context.SendActivityAsync(ResponseManager.GetResponse(FindContactResponses.AlreadyLastPage)); } var options = new PromptOptions { Choices = new List <Choice>(), Prompt = ResponseManager.GetResponse(FindContactResponses.ConfirmMultiplContactEmailSinglePage, new StringDictionary() { { "UserName", confirmedPerson.DisplayName } }) }; if (!isSinglePage) { options.Prompt = ResponseManager.GetResponse(FindContactResponses.ConfirmMultiplContactEmailMultiPage, new StringDictionary() { { "UserName", confirmedPerson.DisplayName } }); } for (var i = 0; i < emailList.Count; i++) { var user = confirmedPerson; var mailAddress = emailList[i] ?? user.UserPrincipalName; var choice = new Choice() { Value = $"{user.DisplayName}: {mailAddress}", Synonyms = new List <string> { (options.Choices.Count + 1).ToString(), user.DisplayName, user.DisplayName.ToLower(), mailAddress }, }; var userName = user.UserPrincipalName?.Split("@").FirstOrDefault() ?? user.UserPrincipalName; if (!string.IsNullOrEmpty(userName)) { choice.Synonyms.Add(userName); choice.Synonyms.Add(userName.ToLower()); } if (skip <= 0) { if (options.Choices.Count >= pageSize) { options.Prompt.Speak = SpeechUtility.ListToSpeechReadyString(options, ReadPreference.Chronological, ConfigData.GetInstance().MaxReadSize); options.Prompt.Text += "\r\n" + GetSelectPromptEmailString(options, true); options.RetryPrompt = ResponseManager.GetResponse(EmailSharedResponses.NoChoiceOptionsRetry); return(options); } options.Choices.Add(choice); } else { skip--; } } options.Prompt.Speak = SpeechUtility.ListToSpeechReadyString(options, ReadPreference.Chronological, ConfigData.GetInstance().MaxReadSize); options.Prompt.Text += "\r\n" + GetSelectPromptEmailString(options, true); options.RetryPrompt = ResponseManager.GetResponse(EmailSharedResponses.NoChoiceOptionsRetry); return(options); }
public PersonLogic(PersonModel model, AdaptersExtender adaptersExtender, CityLogic city) { _personModel = model; _adaptersExtender = adaptersExtender; _city = city; }
public static PersonModel GetPersonById(Guid id) { // Person to return PersonModel p = null; // SQL interaction using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); // Open connection SqlCommand command = connection.CreateCommand(); // Create command try { command.CommandText = $"SELECT * FROM Person AS p " + $"LEFT JOIN ContactInfo AS c ON p.Id = c.FK_Person " + $"LEFT JOIN address AS a ON p.Id = a.FK_Person " + $"WHERE p.Id = '{id}' " + $";"; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { p = new PersonModel() { Id = new Guid(reader[0].ToString()), Firstname = reader[1].ToString(), Lastname = reader[2].ToString(), Age = Int32.Parse(reader[3].ToString()), Gender = reader[4].ToString(), ContactInfo = new ContactInfoModel { Id = new Guid(reader[5].ToString()), FK_Person = new Guid(reader[6].ToString()), FK_Country = new Guid(reader[7].ToString()), Number = reader[8].ToString(), Ext = reader[9].ToString(), Email = reader[10].ToString() }, Address = new AddressModel { Id = new Guid(reader[11].ToString()), FK_Person = new Guid(reader[12].ToString()), AddrLine1 = reader[13].ToString(), AddrLine2 = reader[14].ToString(), City = reader[15].ToString(), State = reader[16].ToString(), FK_Country = new Guid(reader[17].ToString()), Zipcode = reader[18].ToString() } }; p.Print(); } reader.Close(); if (p == null) { throw new Exception($"No Person exists with ID: {id}"); } } catch (Exception ex) { logger.Info($"PersonSqlDbAccess.GetPersonById threw: {ex.Message}"); } } return(p); }
public bool PostMessage(PersonModel model) { var result = false; Action <DeliveryReport <Null, string> > handler = r => Console.WriteLine($"{(!r.Error.IsError ? $"Delivered message to {r.TopicPartitionOffset}" : $"Delivery error {r.Error.Reason}")}");
public static List <PersonModel> Search(string s) { string query = s.ToLower(); // List to return query results List <PersonModel> results = new List <PersonModel>(); // SQL interaction using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); // Open connection SqlCommand command = connection.CreateCommand(); // Create command try { // Search firstname, lastname, zipcode, city, and phone number for query command.CommandText = $"SELECT * FROM Person AS p " + $"LEFT JOIN ContactInfo AS c ON p.ID = c.FK_Person " + $"LEFT JOIN Address AS a ON p.ID = a.FK_Person " + $"WHERE LOWER(p.Firstname) = '{query}' " + $"OR LOWER(p.Lastname) = '{query}' " + $"OR LOWER(p.Age) = '{query}' " + $"OR LOWER(p.Gender) = '{query}' " + $"OR LOWER(c.Number) = '{query}' " + $"OR LOWER(c.Ext) = '{query}' " + $"OR LOWER(c.Email) = '{query}' " + $"OR LOWER(a.AddrLine1) = '{query}' " + $"OR LOWER(a.AddrLine2) = '{query}' " + $"OR LOWER(a.City) = '{query}' " + $"OR LOWER(a.State) = '{query}' " + $"OR LOWER(a.Zipcode) = '{query}' " + $";"; SqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { PersonModel p = new PersonModel() { Id = new Guid(reader[0].ToString()), Firstname = reader[1].ToString(), Lastname = reader[2].ToString(), Age = Int32.Parse(reader[3].ToString()), Gender = reader[4].ToString(), ContactInfo = new ContactInfoModel { Id = new Guid(reader[5].ToString()), FK_Person = new Guid(reader[6].ToString()), FK_Country = new Guid(reader[7].ToString()), Number = reader[8].ToString(), Ext = reader[9].ToString(), Email = reader[10].ToString() }, Address = new AddressModel { Id = new Guid(reader[11].ToString()), FK_Person = new Guid(reader[12].ToString()), AddrLine1 = reader[13].ToString(), AddrLine2 = reader[14].ToString(), City = reader[15].ToString(), State = reader[16].ToString(), FK_Country = new Guid(reader[17].ToString()), Zipcode = reader[18].ToString() } }; results.Add(p); } reader.Close(); } catch (Exception ex) { logger.Info($"PersonSqlDbAccess.Search threw: {ex.Message}"); } } return(results); }
public override BaseState Update(PersonModel person) { //Debug.Log("Travel"); if (person.TargetLocation == null) { Debug.Log($"No destination found"); return(new DoNothingState()); } if (person.CurrentLocation != null) { Debug.Log($"Travel Get out of location {person.CurrentLocation.Name}"); person.X = person.CurrentLocation.X; person.Y = person.CurrentLocation.Y; person.CurrentArea = person.CurrentLocation.Area; person.CurrentLocation = null; return(this); } else if (person.CurrentArea != null) { Debug.Log($"Travel in Area "); if (person.CurrentArea.Contains(person.TargetLocation)) { var targetX = person.TargetLocation.X; var targetY = person.TargetLocation.Y; bool atX = false; bool atY = false; // Debug.Log($"Travel ({person.X} {person.Y}) to ({targetX} {targetY})"); if (person.X < targetX) { person.X++; } else if (person.X > targetX) { person.X--; } else { atX = true; } if (person.Y < targetY) { person.Y++; } else if (person.Y > targetY) { person.Y--; } else { atY = true; } if (atY && atX) { return(new GoIntoTargetLocationState()); } } } return(this); }
public async Task <ObjectResult> UpdatePerson([FromBody] PersonModel model) { await db.UpdatePerson(model); return(Accepted("/api/People/UpdatePerson", model)); }
public PersonModel CreatePerson(PersonModel model) { return(null); }
public IActionResult Update(PersonModel personModel) { SourceManager.Update(personModel); return(RedirectToAction("Index")); }
public void UpdatePerson(PersonModel oldPerson, PersonModel newPerson) { _PersonListBox.Items.Remove(oldPerson.IdentityName); _PersonListBox.Items.Add(newPerson.IdentityName); }
/// <summary> /// Initializes a new instance of the <see cref="DemoWindowViewModel"/> class. /// </summary> public DemoWindowViewModel(IMessageService messageService) { _messageService = messageService; Person = new PersonModel(); }
public ActionResult FamilyGrid(int id) { var m = new PersonModel(id); //UpdateModel(m.Pager); return View(m); }
public ActionResult GetRelationItemsByAjax(string id, string relationTypeId) { var personModel = new PersonModel(); var person = personModel.GetSpecificPerson(int.Parse(id)); var relationItems = new List <IntakeRelationItem>(); var client = person.Clients.FirstOrDefault(); if (string.IsNullOrEmpty(relationTypeId)) { relationTypeId = "-1"; } if (client != null) { if ((relationTypeId == "-1") || (int.Parse(relationTypeId) == (int)RelationTypeEnum.AdoptiveParents)) { relationItems.AddRange(from p in client.Client_Adoptive_Parents.ToList() select new IntakeRelationItem() { Item_Id = p.Client_Adoptive_Parent_Id, Person_Id = p.Person_Id, Relation_Person = p.Person, Relation_Type_Id = (int)RelationTypeEnum.AdoptiveParents, Relation_Type_Description = "Adoptive Parent" }); } if ((relationTypeId == "-1") || (int.Parse(relationTypeId) == (int)RelationTypeEnum.BiologicalParents)) { relationItems.AddRange(from p in client.Client_Biological_Parents.ToList() select new IntakeRelationItem() { Item_Id = p.Client_Biological_Parent_Id, Person_Id = p.Person_Id, Relation_Person = p.Person, Relation_Type_Id = (int)RelationTypeEnum.BiologicalParents, Relation_Type_Description = "Biological Parent" }); } if ((relationTypeId == "-1") || (int.Parse(relationTypeId) == (int)RelationTypeEnum.FamilyMembers)) { relationItems.AddRange(from p in client.Client_Family_Members.ToList() select new IntakeRelationItem() { Item_Id = p.Client_Family_Member_Id, Person_Id = p.Person_Id, Relation_Person = p.Person, Relation_Type_Id = (int)RelationTypeEnum.FamilyMembers, Relation_Type_Description = "Family Member" }); } if ((relationTypeId == "-1") || (int.Parse(relationTypeId) == (int)RelationTypeEnum.FosterParents)) { relationItems.AddRange(from p in client.Client_Foster_Parents.ToList() select new IntakeRelationItem() { Item_Id = p.Client_Foster_Parent_Id, Person_Id = p.Person_Id, Relation_Person = p.Person, Relation_Type_Id = (int)RelationTypeEnum.FosterParents, Relation_Type_Description = "Foster Parent" }); } if ((relationTypeId == "-1") || (int.Parse(relationTypeId) == (int)RelationTypeEnum.Caregivers)) { relationItems.AddRange(from p in client.Client_CareGivers.ToList() select new IntakeRelationItem() { Item_Id = p.Client_Caregiver_Id, Person_Id = p.Person_Id, Relation_Person = p.Person, Relation_Type_Id = (int)RelationTypeEnum.Caregivers, Relation_Type_Description = "Caregiver" }); } if ((relationTypeId == "-1") || (int.Parse(relationTypeId) == (int)RelationTypeEnum.ProspectiveAdoptiveParents)) { relationItems.AddRange(from p in client.int_Client_ProspectiveAdoptiveParents.ToList() select new IntakeRelationItem() { Item_Id = p.Client_ProspectiveAdoptiveParents_Id, Person_Id = p.Person_Id, Relation_Person = p.int_Person, Relation_Type_Id = (int)RelationTypeEnum.ProspectiveAdoptiveParents, Relation_Type_Description = "ProspectiveAdoptiveParents" }); } } return(PartialView("_RelationGrid", relationItems)); }
public void AddPerson(PersonModel person) { _PersonListBox.Items.Add(person.IdentityName); }
private FamilyModel GetCurrentFamilyModel() { FamilyModel currentFamilyModel = new FamilyModel(); currentFamilyModel.PersonSettings = Settings.Instance.Person; currentFamilyModel.RelationshipSettings = Settings.Instance.Relationship; currentFamilyModel.Tree = Tree; if (SelectedPerson != null) { currentFamilyModel.Tree.SelectedPersonId = SelectedPerson.Id; } if (SelectedRelationship != null) { currentFamilyModel.Tree.SelectedRelationshipId = SelectedRelationship.Id; } currentFamilyModel.Members = new ObservableCollection<PersonModel>() { }; foreach (PersonView personView in Members) { PersonModel personModel = new PersonModel(); personModel.CopyBaseProperties(personView); currentFamilyModel.Members.Add(personModel); } currentFamilyModel.Relationships = new ObservableCollection<RelationshipModel> { }; foreach (RelationshipView relationshipView in Relationships) { RelationshipModel relationshipModel = new RelationshipModel(); relationshipModel.CopyBaseProperties(relationshipView); currentFamilyModel.Relationships.Add(relationshipModel); } return currentFamilyModel; }
public ChangeEmailForm(PersonModel pm) { InitializeComponent(); p = pm; enterEmailValue.Text = p.EmailAddress; }
static void Main(string[] args) { var client = HelloWorldServiceClient.GetInstance("http://localhost:13337"); //var response = client.Hello(new HelloRequestType { Name = "World" }); //if (response.ResponseStatus.Ack == AckCodeType.Success) //{ // Console.WriteLine("Response : {0}", response.Result); //} //else //{ // Console.WriteLine("Error : {0}", response.ResponseStatus.Errors[0].Message); //} ////新加的方法,返回服务器当前的时间 //int i = 1; //while (i++ < 20) //{ // System.Threading.Thread.Sleep(1000); // var latestResponse = client.GetLatestTime(new GetLatestTimeType()); // if (latestResponse.ResponseStatus.Ack == AckCodeType.Success) // { // Console.WriteLine(latestResponse.Result); // } //} ////工具生成的方法,计算数字之和 //int n1 = 10; int n2 = 5; //var addResponse = client.AddNumber(new AddNumberRequestType { num1 = n1, num2 = n2 }); //Console.WriteLine(addResponse.Result); //int n1 = 20; //PersonModel p = new PersonModel() { Name = "yrs", Age = 30 }; //var personResponse = client.AddPersonAge(new AddPersonAgeRequestType { num1 = n1, Person = p }); //Console.WriteLine(personResponse.IsPersonOlder); //Console.WriteLine(personResponse.Person.Name); //int n2 = 31; //PersonModel p2 = new PersonModel() { Name = "yrs", Age = 30 }; //var personResponse2 = client.AddPersonAge(new AddPersonAgeRequestType { num1 = n2, Person = p2 }); //Console.WriteLine(personResponse2.IsPersonOlder); //Console.WriteLine(personResponse2.Person.Name); List<PersonModel> lstPerson = new List<PersonModel>(); for (int i = 0; i < 4; i++) { PersonModel p = new PersonModel(); p.Age = 25 + i; p.Name = "lyn" + i * 2; lstPerson.Add(p); } var response4 = client.SavePersonList(new SavePersonListRequestType { PersonList = lstPerson }); Console.WriteLine(response4.AvgAge); Console.ReadKey(); }
private void TrySaveFamily(string idNumber, DataSet ds, int tryCount, Action <string> callback) { try { //家庭档案号 string jtKey = GetJTKeyByID(idNumber); if (!string.IsNullOrEmpty(jtKey)) { // 修改家庭信息 EditJT(jtKey, ds); DataTable dt = ds.Tables["memBer"]; foreach (DataRow row in dt.Rows) { string idcardno = row["IDCardNo"].ToString(); string strHouseRelation = row["HouseRelation"].ToString(); // 户主时跳过 if (idcardno.ToUpper() == idNumber.ToUpper()) { continue; } CommonBusiness.CommonBusiness cb = new CommonBusiness.CommonBusiness(); PersonModel person = cb.GetGrdaByIDCardNo(idcardno, loginKey, SysCookieContainer); if (person == null) { continue; } string merberID = ""; // 没有家庭的,则直接增加 if (person.fid == "") { merberID = GetMemID(jtKey, person.pid); if (!string.IsNullOrEmpty(merberID)) { AddJTMem(merberID, strHouseRelation, jtKey); } continue; } // 若是已经存在,则不操作。(关系未修改) if (person.fid.ToUpper() == jtKey.ToUpper()) { continue; } JTClass jtclass = GetJtXXInfo(person.fid); if (string.IsNullOrEmpty(jtclass.JTKey)) { continue; } // 户主变更,删除当前家庭中人员 foreach (var p in jtclass.JTPeoples) { if (p.houseRelation == "1") { continue; } DelJTMem(p.pid, p.houseRelation, jtclass.JTKey, jtclass.JTCount); jtclass.JTCount--; } // 删除户主 var tmpM = jtclass.JTPeoples.Where(m => m.houseRelation == "1").FirstOrDefault(); if (tmpM != null) { DelJTMem(tmpM.pid, tmpM.houseRelation, jtclass.JTKey, 1); } merberID = GetMemID(jtKey, person.pid); if (!string.IsNullOrEmpty(merberID)) { AddJTMem(merberID, strHouseRelation, jtKey); } } } } catch (Exception ex) { if (ex.Message.IndexOf("登录超时") > -1) { callback("EX-“登录超时”、“该用户在别处登录”或者“当前用户信息被上级用户修改”导致用户无法操作,请您重新登录!"); throw; } CommonExtensions.WriteLog(ex.Message); CommonExtensions.WriteLog(ex.StackTrace); if (tryCount < MaxtryCount) { callback("EX-家庭信息:身份证[" + idNumber + "]:上传家庭信息失败。重新尝试获取第" + tryCount + "次..."); System.Threading.Thread.Sleep(SleepMilliseconds); tryCount++; TrySaveFamily(idNumber, ds, tryCount, callback); } else { callback("EX-家庭信息:身份证[" + idNumber + "]:上传家庭信息失败。请确保网路畅通。"); } } }
public ActionResult DeleteRelation(int id, int id1, int id2) { var r = DbUtil.Db.RelatedFamilies.SingleOrDefault(rf => rf.FamilyId == id1 && rf.RelatedFamilyId == id2); DbUtil.Db.RelatedFamilies.DeleteOnSubmit(r); DbUtil.Db.SubmitChanges(); var m = new PersonModel(id); return View("RelatedFamilies", m); }
/// <summary> /// 根据信息,获取家庭档案 /// </summary> /// <param name="listPerson"></param> /// <param name="callback"></param> private void GetJtPeopleInfo(string jtKey, int tryCount, Action <string> callback) { try { WebHelper web = new WebHelper(); StringBuilder postStr = new StringBuilder(); postStr.Append("djtdabh=").Append(jtKey); //http://112.6.122.71:9165/sdcsm/home/homeshow.action?djtdabh=3714240201900434 //查询请求执行 string returnString = web.GetHttp(baseUrl + "home/homeshow.action", postStr.ToString(), SysCookieContainer); HtmlDocument doc = HtmlHelper.GetHtmlDocument(returnString); if (doc == null) { return; } var nodetrs = doc.DocumentNode.SelectNodes("//div[@id='jtcyxg']//table[@id='table1']//tr[position()>3]"); List <PersonModel> lstpm = new List <PersonModel>(); PersonModel pmMaster = new PersonModel(); if (nodetrs != null) { var node0 = nodetrs[0].SelectSingleNode("td[1]/input[1]"); var nodeR0 = nodetrs[0].SelectSingleNode("td[2]/select/option[@selected]"); pmMaster.pid = node0 == null || !node0.Attributes.Contains("value") ? "" : node0.Attributes["value"].Value; string pMNumber = ""; if (!string.IsNullOrEmpty(pmMaster.pid)) { pMNumber = GetGrdaInfo(pmMaster, ""); } if (string.IsNullOrEmpty(pMNumber)) { return; } //家庭信息 DataSet dsT = GetDataTableTmp(); DataTable baseInfo = dsT.Tables["ARCHIVE_FAMILY_INFO"].Clone(); DataRow dr = baseInfo.NewRow(); dr["RecordID"] = jtKey; dr["FamilyRecordID"] = pMNumber; dr["IDCardNo"] = pMNumber; var nodeJT = doc.DocumentNode.SelectSingleNode("//select[@id='dcslx']/option[@selected]"); dr["ToiletType"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; dr["ToiletType"] = dr["ToiletType"].ToString() == "99" ? "4" : dr["ToiletType"]; nodeJT = doc.DocumentNode.SelectSingleNode("//select[@id='dzflx']/option[@selected]"); dr["HouseType"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; nodeJT = doc.DocumentNode.SelectSingleNode("//select[@id='dsfdb']/option[@selected]"); string strPoor = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; dr["IsPoorfy"] = strPoor == "2" ? "0" : strPoor; nodeJT = doc.DocumentNode.SelectSingleNode("//input[@id='djzmj']"); dr["HouseArea"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; nodeJT = doc.DocumentNode.SelectSingleNode("//input[@id='drjsr']"); dr["IncomeAvg"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; nodeJT = doc.DocumentNode.SelectSingleNode("//input[@id='dcyanl']"); dr["Monthoil"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; nodeJT = doc.DocumentNode.SelectSingleNode("//input[@id='dcyl']"); dr["MonthSalt"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; nodeJT = doc.DocumentNode.SelectSingleNode("//input[@id='happentime']"); dr["CreatedDate"] = nodeJT == null || !nodeJT.Attributes.Contains("value") ? "" : nodeJT.Attributes["value"].Value; baseInfo.Rows.Add(dr); DataSet saveDS = new DataSet(); saveDS.Tables.Add(baseInfo); CommonBusiness.CommonDAOBusiness dao = new CommonBusiness.CommonDAOBusiness(); dao.SaveDataSet(saveDS, pMNumber); saveDS.Tables.Clear(); // 排除户主,从1开始 //for (int i = 1; i < nodetrs.Count; i++) //{ // var jtP = nodetrs[i]; // var node = jtP.SelectSingleNode("td[1]/input[1]"); // var nodeR = jtP.SelectSingleNode("td[2]/select/option[@selected]"); // PersonModel pm = new PersonModel(); // pm.pid = node == null || !node.Attributes.Contains("value") ? "" : node.Attributes["value"].Value; // if (!string.IsNullOrEmpty(pm.pid)) // { // GetGrdaInfo(pm, pMNumber); // } //} } } catch (Exception ex) { CommonExtensions.WriteLog(ex.Message); CommonExtensions.WriteLog(ex.StackTrace); if (tryCount < MaxtryCount) { callback("EX-家庭档案:家庭档案号[" + jtKey + "]:下载信息失败。重新尝试获取第" + tryCount + "次..."); System.Threading.Thread.Sleep(SleepMilliseconds); tryCount++; GetJtPeopleInfo(jtKey, tryCount, callback); } else { callback("EX-家庭档案:家庭档案号[" + jtKey + "]:下载信息失败。请确保网路畅通。"); } } }
public void RemovePerson(PersonModel person) { _PersonListBox.Items.Remove(person.IdentityName); }
public ActionResult Snapshot(int id) { var m = new PersonModel(id); return View(m); }