public void OnProgress(int levelNumber, bool coin_experiment, bool coin_condition, bool coin_wait, string infoState, float timeWaitedForCoins, float totalCoinsEarned) { Motivation.MotivationModel motivation = new Motivation.MotivationModel(levelNumber, coin_experiment, coin_condition, coin_wait, infoState, timeWaitedForCoins, totalCoinsEarned); FileStream stream = new FileStream(Application.persistentDataPath + "/" + dataFileName, FileMode.OpenOrCreate); StreamReader reader = new StreamReader(stream); string json = reader.ReadToEnd(); stream.Close(); reader.Close(); stream = new FileStream(Application.persistentDataPath + "/" + dataFileName, FileMode.Truncate); Motivation motivations = new Motivation(); if (!string.IsNullOrEmpty(json)) { motivations = JsonUtility.FromJson <Motivation> (json); } motivations.Add(motivation); json = JsonUtility.ToJson(motivations); StreamWriter writer = new StreamWriter(stream); writer.Write(json); //motivationJson = json; writer.Flush(); stream.Close(); }
public async Task <IActionResult> Edit(int id, [Bind("Id,ApplicationUserId,DateTime,MotivationText")] Motivation motivation) { if (id != motivation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(motivation); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MotivationExists(motivation.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["ApplicationUserId"] = new SelectList(_context.ApplicationUser, "Id", "Id", motivation.ApplicationUserId); return(View(motivation)); }
public async Task <IActionResult> PostMotivationForType([FromBody] Motivation motivation) { var user = await GetOrThrowForCurrentUser().ConfigureAwait(false); await _storeMotivationCommand.Execute(user.Id, motivation).ConfigureAwait(false); return(Ok()); }
public void ShowScoreForMotivation(Motivation motivation, int score) { var bar = scoreBars.Find(x => x.gameObject.name.ToLower().Contains(motivation.Name.ToLower())); bar.UpdateScore(score); SoundToPlay.Play(); }
public void MotivationHasValidMotivationText() { String text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed " + "doeiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enimad minim veniam"; Motivation motivation = new Motivation(text); Assert.Equal(text, motivation.MotivationText); }
public void MotivationIsNotApprovedByDefault() { String text = "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed " + "doeiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enimad minim veniam"; Motivation motivation = new Motivation(text); Assert.False(motivation.Approved); }
public async Task <IActionResult> Create([Bind("Id,DateTime,MotivationText,ApplicationUserId")] Motivation motivation) { if (ModelState.IsValid) { _context.Add(motivation); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(motivation)); }
public int GetScore(Motivation motivation) { foreach (var entry in MotivationScores) { if (entry.Type == motivation) { return((int)entry.Score); } } return(0); }
private void DefaultMemoryConfiguration() { C_TimePositionYear = 1; C_TimePositionMonth = 1; C_TimePositionDay = 1; C_TimePositionHour = 1; C_TimePositionMinute = 1; C_ThoughtTime = new TimePosition(C_TimePositionYear, C_TimePositionMonth, C_TimePositionDay, C_TimePositionHour, C_TimePositionMinute); C_ThoughtType = 1; C_NeedTime = new TimePosition(C_TimePositionYear, C_TimePositionMonth, C_TimePositionDay, C_TimePositionHour, C_TimePositionMinute); C_NeedType = 1; C_MotivationTime = new TimePosition(C_TimePositionYear, C_TimePositionMonth, C_TimePositionDay, C_TimePositionHour, C_TimePositionMinute); C_MotivationType = 1; C_EventTime = new TimePosition(C_TimePositionYear, C_TimePositionMonth, C_TimePositionDay, C_TimePositionHour, C_TimePositionMinute); C_EventType = 1; C_Need = new Need(C_NeedTime, C_NeedType); C_Motivation = new Motivation(C_MotivationTime, C_MotivationType); C_Thought = new Thought(C_ThoughtTime, C_ThoughtType); C_Event = new Event(C_EventTime, C_EventType); C_DayThoughts = new List <Thought>(); C_DayNeeds = new List <Need> (); C_DayMotivation = new List <Motivation> (); C_DayEvent = new List <Event> (); C_WeekThoughts = new List <Thought>(); C_WeekNeeds = new List <Need> (); C_WeekMotivation = new List <Motivation> (); C_WeekEvent = new List <Event> (); C_MonthThoughts = new List <Thought>(); C_MonthNeeds = new List <Need> (); C_MonthMotivation = new List <Motivation> (); C_MonthEvent = new List <Event> (); C_YearThoughts = new List <Thought>(); C_YearNeeds = new List <Need> (); C_YearMotivation = new List <Motivation> (); C_YearEvent = new List <Event> (); C_LifeThoughts = new List <Thought>(); C_LifeNeeds = new List <Need> (); C_LifeMotivation = new List <Motivation> (); C_LifeEvent = new List <Event> (); C_DayThoughts.Add(C_Thought); C_DayMotivation.Add(C_Motivation); C_DayNeeds.Add(C_Need); C_DayEvent.Add(C_Event); }
public ApprovedStateTest() { Context = new Context { CurrentState = new ApprovedState() }; Group = new Group("Foobar"); Motivation = new Motivation("My motivation"); Motivation.Approved = true; Company = new Company("Name", "Description", "Address", "Website", "Email", new byte[1]); Group.Motivation = Motivation; Motivation.Group = Group; }
private void ReadMotivations(string xmlFileAsText) { XDocument xmlDoc = XDocument.Parse(xmlFileAsText); IEnumerable <XElement> motivations = xmlDoc.Root.Element("Motivations").Elements("Motivation").ToList(); foreach (XElement motivationXelement in motivations) { int id = Convert.ToInt32(motivationXelement.Attribute("ID").Value); string title = motivationXelement.Element("Title").Value; string description = motivationXelement.Element("Description").Value; Motivation motivation = new Motivation(id, title, description); Data.Motivations.Add(motivation); } }
//Initialize world private void button10_Click(object sender, EventArgs e) { this.world.quests.Clear(); ObjectNpcLocation.locations = 0; ObjectNpcLocation.objects = 0; ObjectNpcLocation.person = 0; //Doplni svet nahodnymi postavami int count = this.world.people.Count; int max = Convert.ToInt32(charNumber.Value); for (int i = 0; i < max - count; i++) { GeneratePerson(Convert.ToInt32(motivationDepthNUD.Value)); } List <string> focus = new List <string>(); foreach (var item in this.motivationFocusList.CheckedItems) { focus.Add(item.ToString()); } foreach (Person p in this.world.people) { for (int i = 0; i < 5; i++) { Motivation m = p.randomMotivation(focus); m.questgiver = p.Name; m.GenerateAbstractQuests(Convert.ToInt32(motivationDepthNUD.Value)); this.world.quests.Add(m.Quests); } } this.world.InitializeRelationship(); this.world.repetitionFactor = Convert.ToDouble(this.repetitionNUD.Value) / 100; this.world.options = Convert.ToInt32(this.optionsNUD.Value); this.world.relations = this.relationsCb.Checked; this.world.dramatic = this.dcCb.Checked; dataGridView1.Rows.Clear(); List <Tuple <SuperQuest, double> > fitQuests = world.getFittestQuests(); foreach (Tuple <SuperQuest, double> t in fitQuests) { dataGridView1.Rows.Add(t.Item1.questgiver, t.Item1.name, t.Item1, t.Item2); } }
public void SpawnPlayers() { for (int i = 0; i < PlayerConfig.Instance.PlayableMotivations.Count; i++) { bool active = !SetActivePlayers || ActivePlayers[i]; if (!active) { continue; } Motivation motivation = PlayerConfig.Instance.PlayableMotivations[i]; GameObject player = GameObject.Instantiate(motivation.PlayableObject, PlayerSpawnLocations[i].position, motivation.PlayableObject.transform.rotation); player.AddComponent <MotivationInstance>().Motivation = motivation; player.GetComponent <CharacterControllerRewiredInput>().playerId = i; } }
public void Champ4() { IDChamp = 4; if (Smoke != null && Motivation != null) { Animator animator = Smoke.GetComponent <Animator>(); Animator animator2 = Motivation.GetComponent <Animator>(); if (animator != null && animator2 != null) { animator.SetBool("Open", true); animator2.SetBool("Open", true); Smoke.transform.SetSiblingIndex(5); } } }
public void ReturnMotivation() { AM.PlaySound("Return"); IDChamp = 0; if (Smoke != null && Motivation != null) { Animator animator = Smoke.GetComponent <Animator>(); Animator animator2 = Motivation.GetComponent <Animator>(); if (animator != null && animator2 != null) { animator.SetBool("Open", false); animator2.SetBool("Open", false); Smoke.transform.SetSiblingIndex(0); } } }
public List <Motivation.MotivationModel> GetCurrentMotivationData() { if (File.Exists(Application.persistentDataPath + "/" + dataFileName)) { FileStream stream = new FileStream(Application.persistentDataPath + "/" + dataFileName, FileMode.Open); StreamReader reader = new StreamReader(stream); string json = reader.ReadToEnd(); if (!string.IsNullOrEmpty(json)) { Motivation motivations = JsonUtility.FromJson <Motivation> (json); stream.Close(); reader.Close(); return(motivations.motivations); } stream.Close(); reader.Close(); } return(null); }
public AnnouncedStateTest() { Context = new Context { CurrentState = new AnnouncedState() }; Group = new Group("Foobar"); Motivation = new Motivation("My motivation"); Motivation.Approved = true; Company = new Company("Name", "Description", "Address", "Website", "Email", new byte[1]); Label = new Label(Group, Company); Post = new Post("Announcement"); Label.Post = Post; Post.Label = Label; Group.Label = Label; Company.Label = Label; Group.Motivation = Motivation; Motivation.Group = Group; }
private Motivation CreateMotivation(Group group, Boolean approved = false) { Motivation m = new Motivation("Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed doeiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enimad minim veniam, qu"); group.Motivation = m; m.Approved = approved; if (approved) { group.Context.CurrentState = new ApprovedState(); } else { group.Context.CurrentState = new SubmittedState(); } m.OrganizationName = "Organization Name"; m.OrganizationAddress = "Organization Address"; m.OrganizationWebsite = "http://www.myorganization.com"; m.OrganizationEmail = "*****@*****.**"; return(m); }
public override int GetHashCode() { int hash = 1; if (Status != 0) { hash ^= Status.GetHashCode(); } if (pokemon_ != null) { hash ^= Pokemon.GetHashCode(); } if (GymId.Length != 0) { hash ^= GymId.GetHashCode(); } if (Team != 0) { hash ^= Team.GetHashCode(); } if (DefenderCount != 0) { hash ^= DefenderCount.GetHashCode(); } if (Motivation != 0) { hash ^= Motivation.GetHashCode(); } if (CpNow != 0) { hash ^= CpNow.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public InitialStateTest() { Context = new Context { CurrentState = new InitialState() }; Group = new Group("Foobar"); Organization = new Organization("Foo", "Bar", "foobar.com"); Participant = new Participant(Organization); User = new GUser("*****@*****.**", Participant); Motivation = new Motivation("My motivation"); Participant.Organization = Organization; Organization.Participants.Add(Participant); User.UserState = Participant; Participant.User = User; Group.Organization = Organization; Organization.Groups.Add(Group); Group.Motivation = Motivation; Motivation.Group = Group; }
private Motivation CreateMotivation(Group group, bool approved = false) { var m = new Motivation( "Deze organisatie helpt enorm veel mensen. We zijn enorm blij met al het werk dat ze leveren en willen hun hiermee een hart onder de riem steken."); group.Motivation = m; m.Approved = approved; if (approved) { group.Context.CurrentState = new ApprovedState(); } else { group.Context.CurrentState = new SubmittedState(); } m.OrganizationName = "OCMW Brugge WZC Van Zuylen"; m.OrganizationAddress = "Geralaan 50, 8310 St. Kruis, Brugge"; m.OrganizationWebsite = "https://www.ocmw-brugge.be/"; m.OrganizationEmail = "*****@*****.**"; return(m); }
public IActionResult Update(Participant participant, int id, Motivation motivation) { // Save or submit motivation var group = _groupRepository.GetBy(id); try { if (Request.Form.ContainsKey("submit")) { if (!ModelState.IsValid) { throw new GoedBezigException( ModelState.Values.SelectMany(v => v.Errors.Select(b => b.ErrorMessage)).Join()); } group.Save(motivation); group.Submit(); TempData["success"] = "Uw motivatie werd verzonden naar de begeleidende lector"; } else { group.Save(motivation); TempData["success"] = "Uw motivatie werd opgeslaan"; } _groupRepository.SaveChanges(); return(RedirectToAction("Dashboard", "Group")); } catch (GoedBezigException e) { TempData["error"] = e.Message; return(RedirectToAction("Edit", new { id = group.GroupId })); } }
public virtual void Save(Context context, Group group, Motivation motivation) { throw new StateException($"Operation not supported in {GetType()}: Submit"); }
private void ShowWinnerText(Motivation motivation) { winnerText.text = winnerShadow.text = ("In the end, it was " + motivation.Name + " that truly drove him.").ToUpper(); }
private void Start() { gui = GetComponent <AgentGUI>(); personality = GetComponent <Personality>(); motivation = GetComponent <Motivation>(); }
public override void Save(Context context, Group group, Motivation motivation) { throw new StateException("Motivatie is reeds verzonden"); }
public void Save(Group group, Motivation motivation) { CurrentState.Save(this, group, motivation); }
public async Task <IActionResult> CreateAsync(TrueView model, string search) { List <Marker> list = db.Marker.ToList(); var applicationMax = db.Application; var applicationDetailsMax = db.ApplicationDetails; ViewBag.MarkerList = new SelectList(list, "IdentityNo", "Name"); var markerDatabase = db.Marker; var idNumber = markerDatabase.AsQueryable().Where(idNumber => model.IdentityNo == idNumber.IdentityNo); if (idNumber.Count() <= 0) { Marker marker = new Marker(); marker.IdentityNo = model.IdentityNo; marker.Surname = model.Surname; marker.Initials = model.Initials; marker.Gender = model.Gender; marker.Race = model.Race; marker.Title = model.Title; marker.Persal = model.Persal; marker.MaidenName = model.MaidenName; marker.Nationality = model.Nationality; db.Marker.Add(marker); db.SaveChanges(); } else { List <Marker> allsearch = db.Marker.Where(x => x.IdentityNo.Contains(search)).Select(x => new Marker { IdentityNo = x.IdentityNo, Surname = x.Surname }).ToList(); }; //Application Application application = new Application(); application.IdentityNo = model.IdentityNo; application.Subject = model.Subject; application.Language = model.Language; application.Paper = model.Paper; application.Position = model.Position; application.CurrentPosition = model.CurrentPosition; application.PracticalSubject = model.PracticalSubject; application.PracticalExamination = model.PracticalExamination; application.CheckedBySubjectAdvisor = model.CheckedBySubjectAdvisor; application.RecommendedBySubject = model.RecommendedBySubject; application.SelectionReason = model.SelectionReason; db.Application.Add(application); db.SaveChanges(); //LanguageContact LanguagePreference languagePreference = new LanguagePreference(); languagePreference.IdentityNo = model.IdentityNo; languagePreference.LanguageDescription = model.LanguageDescription; db.LanguagePreference.Add(languagePreference); db.SaveChanges(); //Save contact Contact contact = new Contact(); contact.IdentityNo = model.IdentityNo; contact.TelephoneNo = model.TelephoneNo; contact.WorkSchool = model.WorkSchool; contact.HomeTelephoneNo = model.HomeTelephoneNo; contact.CellphoneNo = model.CellphoneNo; contact.FaxNo = model.FaxNo; contact.EmailAddress = model.EmailAddress; db.Contact.Add(contact); db.SaveChanges(); //Resindent Resident resident = new Resident(); resident.IdentityNo = model.IdentityNo; resident.ResidentialAddress = model.ResidentialAddress; resident.PostalCode = model.PostalCode; resident.Latitude = model.Latitude; resident.Longitude = model.Longitude; resident.FullResidentialAddress = model.FullResidentialAddress; db.Resident.Add(resident); db.SaveChanges(); //currentEmployment CurrentEmployment currentEmployment = new CurrentEmployment(); currentEmployment.IdentityNo = model.IdentityNo; currentEmployment.NameOftheSchoolOffice = model.NameOftheSchoolOffice; currentEmployment.CentreNumber = model.CentreNumber; currentEmployment.District = model.District; currentEmployment.CurrentPosition = model.CurrentPosition; currentEmployment.EmploymentType = model.EmploymentType; currentEmployment.Retiring = model.Retiring; db.CurrentEmployment.Add(currentEmployment); db.SaveChanges(); //Qualification Qualification qualification = new Qualification(); qualification.IdentityNo = model.IdentityNo; qualification.QualificationYear = model.QualificationYear; qualification.QualificationDescription = model.QualificationDescription; qualification.MojarSubjects = model.MojarSubjects; qualification.CourseLevel = model.CourseLevel; qualification.LevelOfDegree = model.LevelOfDegree; qualification.LevelOfDiploma = model.LevelOfDiploma; db.Qualification.Add(qualification); db.SaveChanges(); //Teaching Experience TeachingExperience teachingExperience = new TeachingExperience(); teachingExperience.IdentityNo = model.IdentityNo; teachingExperience.TeachingExperience1 = model.TeachingExperience1; teachingExperience.ExperienceInNcsCaps = model.ExperienceInNcsCaps; teachingExperience.SubjectExperience = model.SubjectExperience; teachingExperience.Fetexperience = model.Fetexperience; teachingExperience.Year = model.Year; teachingExperience.Subject = model.Subject; teachingExperience.Language = model.Language; teachingExperience.Grade = model.Grade; teachingExperience.NameofschooIInstitution = model.NameofschooIInstitution; teachingExperience.PercentageofLearners = model.PercentageofLearners; db.TeachingExperience.Add(teachingExperience); db.SaveChanges(); //Marking Experience MarkingExperience markingExperience = new MarkingExperience(); markingExperience.IdentityNo = model.IdentityNo; markingExperience.MarkingExperienceYear = model.MarkingExperienceYear; markingExperience.Subject = model.Subject; markingExperience.Language = model.Language; markingExperience.PositionHeld = model.PositionHeld; db.MarkingExperience.Add(markingExperience); db.SaveChanges(); ApplicationDetails applicationDetails = new ApplicationDetails(); //Test int max = applicationMax.AsQueryable().Max(pet => pet.AppliactionId); applicationDetails.Subject = model.Subject; applicationDetails.Language = model.Language; applicationDetails.Paper = model.Paper; applicationDetails.ApplicationId = max; db.ApplicationDetails.Add(applicationDetails); db.SaveChanges(); //Prescribe PrescribedWorks prescribedWorks = new PrescribedWorks(); int maxD = applicationDetailsMax.AsQueryable().Max(detail => detail.ApplicationDetailsId); prescribedWorks.ApplicationDetailsId = maxD; prescribedWorks.Drama = model.Drama; prescribedWorks.Novel = model.Novel; prescribedWorks.ShortStories = model.ShortStories; prescribedWorks.Poetry = model.Poetry; db.PrescribedWorks.Add(prescribedWorks); db.SaveChanges(); //Declaration DeclerationByApplicant declerationByApplicant = new DeclerationByApplicant(); declerationByApplicant.IdentityNo = model.IdentityNo; declerationByApplicant.Declaration = model.Declaration; declerationByApplicant.YearAvg = model.YearAvg; declerationByApplicant.TaughtByAverage = model.TaughtByAverage; declerationByApplicant.DistrictYear = model.DistrictYear; declerationByApplicant.CandidatesByDistrictPercentage = model.CandidatesByDistrictPercentage; declerationByApplicant.PercentageYear = model.PercentageYear; declerationByApplicant.ProvincePercentage = model.ProvincePercentage; db.DeclerationByApplicant.Add(declerationByApplicant); db.SaveChanges(); //Motivation Motivation motivation = new Motivation(); motivation.IdentityNo = model.IdentityNo; motivation.MotivationDescription = model.MotivationDescription; db.Motivation.Add(motivation); db.SaveChanges(); ////Applicatio //List<string> result = new List<string>(); //using (SqlConnection con = new SqlConnection("Data Source=197.242.147.140,1433;User ID=markers_user;Password=********;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False")) //{ // using (SqlCommand cmd = new SqlCommand("select DISTINCT IdentityNo from Marker where IdentityNoLIKE '%'+@IdentityNo+'%'", con)) // { // con.Open(); // cmd.Parameters.AddWithValue("@IdentityNo", IdentityNo); // SqlDataReader dr = cmd.ExecuteReader(); // while (dr.Read()) // { // result.Add(dr["IdentityNo"].ToString()); // } // con.Close(); //} return(View(model)); }
public Task Execute(string userId, Motivation motivation) { return(_motivationsStoreManager.InsertMotivation(userId, motivation.MotivationType, motivation.MotivationMessage)); }
protected override Position FindMotivationalTargetInSight(Motivation motivation, IRasterLayer layer, ISpatialGraphEnvironment environment) { throw new NotImplementedException(); }