コード例 #1
0
        public int addNewUser(string userName, string password, string Email, string address, String phoneNo)
        {
            /*if
               * getUserwithSameName() returns null then go ahead and
               * AddNewUser();
               * then AddUserInfo()
               * then setPassword()
               *
               * */
            int insertionsuccess = -1;
            DAL.pyatLevelDSTableAdapters.tbluserTableAdapter useradapter = new tbluserTableAdapter();
            DAL.pyatLevelDSTableAdapters.tbluserinfoTableAdapter infoAdapter = new tbluserinfoTableAdapter();
            DAL.pyatLevelDSTableAdapters.tblpasswordTableAdapter passwordAdapter = new tblpasswordTableAdapter();

            if (useradapter.GetUserIDByName(userName) != null)
            {
                //we got result back. Which means there is a user with the same name.
                return -1;
            }
            else
            {
                try
                {

                    int userid = addNewUser(userName, address, 0);
                    int success = infoAdapter.AddUserInfo(userid, userName, address, phoneNo, Email);
                    insertionsuccess = passwordAdapter.SetPasswordInfo(password, password, 0, userid);
                }
                catch
                {
                }

            }

            return insertionsuccess;
        }
コード例 #2
0
 public int addUserInfo(int UniqueID, string UserName, string Qustion, string Answer, string Email)
 {
     tbluserinfoTableAdapter adapter = new tbluserinfoTableAdapter();
     return adapter.AddUserInfo(UniqueID, UserName, Qustion, Answer, Email);
 }