コード例 #1
0
        public void AddNewUser(string firstName, string lastName, string emailAddress, string password)
        {
            using (IDbConnection connection = new SqlConnection(HelperforSQLDB.ConVal("PersonalFinance")))
            {
                User newUser = new User {
                    FirstName = firstName, LastName = lastName, EmailAddress = emailAddress, Password = password
                };

                string insertUser = @"INSERT INTO dbo.tblUsers(FirstName,LastName,EmailAddress,Password) Values('" + firstName + "','" + lastName + "', '" + emailAddress + "', '" + password + "')";

                var newuser = connection.Execute(insertUser, "PersonalFinance");
            }
        }
コード例 #2
0
        public void SaveNetWorth(string emailaddress, string assetTotal, string debtTotal, string netWorth)
        {
            using (System.Data.IDbConnection connection = new SqlConnection(HelperforSQLDB.ConVal("PersonalFinance")))
            {
                tblFinance saveNetWorth = new tblFinance {
                    EmailAddress = emailaddress, AssetTotal = assetTotal, DebtTotal = debtTotal, NetWorth = netWorth
                };

                string insertFinance = @"INSERT INTO dbo.tblFinance(EmailAddress,AssetTotal,DebtTotal,NetWorth) Values('" + emailaddress + "','" + assetTotal + "','" + debtTotal + "', '" + netWorth + "')";

                var addsurvey = connection.Execute(insertFinance, "PersonalFinance");
            }
        }
コード例 #3
0
        public void SaveSurvey(string agebox, string retireAgeBox, string savedBox, string savePerMonth, string riskBox, string yearsBox, string amountBox)
        {
            using (System.Data.IDbConnection connection = new SqlConnection(HelperforSQLDB.ConVal("PersonalFinance")))
            {
                tblSurvey newsurvey = new tblSurvey {
                    Age = agebox, RetirementAge = retireAgeBox, CurrentSavings = savedBox, SavingsPerMonth = savePerMonth, Risk = riskBox, YearsUntilRetirement = yearsBox, AmountSaved = amountBox
                };

                string SurveyResponse = @"INSERT INTO dbo.tblSurvey(Age,RetirementAge,CurrentSavings,SavingsPerMonth,Risk,YearsUntilRetirement,AmountSaved) Values('" + agebox + "','" + retireAgeBox + "', '" + savedBox + "', '" + savePerMonth + "','" + riskBox + "','" + yearsBox + "','" + amountBox + "')";

                var addsurvey = connection.Execute(SurveyResponse, "PersonalFinance");
            }
        }