예제 #1
0
        public void IsOnline_IsFalse_At_Creation()
        {
            AgentProfile   agentProfile = new AgentProfile("agent");
            AgentViewModel target       = new AgentViewModel(agentProfile);

            Assert.IsFalse(target.IsOnline);
        }
예제 #2
0
        public void AgentProfileConstructorTest_With_Agent_Only()
        {
            string       agent  = "agent";
            AgentProfile target = new AgentProfile(agent);

            Assert.AreEqual <string>(agent, target.Agent);
        }
예제 #3
0
        public async Task <IActionResult> AgentInfo(string userName)
        {
            if (userName == null)
            {
                return(NotFound());
            }

            var userInaspNetTable = await aspUserManager.FindByNameAsync(userName);

            var agent = agentManager.GetAllWithInclude(a => a.Job, a => a.AspNetUsersId == userInaspNetTable.Id).FirstOrDefault();

            IEnumerable <AgentSkill> agnetSkills = agentSkillManager.GetAllWithInclude(s => s.Skill, s => s.AgentId == agent.Id).ToList();

            IEnumerable <string> mySkills = getSkills(agnetSkills);

            AgentProfile agentProfile = new AgentProfile
            {
                Email       = agent.Email,
                Experience  = agent.Experience,
                ImagePath   = agent.ImagePath,
                JobName     = agent.Job.Name,
                Location    = agent.Location,
                PhoneNumber = agent.PhoneNumber,
                Rate        = agent.Rate,
                UserName    = userInaspNetTable.UserName,
                Skills      = mySkills
            };

            return(Ok(agentProfile));
        }
예제 #4
0
        public void Image_IsNotNull_When_AgentProfileImage_IsNull()
        {
            AgentProfile   agentProfile = new AgentProfile("agent");
            AgentViewModel target       = new AgentViewModel(agentProfile);

            Assert.IsNotNull(target.Image);
        }
예제 #5
0
        public void IsOnline_Can_Be_Set()
        {
            AgentProfile   agentProfile = new AgentProfile("agent");
            AgentViewModel target       = new AgentViewModel(agentProfile);

            target.IsOnline = true;
            Assert.IsTrue(target.IsOnline);
        }
예제 #6
0
        public void AgentProfileConstructorTest_With_AgentAndImage()
        {
            string       agent  = "agent";
            Bitmap       image  = new Bitmap(100, 100);
            AgentProfile target = new AgentProfile(agent, image);

            Assert.AreEqual <Bitmap>(image, target.Image);
        }
예제 #7
0
        public int updateAgentProfile(string ProcessType, AgentProfile AgentProfile)
        {
            int ret = 1;

            if (ProcessType == "Update")
            {
                string   sql   = "[usp_UpdateAgentProfile]";
                object[] parms =
                {
                    "ID",                 AgentProfile.ID.AsString(),
                    "Code",               AgentProfile.AGENTCode.AsString(),
                    "OrganizationID",     AgentProfile.OrganizationID.AsString(),
                    "LastName",           AgentProfile.LastName.AsString(),
                    "FirstName",          AgentProfile.FirstName.AsString(),
                    "MiddleName",         AgentProfile.MiddleName.AsString(),
                    "GenderID",           AgentProfile.GenderID.AsString(),
                    "CivilStatusID",      AgentProfile.CivilStatusID.AsString(),
                    "DateofBirth",        AgentProfile.DateofBirth.AsString(),
                    "AgentTypeID",        AgentProfile.AgentTypeID.AsString(),
                    "WithCashCard",       AgentProfile.WithCashCard.AsString(),
                    "PreparedBYID",       AgentProfile.PreparedByID.AsString(),
                    "DocumentStatusCode", "7",
                    "Permission",         "65541",
                    "Notes",              ""
                };
                ret = db.Scalar(sql, 1, parms).AsInt();
            }
            else
            {
                string   sql   = "[usp_UpdateAgentProfile]";
                object[] parms =
                {
                    "ID",                 AgentProfile.ID.AsString(),
                    "Code",               AgentProfile.AGENTCode.AsString(),
                    "OrganizationID",     AgentProfile.OrganizationID.AsString(),
                    "LastName",           AgentProfile.LastName.AsString(),
                    "FirstName",          AgentProfile.FirstName.AsString(),
                    "MiddleName",         AgentProfile.MiddleName.AsString(),
                    "GenderID",           AgentProfile.GenderID.AsString(),
                    "CivilStatusID",      AgentProfile.CivilStatusID.AsString(),
                    "DateofBirth",        AgentProfile.DateofBirth.AsString(),
                    "AgentTypeID",        AgentProfile.AgentTypeID.AsString(),
                    "WithCashCard",       AgentProfile.WithCashCard.AsString(),
                    "PreparedBYID",       AgentProfile.PreparedByID.AsString(),
                    "DocumentStatusCode", "7",
                    "Permission",         "65541",
                    "Notes",              ""
                };
                ret = db.Scalar(sql, 1, parms).AsInt();
            }
            return(ret);
        }
