Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (comboBox1.Text.Equals("Crime") || comboBox2.Text.Length == 0)
            {
                return;
            }
            string CrimeType;

            if (comboBox1.Text.Equals("Corruption"))
            {
                CrimeType = "corrupt";
            }
            else
            {
                CrimeType = comboBox1.Text;
            }
            DateTime time = new DateTime();

            foreach (KeyValuePair <Crime, DateTime> comparer in suspected.Crimes)
            {
                if (comparer.Key.ToString().ToLower().Equals(suspected.LastCrime.ToString().ToLower()))
                {
                    time = comparer.Value;
                }
            }
            if (dateTimePicker1.Value.Year - time.Year >= 0 && dateTimePicker1.Value.Month - time.Month >= 0 && dateTimePicker1.Value.Day - time.Day >= 0)
            {
                suspected.LastCrime = Methods.SetCrime(CrimeType + '>' + comboBox2.Text, '>');
            }
            suspected.Crimes.Add(Methods.SetCrime(CrimeType + ">" + comboBox2.Text, '>'), dateTimePicker1.Value);
            fillTableWithCrimes();
        }
Example #2
0
        protected virtual Dictionary <Crime, DateTime> CreateDictionary(string param)
        {
            Dictionary <Crime, DateTime> result = new Dictionary <Crime, DateTime>();

            Char[]   Characters = new Char[] { ',' };
            string[] a          = param.Split(Characters);
            for (int i = 0; i < a.Length; i++)
            {
                result.Add(Methods.SetCrime(a[i].Substring(0, a[i].IndexOf(':')), '>'), Methods.CreateDate(a[i].Substring(a[i].IndexOf(':') + 1)));
            }
            return(result);
        }
Example #3
0
 public Suspect(string Data)
 {
     History = new StoryCollection();
     Char[]   a       = new Char[] { '~' };
     string[] alldata = Data.Split(a);
     this.PhysData    = new HumanPhysData(alldata[0], alldata[1], alldata[2], Methods.CreateDate(alldata[3]), alldata[4], alldata[5], alldata[6], alldata[7], Convert.ToInt32(alldata[8]));
     this.CrimeNumber = Convert.ToInt32(alldata[9]);
     this.LastCrime   = Methods.SetCrime(alldata[10], '>');
     this.IfWife      = Convert.ToBoolean(alldata[11]);
     this.IfChildren  = Convert.ToBoolean(alldata[12]);
     this.LastSeen    = alldata[13];
     this.Crimes      = CreateDictionary(alldata[14]);
     this.SearchedIn  = alldata[15];
     this.Status      = alldata[16];
     this.PicLoc      = alldata[17];
     History.FillCollection(alldata[18]);
 }
Example #4
0
        public bool MatchesQuery(string[] Data)
        {
            int counter = 0;
            Dictionary <string, string> dictio = this.ReturnData();

            for (int i = 0; i < Data.Length; i++)
            {
                foreach (KeyValuePair <string, string> comparer in dictio)
                {
                    if (Data[i].Substring(0, Data[i].IndexOf(':')).ToLower().Equals(comparer.Key.ToLower()))
                    {
                        if (Data[i].Substring(Data[i].IndexOf(':') + 1).ToLower().Equals(comparer.Value.ToLower()))
                        {
                            counter++;
                        }
                    }
                }
                foreach (KeyValuePair <Crime, DateTime> comparer in Crimes)
                {
                    if (comparer.Key.GetType().Name.ToLower().Equals(ReplaceStr(Data[i].ToLower().Substring(0, Data[i].IndexOf(':')))) && comparer.Key.Equals(Methods.SetCrime(Data[i].ToLower(), ':')))
                    {
                        counter++;
                    }
                }
            }
            if (counter == Data.Length)
            {
                return(true);
            }
            return(false);
        }