Example #1
0
        /// <summary>
        /// 新链接处理
        /// </summary>
        /// <param name="session"></param>
        /// <param name="value"></param>
        private void ServerBroker_NewSessionConnected(SkeFramework.Core.WebSocketPush.PushServices.PushClients.WebSocketSession session, Guid value)
        {
            ClientVo clientVo       = JsonConvert.DeserializeObject <ClientVo>(session.SessionExtraProps);
            string   clientRedisKey = RedisUtil.GetUserIdRedisKey(clientVo.AppId, clientVo.UserId);

            ServerConfig.Redis.GetSet(clientRedisKey, session.SessionId.ToString());
        }
Example #2
0
        public ClientVo update(ClientVo input, int?clientId = null)
        {
            using (var db = new MainDb())
            {
                if (clientId == null)
                {
                    clientId = input.clientId;
                }

                var res = db.clients.FirstOrDefault(e => e.clientId == clientId);

                if (res == null)
                {
                    return(null);
                }

                input.created = res.created;
                // input.createdBy = res.createdBy;
                db.Entry(res).CurrentValues.SetValues(input);


                db.SaveChanges();
                return(res);
            }
        }
Example #3
0
        public ActionResult Edit(int id, ClientVo input)
        {
            bool foundTheMatch = false;

            if (this.ModelState.IsValid)
            {
                ClientVo item = clientManager.get(id);
                if (item.organizations != null)
                {
                    foreach (ClientOrganizationLookupVo orgLookupVo in item.clientOrganizationLookupses)
                    {
                        foundTheMatch = false;
                        foreach (int clientRoleId in input.organizations)
                        {
                            if (orgLookupVo.organizationId == clientRoleId)
                            {
                                input.organizations.Remove(clientRoleId);
                                foundTheMatch = true;
                                break;
                            }
                        }
                        if (!foundTheMatch)
                        {
                            clientOrganizationLookupManager.delete(orgLookupVo.clientOrganizationLookupId);
                        }
                    }
                }
                if (input.organizations != null)
                {
                    foreach (int orgId in input.organizations)
                    {
                        var clientOrganizationLookupVo = new ClientOrganizationLookupVo();
                        clientOrganizationLookupVo.clientId       = input.clientId;
                        clientOrganizationLookupVo.organizationId = orgId;
                        clientOrganizationLookupVo.isActive       = true;
                        clientOrganizationLookupManager.insert(clientOrganizationLookupVo);
/*=================This sections adds clientfee amount to the organization total fee amount=========================================*/
                        if (input.feeAmount != null)
                        {
                            OrganizationVo currentOrg = organizationManager.get(orgId);
                            if (currentOrg != null)
                            {
                                OrganizationManager.updateOrganizationFeeAmountForClientController(currentOrg, input.feeAmount);
                            }
                        }
                    }
                }

                contactInfoManager.update(input.contactInfo, input.contactInfoId);

                var res = clientManager.update(input, id);
                return(RedirectToAction("Index"));
            }

            return(View(input));
        }
Example #4
0
        public ClientVo insert(ClientVo input)
        {
            using (var db = new MainDb())
            {
                db.clients.Add(input);
                db.SaveChanges();

                return(input);
            }
        }
Example #5
0
 public ActionResult ClientInfoOnReferralRecord(int id)
 {
     if (id != 0)
     {
         ClientVo client = clientManager.get(id);
         return(View("_ClientInfoOnReferralRecord", client));
     }
     else
     {
         return(null);
     }
 }
        public ActionResult <JsonResponses> PreConnect([FromForm] string appId, [FromForm] string userId, [FromForm] Guid?websocketId)
        {
            if (websocketId == null)
            {
                websocketId = Guid.NewGuid();
            }
            ClientVo clientVo = new ClientVo()
            {
                AppId  = appId,
                UserId = userId,
                AppIp  = this.Ip,
            };
            var wsserver = WebSocketProxyAgent.PrevConnectServer(websocketId.Value, JsonConvert.SerializeObject(clientVo));

            return(new JsonResponses(new ConnectVo()
            {
                Server = wsserver,
                WebsocketId = websocketId
            }));
        }
Example #7
0
        public ActionResult Create(ClientVo input)
        {
            ViewBag.Title = "Add New Client";

            if (this.ModelState.IsValid)
            {
                if (input.contactInfo != null && input.contactInfo.state != null)
                {
                    input.contactInfo.state = input.contactInfo.state.ToUpper();
                }

                var item = clientManager.insert(input);
                if (input.organizations != null)
                {
                    foreach (int orgId in input.organizations)
                    {
                        var clientOrganizationLookupVo = new ClientOrganizationLookupVo();
                        clientOrganizationLookupVo.clientId       = input.clientId;
                        clientOrganizationLookupVo.organizationId = orgId;
                        clientOrganizationLookupVo.isActive       = true;

                        clientOrganizationLookupManager.insert(clientOrganizationLookupVo);
                        /*=================This sections adds clientfee amount to the organization total fee amount=========================================*/
                        if (input.feeAmount != null)
                        {
                            OrganizationVo currentOrg = organizationManager.get(orgId);
                            if (currentOrg != null)
                            {
                                OrganizationManager.updateOrganizationFeeAmountForClientController(currentOrg, input.feeAmount);
                            }
                        }
                    }
                }
                return(RedirectToAction("Index"));
            }


            return(View(input));
        }
Example #8
0
        public ActionResult Create()
        {
            var vo = new ClientVo();

            return(View(vo));
        }