private void SaveProfile(string profileName, bool overwrite)
        {
            try
            {
                var myProfile = BuildFormProfile(profileName);

                myProfile.Name = profileName;

                var saveStatus = ProfileHandler.SaveProfile(_profiles, myProfile, overwrite);

                if (saveStatus.Successful)
                {
                    _profiles = saveStatus.Profiles;
                    _profile  = _profiles.GetByName(profileName);
                    BindProfiles(profileName);
                }


                if (saveStatus.Successful)
                {
                    MessageBox.Show(saveStatus.Message, "Saved Profile", MessageBoxButtons.OK,
                                    MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show(saveStatus.Message, "Save Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0} {1}", ex.Message, ex.StackTrace));
            }
        }
示例#2
0
        public ActionResult TransactionDetails(int transactionId)
        {
            Transaction transaction = TransactionHandler.getTransaction(transactionId);

            Profile buyer  = ProfileHandler.GetProfile(transaction.BuyerId);
            Profile seller = ProfileHandler.GetProfile(transaction.SellerId);

            if (User.Identity.Name == buyer.Email)
            {
                transaction.CurrentUser      = ActionBy.Buyer;
                transaction.CounterPartyName = seller.Name;
            }
            else
            {
                transaction.CurrentUser      = ActionBy.Seller;
                transaction.CounterPartyName = buyer.Name;
            }

            if ((transaction.CurrentUser == ActionBy.Buyer && transaction.Confirmed == Confirmed.ByBuyer) ||
                (transaction.CurrentUser == ActionBy.Seller && transaction.Confirmed == Confirmed.BySeller))
            {
                transaction.ConfirmedByCurrentUser = true;
            }
            else
            {
                transaction.ConfirmedByCurrentUser = false;
            }

            TransactionCommentModel model = new TransactionCommentModel(transaction, User.Identity.Name);

            return(View(model));
        }
示例#3
0
        public async Task <IActionResult> GetProfileByUserId([FromQuery] Guid userId)
        {
            try
            {
                if (userId != null)
                {
                    var profile = await ProfileHandler.GetProfile(userId);

                    if (profile == null)
                    {
                        return(StatusCode(505, "Profile was not found"));
                    }
                    else
                    {
                        var measurements = await MeasurementsHandler.GetMeasurements(userId);

                        profile.profileMeasurements = measurements;
                    }
                    Logger.LogWarning("Profile Found");
                    return(Ok(profile));
                }
                return(StatusCode(505, "Missing User Id"));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                return(StatusCode(505, ex.Message));
            }
        }
    // for load button
    public void LoadGame()
    {
        ProfileHandler ph = GameObjectFinder.FindProfileHandler();

        ph.LoadedFromFile = true;
        StateController.SwitchToMatching();
    }
    // for multiPlayer button
    public void GoToQuickMatch()
    {
        ProfileHandler ph = GameObjectFinder.FindProfileHandler();

        ph.LoadedFromFile = false;
        StateController.SwitchToMatching();
    }
 // Update the profile in profile handler
 public void UpdateProfile(bool win)
 {
     if (photonView.isMine)
     {
         ProfileHandler ph = GameObjectFinder.FindProfileHandler();
         ph.UpdateProfile(this.NumKilled, this.NumDeath, win);
     }
 }
示例#7
0
        private async void InitializeMyStashList()
        {
            Snus[] snus = await ProfileHandler.GetSnusForThisProfile();

            foreach (Snus s in snus)
            {
                MyStashList.Add(s);
            }
        }
示例#8
0
        private APIGateway(UserHandler users, ImageHandler images, PostHandler posts, ProfileHandler profiles, AddressHandler addresses)

        {
            this.users     = users;
            this.images    = images;
            this.posts     = posts;
            this.profiles  = profiles;
            this.addresses = addresses;
        }
        public ActionResult Index()
        {
            var viewModel      = new ProfileViewModel();
            var profileHandler = new ProfileHandler();

            viewModel.SetByProfile(profileHandler.GetProfile(new AspNetUserHandler()
                                                             .GetAspNetUser(User.Identity.GetUserName())
                                                             .Profile.Id));
            return(View(viewModel));
        }
示例#10
0
        public ActionResult TransactionHistory()
        {
            string  username = User.Identity.Name;
            Profile profile  = ProfileHandler.GetProfile(username);
            IEnumerable <Transaction> transactions = TransactionHandler.getUserTransactionHistory(profile.ProfileId);

            IEnumerable <TransactionDetailModel> detailedHistory = transactions.Select(
                x => new TransactionDetailModel(x));

            return(View(detailedHistory));
        }
        private void DeleteCurrentProfile()
        {
            var dialogResult = MessageBox.Show("Delete the current Profile?", "Delete Profile", MessageBoxButtons.OKCancel);

            if (dialogResult == DialogResult.OK)
            {
                ProfileHandler.DeleteProfile(_profiles, _profile, true);

                ShowFirstProfile();
            }
        }
示例#12
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            if (ModelState.IsValid &&
                ProfileHandler.ConfirmValidation(model.UserName) &&
                WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
            {
                return(RedirectToLocal(returnUrl));
            }

            // If we got this far, something failed, redisplay form
            ModelState.AddModelError("", "The email or password provided is incorrect.");
            return(View(model));
        }
示例#13
0
    public override void RegenerateSteps()
    {
        Logger.LogDebug("REGENERATING STEPS");
        SetContext();

        AllSteps.Clear();

        AllSteps.Add(new Step(this, 0, 45, ItemDB.BoltOfLinenCloth)); // Force precraft
        AllSteps.Add(new Step(this, 45, 70, ItemDB.HeavyLinenGloves, 35));
        AllSteps.Add(new Step(this, 70, 75, ItemDB.ReinforcedLinenCape, 5));
        AllSteps.Add(new Step(this, 75, 97, ItemDB.BoltofWoolenCloth)); // Force precraft
        AllSteps.Add(new Step(this, 97, 110, ItemDB.SimpleKilt, 15));
        AllSteps.Add(new Step(this, 110, 125, ItemDB.DoublestitchedWoolenShoulders, 15));
        AllSteps.Add(new Step(this, 125, 145, ItemDB.BoltOfSilkCloth)); // Force precraft
        AllSteps.Add(new Step(this, 145, 150, ItemDB.AzureSilkHood, 5));
        AllSteps.Add(new Step(this, 150, 160, ItemDB.AzureSilkHood, 15));
        AllSteps.Add(new Step(this, 160, 170, ItemDB.SilkHeadband, 10));
        AllSteps.Add(new Step(this, 170, 175, ItemDB.FormalWhiteShirt, 5));
        AllSteps.Add(new Step(this, 175, 185, ItemDB.BoltOfMageweave)); // Force precraft
        AllSteps.Add(new Step(this, 185, 200, ItemDB.CrimsonSilkVest, 15));
        AllSteps.Add(new Step(this, 200, 215, ItemDB.CrimsonSilkPantaloons, 15));
        AllSteps.Add(new Step(this, 215, 220, ItemDB.BlackMageweaveLeggings, 5));
        AllSteps.Add(new Step(this, 220, 225, ItemDB.BlackMageweaveGloves, 5));
        AllSteps.Add(new Step(this, 225, 230, ItemDB.BlackMageweaveGloves, 5));
        AllSteps.Add(new Step(this, 230, 250, ItemDB.BlackMageweaveHeadband, 23));
        AllSteps.Add(new Step(this, 250, 260, ItemDB.BoltofRunecloth)); // Force precraft
        AllSteps.Add(new Step(this, 260, 280, ItemDB.RuneclothBelt, 30));
        AllSteps.Add(new Step(this, 280, 295, ItemDB.RuneclothGloves, 20));
        AllSteps.Add(new Step(this, 295, 300, ItemDB.RuneclothHeadband, 5));
        AllSteps.Add(new Step(this, 300, 325, ItemDB.BoltofNetherweave)); // Force precraft
        AllSteps.Add(new Step(this, 325, 340, ItemDB.NetherweavePants, 20));
        AllSteps.Add(new Step(this, 340, 350, ItemDB.NetherweaveRobe, 10));
        AllSteps.Add(new Step(this, 350, 375, ItemDB.BoltofFrostweave));
        AllSteps.Add(new Step(this, 375, 380, ItemDB.FrostwovenBelt, 5));
        AllSteps.Add(new Step(this, 380, 385, ItemDB.FrostwovenBoots, 5));
        AllSteps.Add(new Step(this, 385, 395, ItemDB.FrostwovenCowl, 15));
        AllSteps.Add(new Step(this, 395, 400, ItemDB.DuskweaveBelt, 5));
        AllSteps.Add(new Step(this, 400, 410, ItemDB.DuskweaveWristwraps, 10));
        AllSteps.Add(new Step(this, 410, 415, ItemDB.DuskweaveGloves, 5));
        AllSteps.Add(new Step(this, 415, 425, ItemDB.DuskweaveBoots, 15));

        MustRecalculateStepFlag      = true;
        HasCheckedIfWeKnowRecipeFlag = false;

        if (Bot.ProfileName != null)
        {
            ProfileHandler.UnloadCurrentProfile();
        }
    }
示例#14
0
 internal static void Dispose()
 {
     try
     {
         CustomClass.DisposeCustomClass();
         Fsm.StopEngine();
         Fight.StopFight();
         MovementManager.StopMove();
         ProfileHandler.UnloadCurrentProfile();
     }
     catch (Exception e)
     {
         Logging.WriteError("Bot > Bot  > Dispose(): " + e);
     }
 }
示例#15
0
    /// <summary>
    /// Displays scores from previous matches
    /// </summary>
    /// <param name="stats">Score information</param>
    private void DisplayPreviousMatches_(List <IGrouping <DateTime, StatContent> > stats)
    {
        var ph = new ProfileHandler();

        ph.Initialise();

        // order by date
        var sorted = stats.OrderByDescending(s => s.Key).ToList();

        var index = 0;

        // loop though controls - up to 5
        for (; index < PreviousResults.Count() && index < sorted.Count(); index++)
        {
            // find active player
            var activePlayerId = _playerDisplaysInUse[_playerIndex].PlayerID();
            var player         = sorted[index].Where(s => s.GetPlayerId() == activePlayerId).FirstOrDefault();

            // get other players who played
            var otherPlayers = sorted[index].Where(s => s.GetPlayerId() != activePlayerId);

            // work out the scores
            var plScore  = player?.GetScore();
            var maxScore = sorted[index].Max(s => s.GetScore());

            var otherCharacters = new List <int>();

            // get a list of the characters that were used by other players
            foreach (var p in otherPlayers)
            {
                var profile = ph.GetProfile(p.GetPlayerId());
                if (profile != null)
                {
                    otherCharacters.Add(profile.GetCharacterIndex());
                }
            }

            // initialise controls
            PreviousResults[index].gameObject.SetActive(true);
            PreviousResults[index].SetData(sorted[index].Key, (int)plScore, otherCharacters, plScore == maxScore);
        }

        // hind unused controls
        for (; index < PreviousResults.Count(); index++)
        {
            PreviousResults[index].gameObject.SetActive(false);
        }
    }
        private void ShowFirstProfile(string name)
        {
            // Init the profiles and bind them
            _profiles = ProfileHandler.LoadProfiles();

            if (_profiles.Items.Count == 0)
            {
                _profiles.Add(ProfileHandler.CreateNew());
            }

            BindProfiles("");

            Application.DoEvents();

            LoadProfileByName(name);
        }
示例#17
0
        public static async Task <APIGateway> Create(string path, PrivateIdentity self, int port)
        {
            var conn = new SQLiteAsyncConnection(path, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create | SQLiteOpenFlags.FullMutex);

            var users = await UserHandler.Create(conn, self.ID);

            var images = await ImageHandler.Create(conn, users);

            var posts = await PostHandler.Create(conn, users);

            var profiles = await ProfileHandler.Create(conn, users);

            var addresses = await AddressHandler.Create(conn, users, port, self);

            return(new APIGateway(users, images, posts, profiles, addresses));
        }
示例#18
0
        /// <summary>
        /// Snaps to an edge closest to the given coordinates.
        /// </summary>
        /// <param name="routerDb">The router db.</param>
        /// <param name="longitude">The longitude.</param>
        /// <param name="latitude">The latitude.</param>
        /// <param name="maxOffsetInMeter">The maximum offset in meter.</param>
        /// <param name="profile">The profile to snap for.</param>
        /// <returns>The snap point.</returns>
        public static Result <SnapPoint> Snap(this RouterDb routerDb, double longitude, double latitude, float maxOffsetInMeter = 1000,
                                              Profile profile = null)
        {
            ProfileHandler profileHandler = null;

            if (profile != null)
            {
                profileHandler = routerDb.GetProfileHandler(profile);
            }

            var offset = 100;

            while (offset < maxOffsetInMeter)
            {
                // calculate search box.
                var offsets         = (new Coordinate(longitude, latitude)).OffsetWithDistances(maxOffsetInMeter);
                var latitudeOffset  = System.Math.Abs(latitude - offsets.Latitude);
                var longitudeOffset = System.Math.Abs(longitude - offsets.Longitude);
                var box             = (longitude - longitudeOffset, latitude - latitudeOffset, longitude + longitudeOffset,
                                       latitude + latitudeOffset);

                // make sure data is loaded.
                routerDb.DataProvider?.TouchBox(box);

                // snap to closest edge.
                var snapPoint = routerDb.SnapInBox(box, (eEnum) =>
                {
                    if (profileHandler == null)
                    {
                        return(true);
                    }

                    profileHandler.MoveTo(eEnum);
                    var canStop = profileHandler.CanStop;

                    return(canStop);
                });
                if (snapPoint.EdgeId != uint.MaxValue)
                {
                    return(snapPoint);
                }

                offset *= 2;
            }
            return(new Result <SnapPoint>($"Could not snap to location: {longitude},{latitude}"));
        }
示例#19
0
    void OnSceneLoaded(Scene current, Scene next)
    {
        gameManager = GameObject.Find("Game Manager").GetComponent <GameManager>();
        if (gameManager == null)
        {
            Debug.Log(TAG + "Game Manager is NULL");
        }

        if (next.name.Equals("MainMenu"))
        {
            profileHandler = GameObject.Find("Profie Panel").GetComponent <ProfileHandler>();
        }
        if (current.name.Equals("StackRoom"))
        {
            UpdateScore();
        }
    }
        private void LoadProfileByName(string name)
        {
            try
            {
                if (_profiles != null)
                {
                    // load the appropiate profile
                    _profile = name == String.Empty
                                   ? _profiles.Items[0]
                                   : ProfileHandler.GetProfileByName(_profiles, name);

                    if (_profile != null)
                    {
                        //select the profile in the drop down list
                        cboProfiles.SelectedValue = _profile.Name;

                        uxAuthServerUrl.Text   = _profile.ServerUrl;
                        uxAuthUserID.Text      = _profile.Username;
                        uxAuthPassword.Text    = _profile.Password;
                        txtFilePath.Text       = _profile.ImportCsvSourcePath;
                        txtExportFilePath.Text = _profile.ExportCsvTargetPath;
                        SelectFormTemplate(_profile.ImportFormTemplateName);
                        SelectFormDashboard(_profile.ExportFormDashboardName);
                        chkCsvHeadersQuoted.Checked = _profile.CsvHeadersQuoted;
                        chkCsvLinesQuoted.Checked   = _profile.CsvLineItemsQuoted;
                        chkAllowUpdate.Checked      = _profile.AllowUpdate;

                        if (!string.IsNullOrEmpty(_profile.CsvDelimeterCharacter))
                        {
                            txtDelimeter.Text = _profile.CsvDelimeterCharacter;
                        }

                        if (!string.IsNullOrEmpty(_profile.DateTimeFormat))
                        {
                            txtDateTimeFormat.Text = _profile.DateTimeFormat;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(string.Format("{0} {1}", ex.Message, ex.StackTrace));
            }
        }
示例#21
0
    public override void RegenerateSteps()
    {
        Logger.LogDebug("REGENERATING ENCHANTING STEPS");
        SetContext();

        AllSteps.Clear();
        AllSteps.Add(new Step(this, 0, 50, ItemDB.EnchantBracerMinorHealth, 20));
        AllSteps.Add(new Step(this, 50, 75, ItemDB.EnchantBracerMinorHealth, 20));
        AllSteps.Add(new Step(this, 75, 90, ItemDB.EnchantBracerMinorHealth, 20));
        AllSteps.Add(new Step(this, 90, 120, ItemDB.EnchantBracerMinorStamina, 30));

        MustRecalculateStepFlag      = true;
        HasCheckedIfWeKnowRecipeFlag = false;

        if (Bot.ProfileName != null)
        {
            ProfileHandler.UnloadCurrentProfile();
        }
    }
示例#22
0
        public ActionResult validate(Guid Token)
        {
            try
            {
                var profile = ProfileHandler.ValidateProfile(Token);

                if (profile != null)
                {
                    //Log the user in
                    FormsAuthentication.SetAuthCookie(profile.Email, true);
                }
            }
            catch (Exception ex)
            {
                Console.Write("Error occured in validating account.");
            }

            return(View());
        }
示例#23
0
        public void TestGetProfile()
        {
            var mock        = new Mock <IProfileRepository>();
            var profileGuid = new Guid();
            var profile     = new Profile
            {
                FirstName = "testFristName",
                LastName  = "testLastName",
                Id        = profileGuid
            };

            mock.Setup(framework => framework.GetProfile(profileGuid))
            .Returns(profile);
            IProfileRepository profileRepository = mock.Object;
            var profileHandler = new ProfileHandler(profileRepository);

            Assert.AreEqual("testFristName", profileHandler.GetProfile(profileGuid).FirstName);
            Assert.AreEqual("testLastName", profileHandler.GetProfile(profileGuid).LastName);
            Assert.AreEqual(profile, profileHandler.GetProfile(profileGuid));
        }
示例#24
0
        public void TestGetAddress()
        {
            var mock        = new Mock <IProfileRepository>();
            var profileGuid = new Guid();
            var profile     = new Profile
            {
                Address = new Address
                {
                    ZipCode = "10001"
                },
                Id = profileGuid
            };

            mock.Setup(framework => framework.GetProfile(profileGuid))
            .Returns(profile);
            IProfileRepository profileRepository = mock.Object;
            var profileHandler = new ProfileHandler(profileRepository);

            Assert.AreEqual("10001", profileHandler.GetAddress(profileGuid).ZipCode);
        }
示例#25
0
        public override void Run()
        {
            Logger.LogDebug("************ RUNNING LOAD PROFILE STATE ************");
            Step currentStep = profession.CurrentStep;

            string faction = ToolBox.IsHorde() ? "Horde" : "Alliance";

            // Setting profile name
            string profileName;

            if (profession.ItemToFarm.Profile != null)
            {
                profileName = profession.ItemToFarm.Profile;
            }
            else
            {
                profileName = $"{faction} - {profession.ItemToFarm.Name}.xml";
            }

            Logger.Log($"Loading profile {profileName}");
            ProfileHandler.LoadNewProfile(profession.Name.ToString(), profileName);
        }
示例#26
0
        public async Task <IActionResult> SignupUser([FromBody] SignupRequest request)
        {
            try
            {
                if (request != null)
                {
                    bool emailAvailable = await UserHandler.EmailNotInUse(request.User.Email);

                    if (!emailAvailable)
                    {
                        return(StatusCode(505, new ErrorResponse()
                        {
                            Message = "There is already an account associated with that email address"
                        }));
                    }
                    var user = await UserHandler.InsertUser(request.User, request.Password);

                    CustomerProfile cp = new CustomerProfile();
                    cp.Birthdate = DateTime.UtcNow;
                    cp.Email     = request.User.Email;
                    cp.UserId    = user.UserId;
                    var profileUpdated = await ProfileHandler.InsertProfile(cp);

                    if (user == null)
                    {
                        return(Unauthorized());
                    }
                    Logger.LogWarning("User added");
                    return(Ok(user));
                }
                return(StatusCode(404));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                return(StatusCode(505, ex.Message));
            }
        }
示例#27
0
        public TransactionCommentModel(Transaction transaction, string userName)
        {
            Details         = new TransactionDetailModel(transaction);
            profile         = ProfileHandler.GetProfile(userName);
            UserId          = profile.ProfileId;
            UserDisplayName = profile.Name;
            UserFacebookId  = profile.FacebookId;

            if (UserId == transaction.BuyerId)
            {
                CounterPartyId = transaction.SellerId;
                UserAction     = ActionBy.Buyer;
            }
            else
            {
                CounterPartyId = transaction.BuyerId;
                UserAction     = ActionBy.Seller;
            }

            Profile counterPartyProfile = ProfileHandler.GetProfile(CounterPartyId);

            CounterPartyDisplayName = counterPartyProfile.Name;
            CounterPartyFacebookId  = counterPartyProfile.FacebookId;

            // load comments
            Comments = CommentHandler.getComments(transaction.TransactionId);
            foreach (Comment comment in Comments)
            {
                if (comment.UserId == UserId)
                {
                    comment.CommentByCurrentUser = true;
                }
                else
                {
                    comment.CommentByCurrentUser = false;
                }
            }
        }
示例#28
0
        public async Task <IActionResult> UpdateProfileByUserId([FromBody] CustomerProfile profile)
        {
            try
            {
                if (profile != null)
                {
                    var profileUpdated = await ProfileHandler.UpdateProfile(profile);

                    if (profileUpdated == null)
                    {
                        return(StatusCode(505, "Profile was not found or updated."));
                    }
                    Logger.LogWarning("Profile Found");
                    return(Ok(profile));
                }
                return(StatusCode(505, "Missing profile data."));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                return(StatusCode(505, ex.Message));
            }
        }
示例#29
0
 public Comment(
     int commentId,
     string comment,
     int userId,
     ActionBy actionBy,
     int transactionId,
     int isActive,
     int isDeleted,
     DateTime createdDate,
     DateTime modifiedDate
     )
 {
     CommentId          = commentId;
     UserId             = userId;
     ActionBy           = actionBy;
     TransactionId      = transactionId;
     this.comment       = comment;
     IsActive           = isActive;
     IsDeleted          = isDeleted;
     CreatedDate        = createdDate;
     ModifiedDate       = modifiedDate;
     CommentatorProfile = ProfileHandler.GetProfile(UserId);
 }
示例#30
0
    /// <summary>
    /// Displays high score data
    /// </summary>
    /// <param name="stats">The data to show</param>
    private void ShowHighscores_(List <StatContent> stats)
    {
        var ph = new ProfileHandler();

        ph.Initialise();

        var index = 0;

        for (; (index < stats.Count && index < HighScores.Length); index++)
        {
            HighScores[index].gameObject.SetActive(true);
            var profile = ph.GetProfile(stats[index].GetPlayerId());
            if (profile != null)
            {
                HighScores[index].SetPlayerData(profile.GetProfileName(), stats[index].GetScore(), profile.GetCharacterIndex());
            }
        }

        for (; index < HighScores.Length; index++)
        {
            HighScores[index].gameObject.SetActive(false);
        }
    }