Exemplo n.º 1
0
 /// <summary>
 /// create query for insert user
 /// </summary>
 /// <param name="UserName">string</param>
 /// <param name="pwd">string</param>
 /// <param name="userLevel">int</param>
 /// <returns></returns>
 public int InsertUser(string UserName, string pwd, int userLevel)
 {
     try
     {
         return(_tableUserTableAdapter.InsertUser(UserName, pwd, userLevel));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Insert a user from User table.
 /// </summary>
 /// <param name="username">string username</param>
 /// <param name="password">string password</param>
 /// <param name="userLevel">int userLevel</param>
 /// <returns>int rowsAffected</returns>
 /// <exception cref="ex">Exception</exception>
 public int InsertUser(string userName, string userPassword, int userLevel)
 {
     try
     {
         return(_tabUserTableAdapter.InsertUser(userName, userPassword, userLevel));
     }
     catch (Exception ex)
     {
         //Error log simulate
         Console.WriteLine(ex.ToString());
         Console.WriteLine(ex.GetBaseException().ToString());
         throw;
     }
 }
        public int InsertUser(string userName, string userEmail, int userLevel, string password)
        {
            var userData         = new UserData.TabUserDataTable();
            var userTableAdapter = new TabUserTableAdapter();

            if (userName != null && password != null)
            {
                int countRow = userTableAdapter.InsertUser(userName, password, userLevel, userEmail);
                return(countRow);
            }
            else
            {
                return(0);
            }
        }
        // add new user row into User table
        public bool IsUserInserted(UserDTO newUser)
        {
            try
            {
                //if (!newUser.UserName.ToLower().Contains("admin") || !newUser.UserName.ToLower().Contains("user") || !newUser.UserName.ToLower().Contains("sup"))
                //{
                //    MessageBox.Show("User Name must contain 'user' or 'admin' or 'sup' ");
                //    return false;
                //}
                //else
                //{
                //}

                // insert row using query
                tabUserTableAdapter.InsertUser(newUser.UserName, newUser.Password, newUser.UserLevel, newUser.UserEmail);
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return(false);
            }
        }
Exemplo n.º 5
0
 public int InsertUser(string userName, string userPassword, int userLevel)
 {
     return(_tabUserTableAdapter.InsertUser(userName, userPassword, userLevel));
 }