private Customer TryLogin(string userId, string pin) { short nPin = 0; if (Int16.TryParse(pin, out nPin) == false) { this.errorProvider1.SetError(this.pin_textbox, "Invalid pin entered."); return(null); } Customer customer = customerDB.GetCustomerObject(userId, nPin); customer.Accounts = customerDB.GetAccounts(customer.CustomerNumber); if (!(customer.CustomerNumber > 0 && customer.Status == ObjectStatus.Clean)) { this.errorProvider1.SetError(this.pin_textbox, "Invalid Account Number / PIN."); return(null); } return(customer); }