public bool login(string username, string password)
 {
    user =  context.Users.Where<User>(x=> x.Email == username && x.Password == password).First();
     if(user != null)
         return true;
     else
         return false;
 }
        public bool register(string username, string password, string address, string phone, string imei)
        {
            try
            {
                User user = new User()
                {
                    Email = username,
                    Password = password,
                    Address = address,
                    Phone = phone,
                    Code = imei
                };

                context.Users.InsertOnSubmit(user);
                context.SubmitChanges();
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
Пример #3
0
 public string register(string username, string email, string password, string phone, string mobile, string fax, string address, string date, string modifyDate, string BirthDay, string cityId)
 {
     string result;
     if (this.context.Users.Any((User x) => x.Mobailenumber == mobile))
     {
         result = "";
     }
     else
     {
         try
         {
             User user = new User
             {
                 Name = username,
                 Email = email,
                 Password = password,
                 Phonenumber = phone,
                 Mobailenumber = mobile,
                 Faxnumber = fax,
                 Address = address,
                 Date = date,
                 ModifyDate = date,
                 BirthDay = BirthDay,
                 CityId = (cityId != null) ? new int?(Convert.ToInt32(cityId)) : new int?(0)
             };
             this.context.Users.InsertOnSubmit(user);
             this.context.SubmitChanges();
             result = user.Id.ToString();
         }
         catch (Exception ex)
         {
             result = ex.Message;
         }
     }
     return result;
 }
 public MyService()
 {
     context = new DataClasses1DataContext();
     allFood = new List<food>();
     user = new User();
 }
 partial void DeleteUser(User instance);
 partial void UpdateUser(User instance);
 partial void InsertUser(User instance);
Пример #8
0
 /// <summary>
 /// Create a new User object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="email">Initial value of the Email property.</param>
 public static User CreateUser(global::System.Int64 id, global::System.String email)
 {
     User user = new User();
     user.Id = id;
     user.Email = email;
     return user;
 }
Пример #9
0
 /// <summary>
 /// Deprecated Method for adding a new object to the Users EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToUsers(User user)
 {
     base.AddObject("Users", user);
 }