예제 #8
0
        //public ICommand LoginCommand
        //{
        //    get
        //    {
        //        return new Command(async() =>
        //       {
        //           IsBusy = true;
        //           LoginEnabled = false;
        //           var accessToken =  await _apiServices.LoginAsync(Username, Password);

        //           LoginEnabled = true;
        //           if (accessToken == null)
        //           {
        //               IsBusy = false;
        //               LoginSuccess = false;
        //               Message = "Login failed";
        //           }
        //           else
        //           {
        //               Settings.AccessToken = accessToken;
        //               //if (Settings.Username ==  "" && Settings.Password == "")
        //               //{
        //               //    Settings.Username = Username;
        //               //    Settings.Password = Password;
        //               //}

        //               Message = "Logged in Successfully";
        //               LoginSuccess = true;

        //               var nav = new NavigationPage(new LandingPage());
        //               nav.BarBackgroundColor = Color.FromHex("#00adbb");
        //               Application.Current.MainPage = nav;
        //               AgentProfile agentProfile = new AgentProfile();
        //               agentProfile = await _apiServices.GetAgentProfile(accessToken);
        //               Settings.jobRole = agentProfile.Role;
        //               Settings.agentCode = (agentProfile.Role == "Organizer" ? agentProfile.Organizer_code.ToString() : agentProfile.Agent_code.ToString());
        //               Settings.orgTeamCode = (agentProfile.Role == "Organizer" ? agentProfile.Organizer_codeTeam.ToString():"");
        //               IsBusy = false;

        //           }
        //       });
        //    }

        //}

        public async Task Login()
        {
            IsBusy       = true;
            LoginEnabled = false;
            var accessToken = await _apiServices.LoginAsync(Username, Password);

            if (accessToken == null)
            {
                IsBusy       = false;
                LoginSuccess = false;
                Message      = "Login failed";
                LoginEnabled = true;
            }
            else
            {
                Settings.AccessToken = accessToken;

                //Message = "Logged in Successfully";
                LoginSuccess = true;

                AgentProfile agentProfile = new AgentProfile();
                agentProfile = await _apiServices.GetAgentProfile(accessToken);

                if (agentProfile.allowAccess == true)
                {
                    Settings.jobRole     = agentProfile.Role;
                    Settings.agentCode   = (agentProfile.Role == "Organizer" ? agentProfile.Organizer_code.ToString() : agentProfile.Agent_code.ToString());
                    Settings.orgTeamCode = (agentProfile.Role == "Organizer" ? agentProfile.Organizer_codeTeam.ToString() : "");

                    Audit_trail au = new Audit_trail
                    {
                        Action   = "Log in",
                        Log_date = DateTime.Now,
                        Stream   = "Common",
                        App_Id   = "B Connect",
                        User_Id  = Username
                    };

                    bool successCode = await _apiServices.WritetoAuditLog(au, accessToken);
                }
                else
                {
                    IsBusy       = false;
                    LoginSuccess = false;
                    Message      = "Login Restricted";
                    LoginEnabled = true;
                }
                IsBusy = false;
            }
        }
예제 #9
0
        public void PropertyChangedEvent_When_IsOnline_Updated()
        {
            bool           result       = false;
            AgentProfile   agentProfile = new AgentProfile("agent");
            AgentViewModel target       = new AgentViewModel(agentProfile);

            target.PropertyChanged += new System.ComponentModel.PropertyChangedEventHandler((o, e) => { if (e.PropertyName.Equals("IsOnline"))
                                                                                                        {
                                                                                                            result = true;
                                                                                                        }
                                                                                            });
            target.IsOnline = true;
            Assert.IsTrue(result);
        }
