static async Task MainAsync(string connectionString) { string fullName = "Kus"; decimal winnings = 200000M; string countryAbbreviation = "USA"; PersonData.AddPerson(connectionString: connectionString, fullName: fullName, winnings: winnings, countryAbbreviation: countryAbbreviation); List <Person> persons = await PersonData.Get(connectionString); foreach (Person person in persons) { System.Console.WriteLine($"Person Name: {person.FullName}. Winnings: {person.Winnings.ToString(System.Globalization.CultureInfo.InvariantCulture)}. Country: {person.Country.Abbreviation}"); } }
public void GenerateData(PersonData p, Date today) { id = p.ID; fName = p.fName; sName = p.sName; travelDate = today; nat = p.nationality; sex = p.sex; visaText = string.Format( "Dear Sir or Madam,\nI am writing to support the visa\napplication of {0} {1}.\n\nPlease let them enter your country.\nYours faithfully,\nThe {2} embassy", fName, sName, Visa.NationalityToString(nat) ); }
public IActionResult Edit(int id, [Bind("Id,Name,Department,Years")] Person person) { if (id != person.Id) { return(NotFound()); } if (ModelState.IsValid) { PersonData.UpdatePerson(id, person); return(RedirectToAction("Details", new { id = id })); } return(View(person)); }
public int Insert(string firstName, string lastName) { var data = new PersonData { FirstName = firstName, LastName = lastName }; dataContext.Persons.Add(data); var count = dataContext.SaveChanges(); if (count == 0) { throw new InvalidOperationException("PersonDal.Insert"); } return(data.Id); }
void onPersonArrival(PersonData p) { Debug.Log("Someone arrived!"); Debug.Log(string.Format("x:{0:0.######} y:{1:0.######} z:{2:0.######}", p.pos.x, p.pos.y, p.pos.z)); GameObject go_footprints = Instantiate(footprintsPrefab, p.pos, Quaternion.Euler(p.rot)); GameObject go_phone = Instantiate(phonePrefab, p.pos, Quaternion.Euler(p.rot)); PersonVisual visual = PersonVisual.CreatePersonVisual(p, go_footprints, go_phone); // Play sound, but not for the first wave of initial messages. if (enabledAt + 3f < Time.time) { visual.phone.GetComponent <AudioSource> ().PlayOneShot(audioOnAppear); } visuals.Add(p.id, visual); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); ISqlDataAccess sql = new SqlDataAccess(); IMainView mainView = new MainForm(); IPersonData personData = new PersonData(sql); IComboBoxData boxData = new ComboBoxData(sql); ApplicationSeed.Seed(boxData, sql); var mainPresenter = new MainPresenter(mainView, personData, boxData); mainPresenter.ShowView(); }
public static SqlDataReader FindByFacebookIdAndAttributeGuid(this PersonData personData, string facebookID, Guid attributeGuid) { var list = new ArrayList(); list.Add(new SqlParameter("@FacebookID", facebookID)); list.Add(new SqlParameter("@AttributeGuid", attributeGuid)); try { return(personData.ExecuteSqlDataReader("cust_cccev_core_getPersonListByFacebookIdAndAttributeGuid", list)); } catch (SqlException ex) { throw ex; } }
public void UpdatePerson(int personId, PersonData newData) { using (var personCtx = new DataClassesDataContext()) { // Set up the query var person = personCtx.Persons.Single(p => p.PersonId == personId); if (person != null) { person.FirstName = newData.FirstName; person.LastName = newData.LastName; person.EmailAddress = newData.EmailAddress; person.Department = newData.Department; personCtx.SubmitChanges(); } } }
public void OnPropertyChanged_Should_Not_Invoke_PropertyChanged_Event_When_Property_Is_The_Same() { var age = 20; var personData = new PersonData { Age = age }; var propertyChangedEventWasCalled = false; personData.PropertyChanged += (sender, args) => { propertyChangedEventWasCalled = true; }; personData.Age = age; Assert.IsFalse(propertyChangedEventWasCalled); }
public AccountPerson Map(PersonData emp_data) { return(new AccountPerson(QIQOPersonType.AccountEmployee) { PersonKey = emp_data.PersonKey, PersonCode = emp_data.PersonCode, PersonFirstName = emp_data.PersonFirstName, PersonLastName = emp_data.PersonLastName, PersonDOB = emp_data.PersonDob, PersonMI = emp_data.PersonMi, AddedUserID = emp_data.AuditAddUserId, AddedDateTime = emp_data.AuditAddDatetime, UpdateUserID = emp_data.AuditUpdateUserId, UpdateDateTime = emp_data.AuditUpdateDatetime }); }
public IActionResult create(PersonData person) { HttpClient client = _api.Initial(); var postTask = client.PostAsJsonAsync <PersonData>("api/person", person); postTask.Wait(); var result = postTask.Result; if (result.IsSuccessStatusCode) { return(RedirectToAction("Index")); } return(View()); }
public void InsertPersonDl() { Person lPerson = new Person() { PersonID = 0, FullName = "James", ProductName = "Bond", Address = "10 Avenue A", Purpose = "New York", ProductCategory = "NY", ProductPrice = "12345" }; PersonData lPersonData = new PersonData(); lPersonData.InsertPerson(lPerson); }
private void GeneratePerson() { var personPos = Vector3.zero; var loopCount = 0; while (true) { personPos = RandomWorldPos(); ++loopCount; if (loopCount > 1000 * 1000 * 1000) { Console.instance.WriteMessage("Cannot generate person; too many iterations."); break; } var tooClose = false; foreach (Transform child in transform) { if (child.GetComponentInChildren <Person>() == null) { continue; } var distance = Vector3.Distance(personPos, child.transform.position); if (distance < m_minPersonDistance) { tooClose = true; Console.instance.WriteMessage($"Reroll for person placement ({distance}/{m_minPersonDistance})"); break; } } if (tooClose == false) { break; } } var personData = new PersonData() { name = m_nameList.RandomElement(), surname = m_surnameList.RandomElement(), profession = m_professionList.RandomElement(), age = Random.Range(m_ageMin, m_ageMax) }; CreatePerson(personPos, personData); }
private ResponseResult PostPerson(Person p) { ResponseResult r = new ResponseResult(); int result = 0; try { PersonData pd = new PersonData() { //Converts the .Net objects to XML String PersonXML = HelperMethods.ObjectToXMLString <Person>(p), CreatedDate = DateTime.Now }; if (context.Add(pd) == 1) { result = context.SaveChanges(); if (result == 1) { r.ReturnResult = pd; r.Message = "Inserted successfully."; r.status = ResponseStatus.Success; } else { r.ReturnResult = pd; r.Message = "Fail to insert."; r.status = ResponseStatus.Fail; } } else { r.ReturnResult = pd; r.Message = "Fail to insert."; r.status = ResponseStatus.Fail; } } catch (Exception ex) { r.ReturnResult = null; r.Message = "Bad Request / Internal Server error."; r.status = ResponseStatus.Error; LogFactory.Log(LogType.Error, LogMode.TextFile, $"{ex.Message} \r\n {new StackTrace(ex, true).GetFrame(0).GetFileLineNumber()}"); } return(r); }
public void Test_Validate_Join_Three_ValidatesPipeLines() { var testData = new PersonData("*****@*****.**", "ikke", "02034567887", 18, true) { Address = new Address("mien street") }; var httpRequest = new HttpRequestContext(HttpContextHelper.SetUpHttpContextAccessor(), HttpContextHelper.GetUser()); int nr = 1; var initContextValidate = ValidatorExt.InitPipe <HttpRequestContext, Result>(out var contextValidator); var initFieldsValidate = ValidatorExt.InitPipe <ValidateFields, Result>(out var fieldsValidator); var initReferenceValidate = ValidatorExt.InitPipe <ValidateReferences, Result>(out var referenceValidator); var validateContext = Pipe.Init(initContextValidate, contextValidator) .Then(contextAndResult => contextAndResult.Val.ValidateIsAuthenticated(contextAndResult.SupplementVal)) .Then(context => HttpContextHelper.SetObjectAsJson(context.ContextAccessor, "person" + nr, testData)); var validateFields = Pipe.Init(initFieldsValidate, fieldsValidator) .Then(valAndResult => valAndResult.Val.ValidateEmail(valAndResult.SupplementVal)) .Then(valAndResult => valAndResult.Val.ValidatePerson(valAndResult.SupplementVal)); var validateReferences = Pipe.Init(initReferenceValidate, referenceValidator) .Then(valAndResult => valAndResult.Val.AddInvalidAddress(valAndResult.SupplementVal)); var pipelineBoth = validateContext .JoinIfValid(cnt => new ValidateFields(HttpContextHelper.GetObjectFromJson <PersonData>(cnt.ContextAccessor, "person" + nr)), validateFields) .Join(valflds => new ValidateReferences(valflds.Person), validateReferences); var pipelineResult = (Validator <ValidateReferences, Result>)pipelineBoth(httpRequest); Assert.IsTrue(pipelineResult.GetOptionType == OptionType.Some); Assert.IsTrue(pipelineResult.SupplementVal.Messages.Count == 0); testData = new PersonData("", "ikke", "02034567887", 18, true) { Address = new Address("") }; nr++; pipelineResult = (Validator <ValidateReferences, Result>)pipelineBoth(httpRequest); Assert.IsTrue(pipelineResult.GetOptionType == OptionType.Validation); Assert.IsTrue(pipelineResult.SupplementVal.Messages.Count == 2); Assert.IsTrue(pipelineResult.SupplementVal.Messages.Any(x => x == ValidateFields.PersonNoValidEmail)); Assert.IsTrue(pipelineResult.SupplementVal.Messages.Any(x => x == ValidateReferences.InValidAddress)); }
public void AddPerson(PersonData p) { using (var personCtx = new DataClassesDataContext()) { var person = new Person { PersonId = p.PersonId, FirstName = p.FirstName, LastName = p.LastName, EmailAddress = p.EmailAddress, Department = p.Department }; personCtx.Persons.InsertOnSubmit(person); personCtx.SubmitChanges(); } }
public IHttpActionResult GetFirstNames() { var allPeople = new PersonData().GetPeople(); List <string> names = new List <string>(); foreach (var person in allPeople) { var firstName = person.First; firstName = firstName.Trim(); if (!names.Contains(firstName)) { names.Add(firstName); } } return(Ok(names)); }
/// <summary> /// Loads Person controller /// </summary> /// <param name="pData"></param> void LoadFromFile(PersonData pData) { //person controller vars Difficulty = pData.PersonControllerSaveLoad.Difficulty; UnivCounter = pData.PersonControllerSaveLoad.UnivCounter; Queues = pData.PersonControllerSaveLoad.Queues; GenderLast = pData.PersonControllerSaveLoad.GenderLast; Locked = pData.PersonControllerSaveLoad.Locked; BuildersManager1 = pData.PersonControllerSaveLoad.BuildersManager; RoutesCache1 = pData.PersonControllerSaveLoad.RoutesCache; RoutesCache1.LoadTheSave(); //OnSystemNow1 = pData.PersonControllerSaveLoad.OnSystemNow1; EmigrateController1 = pData.PersonControllerSaveLoad.EmigrateController1; EmigrateController1.RecreateEmigratesGC(); IsAPersonHomeLessNow = pData.PersonControllerSaveLoad.IsAPersonHomeLessNow; Program.MyScreen1.TownName = pData.PersonControllerSaveLoad.TownName; //BulletinWindow.SubBulletinProduction1 = pData.PersonControllerSaveLoad.SubBulletinProduction; //BulletinWindow.SubBulletinFinance1 = pData.PersonControllerSaveLoad.SubBulletinFinance; Program.gameScene.QuestManager = pData.PersonControllerSaveLoad.QuestManager; Program.gameScene.QuestManager.JustLoadedShowCurrent(); //persons for (int i = 0; i < pData.All.Count; i++) { Person t = Person.CreatePersonFromFile(pData.All[i]); MouseClick += t.MouseClickHandler; BuildingPot.InputU.BuildPlaced += t.BuildPlacedHandler; Program.MouseListener.Demolished += t.BuildWasDemolished; All.Add(t); _allGC.Add(t.MyId, t); } //Program.MyScreen1.LoadData(pData); }
public Person(PersonData pd, Place _current_room) { position = new Vector2Int(pd.xPosition, pd.yPosition); rotation = (Enums.rotations)pd.rotation; name = pd.name; eyesight = pd.eyesight; features_float = new Dictionary <string, float>(); features_string = new Dictionary <string, string>(); splitPercent = new char[1]; splitPercent[0] = '%'; splitColon = new char[1]; splitColon[0] = ':'; features_float["muscle"] = pd.muscle; features_float["fat"] = pd.fat; features_float["height"] = pd.height; features_float["weight"] = pd.weight; features_float["beauty"] = pd.beauty; features_float["wit"] = pd.wit; features_float["chill"] = pd.chill; features_float["introversion"] = pd.introversion; features_float["happiness"] = pd.happiness; features_float["sadness"] = pd.sadness; features_float["anger"] = pd.anger; features_float["fear"] = pd.fear; features_float["disgust"] = pd.disgust; features_float["hunger"] = pd.hunger; features_float["thirst"] = pd.thirst; features_float["tiredness"] = pd.tiredness; features_float["social"] = pd.social; features_float["stress"] = pd.stress; features_float["libido"] = pd.libido; for (int i = 0; i < pd.features.Length; i++) { string[] f = pd.features[i].Split(splitPercent); features_string[f[0]] = f[1]; } preferences = new Preferences(pd.preferences); memory = new Memory(); current_place = _current_room; }
public Person UpdatePerson(long personID, PersonData data) { var person = this.GetPerson(personID); if (person == null) { throw new CustomNotFoundException($"Person with ID={personID} not found"); } person.Change(data.Gender, data.Name, data.Email, data.Phone, data.DateBirth, data.DateDeath); this.UnitOfWork.PersonRepository.Update(person); this.SaveChanges(); return(person); }
public void GetByTag_User_Test() { // Get tag by user IDataRepository <Person> getUser = new PersonData(); var user = getUser.GetById(2); Tag tag = new Tag() { UserTag = user }; ITag <Journal> getbytag = new JournalData(); var journals = getbytag.GetByTag(tag); foreach (var journal in journals) { Console.WriteLine($"{journal.Title}"); } }
static IEnumerable <Person> GetInitialMatches(PersonData data) { if (!String.IsNullOrEmpty(data.Phone)) { var phoneMatches = Program.Table <Person>().Rows.Where(p => p.Phone == data.Phone).ToArray(); if (phoneMatches.Length == 1) { return(new ReadOnlyCollection <Person>(phoneMatches)); } if (phoneMatches.Length > 1) { var phoneLast = phoneMatches.Where(p => data.LastName.Equals(p.LastName, StringComparison.OrdinalIgnoreCase)); if (phoneLast.Any()) { return(phoneMatches); } } } IEnumerable <Person> addressMatches = null; var address = AddressInfo.Parse(data.Address); if (address != AddressInfo.Invalid) { addressMatches = Program.Table <Person>().Rows.Where(p => !String.IsNullOrEmpty(p.Address) && AddressInfo.Parse(p.Address) == address); if (addressMatches.Any()) { var addrLastMatches = addressMatches.Where(p => data.LastName.Equals(p.LastName, StringComparison.OrdinalIgnoreCase)); if (addrLastMatches.Any()) { return(new ReadOnlyCollection <Person>(addrLastMatches.ToArray())); } return(new ReadOnlyCollection <Person>(addressMatches.ToArray())); } } //If we've gotten here, both phone and address are either missing or not in AllPeople. var retVal = Program.Table <Person>().Rows.Where(p => data.LastName.Equals(p.LastName, StringComparison.OrdinalIgnoreCase)); if (!FilterName(retVal, data).Any()) { return(Enumerable.Empty <Person>()); } return(retVal); }
private void PerformSearch() { DataTable dt = new PersonData().GetPersonByNameLimited_DT(tbFirstName.Text.Trim(), tbLastName.Text.Trim()); dgvPersonSearch.DataSource = dt; if (dt.Rows.Count > 0) { dgvPersonSearch.Focus(); DisplayPerson(new Person((int)dgvPersonSearch.SelectedRows[0].Cells["PS_person_id"].Value)); } else { this.AcceptButton = null; this.CancelButton = btnCancelSelect; ShowMessage("There were not any people that matched your search criteria.", "No Matches"); } }
public async Task <IActionResult> PurchaseOrderList(long id) { var user = new PersonData(); HttpClient client = _api.Initial(); HttpResponseMessage res = await client.GetAsync($"api/person/{id}"); if (res.IsSuccessStatusCode) { var result = res.Content.ReadAsStringAsync().Result; user = JsonConvert.DeserializeObject <PersonData>(result); } List <PurchaseOrderData> lista = new List <PurchaseOrderData>(); lista = user.purchaseOrderDatas; return(View(lista)); }
/// <summary> /// sparar personen i databasen /// </summary> /// <param name="data"></param> /// <returns>Info om en person/medlem</returns> public PersonData CreatePerson(PersonData data) { using (IDbConnection connection = new System.Data.SqlClient.SqlConnection(GlobalConfig.CnnString("Tournaments"))) { var p = new DynamicParameters(); p.Add("@FirstName", data.FirstName); p.Add("@LastName", data.Lastname); p.Add("@EmailAddress", data.EmailAddress); p.Add("@PhoneNumber", data.PhoneNumber); p.Add("@id", 0, dbType: DbType.Int32, direction: ParameterDirection.Output); connection.Execute("dbo.spPeople_Insert", p, commandType: CommandType.StoredProcedure); data.Id = p.Get <int>("@id"); return(data); } }
// Coroutine to save the user's position to Firebase IEnumerator _SendData() { while (true) { // The ID that identifies the person in the room. string id = SystemInfo.deviceUniqueIdentifier; // Get the position of the current camera. PersonData cd = PersonData.CreatePersonData(Camera.main.transform, deviceLocationId); string scd = JsonUtility.ToJson(cd); // Save to Firebase peopleRef.Child(cd.id).SetRawJsonValueAsync(scd); // Wait some time before sending again yield return(new WaitForSeconds(updateInterval)); } }
public PersonModel UpdatePerson(long id, [FromBody] UpdatePersonRequest request) { var data = new PersonData() { Name = request.Name, Gender = request.Gender, Email = request.Email, Phone = request.Phone, DateBirth = request.DateBirth, DateDeath = request.DateDeath }; if (!String.IsNullOrWhiteSpace(request.Avatar)) { _manager.ChangePersonAvatar(id, request.Avatar); } return(_manager.UpdatePerson(id, data).ToSerial()); }
public static List <PersonData> ConvertToPerson(this List <string> lines) { List <PersonData> output = new List <PersonData>(); foreach (string line in lines) { string[] cols = line.Split(','); PersonData p = new PersonData(); p.Id = int.Parse(cols[0]); p.FirstName = cols[1]; p.Lastname = cols[2]; p.EmailAddress = cols[3]; p.PhoneNumber = cols[4]; output.Add(p); } return(output); }
/// <summary> /// Once data is loaded the Book has to be redo /// </summary> void RedoStuffWithLoadedData() { //means is a new game and this below is not needed if (Program.MyScreen1.HoldDifficulty != -1) { return; } Program.MyScreen1.HoldDifficulty = PersonPot.Control.Difficulty; _book = new Book(); _book.Start(); PersonData pData = XMLSerie.ReadXMLPerson(); Program.IsPirate = pData.PersonControllerSaveLoad.IsPirate; Program.IsFood = pData.PersonControllerSaveLoad.IsFood; Program.WasTutoPassed = pData.PersonControllerSaveLoad.WasTutoPassed; }
private void AssignData() { tOsoby person = GetPersonData(); if (person != null) { IsPerson = true; PersonData.AssignData(person); } else { tFirmy firm = GetFirmData(); if (firm != null) { IsFirm = true; FirmData.AssignData(firm); } } }
private static ComboOrderData BuildComboOrder(string partyId, decimal amount, string fund) { var usd = new CurrencyData("USD"); var party = new PersonData { PartyId = partyId }; var customerParty = new CustomerPartyData { Id = partyId, Party = party }; var orderData = new OrderData { BillToCustomerParty = customerParty, SoldToCustomerParty = customerParty, Currency = usd, Lines = new OrderLineDataCollection{ new OrderLineData { Item = new GiftItemData {ItemCode = fund}, QuantityOrdered = new QuantityData(1), UnitPrice = new MonetaryAmountData(amount, usd), ExtendedAmount = new MonetaryAmountData(amount, usd) } }, }; var comboOrder = new ComboOrderData { Currency = usd, Order = orderData }; comboOrder.Payments = new RemittanceDataCollection { new RemittanceData { Amount = new MonetaryAmountData(amount, usd), PaymentMethod = new PaymentMethodData {PaymentMethodId = "CASH"}, PayorParty = new CustomerPartyData {Id = partyId, Party = party} } }; return comboOrder; }
private static void SerializePatient() { Patient patient = new Patient(); PersonData cd = new PersonData(); cd.ID = Guid.NewGuid(); cd.Surname = "Androulidakis"; cd.Name = "Aggelos"; List<Communication> communications = new List<Communication>(); Communication commun1 = new Communication(); commun1.IsPrimary = true; commun1.Type = CommunicationType.Phone; commun1.Value = "+302107722453"; communications.Add(commun1); Communication commun2 = new Communication(); commun2.IsPrimary = false; commun2.Value = "*****@*****.**"; commun2.Type = CommunicationType.Email; communications.Add(commun2); cd.CommunicationList = new List<Communication>(communications); List<Address> addresses = new List<Address>(); Address address = new Address(); address.Street = "Patission"; address.StreetNo = "42"; address.City = "Athens"; address.Country = "GR"; address.Notes = "3rd floor"; address.IsPrimary = true; address.ZipCode = "123-45"; address.County = "Attica"; addresses.Add(address); addresses.Add(address); List<Identifier> ids = new List<Identifier>(); Identifier id = new Identifier(); id.Type = IdentifierType.PassportID; id.Number = "AB202825"; id.IssueDate = "17/02/2003"; id.IssueAuthority = "ABC"; ids.Add(id); ids.Add(id); cd.IdentifierList = ids; cd.AddressList = new List<Address>(addresses); patient.PersonData = cd; SocioDemographicData sd = new SocioDemographicData(); sd.Age = 82; SystemParameter maritalStatus = new SystemParameter(); maritalStatus.Code = 1; maritalStatus.Description = "widow"; sd.MaritalStatus = maritalStatus; sd.Children = 2; SystemParameter sex = new SystemParameter(); sex.Code = 1; sex.Description = "Male"; sd.Gender = sex; SystemParameter livingWith = new SystemParameter(); livingWith.Code = 1; livingWith.Description = "with son/daughter"; sd.LivingWith = livingWith; patient.SD_Data = sd; Carer c1 = new Carer(); c1.PersonData = patient.PersonData; c1.SD_Data = patient.SD_Data; PatientCaregiver pc1 = new PatientCaregiver(); pc1.Caregiver = c1; pc1.IsPrimary = true; PatientCaregiver pc2 = new PatientCaregiver(); pc2.Caregiver = c1; pc2.IsPrimary = false; patient.PatientCaregiverList.ListOfCaregivers.Add(pc1); patient.PatientCaregiverList.ListOfCaregivers.Add(pc2); Clinician respClinician = new Clinician(); respClinician.PersonData = patient.PersonData; patient.ResponsibleClinician = respClinician; //PatientAssessment assessment = new PatientAssessment(); //assessment.MMSE = 22; //assessment.DateOfAssessment = System.DateTime.Now; //patient.Assessments.ListOfAssessments.Add(assessment); SerializeMe(patient, "Patient.xml"); }
static Person FindPerson(TypedTable<Person> masterDirectory, DataTable ykData, PersonData ykPerson, int ykid) { var mdRow = masterDirectory.Rows.FirstOrDefault(p => p.YKID == ykid); if (mdRow != null && mdRow.LastName != ykPerson.LastName) { var candidates = masterDirectory.Rows .Where(md => md.LastName == ykPerson.LastName && md.YKID != null && ykData.Select("IDNUM=" + md.YKID).Length == 0 ).ToArray(); if (candidates.Length == 1) mdRow = candidates[0]; else if (candidates.Length > 1) { candidates = candidates.Where(md => md.Phone == ykPerson.Phone).ToArray(); if (candidates.Length == 1) mdRow = candidates[0]; } } return mdRow; }
private OrderData ProcessOrderImportRow(string[] pieces, string line, int lineNumber) { OrderData orderData = null; if (pieces.Length < minimumSupportedColumnsForOrder) { AddError(line, lineNumber, "Invalid line - too few columns for ORDER"); } else { var partyId = pieces[partyIdColumn]; var firstName = pieces[firstNameColumn]; var lastName = pieces[lastNameColumn]; var email = pieces[emailColumn]; var phone = pieces[phoneColumn]; var country = pieces[countryColumn]; var line1 = pieces[addressLine1Column]; var line2 = pieces[addressLine2Column]; var city = pieces[cityColumn]; var stateProvince = pieces[stateProvinceColumn]; var postalCode = pieces[postalCodeColumn]; PartyData party; var updateParty = false; AlternateIdData originatorId = null; if (String.IsNullOrEmpty(partyId)) { party = CreateNewParty(firstName, lastName, country, city, stateProvince, postalCode, email, phone, line1, line2); originatorId = new AlternateIdData("SourceId", Guid.NewGuid().ToString()); updateParty = true; } else party = new PersonData {PartyId = partyId}; var customerParty = new CustomerPartyData { Id = partyId, UpdateParty = updateParty, Party = party, OriginatorCustomerId = originatorId}; var deliveryData = new DeliveryData { DeliveryMethod = new DeliveryMethodData { DeliveryMethodId = "USPS" }, Address = party.Addresses[0], CustomerParty = customerParty }; orderData = new OrderData { BillToCustomerParty = customerParty, SoldToCustomerParty = customerParty, Currency = CommerceSettings.DefaultCurrency, Lines = new OrderLineDataCollection(), OrderReference = new OrderReferenceData(), Delivery = new DeliveryDataCollection { deliveryData } }; } return orderData; }
private void doImport_Click(object sender, EventArgs e) { foreach (DataRow ykRow in processedRows.Rows) { switch (ykRow.Field<ImportAction>("Action")) { case ImportAction.Ignore: break; case ImportAction.Update: var ykPerson = new PersonData(ykRow); var mdRow = Program.Table<Person>().Rows.First(p => p.Id == ykRow.Field<Guid>("PersonId")); if (!ykRow.IsNull("YKID")) mdRow.YKID = ykRow.Field<int>("YKID"); if (!string.IsNullOrEmpty(ykPerson.FullName)) mdRow.FullName = ykPerson.FullName; if (!string.IsNullOrEmpty(ykPerson.HisName)) mdRow.HisName = ykPerson.HisName; if (!string.IsNullOrEmpty(ykPerson.HerName)) mdRow.HerName = ykPerson.HerName; if (!string.IsNullOrEmpty(ykPerson.LastName)) mdRow.LastName = ykPerson.LastName; if (!string.IsNullOrEmpty(ykPerson.Address)) mdRow.Address = ykPerson.Address; if (!string.IsNullOrEmpty(ykPerson.City)) mdRow.City = ykPerson.City; if (!string.IsNullOrEmpty(ykPerson.State)) mdRow.State = ykPerson.State; if (!string.IsNullOrEmpty(ykPerson.Zip)) mdRow.Zip = ykPerson.Zip; if (!string.IsNullOrEmpty(ykPerson.Phone)) mdRow.Phone = ykPerson.Phone; mdRow.Source = "YK Directory"; break; case ImportAction.Add: var newRow = Program.Table<Person>().AddPerson(new PersonData(ykRow), "YK Directory"); newRow.YKID = ykRow.Field<int>("YKID"); if (!ykRow.IsNull("PersonId")) { var oldRow = Program.Table<Person>().Rows.First(p => p.Id == ykRow.Field<Guid>("PersonId")); if (oldRow.YKID == newRow.YKID) oldRow.YKID = null; } break; case ImportAction.Delete: Program.Table<Person>().Rows.First(p => p.Id == ykRow.Field<Guid>("PersonId")).RemoveRow(); break; } } Close(); }
public void UpdatePerson(string personId, PersonData personData) { WebOperationContext ctx = WebOperationContext.Current; System.Net.HttpStatusCode status = System.Net.HttpStatusCode.OK; try { using (var dataContext = new DataClassesDataContext()) { Person person = dataContext.Persons.SingleOrDefault( prod => prod.PersonId == Convert.ToInt32(personId)); if (person == null) { person = new Person(); dataContext.Persons.InsertOnSubmit(person); status = System.Net.HttpStatusCode.Created; } person.FirstName = personData.FirstName; person.LastName = personData.LastName; person.Department = personData.Department; person.EmailAddress = personData.EmailAddress; dataContext.SubmitChanges(); ctx.OutgoingResponse.StatusCode = status; return; } } catch { ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest; return; } }
public void IterationStarting(int iteration) { this.Data = new PersonData( this ); }
public void IterationFinished(int iteration) { this.Data.Save(); this.Data = null; }
public PersonData GetPerson(string personId) { var ctx = WebOperationContext.Current; try { using (var personCtx = new DataClassesDataContext()) { // Set up the query var person = personCtx.Persons.SingleOrDefault(p => p.PersonId == Convert.ToInt32(personId)); if (person == null) { ctx.OutgoingResponse.SetStatusAsNotFound(); return null; } var personData = new PersonData { PersonId = person.PersonId, FirstName = person.FirstName, LastName = person.LastName, EmailAddress = person.EmailAddress, Department = person.Department }; ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.OK; return personData; } } catch { ctx.OutgoingResponse.StatusCode = System.Net.HttpStatusCode.BadRequest; return null; } }
private static void SerializePatientAssessment() { PatientAssessment pa = new PatientAssessment(); Patient patient = new Patient(); PersonData cd = new PersonData(); cd.ID = Guid.NewGuid(); cd.Surname = "Androulidakis"; cd.Name = "Aggelos"; cd.ID = Guid.NewGuid(); patient.PersonData = cd; pa.Patient = patient; pa.Aetiology = new SystemParameter(1, "Alzheimer D"); pa.BarthelIndex = 80; pa.BlessedScalePart1 = 5.5M; pa.BlessedScalePart2 = 5; pa.BlessedScalePart3 = 6; pa.CharlsonComorbidityIndex = 10; pa.ChecklistMBPC = 50; pa.Comorbidity = "HBP"; pa.DateOfAssessment = System.DateTime.Now; pa.GDS = 7; pa.LawtonIndex = 7; pa.MDRS = 100; pa.MMSE = 22; pa.NPQI_Severity = 30; pa.NPQI_Stress = 30; pa.RelevantPathologyAntecedents = "AVC"; pa.TimeElapsedSinceDiagnosed = 6; Measurement m1 = new Measurement(); m1.DateTime = System.DateTime.Now; m1.Type = MeasurementType.BP_Systolic; m1.Units = "mmHg"; m1.Value = 115.0M; m1.LowerLimit = 100; Measurement m2 = new Measurement(); m2.DateTime = DateTime.Now; m2.Type = MeasurementType.BP_Diastolic; m2.Units = "mmHg"; m2.Value = 60; m2.UpperLimit = 80; Measurement m3 = new Measurement(); m3.DateTime = DateTime.Now; m3.Type = MeasurementType.Weight; m3.Units = "Kg"; m3.Value = 102; pa.ClinicalData = new List<Measurement>(); pa.ClinicalData.Add(m1); pa.ClinicalData.Add(m2); pa.ClinicalData.Add(m3); SerializeMe(pa, "PatientAssessment.xml"); }
private PartyData CreateNewParty(string firstName, string lastName, string country, string city, string stateProvince, string postalCode, string email, string phone, string address1, string address2) { var person = new PersonData { PersonName = new PersonNameData { FirstName = firstName, LastName = lastName }, Addresses = new FullAddressDataCollection() }; var address = new FullAddressData { Address = new AddressData { AddressLines = new AddressLineDataCollection(), CountryCode = country, CityName = city, CountrySubEntityCode = stateProvince, PostalCode = postalCode }, Email = email, Phone = phone, AddressPurpose = "Address" }; address.Address.AddressLines.Add(address1); address.Address.AddressLines.Add(address2); person.Addresses.Add(address); return person; }
static PersonData ImportRow(DataRow ykRow) { var ykPerson = new PersonData { FullName = ykRow.Field<string>("Address1MM").Cleanup(), HisName = ykRow.Field<string>("HIS_FIRST").Cleanup(), HerName = ykRow.Field<string>("HER_FIRST").Cleanup(), LastName = ykRow.Field<string>("Company").Cleanup(), Address = ykRow.Field<string>("Address").Cleanup(), City = ykRow.Field<string>("City").Cleanup(), State = ykRow.Field<string>("State").Cleanup(), Zip = ykRow.Field<string>("Zip").Cleanup(), Phone = ykRow.Field<string>("Telephone").Cleanup().FormatPhoneNumber() }; if (ykPerson.Address == null) ykPerson.City = ykPerson.State = ykPerson.Zip = null; return ykPerson; }