private bool isAlreadyExists() { bool uExists = false; bool eExists = false; User user = new User { Username = txtUsername.Text, Email = txtEmail.Text }; ECommerceBusiness ecb = new ECommerceBusiness { UserObj = user }; DataTable dt = ecb.IsUserNameExists(); if (dt.Rows.Count > 0) { uExists = dt.Rows[0]["UserNameExists"].ToString().Equals("0") ? false : true; } dt = ecb.IsEmailExists(); if (dt.Rows.Count > 0) { eExists = dt.Rows[0]["EmailExists"].ToString().Equals("0") ? false : true; } return((uExists == false && eExists == false) ? false : true); }
public void EmailExists(string email) { User user = new User { Email = email }; user.EmailInUse = false; ECommerceBusiness ecb = new ECommerceBusiness { UserObj = user }; DataTable dt = ecb.IsEmailExists(); if (dt.Rows.Count > 0) { user.EmailInUse = dt.Rows[0]["EmailExists"].ToString().Equals("0") ? false : true; } JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(user)); }