Exemple #1
0
        public bool SaveTaxInfo(string userId)
        {
            using (var db = new WorktripEntities())
            {
                var userInfo = db.Users.FirstOrDefault(u => u.Id == userId);

                if (userInfo == null)
                {
                    return(false);
                }

                if (this.TaxInfos != null)
                {
                    foreach (var kvPair in this.TaxInfos)
                    {
                        var taxInfo = UserInfoViewModel.GetOrCreateUserInfo(db, userId, kvPair.Value.Year);

                        var u = kvPair.Value;

                        taxInfo.CellphoneBill                   = u.CellphoneBill;
                        taxInfo.ClothingFees                    = u.ClothingFees;
                        taxInfo.DaysInTrainingOrAway            = u.DaysInTrainingOrAway;
                        taxInfo.DriverLayoverTips               = u.DriverLayoverTips;
                        taxInfo.FlightGearLuggageFees           = u.FlightGearLuggageFees;
                        taxInfo.IdentityFees                    = u.IdentityFees;
                        taxInfo.InternetBill                    = u.InternetBill;
                        taxInfo.LaundryFees                     = u.LaundryFees;
                        taxInfo.TechPurchasesFees               = u.TechPurchasesFees;
                        taxInfo.TotalSpentLayoverTransportation = u.TotalSpentLayoverTransportation;
                        taxInfo.TransactionalFees               = u.TransactionalFees;
                        taxInfo.UnreimbursedExpenses            = u.UnreimbursedExpenses;
                        taxInfo.DLState = u.DLState;
                        taxInfo.InternationalLayovers = u.InternationalLayovers;
                    }
                }

                db.SaveChanges();

                UpdateUserActionsLog(userId, "answered " + this.TaxInfos.First().Value.Year + " tax questions");
            }

            return(true);
        }
Exemple #2
0
        public bool SavePersonalInfo(string userId)
        {
            using (var db = new WorktripEntities())
            {
                var userInfo = db.Users.FirstOrDefault(u => u.Id == userId);

                if (userInfo == null)
                {
                    return(false);
                }

                userInfo.FirstName         = this.FirstName;
                userInfo.MiddleName        = this.MiddleName;
                userInfo.LastName          = this.LastName;
                userInfo.Email             = this.Email;
                userInfo.PhoneNumber       = this.PhoneNumber;
                userInfo.DOB               = String.IsNullOrEmpty(this.DOB) ? (DateTime?)null : DateTime.Parse(this.DOB);
                userInfo.Address           = this.Address;
                userInfo.City              = this.City;
                userInfo.State             = this.State;
                userInfo.Zip               = this.Zip;
                userInfo.BankName          = this.BankName;
                userInfo.BankAccountNumber = this.BankAccountNumber;
                userInfo.RoutingNumber     = this.RoutingNumber;

                if (this.TaxInfos != null)
                {
                    foreach (var kvPair in this.TaxInfos)
                    {
                        var taxInfo = UserInfoViewModel.GetOrCreateUserInfo(db, userId, kvPair.Value.Year);

                        taxInfo.BaseAirportCode = kvPair.Value.BaseAirportCode?.ToUpper();
                        taxInfo.Airline         = kvPair.Value?.Airline;
                    }
                }

                db.SaveChanges();

                UpdateUserActionsLog(userId, "updated personal info");
            }

            return(true);
        }
Exemple #3
0
        public bool SaveYesNoQuestions(string userId)
        {
            using (var db = new WorktripEntities())
            {
                var userInfo = db.Users.FirstOrDefault(u => u.Id == userId);

                if (userInfo == null)
                {
                    return(false);
                }

                if (this.TaxInfos != null)
                {
                    foreach (var kvPair in this.TaxInfos)
                    {
                        var taxInfo = UserInfoViewModel.GetOrCreateUserInfo(db, userId, kvPair.Value.Year);

                        var u = kvPair.Value;

                        taxInfo.Married      = u.Married;
                        taxInfo.Dependent    = u.Dependent;
                        taxInfo.StudentLoans = u.StudentLoans;
                        taxInfo.Stocks       = u.Stocks;
                        taxInfo.House        = u.House;
                        taxInfo.HSA          = u.HSA;
                        taxInfo.C1098T       = u.C1098T;
                        taxInfo.C1099R       = u.C1099R;
                    }
                }

                db.SaveChanges();

                UpdateUserActionsLog(userId, "updated yes/no questions");
            }
            return(true);
        }