コード例 #1
0
        public ActionResult Index(ClientAddViewModel clientVm)
        {
            if (ModelState.IsValid)
            {
                var client = Mapper.Map <Client>(clientVm);

                if (_clientManager.Add(client))
                {
                    ViewBag.SuccesMsg = "Saved";
                }
                else
                {
                    ViewBag.FailedMsg = "Failed";
                }
            }
            else
            {
                ViewBag.FailedMsg = "Validation Failed";
            }
            clientVm.DesignationSelectListItem = _designationManager.GetAll()
                                                 .Select(c => new SelectListItem()
            {
                Value = c.ID.ToString(),
                Text  = c.DesignationName
            })
                                                 .ToList();

            return(View(clientVm));
        }
コード例 #2
0
        public void AddClient_ClientShouldBeAddedToManager()
        {
            var client = new FakeClient();

            _sut.Add(client);
            _sut.GetAll().Should().HaveCount(1).And.Contain(client);
        }
コード例 #3
0
        /// <summary>
        /// Adding a New Client and Create a Presence for it.
        /// Called by the LLClientView when the UseCircuitCode packet comes in
        /// Used by NPCs to add themselves to the Scene
        /// </summary>
        /// <param name="client"></param>
        public void AddNewClient(IClientAPI client)
        {
            try
            {
                System.Net.IPEndPoint ep       = (System.Net.IPEndPoint)client.GetClientEP();
                AgentCircuitData      aCircuit = AuthenticateHandler.AuthenticateSession(client.SessionId, client.AgentId, client.CircuitCode, ep);

                if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
                {
                    return;
                }

                m_clientManager.Add(client);

                //Create the scenepresence
                IScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client);
                sp.IsChildAgent = aCircuit.child;


                //Trigger events
                m_eventManager.TriggerOnNewPresence(sp);

                //Make sure the appearanace is updated
                if (aCircuit != null)
                {
                    IAvatarAppearanceModule appearance = sp.RequestModuleInterface <IAvatarAppearanceModule> ();
                    if (appearance != null)
                    {
                        appearance.Appearance = aCircuit.Appearance;
                    }
                }

                if (GetScenePresence(client.AgentId) != null)
                {
                    EventManager.TriggerOnNewClient(client);
                    if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0)
                    {
                        EventManager.TriggerOnClientLogin(client);
                    }
                }

                //Add the client to login stats
                ILoginMonitor monitor = (ILoginMonitor)RequestModuleInterface <IMonitorModule>().GetMonitor("", "LoginMonitor");
                if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0 && monitor != null)
                {
                    monitor.AddSuccessfulLogin();
                }
            }
            catch (Exception ex)
            {
                m_log.Warn("[Scene]: Error in AddNewClient: " + ex.ToString());
            }
        }
コード例 #4
0
        /// <summary>
        ///     Adding a New Client and Create a Presence for it.
        ///     Called by the LLClientView when the UseCircuitCode packet comes in
        ///     Used by NPCs to add themselves to the Scene
        /// </summary>
        /// <param name="client"></param>
        /// <param name="completed"></param>
        public void AddNewClient(IClientAPI client, BlankHandler completed)
        {
            AddAsyncEvent(delegate
            {
                try
                {
                    AgentCircuitData aCircuit = AuthenticateHandler.GetAgentCircuitData(client.AgentId);

                    m_clientManager.Add(client);

                    //Create the scenepresence
                    IScenePresence sp = CreateAndAddChildScenePresence(client);
                    sp.IsChildAgent   = aCircuit.IsChildAgent;

                    //Trigger events
                    m_eventManager.TriggerOnNewPresence(sp);

                    if (GetScenePresence(client.AgentId) != null)
                    {
                        EventManager.TriggerOnNewClient(client);
                        if ((aCircuit.TeleportFlags & (uint)TeleportFlags.ViaLogin) != 0)
                        {
                            EventManager.TriggerOnClientLogin(client);
                        }
                    }

                    //Add the client to login stats
                    ILoginMonitor monitor3 = RequestModuleInterface <IMonitorModule>().GetMonitor <ILoginMonitor>(null);
                    if ((aCircuit.TeleportFlags & (uint)TeleportFlags.ViaLogin) != 0 &&
                        monitor3 != null)
                    {
                        monitor3.AddSuccessfulLogin();
                    }

                    if (sp.IsChildAgent)
                    {
                        //If we're a child, trigger this so that we get updated in the modules
                        sp.TriggerSignificantClientMovement();
                    }
                    if (completed != null)
                    {
                        completed();
                    }
                }
                catch (Exception ex)
                {
                    MainConsole.Instance.Warn("[Scene]: Error in AddNewClient: " + ex);
                }
            });
        }
コード例 #5
0
        public ActionResult Create(CreateClientViewModel model)
        {
            var selectedDemographics = model.Demographics.Where(x => x.IsChecked).Select(x => x.ID).ToList();
            var selectedAbuseTypes   = model.AbuseTypes.Where(x => x.IsChecked).Select(x => x.ID).ToList();

            if (model.StateId == 0)
            {
                model.StateId = 25;
            }

            ClientManager.Add(model.ClientFirstName, model.ClientMiddleInitial, model.ClientLastName, model.DateofBirth, model.DateofFirstContact, model.Address1, model.Address2,
                              model.City, model.Phone, model.ZipCode, model.EmergencyContactName, model.EmergencyContactPhone, selectedDemographics, selectedAbuseTypes, model.EthnicityId,
                              model.ClientNumber, model.CountyOfResidenceId, model.CountyOfIncidentId, model.StateId, model.TypeId, model.StatusId, model.GenderId);
            return(RedirectToAction("Index"));
        }
