Exemplo n.º 1
0
        public static string CreatePhoneUser(string phone, int pin)
        {
            //TODO -- Error Check!
            string errorMessage = "";

            LData.DBDataContext db = new DBDataContext(Constants.AppConnectionString);

            //Verify phone number doesn't exist
            if (!DoesPhoneNumberExist(phone))
            {
                LData.PhoneUser user = new PhoneUser();
                user.ID = Guid.NewGuid();
                user.PhoneNumber = phone;
                user.PIN = pin;
                user.DateCreated = DateTime.Now;
                user.DateLastAccessed = Constants.NullDate;
                user.DateActivated = DateTime.Now;

                db.PhoneUsers.InsertOnSubmit(user);
                db.SubmitChanges();
            }
            else
            {
                errorMessage = "I'm sorry, you already have an account!";
            }

            return errorMessage;
        }
Exemplo n.º 2
0
        public static string CreatePhoneUser(string phone, int pin)
        {
            //TODO -- Error Check!
            string errorMessage = "";

            LData.DBDataContext db = new DBDataContext(Constants.AppConnectionString);

            //Verify phone number doesn't exist
            if (!DoesPhoneNumberExist(phone))
            {
                LData.PhoneUser user = new PhoneUser();
                user.ID               = Guid.NewGuid();
                user.PhoneNumber      = phone;
                user.PIN              = pin;
                user.DateCreated      = DateTime.Now;
                user.DateLastAccessed = Constants.NullDate;
                user.DateActivated    = DateTime.Now;

                db.PhoneUsers.InsertOnSubmit(user);
                db.SubmitChanges();
            }
            else
            {
                errorMessage = "I'm sorry, you already have an account!";
            }

            return(errorMessage);
        }
Exemplo n.º 3
0
        public static void UpdateLastAccessedDate(string phoneNumber)
        {
            LData.DBDataContext db = new DBDataContext(Constants.AppConnectionString);

            //Get the record from db
            LData.PhoneUser user = db.PhoneUsers.FirstOrDefault(p => p.PhoneNumber == phoneNumber);

            if (user != null)
            {
                user.DateLastAccessed = DateTime.Now;
                db.SubmitChanges();
            }
        }
Exemplo n.º 4
0
        public static void SaveUserPrefs(string phoneNumber, int zipCode, string keyWords)
        {
            LData.DBDataContext db = new DBDataContext(Constants.AppConnectionString);

            //Get the record from db
            LData.PhoneUser user = db.PhoneUsers.FirstOrDefault(p => p.PhoneNumber == phoneNumber);

            if (user != null)
            {
                user.ZipCode  = zipCode;
                user.KeyWords = keyWords;

                db.SubmitChanges(); //save back to db
            }
        }
Exemplo n.º 5
0
        public static void UpdateLastAccessedDate(string phoneNumber)
        {
            LData.DBDataContext db = new DBDataContext(Constants.AppConnectionString);

             //Get the record from db
            LData.PhoneUser user = db.PhoneUsers.FirstOrDefault(p => p.PhoneNumber == phoneNumber);

            if (user != null)
            {
                user.DateLastAccessed = DateTime.Now;
                db.SubmitChanges();
            }
        }
Exemplo n.º 6
0
        public static void SaveUserPrefs(string phoneNumber, int zipCode, string keyWords)
        {
            LData.DBDataContext db = new DBDataContext(Constants.AppConnectionString);

            //Get the record from db
            LData.PhoneUser user = db.PhoneUsers.FirstOrDefault(p => p.PhoneNumber == phoneNumber);

            if (user != null)
            {
                user.ZipCode = zipCode;
                user.KeyWords = keyWords;

                db.SubmitChanges(); //save back to db
            }
        }