예제 #10
0
        public AgentViewModel(AgentProfile agentProfile)
        {
            if (agentProfile == null)
            {
                throw new ArgumentException("Cannot have null AgentProfile");
            }

            if (string.IsNullOrEmpty(agentProfile.Agent))
            {
                throw new ArgumentException("AgentProfile cannot have null or empty Agent string");
            }

            _agentProfile = agentProfile;
        }
예제 #11
0
        public virtual TaskStatus OnUpdate()
        {
            if (Object.op_Equality((Object)this._partner, (Object)null))
            {
                return((TaskStatus)1);
            }
            if (!Singleton <Resources> .IsInstance())
            {
                return((TaskStatus)3);
            }
            AgentProfile      agentProfile      = Singleton <Resources> .Instance.AgentProfile;
            LocomotionProfile locomotionProfile = Singleton <Resources> .Instance.LocomotionProfile;
            Vector3           destination       = this.DesiredPosition(this._partner);

            if ((double)agentProfile.RestDistance <= (double)Vector3.Distance(destination, this._merchant.Position))
            {
                this.SetDestination(destination);
                this._moved = true;
            }
            else
            {
                NavMeshPathStatus pathStatus = this._navMeshAgent.get_pathStatus();
                if (pathStatus == 1 || pathStatus == 2)
                {
                    if ((double)Vector3.Distance(this._merchant.Position, this._partner.Position) < (double)agentProfile.RestDistance)
                    {
                        this.Stop();
                        if (this._merchant.IsRunning)
                        {
                            this._merchant.IsRunning = false;
                        }
                    }
                }
                else if (!this._navMeshAgent.get_pathPending())
                {
                    if ((double)this._navMeshAgent.get_remainingDistance() < (double)agentProfile.RestDistance && this._merchant.IsRunning)
                    {
                        this._merchant.IsRunning = false;
                    }
                    if (this._moved && (double)this._navMeshAgent.get_remainingDistance() < (double)this._navMeshAgent.get_stoppingDistance())
                    {
                        this.Stop();
                        this._moved = false;
                    }
                }
            }
            return((TaskStatus)3);
        }
예제 #12
0
        public async Task <AgentProfile> GetAgentProfile(string accessToken)
        {
            var client = new HttpClient();

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("bearer", accessToken);

            var json = await client.GetStringAsync(Path + "/MobileAuthWS/api/Agent/getAgentProfile");

            AgentProfile agentProf = JsonConvert.DeserializeObject <AgentProfile>(json);

            return(agentProf);

            //-----------------------------------------------------------------------------------

            //return custPolicies; --- Original code
        }
예제 #13
0
        public static int GetAcwTime(AgentProfile profile)
        {
            try
            {
                var url          = profile.settingObject["ardsUrl"].Replace("resource", "requestmeta") + "/CALLSERVER/CALL";
                var responseData = HttpHandler.MakeRequest(url, "Bearer " + profile.server.token, null, "get");
                var data         = profile.jsonSerializer.Deserialize <Dictionary <string, dynamic> >(responseData.ToString());
                var resultData   = profile.jsonSerializer.Deserialize <Dictionary <string, dynamic> >(data["Result"]);


                return(resultData["MaxAfterWorkTime"] - VeerySetting.Instance.AcwGap);
            }
            catch (Exception exception)
            {
                Logger.Instance.LogMessage(Logger.LogAppender.DuoDefault, "EndBreak", exception, Logger.LogLevel.Error);
                return(10);
            }
        }