コード例 #6
0
 public IActionResult Post([FromBody] Client client)
 {
     if (client == null)
     {
         return(BadRequest("Client is null"));
     }
     if (clientManager.Add(client) == 1)
     {
         return(Ok(true));
     }
     else
     {
         return(BadRequest(false));
     }
 }
コード例 #7
0
        /// <summary>
        /// Accept client on the service.
        /// </summary>
        private void AcceptClient()
        {
            // Verify pending connections.
            if (listenner.Pending() == false)
            {
                return;
            }

            // Wait for client to accept.
            ServiceClient serviceClient = new ServiceClient(listenner.AcceptTcpClient());

            // Add client do client list.
            ClientManager.Add(serviceClient);

            // Notify client connected.
            this.RiseClientConnected(serviceClient);
        }
コード例 #8
0
        public IActionResult Register([FromBody] Client registerRequest)
        {
            if (registerRequest == null)
            {
                return(BadRequest(new { error = "Client is null" }));
            }

            byte[] salt           = Encoding.UTF8.GetBytes(registerRequest.Email);
            string hashedPassword = PasswordHasher.Hash(salt, registerRequest.Password);

            registerRequest.Password = hashedPassword;

            if (clientManager.Add(registerRequest) == 1)
            {
                return(Ok(true));
            }
            else
            {
                return(BadRequest(false));
            }
        }
コード例 #9
0
        protected void btnSave_OnClick(object sender, EventArgs e)
        {
            var ddlRestaurant = GetDdlValue(fvRestaurateur, "ddlRestaurant");
            var ddlUsers = GetDdlValue(fvRestaurateur, "ddlUsers");

            var rstManager = new RestaurantManager();
            var clientManager = new ClientManager();
            var userManager = new UserManager();

            if (fvRestaurateur.CurrentMode == FormViewMode.Edit)
            {
                var client = clientManager.Get(currentId);
                client.Restaurant = rstManager.Get(ddlRestaurant);

                var user = userManager.Get(ddlUsers);
                user.Position = Role.Restaurateur;
                userManager.Update(user);
                client.UserInfo = user;
                clientManager.Update(client);

            }
            else if (fvRestaurateur.CurrentMode == FormViewMode.Insert)
            {
                var client = new ClientInfo();
                client.Restaurant = rstManager.Get(ddlRestaurant);

                var user = userManager.Get(ddlUsers);

                user.Position = Role.Restaurateur;
                userManager.Update(user);
                client.UserInfo = user;

                clientManager.Add(client);

            }
            PopupHelper.HidePopup("#pop", this);
            gvClients.DataBind();
        }
コード例 #10
0
ファイル: AsyncScene.cs プロジェクト: satlanski2/Aurora-Sim
        /// <summary>
        /// Adding a New Client and Create a Presence for it.
        /// Called by the LLClientView when the UseCircuitCode packet comes in
        /// Used by NPCs to add themselves to the Scene
        /// </summary>
        /// <param name="client"></param>
        /// <param name="completed"></param>
        public void AddNewClient(IClientAPI client, BlankHandler completed)
        {
            lock (m_events)
                m_events.Add(delegate
                {
                    try
                    {
                        System.Net.IPEndPoint ep  = (System.Net.IPEndPoint)client.GetClientEP();
                        AgentCircuitData aCircuit = AuthenticateHandler.AuthenticateSession(client.SessionId, client.AgentId, client.CircuitCode, ep);

                        if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
                        {
                            completed();
                            return;
                        }

                        m_clientManager.Add(client);

                        //Create the scenepresence
                        IScenePresence sp = CreateAndAddChildScenePresence(client);
                        sp.IsChildAgent   = aCircuit.child;
                        sp.DrawDistance   = aCircuit.DrawDistance;

                        //Trigger events
                        m_eventManager.TriggerOnNewPresence(sp);

                        //Make sure the appearanace is updated
                        IAvatarAppearanceModule appearance = sp.RequestModuleInterface <IAvatarAppearanceModule>();
                        if (appearance != null)
                        {
                            appearance.Appearance = aCircuit.Appearance ?? sp.Scene.AvatarService.GetAppearance(sp.UUID);
                            if (appearance.Appearance == null)
                            {
                                MainConsole.Instance.Error("[AsyncScene]: NO AVATAR APPEARANCE FOUND FOR " + sp.Name);
                                appearance.Appearance = new AvatarAppearance(sp.UUID);
                            }
                        }

                        if (GetScenePresence(client.AgentId) != null)
                        {
                            EventManager.TriggerOnNewClient(client);
                            if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0)
                            {
                                EventManager.TriggerOnClientLogin(client);
                            }
                        }

                        //Add the client to login stats
                        ILoginMonitor monitor3 = (ILoginMonitor)RequestModuleInterface <IMonitorModule>().GetMonitor("", MonitorModuleHelper.LoginMonitor);
                        if ((aCircuit.teleportFlags & (uint)TeleportFlags.ViaLogin) != 0 && monitor3 != null)
                        {
                            monitor3.AddSuccessfulLogin();
                        }

                        if (sp.IsChildAgent)//If we're a child, trigger this so that we get updated in the modules
                        {
                            sp.TriggerSignificantClientMovement();
                        }
                        completed();
                    }
                    catch (Exception ex)
                    {
                        MainConsole.Instance.Warn("[Scene]: Error in AddNewClient: " + ex);
                    }
                });
        }