Beispiel #1
0
        public List <Found> GetFoundsPersonalArea(Person person)
        {
            SqlCommand    cmd         = ConnectSql(string.Format("Select * From Found Where FindID = '{0}'", person.PersonID));
            SqlDataReader reader      = cmd.ExecuteReader();
            List <Found>  resultFound = new List <Found>();
            Found         found       = new Found();

            while (reader.Read())
            {
                resultFound.Add(found.Initialization(reader));
            }
            connection.DisConnectSql();
            int x = resultFound.Count();

            return(resultFound);
        }
Beispiel #2
0
        public List <Found> GetLosses()
        {
            SqlCommand    cmd          = ConnectSql("Select * from Found");
            SqlDataReader reader       = cmd.ExecuteReader();
            List <Found>  resultFounds = new List <Found>();
            Found         found        = new Found();

            while (reader.Read())
            {
                resultFounds.Add(found.Initialization(reader));
            }
            connection.DisConnectSql();
            if (resultFounds.Count() == 0)
            {
                return(null);
            }
            return(resultFounds);
        }
Beispiel #3
0
        public List <Found> GetFounds(Signs signs)
        {
            SqlCommand    cmd          = ConnectSql("Select * From Found");
            SqlDataReader reader       = cmd.ExecuteReader();
            List <Found>  resultFounds = new List <Found>();
            Found         found        = new Found();

            while (reader.Read())
            {
                resultFounds.Add(found.Initialization(reader));
            }
            connection.DisConnectSql();

            int flag, i, j;

            for (i = resultFounds.Count() - 1; i >= 0; i--)
            {
                flag = 0;
                if (resultFounds[i].FoundDate.CompareTo(signs.Date.Subtract(TimeSpan.FromDays(7))) >= 0)
                {
                    if (resultFounds[i].CategoryCode == signs.Category)
                    {
                        flag += 30;
                    }
                    if (signs.Description != " ")
                    {
                        string[] description = signs.Description.Split(' ');
                        j = 0;
                        foreach (string word in description)
                        {
                            string[] FoundDesc = resultFounds[i].FoundDesc.Split(' ');
                            foreach (string desc in FoundDesc)
                            {
                                j += word.Contains(desc) == true ? 1 : 0;
                            }
                        }
                        if (j != 0)
                        {
                            flag += 20;
                        }
                    }
                    else
                    {
                        flag += 10;
                    }
                    if (GetRelevantColors(signs.Color).Contains(resultFounds[i].FoundColor.ToString()))
                    {
                        flag += 15;
                    }
                    if (signs.Remarks != " ")
                    {
                        string[] remarks = signs.Remarks.Split(' ');
                        j = 0;
                        foreach (string word in remarks)
                        {
                            string[] FoundRemark = resultFounds[i].Remarks.Split(' ');
                            foreach (string remark in FoundRemark)
                            {
                                j += word.Contains(remark) == true ? 1 : 0;
                            }
                        }
                        if (j != 0)
                        {
                            flag += 20;
                        }
                    }
                    else
                    {
                        flag += 10;
                    }
                }
                if (flag <= 60)
                {
                    resultFounds.Remove(resultFounds[i]);
                }
            }

            return(resultFounds);
        }