Exemple #1
0
        // Add a person
        static void Test21()
        {
            DataVaultInterface i = new DataVaultInterface();

            i.Login("123");
            PersonalInfo p = new PersonalInfo();

            p.Name.FirstName  = "TestF";
            p.Name.MiddleName = "TestM";
            p.Name.LastName   = "TestL";
            i.ModifyPersonalInfo(p);
        }
Exemple #2
0
        // Modify a person
        static void Test22()
        {
            DataVaultInterface i = new DataVaultInterface();

            i.Login("123");
            PersonalInfo p;

            i.GetPersonalInfo(out p, 0);
            Console.WriteLine(p);
            Seperator();
            p.Name.FirstName  = "TestF";
            p.Name.MiddleName = "TestM";
            p.Name.LastName   = "TestL";
            Console.WriteLine(p);
            Seperator();
            i.ModifyPersonalInfo(p);
        }
Exemple #3
0
        /// <summary>
        /// Remove the selected row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RemoveProfile_Button_Click(object sender, RoutedEventArgs e)
        {
            PersonalInfo personalInfo = PersonalInfos_ListView.SelectedItem as PersonalInfo;

            if (personalInfo != null)
            {
                // Ask the user for confirmation
                MessageBoxResult result = ShowMessageBox("Delete \"" + personalInfo.FullName + "\" ?", MessageBoxButton.YesNo);

                // Remove personal info from the db
                if (result == MessageBoxResult.Yes)
                {
                    personalInfo.ToBeDelete = true;
                    _dataVaultInterface.ModifyPersonalInfo(personalInfo);

                    // Refresh the list
                    RefreshViewList();
                }
            }
        }
        /// <summary>
        /// Save the data
        /// </summary>
        /// <returns></returns>
        private StatusCode SaveData()
        {
            // Fill the personal info object
            StatusCode status = RetrieveDataFromControls();

            if (status != StatusCode.NO_ERROR)
            {
                return(status);
            }

            // Save to database
            if (_personalInfo != null && _dataVaultInterface != null)
            {
                // Save to db
                status          = _dataVaultInterface.ModifyPersonalInfo(_personalInfo);
                _personalInfoId = _personalInfo.Id;

                // Check result
                if (status == StatusCode.NO_ERROR)
                {
                    // Refresh all controls
                    RefreshAllControls();

                    // Set the boolean
                    IsSaved = true;

                    ShowMessageBox("Saved!");
                    return(StatusCode.NO_ERROR);
                }
                else
                {
                    ShowMessageBox(status);
                }
            }
            return(StatusCode.APPLICATION_ERROR);
        }