示例#1
0
        public static ArrayList GetMatches(People people)
        {
            ArrayList list = new ArrayList();

            mydic_whoami.Clear();
            mydic_whoiwant.Clear();

            foreach (DictinorayRow row in DictinorayRow.DictinorayList)
            {
                int temp = row.IsMatchWord(people.Details.WhoAmI);
                if (temp == 1 || temp == -1)
                {
                    if (temp == -1)
                    {
                        row.ChangeToUpSitewords();
                    }
                    mydic_whoami.Add(row);
                    mydic_not_type.Add(row);
                }
            }
            foreach (DictinorayRow row in DictinorayRow.DictinorayList)
            {
                int temp = row.IsMatchWord(people.Details.WhoAmI);
                if (temp == 1 || temp == -1)
                {
                    if (temp == -1)
                    {
                        row.ChangeToUpSitewords();
                    }
                    mydic_whoiwant.Add(row);
                    mydic_not_type.Add(row);
                }
            }

            MatchesChecks xmatch = new MatchesChecks();

            xmatch.p = people;
            string show = " AND SHOW <> 8 AND (show <2 or (show=5 and chadchan like '%{" + GLOBALVARS.MyUser.ID + "}%') or (show=4 and chadchan like '%{" + GLOBALVARS.MyUser.ID + "}%'))";

            if (GLOBALVARS.MyUser.Control == User.TypeControl.Manger || GLOBALVARS.MyUser.Control == User.TypeControl.Admin)
            {
                show = " and show <> 8";
            }

            string sql = "select zerem,looks,show,chadchan,whoami,whoiwant,[peopledetails].[relatedid],[Peoples].[ID],FirstName,facecolor,sexs,Lastname,tall,status,fat,age,show,notes from peoples inner join peopledetails on ID=relatedid  ";

            sql += xmatch.GetSqlCheck() + show;
            SqlDataReader reader = DBFunction.ExecuteReader(sql);

            while (reader.Read())
            {
                Match result = new Match();

                result.Name = reader["firstname"].ToString() + " " + reader["lastname"].ToString();
                result.ID   = (int)reader["id"];

                //FAT CHECK
                result.FatCheckString = xmatch.FatCheck(reader["fat"].ToString(), ref result.FatMatchLevel);


                //FACECOLOR CHECK
                result.FaceColorCheckString = xmatch.FaceColorCheck(reader["facecolor"].ToString(), ref result.FaceColorMatchLevel);


                //Looks CHECK
                result.LooksCheckString = xmatch.LooksCheck(reader["looks"].ToString(), ref result.LooksMatchLevel);


                //FromDic CHECK
                result.DicCheckString.AddRange(xmatch.CheckFromDic(reader["looks"].ToString(), "LookChange", ref result.DicMatchLevel));
                //  result.DicCheckString.AddRange(xmatch.CheckFromDic(reader["zerem"].ToString(), "ZeremChange", ref result.DicMatchLevel));
                result.DicCheckString.AddRange(xmatch.CheckFromDic(reader["facecolor"].ToString(), "FaceChange", ref result.DicMatchLevel));



                // STATUS CHECK
                result.StatusCheckString = xmatch.StatusCheck(reader["status"].ToString(), ref result.MatchLevel);


                //EDA CHECK   NEEEED TO FIXXX
                result.ZeremOfEdaString = xmatch.ZeremCheck(reader["zerem"].ToString(), ref result.ZeremOfEdaMatchLevel);



                //WHOAMI + LOOKFOR CHECK

                result.WhoamiCheckString.AddRange(xmatch.FindPropties(reader["whoiwant"] as string, ref result.WhoAmIMatchLevel, false));

                result.LookForCheckString.AddRange(xmatch.FindPropties(reader["whoami"] as string, ref result.LookForMatchLevel, true));



                result.MatchLevel += result.FaceColorMatchLevel + result.FatMatchLevel + result.LooksMatchLevel +
                                     result.ZeremOfEdaMatchLevel + result.LookForMatchLevel + result.WhoAmIMatchLevel +
                                     result.DicMatchLevel;

                list.Add(result);
            }
            reader.Close();

            return(list);
        }