Exemplo n.º 1
0
        //משווה בין תייר לכל המדריכים
        public List <CalculateMatch> CalculateMatchBetweenTouristToAllGuides(int id)
        {
            Match m = new Match();

            m = m.GetTouristMatchDetailsByID(id);                                               //מקבלת תייר ספציפי ע"פ פורמט הנרמול

            List <Match> AllGuides = m.GetGuidesDetails();                                      //מביא את כל המדריכים ע"פ פורמט הנרמול

            List <Guide_Tourist>  listRanks    = new List <Guide_Tourist>();                    //רשימת ניקודים שהתיירים נתנו למדריכים
            List <CalculateMatch> TouristsList = CalculateMatchBetweenTouristToAllTourists(id); //מביא את ההשוואות בין תייר לכל שאר התיירים

            for (int i = 0; i < TouristsList.Count; i++)                                        //רץ על כל רשימת השוואות התיירים
            {
                if (TouristsList[i].Percents > 60)                                              //בודק אם יש תייר שדומה לתייר במעל 60 אחוזים
                {
                    Guide_Tourist g = new Guide_Tourist();
                    g = g.GetRankByID(TouristsList[i].Id2); //מקבל את הניקודים שתייר ספציפי נתן למדריכים
                    if (g.Rank > 0)
                    {
                        listRanks.Add(g); //מכניס לרשימת הניקודים שהתייר נתן למדריכים
                    }
                }
            }
            List <CalculateMatch> tempCal = Calculate(m, AllGuides, listRanks);

            return(tempCal);
        }
Exemplo n.º 2
0
        //מכניסה ניקוד חדש שתייר נתן למדריך
        public int PostGuideTouristRank(Guide_Tourist guide_Tourist)
        {
            int                  num = 0;
            DBservices           db  = new DBservices();
            List <Guide_Tourist> gt  = db.CheckIfTouristGaveRank(guide_Tourist);

            if (gt.Count > 0)
            {
                for (int i = 0; i < gt.Count; i++)
                {
                    if (guide_Tourist.guidegCode == gt[i].guidegCode && guide_Tourist.TouristId == gt[i].TouristId)
                    {
                        db.UpdateRankGuideByTourist(guide_Tourist);
                        num = 1;
                    }
                    else
                    {
                        db.PostRankGuideByTourist(guide_Tourist);
                        num = 1;
                    }
                }
            }
            else
            {
                db.PostRankGuideByTourist(guide_Tourist);
                num = 1;
            }

            GetAllRanksOfGuide(guide_Tourist.guidegCode);
            return(num);
        }
Exemplo n.º 3
0
        public List <Guide_Tourist> UpdateRequest(Guide_Tourist g)
        {
            DBservices db  = new DBservices();
            int        num = db.UpdateTouristRequestInSQL(g);

            if (num == 1)
            {
                return(db.GetAllGuideRequests(g.GuideEmail));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 4
0
        public List <Guide_Tourist> GetAllListStatus(List <Tourist> tourists)
        {
            DBservices           db = new DBservices();
            List <Guide_Tourist> gt = new List <Guide_Tourist>();

            for (int i = 0; i < tourists.Count; i++)
            {
                Guide_Tourist g = new Guide_Tourist();
                g = db.GetTouristStatus(tourists[i].Email);
                if (g.Status == "Start Chat")
                {
                    gt.Add(g);
                }
            }
            return(gt);
        }
Exemplo n.º 5
0
        public int AddRequest(Guide_Tourist gt)
        {
            int           num          = 0;
            DBservices    db           = new DBservices();
            Guide_Tourist guideTourist = db.GetRequestByTouristEmailAndGuideEmail(gt.TouristEmail, gt.GuideEmail);

            if (guideTourist.GuideEmail != null)
            {
                num = db.updateStatusGuideTourist(gt);
            }
            else
            {
                num = db.AddRequest(gt);
            }
            return(num);
        }