private string GetInfoStr(UninUser user)
 {
     var sb=new StringBuilder();
     sb.Append(user.User.Age+"岁 | ");
     if (!string.IsNullOrEmpty(user.BaseInfo.Height))
     {
         sb.Append(user.BaseInfo.Height + " | ");
     }
     if (!string.IsNullOrEmpty(user.BaseInfo.Education))
     {
         sb.Append(user.BaseInfo.Education + " | ");
     }
     if (!string.IsNullOrEmpty(user.BaseInfo.MonthlyIncome))
     {
         sb.Append(user.BaseInfo.MonthlyIncome );
     }
     sb.Append("<br/>");
     sb.Append(PrivateDb.IamgeCount(user.User.UserId) + "张照片 | ");
     sb.Append("资料完整度" + GetPersent(user.User.UserId)*100 + "%");
     sb.Append("<br/>");
     sb.Append(LastLoginstr(user.User.UserId));
     return sb.ToString();
 }
Beispiel #2
0
        /// <summary>
        /// 匹配user是否符合搜索条件
        /// </summary>
        /// <param name="condition"></param>
        /// <param name="biguser"></param>
        /// <returns></returns>
        private bool MarchUser(Search condition, UninUser biguser)
        {
            // 先判断user的部分
            var residenceprovflag = false;
            var residencecityflag = false;
            var ageflag = false;
            var educationflag = false;
            var incomeflag = false;
            var housingflag = false;
            var carflag = false;
            var conflag = false;
            //var hightflag = false;
            var peopleflag = false;
            var stateflag = false;

            // 还要判断user 自身的资料是否是不为null的。

            //if ((biguser.BaseInfo.ResidenceCity != null && biguser.BaseInfo.ResidenceCity.Contains(condition.ResidenceCity)) || string.IsNullOrEmpty(condition.ResidenceCity))
            //{
            //    residenceflag = true;
            //}
            //所在地省份
            if (string.IsNullOrEmpty(condition.ProvBelong) || (biguser.BaseInfo.ResidenceProvince != null && (condition.ProvBelong == biguser.BaseInfo.ResidenceProvince ||
                biguser.BaseInfo.ResidenceProvince.Contains(condition.ProvBelong))))
            {
                residenceprovflag = true;
            }
            //所在地城市
            if (string.IsNullOrEmpty(condition.CityBelong) || (biguser.BaseInfo.ResidenceCity != null && (condition.CityBelong == biguser.BaseInfo.ResidenceCity ||
            biguser.BaseInfo.ResidenceCity.Contains(condition.CityBelong))))
            {
                residencecityflag = true;
            }
            //年龄
            if ((condition.AgeUp == 0 || (biguser.User.Age != 0 && biguser.User.Age <= condition.AgeLow && biguser.User.Age >= condition.AgeUp))//agelow 要比 ageup 大
                || (condition.AgeLow == 0 && biguser.User.Age >= condition.AgeUp))
            {
                ageflag = true;
            }
            //学历
            if (string.IsNullOrEmpty(condition.Education) || condition.Education == "学历不限" || biguser.BaseInfo.Education != null && ((condition.Education.Contains("及以上") && IntEducation(biguser.BaseInfo.Education) >= IntEducation(condition.Education))
                 || (!condition.Education.Contains("及以上") && IntEducation(biguser.BaseInfo.Education) == IntEducation(condition.Education))))
            {
                educationflag = true;
            }
            //收入
            if (string.IsNullOrEmpty(condition.MonthlyIncome) ||
              (biguser.BaseInfo.MonthlyIncome != null && ((IntIncome(biguser.BaseInfo.MonthlyIncome) >= IntIncome(condition.MonthlyIncome) && condition.MonthlyIncome != "3000元以下") ||
              IntIncome(biguser.BaseInfo.MonthlyIncome) <= IntIncome(condition.MonthlyIncome) && condition.MonthlyIncome == "3000元以下")))
            {
                incomeflag = true;
            }
            // 汽车
            if (string.IsNullOrEmpty(condition.Car) || (biguser.DetailInfo.Car != null && biguser.DetailInfo.Car == condition.Car))
            {
                carflag = true;
            }
            //住房
            if (string.IsNullOrEmpty(condition.Housing) ||
                (biguser.DetailInfo.Housing != null && biguser.DetailInfo.Housing == condition.Housing))
            {
                housingflag = true;
            }
            //星座
            if (string.IsNullOrEmpty(condition.Constellation) || (biguser.DetailInfo.Constellation != null && biguser.DetailInfo.Constellation == condition.Constellation))
            {
                conflag = true;
            }
            //身高
            //int hight = Convert.ToInt32(biguser.BaseInfo.Height.Split('厘')[0]);
            //if (condition.HightUp == 0 || (biguser.BaseInfo.Height != null && ((hight <= condition.HightLow && hight >= condition.HightUp && condition.HightLow != 0)
            //    || (condition.HightLow == 0 && hight >= condition.HightUp))))
            //{
            //    hightflag = true;
            //}

            if (string.IsNullOrEmpty(condition.People) || (biguser.DetailInfo.People != null && condition.People == biguser.DetailInfo.People))
            {
                peopleflag = true;
            }
            if (string.IsNullOrEmpty(condition.State) || (biguser.BaseInfo.State != null && condition.State == biguser.BaseInfo.State))
            {
                stateflag = true;
            }

            return residencecityflag && residenceprovflag && ageflag && educationflag && incomeflag && housingflag &&
                   carflag && conflag && peopleflag && stateflag;
        }
