Beispiel #1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public static bool CheckUserPass(string username, string password)
 {
     Users user = new Users();
     user.USERNAME = username;
     user.PASSWORD = password;
     return user.CheckUserPass();
 }
Beispiel #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="firstname"></param>
        /// <param name="lastname"></param>
        /// <param name="username"></param>
        /// <param name="title"></param>
        /// <param name="email"></param>
        /// <param name="phone"></param>
        /// <param name="city"></param>
        /// <param name="province"></param>
        /// <param name="country"></param>
        /// <returns>
        /// 0 : add user fail
        /// 1 : add user successful
        /// 2 : this email is registered
        /// 3 : this user is registered
        /// </returns>
        public static int AddUser(string firstname, string lastname, string username, string password, string title, 
                                  string email, string phone, string city, string province, string country)
        {
            Users user = new Users();
            user.FIRSTNAME = firstname;
            user.LASTNAME = lastname;
            user.USERNAME = username;
            user.PASSWORD = password;
            user.TITLE = title;
            user.EMAIL = email;
            user.PHONE = phone;
            user.CITY = city;
            user.PROVINCE = province;
            user.COUNTRY = country;

            //check username is existed
            if (user.IsExistEmail()) return 2;
            //check email is existed
            if (user.IsExistUsername()) return 3;
            //inseert new user
            if(user.Insert()) return 1;
            return 0;
        }
Beispiel #3
0
        public DataTable Select()
        {
            DataTable dt;
            try
            {
            objclsUSERS = new Users();

            objclsUSERS.ID = ID;

            dt = objclsUSERS.Select();
            return dt;
            }
            catch(Exception ex)
            {
            throw new Exception(ex.Message);
            }
        }
Beispiel #4
0
        public bool Update()
        {
            try
            {
            objclsUSERS = new Users();

            objclsUSERS.ID = ID;
            objclsUSERS.FIRSTNAME = FIRSTNAME;
            objclsUSERS.LASTNAME = LASTNAME;
            objclsUSERS.USERNAME = USERNAME;
            objclsUSERS.PASSWORD = PASSWORD;
            objclsUSERS.TITLE = TITLE;
            objclsUSERS.EMAIL = EMAIL;
            objclsUSERS.PHONE = PHONE;
            objclsUSERS.CITY = CITY;
            objclsUSERS.PROVINCE = PROVINCE;
            objclsUSERS.POSTCODE = POSTCODE;
            objclsUSERS.COUNTRY = COUNTRY;
            objclsUSERS.MODIFIEDDATE = MODIFIEDDATE;

            if(objclsUSERS.Update())
            {
                return true;
            }
            return false;
            }
            catch(Exception ex)
            {
            throw new Exception(ex.Message);
            }
        }
Beispiel #5
0
        public bool Delete()
        {
            try
            {
            objclsUSERS = new Users();

            objclsUSERS.ID = ID;

            if(objclsUSERS.Delete())
            {
                return true;
            }
            return false;
            }
            catch(Exception ex)
            {
            throw new Exception(ex.Message);
            }
        }