コード例 #1
0
        public void CallerNotification(string maxLeadAuditId_encrypted, bool updateNotification)
        {
            // RealTimeNotificationBusiness realTimeNotificationBusiness = new RealTimeNotificationBusiness(unitOfWork);
            LeadAuditBusiness leadAuditBusiness = new LeadAuditBusiness(unitOfWork);
            //  List<RealTimeNotificationModel> realTimeNotificationModel = realTimeNotificationBusiness.GetNotifyByClientId(Convert.ToInt32(Context.RequestCookies["userid"].Value));
            int maxLeadAuditId    = 0;
            int totalNotification = 0;

            if (maxLeadAuditId_encrypted != "0")
            {
                int.TryParse(maxLeadAuditId_encrypted, out maxLeadAuditId);
            }
            leadAuditBusiness.GetNotification(ReadConfiguration.PageSize, Convert.ToInt32(Context.User.Identity.Name.Split(new[] { '|' })[1]), Convert.ToInt32(Context.User.Identity.Name.Split(new[] { '|' })[0]), ref maxLeadAuditId, updateNotification, ref totalNotification);


            Clients.Caller.NewNotification(totalNotification);
        }
コード例 #2
0
        public void SendNotification(string lead_id_encrypted)
        {
            List <HomeVM>                homeVMList    = new List <HomeVM>();
            List <HomeModel>             homeModelList = new List <HomeModel>();
            RealTimeNotificationBusiness realTimeNotificationBusiness = new RealTimeNotificationBusiness(unitOfWork);
            HomeBusiness      homeBusiness      = new HomeBusiness(unitOfWork);
            LeadAuditBusiness leadAuditBusiness = new LeadAuditBusiness(unitOfWork);
            int         maxLeadAuditId          = 0;
            int         companyid              = Convert.ToInt32(Context.User.Identity.Name.Split(new[] { '|' })[1]);
            int         curentuserid           = Convert.ToInt32(Context.User.Identity.Name.Split(new[] { '|' })[0]);
            List <int?> realTimeNotificationId = realTimeNotificationBusiness.GetNotifyClientByCompanyId(companyid, curentuserid, lead_id_encrypted.Decrypt(), ref maxLeadAuditId);

            homeModelList = homeBusiness.GetRecentActivitiesForHome(1, 1, maxLeadAuditId, false, 0, 0);
            AutoMapper.Mapper.Map(homeModelList, homeVMList);

            foreach (int userid in realTimeNotificationId)
            {
                Clients.User(userid.Encrypt()).NewNotification(new { RecentActivities = homeVMList.Select(x => new { CreatedBy = x.CreatedBy, ImageURL = x.ImageURL, LeadAuditId = x.LeadAuditId, ActivityText = x.ActivityText, ActivityCreatedTime = x.ActivityCreatedTime }), MaxLeadAuditID = maxLeadAuditId.Encrypt() });
            }
        }