private bool IsAlreadyExists() { bool uExists = false; bool eExists = false; User user = new User { UserName = txtUsername.Text, Email = txtEmail.Text }; FrontCodeBusiness fcb = new FrontCodeBusiness { UserObj = user }; DataTable dt = fcb.IsUserNameExists(); if (dt.Rows.Count > 0) { uExists = dt.Rows[0]["UserNameExists"].ToString().Equals("0") ? false : true; } dt = fcb.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 UserNameExists(string username) { User user = new User { UserName = username }; user.UserNameInUse = false; FrontCodeBusiness fcb = new FrontCodeBusiness { UserObj = user }; DataTable dt = fcb.IsUserNameExists(); if (dt.Rows.Count > 0) { user.UserNameInUse = dt.Rows[0]["UserNameExists"].ToString().Equals("0") ? false : true; } JavaScriptSerializer js = new JavaScriptSerializer(); Context.Response.Write(js.Serialize(user)); }