Ejemplo n.º 1
0
        public override System.Threading.Tasks.Task OnDisconnected(bool stopCalled)
        {
            MessangerManager messangerManager = new MessangerManager();
            Guid             bosGuid          = Guid.Empty;

            Guid kullanici_id = messangerManager.fakeOfflineOl(Context.ConnectionId);

            if (kullanici_id != bosGuid)
            {
                ControllerLoglamaManager controllerLoglamaManager = new ControllerLoglamaManager();
                ControllerLoglama        log = controllerLoglamaManager.LoglamaGetir(kullanici_id);

                Thread.Sleep(8000);

                MessangerManager messangerManager2 = new MessangerManager();
                OnlineUser       kullanici         = messangerManager2.OnlineMi(kullanici_id);

                VotedressUserManager votedressUserManager = new VotedressUserManager();

                if (kullanici != null && kullanici.Disconnected == "reflesh")
                {
                    if ((log.Burdan == "Gardrop/Magaza" && log.Buraya == "Gardrop/Magaza") || (log.Burdan == "Gardrop/UrunDetayliIncele" && log.Buraya == "Gardrop/UrunDetayliIncele"))
                    {
                        //Demekki magazada reflesh olmuş birşey yapma
                    }
                    else if ((log.Burdan == "Gardrop/Magaza" && log.Buraya != "Gardrop/UrunDetayliIncele") || (log.Burdan == "Gardrop/UrunDetayliIncele" && log.Buraya != "Gardrop/Magaza"))//magazadan başka bir yere gidilmiş demekki magazadan çıkılmıs
                    {
                        Groups.Remove(Context.ConnectionId, "Gardrop");
                        votedressUserManager.MagazadakilerinSayisiniAzalt(log.parameter);
                        Clients.Group("Gardrop").BiriMagazadanCikti(log.parameter);
                    }
                }
                else
                {
                    OnlineUser        offline_olundumu  = messangerManager.OfflineOl(kullanici_id);
                    List <OnlineUser> online_arkadaslar = messangerManager.OnlineArkadaslar(kullanici_id);

                    for (int i = 0; i < online_arkadaslar.Count; i++)
                    {
                        Clients.Client(online_arkadaslar[i].ConnectionId).BirisiOfflineOldu(kullanici_id);
                    }

                    if (log.Buraya == "Gardrop/Magaza" || log.Buraya == "Gardrop/UrunDetayliIncele")
                    {
                        votedressUserManager.MagazadakilerinSayisiniAzalt(log.parameter);

                        Groups.Remove(Context.ConnectionId, "Gardrop");
                        Clients.OthersInGroup("Gardrop").BiriMagazadanCikti(log.parameter);
                    }
                }
            }
            return(base.OnDisconnected(stopCalled));
        }
        public void Logla(VotedressUser user, string ControllerName, string ActionName, string Parameter, DateTime CreatedTime)
        {
            GenericUnitOfWork unitOfWork = new GenericUnitOfWork();

            ControllerLoglama loglanmismi = new ControllerLoglama();

            loglanmismi = unitOfWork.Repository <ControllerLoglama>().Find(x => x.KullaniciId == user.id);

            if (loglanmismi != null && Parameter != "")
            {
                loglanmismi.Burdan      = loglanmismi.Buraya;
                loglanmismi.Buraya      = ControllerName + "/" + ActionName;
                loglanmismi.CreatedTime = CreatedTime;
                loglanmismi.parameter   = Parameter;

                unitOfWork.Repository <ControllerLoglama>().Update(loglanmismi);
                unitOfWork.SaveChanges();
            }
            else if (loglanmismi != null && Parameter == "")
            {
                loglanmismi.Burdan      = loglanmismi.Buraya;
                loglanmismi.Buraya      = ControllerName + "/" + ActionName;
                loglanmismi.CreatedTime = CreatedTime;

                unitOfWork.Repository <ControllerLoglama>().Update(loglanmismi);
                unitOfWork.SaveChanges();
            }
            else
            {
                ControllerLoglama eklenecek = new ControllerLoglama()
                {
                    KullaniciId = user.id,
                    Burdan      = "",
                    Buraya      = ControllerName + "/" + ActionName,
                    parameter   = Parameter,
                    CreatedTime = CreatedTime
                };

                unitOfWork.Repository <ControllerLoglama>().Insert(eklenecek);
                unitOfWork.SaveChanges();
            }
        }
Ejemplo n.º 3
0
        public void OnlineOl(Guid kullanici_id)
        {
            MessangerManager messangerManager = new MessangerManager();

            int online_olundumu = messangerManager.OnlineOl(Context.ConnectionId, kullanici_id);

            if (online_olundumu == -1)
            {
                Clients.Client(Context.ConnectionId).OnlineOlunamadi();
            }
            else if (online_olundumu == 0)
            {
                Clients.Client(Context.ConnectionId).OnlineOlundu();
                List <OnlineUser> online_arkadaslar = messangerManager.OnlineArkadaslar(kullanici_id);

                if (online_arkadaslar != null)
                {
                    for (int i = 0; i < online_arkadaslar.Count; i++)
                    {
                        Clients.Client(online_arkadaslar[i].ConnectionId).BirisiOnlineOldu(kullanici_id);
                    }
                }
            }
            else
            {
                Clients.Client(Context.ConnectionId).ZatenOnlineydiniz();
            }


            VotedressUserManager     votedressUserManager     = new VotedressUserManager();
            ControllerLoglamaManager controllerLoglamaManager = new ControllerLoglamaManager();
            ControllerLoglama        log = controllerLoglamaManager.LoglamaGetir(kullanici_id);

            if (log.Buraya == "Gardrop/Magaza" && log.Burdan != "Gardrop/Magaza")
            {
                votedressUserManager.MagazadakilerinSayisiniArttir(log.parameter);

                Groups.Remove(Context.ConnectionId, "Gardrop");
                Clients.OthersInGroup("Gardrop").BiriMagazayaGirdi(log.parameter);
            }
        }