예제 #14
0
        public async Task <IdentityResult> Register(UserParams userParams)
        {
            var userProfile = new UserProfile
            {
                FirstName = userParams.FirstName,
                LastName  = userParams.LastName,
                Address   = userParams.Address
            };
            var user = new AppUser
            {
                UserName     = userParams.UserName,
                Email        = userParams.Email,
                PhoneNumber  = userParams.PhoneNumber,
                CreationDate = DateTime.Now,
                UserProfile  = userProfile
            };

            switch (userParams.UserType)
            {
            case "user":
                user.UserProfile.UserTypeID = 1;
                break;

            case "agent":
                user.UserProfile.UserTypeID = 2;
                break;
            }
            if (userParams.IsAgent)
            {
                var agentProfile = new AgentProfile
                {
                    OfficeAddress = userParams.OfficeAddress,
                    WebsiteUrl    = userParams.WebsiteUrl,
                    License       = userParams.License,
                    Vertified     = userParams.Vertified
                };
                user.UserProfile.AgentProfile = agentProfile;
            }

            var result = await _userManager.CreateAsync(user, userParams.Password);

            return(result);
        }
예제 #15
0
        private bool TryGetWakeUpAnimState(
            int personalID,
            out PoseKeyPair pose,
            out PlayState playState)
        {
            AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile;

            if (!agentProfile.TutorialWakeUpPoseTable.TryGetValue(personalID, out pose) && !agentProfile.TutorialWakeUpPoseTable.TryGetValue(0, out pose))
            {
                playState = (PlayState)null;
                return(false);
            }
            Dictionary <int, PlayState> dictionary;

            if (Singleton <Resources> .Instance.Animation.AgentActionAnimTable.TryGetValue(pose.postureID, out dictionary) && dictionary.TryGetValue(pose.poseID, out playState))
            {
                return(true);
            }
            playState = (PlayState)null;
            return(false);
        }
        public ActionResult Save(AgentProfile AgentProfile, HttpPostedFileBase picture)
        {
            if (AgentProfile.ID == 0)
            {
                AgentProfile.ImageName = Path.GetFileNameWithoutExtension(picture.FileName);
                String extension   = Path.GetExtension(picture.FileName);
                var    newExtenion = Guid.NewGuid();
                AgentProfile.ImageName = AgentProfile.ImageName + newExtenion + extension;
                AgentProfile.ImagePath = Path.Combine(Server.MapPath("~/Images_Agent/"), AgentProfile.ImageName);
                //AgentProfile.ImagePath = Path.Combine(Server.MapPath("D:/Images/"), AgentProfile.ImageName);
                picture.SaveAs(AgentProfile.ImagePath);
                // _context.Images.Add(AgentProfile);

                _context.AgentProfiles.Add(AgentProfile);
                _context.SaveChanges();
                // AgentProfile.Image.ID = Images.ID;
            }
            else
            {
                var agentInDb = _context.AgentProfiles.Single(a => a.ID == AgentProfile.ID);
                agentInDb.ImageName = Path.GetFileNameWithoutExtension(picture.FileName);
                String extension   = Path.GetExtension(picture.FileName);
                var    newExtenion = Guid.NewGuid();
                agentInDb.ImageName = agentInDb.ImageName + newExtenion + extension;
                agentInDb.ImagePath = Path.Combine(Server.MapPath("~/Images_Agent/"), agentInDb.ImageName);
                picture.SaveAs(agentInDb.ImagePath);
                _context.AgentProfiles.Add(AgentProfile);
                // _context.SaveChanges();

                agentInDb.Name        = AgentProfile.Name;
                agentInDb.DateOfBirth = AgentProfile.DateOfBirth;
                agentInDb.PhoneNo     = AgentProfile.PhoneNo;
                agentInDb.LicenseNo   = AgentProfile.LicenseNo;
                agentInDb.Email       = AgentProfile.Email;
                agentInDb.Password    = AgentProfile.Password;
            }
            _context.SaveChanges();
            return(RedirectToAction("Details", "Agent"));
        }
