Exemple #1
0
 private void Start()
 {
     // get the components on the object we need ( should not be null due to require component so no need to check )
     agent              = GetComponentInChildren <NavMeshAgent>();
     character          = GetComponent <ThirdPersonCharacter>();
     residentController = gameObject.GetComponent <Resident> ();
     monthManager       = GameObject.Find("Clock").GetComponent <MonthManager> ();
     criminalController = gameObject.GetComponent <Criminal> ();
     rm = GameObject.Find("ResidentManager").GetComponent <ResidentManager> ();
     //Randomizes the walk speed for residents!
     if (isServer)
     {
         if (criminalController == null)
         {
             GetResidentPoints(monthManager.isDay);      //Sets resident movement locations
             agent.speed = 0.5f;                         //Sets resident speed
         }
         else
         {
             GoCommitCrime();                          //Get Crime Waypoints
             agent.speed = 0.8f;                       //Make criminal walk faster
         }
         agent.updateRotation = false;
         agent.updatePosition = true;
     }
 }
Exemple #2
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,Name,DateOfBirth,CrimeRate,Address,Gender,Height,Weight,Complexion,EyeColor")] Criminal criminal)
        {
            if (id != criminal.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(criminal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CriminalExists(criminal.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(criminal));
        }
Exemple #3
0
 public void captureCriminal(Criminal c, Tile t)
 {
     t.setCriminal(null);
     criminals.Remove(c);
     Destroy(c.gameObject);
     statsManager.crime--;
 }
Exemple #4
0
        public override void OnTimePassed(InteractionInstance interactionInstance, float totalTime, float deltaTime)
        {
            base.OnTimePassed(interactionInstance, totalTime, deltaTime);

            Criminal career = OmniCareer.Career <Criminal>(Career);

            if (career == null)
            {
                return;
            }

            career.AddTimeSpentDoingSideJobs(deltaTime / 60f);
            if (career.TotalTimeSpentDoingSideJobs >= (career.WhenSideJobBonusLastGiven + career.TotalTimeToCompleteCurrentSideJob))
            {
                career.WhenSideJobBonusLastGiven         = career.TotalTimeSpentDoingSideJobs;
                career.TotalTimeToCompleteCurrentSideJob = Criminal.DoASideJob.kNumHoursDoingSideJobsToGetBonus * (1f + RandomUtil.GetFloat(-Criminal.DoASideJob.kSideJobDurationVariance, Criminal.DoASideJob.kSideJobDurationVariance));
                if ((base.Career.OwnerDescription != null) && (base.Career.OwnerDescription.Household != null))
                {
                    int num = Criminal.DoASideJob.kBaseSideJobsBonusAmount + (Criminal.DoASideJob.kSideJobBonusAmountExtraPerCareerLevel * (career.CurLevel.Level - 0x1));
                    num  = (int)(num * (1f + RandomUtil.GetFloat(-Criminal.DoASideJob.kSideJobBonusAmountVariance, Criminal.DoASideJob.kSideJobBonusAmountVariance)));
                    num -= num % 0x5;
                    Household household = base.Career.OwnerDescription.Household;
                    household.ModifyFamilyFunds(num);
                    base.Career.ShowOccupationTNS(LocalizeString(base.Career.OwnerDescription, "SideJobBonusText", new object[] { base.Career.OwnerDescription, num }));
                }
            }
        }
        public EditCriminalPage(Criminal criminal)
        {
            InitializeComponent();

            database = Database.Instance;

            this.criminal = criminal;

            CriminalNameTextBox.Text       = criminal.Name;
            CriminalSurameTextBox.Text     = criminal.Surname;
            CriminalNicknameTextBox.Text   = criminal.Nickname;
            CriminalResidenceTextBox.Text  = criminal.Residence;
            CriminalBirthPlaceTextBox.Text = criminal.BirthPlace;
            if (criminal.BirthDate.ToString().Substring(0, 10) == "01.01.0001")
            {
                CriminalUnknownBirthDateCheckBox.IsChecked = true;
            }
            else
            {
                CriminalBirthDateCalendar.SelectedDate = criminal.BirthDate;
            }
            if (criminal.Wanted == true)
            {
                CriminalWantedCheckBox.IsChecked = true;
            }
        }
Exemple #6
0
        public static MemoryStream Build(Criminal criminal)
        {
            var memoryStreamResult = new MemoryStream();
            var doc    = new Document(PageSize.A4, 40, 40, 40, 40);
            var writer = PdfWriter.GetInstance(doc, memoryStreamResult);

            doc.Open();

            var title = new Paragraph();

            title.Alignment = Element.ALIGN_CENTER;
            title.Font      = new Font(Font.NORMAL, 18, (int)System.Drawing.FontStyle.Bold);
            title.Add("National Criminals Search");
            doc.Add(title);

            var profileParagraph = new Paragraph("", new Font(Font.NORMAL, 14));
            var profile          = $"Name: {criminal.Name}" + System.Environment.NewLine +
                                   $"Birth Date: {criminal.BirthDate:MM/dd/yyyy}" + System.Environment.NewLine +
                                   $"Gender: {ResolveGender(criminal.Gender)}" + System.Environment.NewLine +
                                   $"Height: {criminal.Height}" + System.Environment.NewLine +
                                   $"Weight: {criminal.Weight}" + System.Environment.NewLine +
                                   $"Nationality: {criminal.Nationality}" + System.Environment.NewLine +
                                   $"Father's Name: {criminal.FatherName}" + System.Environment.NewLine +
                                   $"Mother's Name: {criminal.MotherName}" + System.Environment.NewLine +
                                   $"Passport Number: {criminal.PassportNumber}" + System.Environment.NewLine +
                                   $"Driver License Number: {criminal.DriverLicenseNumber}";

            profileParagraph.Add(profile);
            doc.Add(profileParagraph);

            writer.CloseStream = false;
            doc.Close();
            return(memoryStreamResult);
        }
        public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,NickName,Age,Height,BirthDate,BirthPlace,Sex,HairColor,EyeColor,ExtraSigns,LastAccomodation")] Criminal criminal)
        {
            if (id != criminal.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(criminal);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!CriminalExists(criminal.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(criminal));
        }
        public void Create(CriminalDTO criminal)
        {
            Criminal addCriminal = _mapper.Map <Criminal>(criminal);

            unitOfWork.CriminalRepository.InsertOnSubmit(addCriminal);
            unitOfWork.Commit();
        }
        public void SearchPost()
        {
            var c = new Criminal()
            {
                Name          = "asdfg",
                AgeMax        = 59,
                AgeMin        = 56,
                HieghtMax     = 5.4,
                HieghtMin     = 5.2,
                NationalityID = 2,
                gender        = Criminal.Gender.Male,
                Sex           = (char)Criminal.Gender.Male,
                WeightMax     = 78,
                WeightMin     = 76
            };

            string[] emails = new string[] { "*****@*****.**", "*****@*****.**" };

            CriminalsController controller = new CriminalsController(_nationality, _criminal, _mapper);

            // Act
            JavaScriptResult result = controller.Search(c, emails) as JavaScriptResult;

            Assert.AreEqual(result.Script, "<script>alert(\"Success! Results are bieng emailed to you.\");</script>");
        }
Exemple #10
0
        public void InvalidName(string input)
        {
            Criminal criminal = personSeeder.GetRandomPersonSeed <Criminal>();

            criminal.Crimes.Add(new CrimeCriminal());
            criminal.FirstName = input;
            Assert.False(validator.Validate(criminal));
        }
        public AssignCrimePage(Criminal criminal, List <Crime> listOfCrimes)
        {
            InitializeComponent();

            this.criminal              = criminal;
            this.listOfCrimes          = listOfCrimes;
            CrimesComboBox.DataContext = this.listOfCrimes;
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Criminal criminal = db.Criminals.Find(id);

            db.Criminals.Remove(criminal);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
        public UnassignCrimePage(Criminal criminal)
        {
            InitializeComponent();

            this.criminal         = criminal;
            listOfCommittedCrimes = criminal.CommittedCrimes.ToList <CommittedCrime>();

            CommittedCrimesComboBox.DataContext = listOfCommittedCrimes;
        }
 public CriminalProxy()
 {
     _criminalInstance             = new Criminal();
     _criminalInstance.Name        = "";
     _criminalInstance.Nationality = "";
     _criminalInstance.Weight      = 0;
     _criminalInstance.Height      = 0;
     _criminalInstance.Age         = 0;
 }
 public ActionResult Edit([Bind(Include = "ID,CriminalName,DateOfArrest,Crimes,Sanction,ArrestingOfficer")] Criminal criminal)
 {
     if (ModelState.IsValid)
     {
         db.Entry(criminal).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(criminal));
 }
        public ActionResult Create([Bind(Include = "ID,CriminalName,DateOfArrest,Crimes,Sanction,ArrestingOfficer")] Criminal criminal)
        {
            if (ModelState.IsValid)
            {
                db.Criminals.Add(criminal);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(criminal));
        }
        public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,NickName,Age,Height,BirthDate,BirthPlace,Sex,HairColor,EyeColor,ExtraSigns,LastAccomodation")] Criminal criminal)
        {
            if (ModelState.IsValid)
            {
                _context.Add(criminal);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(criminal));
        }
Exemple #18
0
        public async Task <IActionResult> Create([Bind("ID,Name,DateOfBirth,CrimeRate,Address,Gender,Height,Weight,Complexion,EyeColor")] Criminal criminal)
        {
            if (ModelState.IsValid)
            {
                _context.Add(criminal);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(criminal));
        }
        // GET: Criminals/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Criminal criminal = db.Criminals.Find(id);

            if (criminal == null)
            {
                return(HttpNotFound());
            }
            return(View(criminal));
        }
Exemple #20
0
        private void ListView_MoveToListevent(object sender, EventArgs e)
        {
            if (listView.ArchiveList.CurrentRow != null)
            {
                Criminal c = listView.ArchiveList.CurrentRow.DataBoundItem as Criminal;

                fileCabinet.MoveToList(c);
                listView.CBS.DataSource = fileCabinet.Criminals;
                listView.ABS.DataSource = fileCabinet.Archive;
                listView.CBS.ResetBindings(false);
                listView.ABS.ResetBindings(false);
                fileCabinet.Save();
            }
        }
        public bool SearchCriminals(CriminalDTO criminal, string[] emails)
        {
            Criminal criteria = _mapper.Map <Criminal>(criminal);
            IEnumerable <Criminal> criminals = unitOfWork.CriminalRepository.Search(criteria);

            if (criminals.Count() != 0)
            {
                var thread = new Thread(SendMailThread.Instace.DoWork);
                thread.Start();
                SendCriminalRecords(criminals, emails);
                return(true);
            }
            return(false);
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Criminal = await _context.Criminal.FirstOrDefaultAsync(m => m.Id == id);

            if (Criminal == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #23
0
 public List <Criminal> SearchCriminal(Criminal CriminalSearch)
 {
     using (PoliceSystemEntities db = new PoliceSystemEntities())
     {
         if (CriminalSearch != null)
         {
             var searchcriminal = db.Criminals.Where(a => a.Cnic == CriminalSearch.Cnic || a.Name == CriminalSearch.Name).ToList();
             return(searchcriminal);
         }
         else
         {
             return(null);
         }
     }
 }
Exemple #24
0
 public bool AddCriminal(Criminal addCriminal)
 {
     using (PoliceSystemEntities db = new PoliceSystemEntities())
     {
         if (addCriminal != null)
         {
             db.Criminals.Add(addCriminal);
             db.SaveChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Exemple #25
0
        // Methods
        public override void BeginCareerTone(InteractionInstance interactionInstance)
        {
            base.BeginCareerTone(interactionInstance);

            Criminal career = OmniCareer.Career <Criminal>(Career);

            if (career == null)
            {
                return;
            }

            if (career.TotalTimeToCompleteCurrentSideJob < 0.5f)
            {
                career.TotalTimeToCompleteCurrentSideJob = Criminal.DoASideJob.kNumHoursDoingSideJobsToGetBonus * (1f + RandomUtil.GetFloat(-Criminal.DoASideJob.kSideJobDurationVariance, Criminal.DoASideJob.kSideJobDurationVariance));
            }
        }
Exemple #26
0
        public async Task <IActionResult> OnPostAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Criminal = await _context.Criminal.FindAsync(id);

            if (Criminal != null)
            {
                _context.Criminal.Remove(Criminal);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }
Exemple #27
0
    public Criminal createCriminal(int x, int z)
    {
        GameObject criminalObject = Instantiate(prefabs.criminal);

        criminalObject.transform.parent = criminalFolder.transform;
        Criminal criminalScript = criminalObject.GetComponent <Criminal>();

        criminals.Add(criminalScript);
        // initialize criminal
        if (Random.value > .5)
        {
            criminalScript.level   = 2;
            criminalScript.canMove = true;
        }
        criminalScript.setLocation(x, z);
        statsManager.crime++;
        return(criminalScript);
    }
Exemple #28
0
        public async Task <IActionResult> OnGetAsync(long?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Criminal = await _context.Criminal
                       .Include(c => c.Casualties)
                       .Include(c => c.Staff)
                       .Include(c => c.TypesCrimes).FirstOrDefaultAsync(m => m.ID == id);

            if (Criminal == null)
            {
                return(NotFound());
            }
            return(Page());
        }
Exemple #29
0
 public void SeedDatabase(int records = 10)
 {
     for (int i = 0; i < records; i++)
     {
         Console.Clear();
         Console.WriteLine("Seeding database: {0}/{1}", i + 1, records);
         using (var unitOfWork = new UnitOfWork(new CriminalContext()))
         {
             Crime crime          = _crimeSeeder.GetRandomCrimeSeed();
             int   criminalAmount = _randomGenerator.GetRandomInt(1, 5);
             for (int ca = 0; ca < criminalAmount; ca++)
             {
                 Criminal criminal = _personSeeder.GetRandomPersonSeed <Criminal>();
                 criminal.Description = "Random Description";
                 //Adding to fields
                 CrimeCriminal crimeCriminal = new CrimeCriminal();
                 crimeCriminal.Criminal = criminal;
                 crimeCriminal.Crime    = crime;
                 criminal.Crimes.Add(crimeCriminal);
                 crime.CrimeCriminals.Add(crimeCriminal);
                 //Adding to databses
                 unitOfWork.Repository <Criminal>().Add(criminal);
                 unitOfWork.Repository <CrimeCriminal>().Add(crimeCriminal);
             }
             int victimAmount = _randomGenerator.GetRandomInt(1, 5);
             for (int va = 0; va < victimAmount; va++)
             {
                 Victim victim = _personSeeder.GetRandomPersonSeed <Victim>();
                 //Adding to fields
                 CrimeVictim crimeVictim = new CrimeVictim();
                 crimeVictim.Victim = victim;
                 crimeVictim.Crime  = crime;
                 victim.Crimes.Add(crimeVictim);
                 crime.CrimeVictims.Add(crimeVictim);
                 //Adding to databse
                 unitOfWork.Repository <Victim>().Add(victim);
                 unitOfWork.Repository <CrimeVictim>().Add(crimeVictim);
             }
             unitOfWork.Complete();
         }
     }
 }
        public void CriminalVeiwModelValidationFailedTest()
        {
            var c = new Criminal()
            {
                Name          = null,
                AgeMax        = 5999,
                AgeMin        = 56321,
                HieghtMax     = 0.4,
                HieghtMin     = 0.2,
                NationalityID = 2,
                Sex           = 'R',
                WeightMax     = 787,
                WeightMin     = -98
            };
            var context             = new ValidationContext(c, null, null);
            var results             = new List <ValidationResult>();
            var isModelStateInValid = Validator.TryValidateObject(c, context, results, true);

            Assert.IsFalse(isModelStateInValid);
        }