void Start() { id = Guid.NewGuid(); CurrentInterests = new Interests(); CurrentInterests.CopyFrom(AgentCategory.Interests); CurrentSocialInterests = new Interests(); CurrentSocialInterests.CopyFrom(AgentCategory.SocialInterests); _agentWalking = GetComponent <AgentWalking>(); RenderAttractedness(); _currentState = State.RandomWalking; _creationTime = Time.time; _exit = transform.position; _allRenderers = GetComponentsInChildren <Renderer>(); }
protected override void Execute(CodeActivityContext context) { // Create a Lead class and populate it with the input arguments Lead l = new Lead(); l.ContactName = ContactName.Get(context); l.ContactPhone = ContactPhone.Get(context); l.Interests = Interests.Get(context); l.Comments = Notes.Get(context); l.WorkflowID = context.WorkflowInstanceId; l.Status = "Open"; // Get the connection string DBExtension ext = context.GetExtension <DBExtension>(); if (ext == null) { throw new InvalidProgramException("No connection string available"); } // Insert a record into the Lead table LeadDataDataContext dc = new LeadDataDataContext(ext.ConnectionString); dc.Leads.InsertOnSubmit(l); dc.SubmitChanges(); // Store the request in the OutArgument Lead.Set(context, l); // Add a custom track record CustomTrackingRecord userRecord = new CustomTrackingRecord("New Lead") { Data = { { "Name", l.ContactName }, { "Phone", l.ContactPhone } } }; // Emit the custom tracking record context.Track(userRecord); }
static MockPersonRepository() { var rng = new Random(); // Ugly randomization to create different people people = Enumerable.Range(1, 30).Select(index => new Person { Id = index, DateOfBirth = DateTime.Now.AddYears(-rng.Next(5, 40)), DateOfDeath = rng.Next(10) == 1 ? DateTime.Now.AddYears(-rng.Next(5)) : (DateTime?)null, FirstName = FirstNames.GetRandom(), LastName = LastNames.GetRandom(), Street1 = $"{rng.Next(999)} {Streets.GetRandom()} {StreetTypes.GetRandom()}", Street2 = rng.Next(10) < 3 ? $"Apt {rng.Next(1, 30)}" : null, City = Cities.GetRandom(), State = States.GetRandom(), PostalCode = $"{rng.Next(99999):00000}", Interests = rng.Next(10) < 5 ? Interests.GetRandom() : null, AvatarUrl = $"/images/{(index % 2 == 0 ? "m" : "f")}/{index}.png" }).ToArray(); }
public Clinker UpdateInterests(int clinkerId, string clinkerInterest, string AddOrRemove) { Interests i = new Interests { Name = clinkerInterest }; var clinker = GetClinkerById(clinkerId); if (AddOrRemove.ToLower() == "add") { clinker.Interests.Add(i); return(clinker); } else if (AddOrRemove.ToLower() == "remove") { var foundInterest = clinker.Interests.Find(interest => interest.Name == clinkerInterest); clinker.Interests.Remove(foundInterest); return(clinker); } return(clinker); }
public ActionResult Save(Interests interest) { if (!ModelState.IsValid) { var viewModel = new InterestFormViewModel(interest); return(View("InterestForm", viewModel)); } if (interest.Id == 0) { _context.Interests.Add(interest); } else { var interestInDb = _context.Interests.Single(i => i.Id == interest.Id); interestInDb.Name = interest.Name; } _context.SaveChanges(); return(RedirectToAction("Index", "Interests", new { id = interest.PersonId })); }
public static Interests FromOSD(OSD O) { Interests I = new Interests(); OSDMap tex = (OSDMap)O; I.LanguagesText = tex["languages_text"].AsString(); I.SkillsMask = tex["skills_mask"].AsUInteger(); I.SkillsText = tex["skills_text"].AsString(); I.WantToMask = tex["want_to_mask"].AsUInteger(); I.WantToText = tex["want_to_text"].AsString(); return I; }