Esempio n. 1
0
 private static void CreateDatabase()
 {
     try
     {
         string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
         System.IO.Directory.CreateDirectory(folderPath);
         string databaseFilePath = System.IO.Path.Combine(folderPath, "FinancialProfile.db");
         using (var db = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(), databaseFilePath))
         {
             db.CreateTable <FinancialProfileDomain>();
             if (db.Table <FinancialProfileDomain>().Count() == 0)
             {
                 var FinancialProfile = new FinancialProfileDomain()
                 {
                     Question = "When is your birthday?",
                     DataType = "DateTime"
                 };
                 db.Insert(FinancialProfile);
                 var question = db.Get <FinancialProfileDomain>(1);
                 FinancialProfile = new FinancialProfileDomain()
                 {
                     Question = "What is your net worth?",
                     DataType = "Int"
                 };
                 db.Insert(FinancialProfile);
                 FinancialProfile = new FinancialProfileDomain()
                 {
                     Question = "How much do you make each month after taxes including 1099, w2, 401k, and ira contributions?",
                     DataType = "Int"
                 };
                 db.Insert(FinancialProfile);
                 FinancialProfile = new FinancialProfileDomain()
                 {
                     Question = "How much do you spend each month on your house?",
                     DataType = "Int"
                 };
                 db.Insert(FinancialProfile);
                 FinancialProfile = new FinancialProfileDomain()
                 {
                     Question = "How much do you spend each month on your car?",
                     DataType = "Int"
                 };
                 db.Insert(FinancialProfile);
                 FinancialProfile = new FinancialProfileDomain()
                 {
                     Question = "How much do you spend each month on everything else?",
                     DataType = "Int"
                 };
                 db.Insert(FinancialProfile);
             }
         }
     }
     catch (SQLiteException ex)
     {
         var t = ex;
     }
 }
Esempio n. 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            buttonSave.TouchUpInside += HandleTouchUpInsideSave;

            record             = repository.Get(1);
            labelQuestion.Text = record.Question;
            // Perform any additional setup after loading the view, typically from a nib.
        }
Esempio n. 3
0
        private void HandleTouchUpInsideSave(object sender, EventArgs ea)
        {
            record.Answer = DateTime.Parse(dateBirthday.Date.ToString()).ToShortDateString();
            repository.Update(record);
            UIStoryboard storyboard = UIStoryboard.FromName("Main", null);
            var          controller = (OtherQuestionController)storyboard.InstantiateViewController("OtherQuestionController");

            for (int i = 2; i < 7; i++)
            {
                record = repository.Get(i);
                if (record.Answer == null || record.Answer == "")
                {
                    controller.Id = i;
                    this.PresentViewController(controller, true, null);
                    break;
                }
                if (i == 7)
                {
                    controller.Id = 7;
                    this.PresentViewController(controller, true, null);
                    break;
                }
            }
        }
 public FinancialProfileDomain Update(FinancialProfileDomain item)
 {
     db.Update(item);
     return(Get(item.Id));
 }
Esempio n. 5
0
 private void GetQuestion(int Id)
 {
     record = repository.Get(Id);
 }