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 EmailExists(string email) { User user = new User { Email = email }; user.EmailInUse = false; FrontCodeBusiness fcb = new FrontCodeBusiness { UserObj = user }; DataTable dt = fcb.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)); }