コード例 #1
0
        public GolferContract UpdateGolfer(CreateGolferContract updatedGolfer)
        {
            var golferRetriever = RetrieverFactory.CreateInterface <IGolferRetriever>();
            var foundGolfer     = golferRetriever.LoadByGolferId(CurrentSession.GolferId);

            using (NeedAGolferDataContext dataContext = new NeedAGolferDataContext())
            {
                foundGolfer.AllowEmails          = updatedGolfer.AllowEmails;
                foundGolfer.AvailabilityDistance = updatedGolfer.AvailabilityDistanceInMiles;
                foundGolfer.EmailAddress         = updatedGolfer.EmailAddress;
                foundGolfer.Handicap             = updatedGolfer.Handicap;
                foundGolfer.IsAvailable          = updatedGolfer.IsAvailable;
                foundGolfer.LastUpdated          = DateTime.Now;
                foundGolfer.Latitude             = updatedGolfer.Latitude;
                foundGolfer.Longitude            = updatedGolfer.Longitude;
                foundGolfer.ScreenName           = updatedGolfer.Name;
                foundGolfer.PhoneNumber          = updatedGolfer.PhoneNumber;

                dataContext.Golfers.Attach(foundGolfer, true);
                dataContext.SubmitChanges();
                dataContext.Connection.Close();
                GolferContract contract = new GolferContract(foundGolfer);
                return(contract);
            }
        }
コード例 #2
0
        public GolferContract RunTest()
        {
            using (NeedAGolferDataContext dataContext = new NeedAGolferDataContext())
            {
                var listGolfers = (from singleGolfer in dataContext.Golfers
                                   select new GolferContract(singleGolfer));


                GolferContract contract = listGolfers.FirstOrDefault();
                dataContext.Connection.Close();
                return(contract);
            }
        }
コード例 #3
0
        public GolferContract GetGolfer(LoginContract loginContract)
        {
            using (NeedAGolferDataContext dataContext = new NeedAGolferDataContext())
            {
                Logging loggingInfo = new Logging();
                loggingInfo.CreatedDate = DateTime.Now;
                loggingInfo.DeviceId    = loginContract.DeviceId;
                loggingInfo.OSVersion   = loginContract.OSVersion;
                loggingInfo.UserAccount = loginContract.UserAccount;
                loggingInfo.DeviceType  = loginContract.DeviceType;
                dataContext.Loggings.InsertOnSubmit(loggingInfo);
                dataContext.SubmitChanges();
                dataContext.Connection.Close();
            }


            var            golferRetriever = RetrieverFactory.CreateInterface <IGolferRetriever>();
            var            golfer          = golferRetriever.LoadByGolferId(CurrentSession.GolferId);
            GolferContract contract        = new GolferContract(golfer);

            return(contract);
        }