Beispiel #3
0
        /// <summary>
        /// first和second比较,second为主体  到时候要改成返回对象 
        /// </summary>
        /// <param name="user">被比较者的Id</param>
        /// <param name="second">比较着的资料</param>
        /// <returns></returns>
        private double TomeRate(UninUser user, Requirement second)
        {
            var tomeInts = GetTomeInts(user, second);

            return (double)tomeInts.Sum()/ 5;
        }
Beispiel #4
0
        public bool PartMathUser(Requirement condition, UninUser biguser)
        {
            var residenceflag = false;
            var ageflag = false;
            var hightflag = false;

            if (string.IsNullOrEmpty(condition.ResidenceCity)||(biguser.BaseInfo.ResidenceCity != null && biguser.BaseInfo.ResidenceCity.Contains(condition.ResidenceCity)) )
            {
                residenceflag = true;
            }

            //年龄
            if ((condition.AgeLl == 0 || (biguser.User.Age != 0 && biguser.User.Age <= condition.AgeUl && biguser.User.Age >= condition.AgeLl))//agelow 要比 ageup 大
                || (condition.AgeUl == 0 && biguser.User.Age >= condition.AgeLl))
            {
                ageflag = true;
            }

            //身高
            int hight = Convert.ToInt32(biguser.BaseInfo.Height.Split('厘')[0]);
            if (condition.HightLl == 0 || (biguser.BaseInfo.Height != null && ((hight <= condition.HightUl && hight >= condition.HightLl && condition.HightUl != 0)
                || (condition.HightUl == 0 && hight >= condition.HightLl))))
            {
                hightflag = true;
            }
            return hightflag && residenceflag && ageflag;
        }
Beispiel #5
0
        /// <summary>
        /// 两者需求匹配度
        /// </summary>
        /// <param name="user"></param>
        /// <param name="second"></param>
        /// <returns></returns>
        public int[] GetTomeInts(UninUser user, Requirement second)
        {
            var firstage = user.User.Age;
            var high =string.IsNullOrEmpty(user.BaseInfo.Height)?0:Convert.ToInt16(user.BaseInfo.Height.Split('厘')[0]);

            var tomeInts = new int[5];

            //没有年龄限制,或者在second的要求范围内,Ageui=0表示是没有上限。
            if (second.AgeLl == 0 || (second.AgeLl <= firstage && (second.AgeUl == 0 || second.AgeUl >= firstage)))
            {
                tomeInts[0] = 1;
            }

            // 地方
            if (string.IsNullOrEmpty(second.ResidenceProvince) ||
                (second.ResidenceProvince == user.BaseInfo.ResidenceProvince &&
                 (second.ResidenceCity == user.BaseInfo.ResidenceCity || string.IsNullOrEmpty(second.ResidenceCity))))
            {
                tomeInts[1] = 1;
            }
            //身高
            if (second.HightLl == 0 || (second.HightLl <= high && (second.HightUl == 0 || second.HightUl >= high))||high==0)
            {
                tomeInts[2] = 1;
            }

            //学历 null 大专 本科 硕士 博士 /不限 大专以下 大专及以上  本科+  硕士+ 博士+
            if (string.IsNullOrEmpty(second.Education) ||
                (ChangEducationToNum(second.Education) <= ChangEducationToNum(user.BaseInfo.Education) && !string.IsNullOrEmpty(user.BaseInfo.Education)))
            {
                tomeInts[3] = 1;
            }

            //月收入 先算出中间值。
            int mm=0;
            if (!string.IsNullOrEmpty(user.BaseInfo.MonthlyIncome))
            {
                mm = user.BaseInfo.MonthlyIncome == "3000元以下" ? 2500 : Convert.ToInt16(user.BaseInfo.MonthlyIncome.Split('-')[0]) + 500;
            }

            if (second.MonthlyIncomeLl == 0 ||
                (second.MonthlyIncomeLl < mm || (second.MonthlyIncomeUl == 0 || second.MonthlyIncomeUl > mm)) || mm==0)
            {
                tomeInts[4] = 1;
            }
            return tomeInts;
        }
Beispiel #6
0
        public UninUser GetMyself()
        {
            var id = CheckValid();
            if (id != -1)
            {
                return _meUninUser ?? (_meUninUser = PrivateDb.GetUninUser(CheckValid()));
            }

            return null;
        }