예제 #17
0
        protected override void OnAwake(PlayerActor player)
        {
            this._player   = player;
            this._agent    = Singleton <Manager.Map> .Instance.TutorialAgent;
            this._isFinish = false;
            if (Object.op_Equality((Object)this._player, (Object)null) || Object.op_Equality((Object)this._agent, (Object)null))
            {
                Debug.LogError((object)"OpeningWakeUp: プレイヤー キャラが空っぽなのはおかしい");
            }
            else
            {
                AgentProfile agentProfile = Singleton <Resources> .Instance.AgentProfile;
                CommonDefine commonDefine = Singleton <Resources> .Instance.CommonDefine;
                Resources.AnimationTables    animation = Singleton <Resources> .Instance.Animation;
                CommonDefine.TutorialSetting setting   = commonDefine.Tutorial;
                player.ChaControl.visibleAll = false;
                this._agent.ChangeTutorialBehavior(AIProject.Definitions.Tutorial.ActionType.Idle);
                player.EventKey = (AIProject.EventType) 0;
                this._fadeEnd   = false;
                int        personality = this._agent.ChaControl.fileParam.personality;
                ChaControl chaControl1 = this._agent.ChaControl;
                chaControl1.ChangeLookEyesPtn(0);
                chaControl1.ChangeLookNeckPtn(3, 1f);
                PoseKeyPair pose;
                PlayState   playState;
                this.TryGetWakeUpAnimState(personality, out pose, out playState);
                MapUIContainer.SetVisibleHUD(false);
                MapUIContainer.SetCommandLabelAcception(CommandLabel.AcceptionState.None);
                Singleton <Manager.Input> .Instance.ReserveState(Manager.Input.ValidType.UI);

                Singleton <Manager.Input> .Instance.SetupState();

                // ISSUE: cast to a reference type
                // ISSUE: explicit reference operation
                this._prevStyle = (CinemachineBlendDefinition.Style)(^ (CinemachineBlendDefinition&)ref player.CameraControl.CinemachineBrain.m_DefaultBlend).m_Style;
                // ISSUE: cast to a reference type
                // ISSUE: explicit reference operation
                (^ (CinemachineBlendDefinition&)ref player.CameraControl.CinemachineBrain.m_DefaultBlend).m_Style = (__Null)0;
                this._eventCamera = player.CameraControl.EventCamera;
                ((Component)this._eventCamera).get_transform().SetParent(player.CameraControl.EventCameraParent, false);
                ((Component)this._eventCamera).get_transform().set_localPosition(Vector3.get_zero());
                ((Component)this._eventCamera).get_transform().set_localRotation(Quaternion.Euler(0.0f, 180f, 0.0f));
                Animator eventCameraLocator            = player.CameraControl.EventCameraLocator;
                RuntimeAnimatorController itemAnimator = animation.GetItemAnimator(commonDefine.ItemAnims.OpeningWakeUpCameraAnimatorID);
                eventCameraLocator.set_runtimeAnimatorController(itemAnimator);
                ((Component)eventCameraLocator).get_transform().set_position(this._agent.Position);
                ((Component)eventCameraLocator).get_transform().set_rotation(this._agent.Rotation);
                eventCameraLocator.set_speed(0.0f);
                float  shapeBodyValue      = this._agent.ChaControl.GetShapeBodyValue(0);
                string heightParameterName = Singleton <Resources> .Instance.DefinePack.AnimatorParameter.HeightParameterName;
                eventCameraLocator.SetFloat(heightParameterName, shapeBodyValue);
                player.CameraControl.Mode = CameraMode.Event;
                this._agent.Animation.LoadEventKeyTable(pose.postureID, pose.poseID);
                this._agent.Animation.InitializeStates(playState);
                this._agent.LoadEventItems(playState);
                this._agent.Animation.StopAllAnimCoroutine();
                this._agent.Animation.PlayInAnimation(playState.MainStateInfo.InStateInfo.EnableFade, playState.MainStateInfo.InStateInfo.FadeSecond, playState.MainStateInfo.FadeOutTime, playState.Layer);
                this.PlayCameraAnimation(eventCameraLocator, personality);
                Transform  transform   = ((Component)player.CameraControl.CameraComponent).get_transform();
                ChaControl chaControl2 = this._agent.ChaControl;
                chaControl2.ChangeLookEyesTarget(1, transform, 0.5f, 0.0f, 1f, 2f);
                chaControl2.ChangeLookEyesPtn(1);
                this._fadeTimerDisposable = ObservableExtensions.Subscribe <long>(Observable.TakeUntilDestroy <long>((IObservable <M0>)Observable.Timer(TimeSpan.FromSeconds((double)setting.OpeningWakeUpStartFadeTime)), (Component)player), (System.Action <M0>)(_ =>
                {
                    if (Singleton <Sound> .IsInstance())
                    {
                        Singleton <Sound> .Instance.StopBGM(setting.OpeningWakeUpFadeTime);
                    }
                    this._fadeTimerDisposable = ObservableExtensions.Subscribe <Unit>((IObservable <M0>)MapUIContainer.StartFade(FadeCanvas.PanelType.Blackout, (global::FadeType)1, setting.OpeningWakeUpFadeTime, false), (System.Action <M0>)(__ => {}), (System.Action)(() => this._fadeEnd = true));
                }));
                ObservableExtensions.Subscribe <Unit>(Observable.Take <Unit>((IObservable <M0>) this._onEndAction, 1), (System.Action <M0>)(_ =>
                {
                    this._isFinish = true;
                    this.Elapsed(player);
                }));
            }
        }
예제 #18
0
 public void Throw_Exception_With_EmpyAgent_In_AgentProfile()
 {
     AgentProfile   profile = new AgentProfile(string.Empty);
     AgentViewModel target  = new AgentViewModel(profile);
 }
예제 #19
0
        protected override void OnUpdate(PlayerActor player, ref Actor.InputInfo info)
        {
            AgentActor agentPartner = player.AgentPartner;

            if (Object.op_Equality((Object)agentPartner, (Object)null))
            {
                return;
            }
            AgentProfile      agentProfile      = Singleton <Resources> .Instance.AgentProfile;
            LocomotionProfile locomotionProfile = Singleton <Resources> .Instance.LocomotionProfile;
            NavMeshAgent      navMeshAgent1     = player.NavMeshAgent;

            if (navMeshAgent1.get_isOnOffMeshLink())
            {
                this.Stop(player);
                OffMeshLinkData currentOffMeshLinkData1 = navMeshAgent1.get_currentOffMeshLinkData();
                if (!Object.op_Inequality((Object)((OffMeshLinkData) ref currentOffMeshLinkData1).get_offMeshLink(), (Object)null))
                {
                    return;
                }
                NavMeshAgent navMeshAgent2 = player.NavMeshAgent;
                M0           m0;
                if (navMeshAgent2 == null)
                {
                    m0 = (M0)null;
                }
                else
                {
                    OffMeshLinkData currentOffMeshLinkData2 = navMeshAgent2.get_currentOffMeshLinkData();
                    m0 = ((Component)((OffMeshLinkData) ref currentOffMeshLinkData2).get_offMeshLink())?.GetComponent <ActionPoint>();
                }
                ActionPoint point = (ActionPoint)m0;
                if (!Object.op_Inequality((Object)point, (Object)null) || !point.OffMeshAvailablePoint((Actor)player))
                {
                    return;
                }
                if (point is DoorPoint)
                {
                    player.CurrentPoint = point;
                    player.PlayerController.ChangeState("DoorOpen", point, (Action)null);
                }
                else
                {
                    player.CurrentPoint = point;
                    player.PlayerController.ChangeState("Move", point, (Action)null);
                }
            }
            else
            {
                Vector3 destination = this.DesiredPosition((Actor)agentPartner);
                if ((double)Vector3.Distance(destination, player.Position) >= (double)agentProfile.RestDistance)
                {
                    this.SetDestination(player, destination);
                    this._moved = true;
                }
                else
                {
                    NavMeshPathStatus pathStatus = navMeshAgent1.get_pathStatus();
                    if (pathStatus == 1 || pathStatus == 2)
                    {
                        if ((double)Vector3.Distance(player.Position, agentPartner.Position) >= (double)agentProfile.RestDistance)
                        {
                            return;
                        }
                        this.Stop(player);
                        if (!player.IsRunning)
                        {
                            return;
                        }
                        player.IsRunning = false;
                    }
                    else
                    {
                        if (navMeshAgent1.get_pathPending())
                        {
                            return;
                        }
                        if ((double)navMeshAgent1.get_remainingDistance() < (double)agentProfile.RestDistance && player.IsRunning)
                        {
                            player.IsRunning = false;
                        }
                        if (!this._moved || (double)navMeshAgent1.get_remainingDistance() >= (double)navMeshAgent1.get_stoppingDistance())
                        {
                            return;
                        }
                        this.Stop(player);
                        this._moved = false;
                    }
                }
            }
        }
예제 #20
0
 public Task <int> SaveAgentProfileAsync(AgentProfile agent)
 {
     return(_database.InsertAsync(agent));
 }