private bool CheckError() { CaptchaControl1.ValidateCaptcha(txtCode.Value); if (string.IsNullOrEmpty(txtEmail.Value)) { clsUtility.Common.Show("Email không được rỗng!"); txtEmail.Focus(); return(false); } else if (!IsValidEmail(txtEmail.Value)) { clsUtility.Common.Show("Email không hợp lệ!"); txtEmail.Focus(); return(false); } else if (string.IsNullOrEmpty(txtCode.Value)) { clsUtility.Common.Show("Mã bảo mật không được rỗng!"); txtCode.Focus(); return(false); } else if (!CaptchaControl1.UserValidated) { clsUtility.Common.Show("Mã bảo mật không đúng"); txtCode.Focus(); return(false); } return(true); }
protected void Button1_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\userside.mdf;Integrated Security=True;User Instance=True"); CaptchaControl1.ValidateCaptcha(TextBox1.Text); if (CaptchaControl1.UserValidated) { string str; //str = "select * from registration phoneno=Convert.ToInt64"; str = "Insert into registration(username,emailid,password,address,city,phoneno,gender,birthdate)values('" + txtusername.Text + "','" + txtemailid.Text + "','" + txtpassword.Text + "','" + txtadd.Text + "','" + DropDownList1.Text + "', '" + txtphoneno.Text + "','" + RadioButtonList1.SelectedItem.Text + "','" + txtbirthdate.Text + "')"; //Class object Class SqlCommand cmd = new SqlCommand(str, con); con.Open(); cmd.ExecuteNonQuery(); //for insert,update & delete query... Response.Redirect("Userlogin.aspx"); con.Close(); } else { Label1.Text = "not match"; } }
protected void Button1_Click(object sender, EventArgs e) { Literal9.Text = ""; Label18.Text = ""; CheckBox1.Attributes.Add("style", "Color:0066FF;"); string subject = "New Order"; string body = buildmessage(); CaptchaControl1.ValidateCaptcha(capchatext.Text); if (!CaptchaControl1.UserValidated) { Literal9.Text = "من فضلك اكتب الحروف بشكل صحيح"; return; } if (CheckBox1.Checked != true) { CheckBox1.ForeColor = Color.Red; return; } if (sendmail(subject, body) == true) { Label18.Text = "تم الارسال بنجاح"; Label18.ForeColor = Color.Green; } else { Label18.Text = "خطأ فى ارسال الطلب"; Label18.ForeColor = Color.Red; } }
protected void Btn_Register_Click(object sender, EventArgs e) { try { int i; if (CheckBox1.Checked == true) { CaptchaControl1.ValidateCaptcha(txtcaptcha.Text); #region btncode string dob = ddlDay.SelectedItem.Value + "-" + ddlMonth.SelectedItem.Value + "-" + ddlYear.SelectedItem.Value; string fullname = txtFname.Text + " " + txtLname.Text; if (CaptchaControl1.UserValidated) { i = bal.reg(dob, fullname, ddlGender.SelectedItem.Value, txtUname.Text + "@canoysoft.com", txtPassword.Text, txtEmail.Text, txtPhno.Text, txtAdd.Text, ddlBatch.SelectedItem.Value, Convert.ToBoolean(1), ddlQues.SelectedItem.ToString(), txtSecAns.Text, Convert.ToBoolean(1)); if (i > 0) { lblmsg.Text = "registration success Please "; lblmsg1.Text = " to login"; LinkButton2.Visible = true; txtFname.Text = ""; txtLname.Text = ""; txtAdd.Text = ""; txtcaptcha.Text = ""; txtCPassword.Text = ""; txtEmail.Text = ""; txtSecAns.Text = ""; txtPassword.Text = ""; txtPhno.Text = ""; txtUname.Text = ""; ddlBatch.SelectedIndex = 0; ddlGender.SelectedIndex = 0; ddlYear.SelectedIndex = 0; ddlQues.SelectedIndex = 0; CheckBox1.Checked = false; } else { lblmsg.Text = " this register number is already used"; lblmsg1.Visible = false; LinkButton2.Visible = false; } } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('The Captcha Code is in correct....!')</script>"); //lblCaptcha.Text = bal.CreateRandomPassword(8); } #endregion } else { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('You must agree with the Canoysoft Terms and conditions')</script>"); } } catch (Exception ex) { ClientScript.RegisterStartupScript(Page.GetType(), "validation", "<script language='javascript'>alert('" + ex.Message + "')</script>"); } }
protected void btRegister_Click(object sender, EventArgs e) { if (fc.checkCompany(txtIDCompany.Text) == true) { Response.Write("<script>alert('Đã tồn tại Tên đăng nhập này')</script>"); } else { try { CaptchaControl1.ValidateCaptcha(txtCapscha.Text); } catch (Exception) { lbCapcha.Visible = true; return; } if (!CaptchaControl1.UserValidated) { lbCapcha.Visible = true; return; } else { try { DateTime certifiedDate = DateTime.Parse(txtCertifiedDate.Text); cnDb.connect(); SqlCommand cmd = new SqlCommand("sp_AddTourCompany", cnDb.conn); cmd.CommandText = "sp_AddTourCompany"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@IDCompany", txtIDCompany.Text); cmd.Parameters.AddWithValue("@CompanyName", txtNameCompay.Text); cmd.Parameters.AddWithValue("@LegalRepresentative", txtLegalRepresentative.Text); cmd.Parameters.AddWithValue("@TransactionName", txtTransactionName.Text); cmd.Parameters.AddWithValue("@TaxCode", txtTaxCode.Text); cmd.Parameters.AddWithValue("@BusinessLicense", txtBusinessLicense.Text); cmd.Parameters.AddWithValue("@CertifiedDate", certifiedDate); cmd.Parameters.AddWithValue("@Address", txtAddress.Text); cmd.Parameters.AddWithValue("@Phone", txtPhone.Text); cmd.Parameters.AddWithValue("@Email", txtEmail.Text); cmd.Parameters.AddWithValue("@Password", txtPass.Text); cmd.Parameters.AddWithValue("@WebAddress", txtWebsite.Text); cmd.ExecuteNonQuery(); cnDb.conn.Close(); Response.Redirect("UI_CompleteRegister.aspx"); } catch (Exception) { cnDb.conn.Close(); Response.Write("<script>alert('Vui lòng đăng ký lại sau.')</script>"); } } } }
protected void btnsubmit_Click(object sender, EventArgs e) { CaptchaControl1.ValidateCaptcha(txtcaptcha.Text.Trim()); if (CaptchaControl1.UserValidated) { if (fileuploadphoto.HasFile) { if (fileuploadphoto.PostedFile.ContentType == "image/jpeg" || fileuploadphoto.PostedFile.ContentType == "image/png" || fileuploadphoto.PostedFile.ContentType == "image/gif" || fileuploadphoto.PostedFile.ContentType == "image/jpg") { if (fileuploadresume.HasFile) { if (fileuploadphoto.PostedFile.ContentType == "document/txt" || fileuploadresume.PostedFile.ContentType == "text/plain" || fileuploadphoto.PostedFile.ContentType == "document/odf" || fileuploadphoto.PostedFile.ContentType == "document/doc" || fileuploadphoto.PostedFile.ContentType == "document/docx" || fileuploadphoto.PostedFile.ContentType == "document/pdf") { PS.FirstName = txtfname.Text; PS.LastName = txtlname.Text; PS.UserName = txtusername.Text; PS.Password = txtpassword.Text; PS.Email = txtemailid.Text; PS.MobileNo = Convert.ToDecimal(txtmobileno.Text); PS.Gender = Convert.ToString(rndbtnlistgender.SelectedItem.Value); PS.DateOfBirth = Convert.ToDateTime(txtdob.Text); PS.SecurityQuestion = Convert.ToString(drpsecurityquestion.SelectedItem.Value); PS.SecurityAnswer = txtanswer.Text; PS.CountryId = Convert.ToInt16(drpcountry.SelectedItem.Value); PS.StateId = Convert.ToInt16(drpstate.SelectedItem.Value); PS.CityId = Convert.ToInt16(drpcity.SelectedItem.Value); PS.Photos = ("~/Photos/" + fileuploadphoto.PostedFile.FileName); PS.Resume = ("Resume/" + fileuploadresume.PostedFile.FileName); PS.InsertRegistration(PS); fileuploadphoto.SaveAs(Server.MapPath(PS.Photos)); fileuploadresume.SaveAs(Server.MapPath(PS.Resume)); txtcl(); } else { Response.Write("<script>alert('Please Select Proper Format Document. Like(TXT,ODF,PDF,DOC,DOCX);')</script>"); } } } else { Response.Write("<script>alert('Please Select Proper Format Image. Like(JPEG,JPG,PNG,GIF)');</script>"); } } } else { lblmessage.ForeColor = System.Drawing.Color.Red; lblmessage.Text = "Re-Enter Captcha"; } }
protected void btnRegister_Click(object sender, EventArgs e) { CaptchaControl1.ValidateCaptcha(txtCapcha.Text.Trim()); if (CaptchaControl1.UserValidated) { ValueObject.MemberVO mem = new ValueObject.MemberVO(); mem.Username = txtUserName.Text; mem.Password = txtConfirmPassword.Text; mem.MemberName = txtFullName.Text; bool gender; if (rdoMale.Checked) { gender = true; } else { gender = false; } mem.Gender = gender; mem.Birthday = DateTime.Parse(txtDOB.Text); mem.Address = txtAddress.Text; mem.City = txtCity.Text; mem.PhoneNo = txtPhone.Text; mem.Email = txtEmail.Text; mem.RoleID = 2; BLL.BLL_Member bm = new BLL.BLL_Member(); bool st = bm.InsertMember(mem); if (st) { mtvwRegister.ActiveViewIndex = 1; } else { Utilties.Alert.Show("Tên đăng nhập hoặc email đã có người dùng!"); } } else { lblError.ForeColor = System.Drawing.Color.Red; lblError.Text = "Mã không đúng."; } }
protected void btnComment_Click(object sender, EventArgs e) { // CaptchaControl1.ValidateCaptcha(txtCaptcha.Text); if (!CaptchaControl1.UserValidated) { lbMessCaptcha.Visible = true; return; } else { try { lbMessCaptcha.Visible = false; string id = Request.QueryString["article"]; string name = txtCommenter.Text; string email = txtEmail.Text; string contents = txtContent.Text; func.addComment(id, name, email, contents); txtContent.Text = ""; txtEmail.Text = ""; txtCommenter.Text = ""; txtCaptcha.Text = ""; //Response.Write("<script>alert('Cảm ơn bạn đã góp ý')</script>"); loadComment(); } catch (Exception) { cnDb.conn.Close(); Response.Write("<script>alert('Vui lòng phản hồi lại sau.')</script>"); txtContent.Text = ""; txtEmail.Text = ""; txtCommenter.Text = ""; txtCaptcha.Text = ""; } } }
protected void btn_login_Click(object sender, EventArgs e) { if (txt_UserName.Text != null && txt_Password.Text != null) { User newuser = User.LoginCheck(txt_UserName.Text, txt_Password.Text); CaptchaControl1.ValidateCaptcha(txt_Captcha.Text); if (CaptchaControl1.UserValidated) { if (newuser == null) { lbl_error.Text = "نام کاربری یا گذرواژه اشتباه می باشد "; } else { Session["User"] = newuser; if (Session["URLReferer"] == null) { Response.Redirect("Default.aspx"); } else { Response.Redirect(Session["URLReferer"].ToString()); Session["URLReferer"] = null; } } } else { lbl_error.Text = "دوباره وارد کنید"; txt_Captcha.Text = ""; } } else { lbl_error.Text = "فیلدها را خواهشا پرکنید"; } }
protected void ibCrearCuenta_Click(object sender, ImageClickEventArgs e) { string Nombre = TextBox2.Text; string Rut = txtRut.Text; string Usuario = txtUsername.Text; string pass = txtPass.Text; string pass2 = txtPass2.Text; string correo = txtCorreo.Text; string Pin = txtPin.Text; string pin2 = txtPin2.Text; CaptchaControl1.ValidateCaptcha(txtCaptcha.Text); if (Usuario == "") { string popupScript = "<script language='JavaScript'> alert(' El Campo Usuario es Obligatorio.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtUsername.Focus(); txtCaptcha.Text = ""; } else if (pass == "") { string popupScript = "<script language='JavaScript'> alert(' El Campo Password es Obligatorio.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtPass.Focus(); txtCaptcha.Text = ""; } else if (pass2 == "") { string popupScript = "<script language='JavaScript'> alert(' El Campo reingrese Password es Obligatorio.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtPass2.Focus(); txtCaptcha.Text = ""; } else if (correo == "") { string popupScript = "<script language='JavaScript'> alert(' El Campo Correo es Obligatorio.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtCorreo.Focus(); txtCaptcha.Text = ""; } else if (Pin == "") { string popupScript = "<script language='JavaScript'> alert(' El Campo PIN es Obligatorio.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtPin.Focus(); txtCaptcha.Text = ""; } else if (pin2 == "") { string popupScript = "<script language='JavaScript'> alert(' El Campo reingrese PIN es Obligatorio.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtPin2.Focus(); txtCaptcha.Text = ""; } else { if (isValidPass(txtPass.Text) == true) { if (pass != "1234" || pass != "4321") { if (pass == pass2) { if (Pin == pin2) { if (IsValidEmail(txtCorreo.Text) == true) { if (CaptchaControl1.UserValidated) { respuesta = cReg.RegistroUsuario(Nombre, Rut, Usuario, pass, correo, Convert.ToInt32(Pin), txtCargo.Text, txtCentroCosto.Text); if (respuesta != false) { generarCorreo(); string popupScript = "<script language='JavaScript'> alert(' Cuenta de Usuario creada correctamente.\\n\\n Su cuenta se encuentra Inactiva. ');location.href='Login.aspx' </script>"; Page.RegisterStartupScript("PopupScript", popupScript); } else { string popupScript = "<script language='JavaScript'> alert(' El nombre de usuario y/o rut ya existe, vuelva a intentarlo.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); } } else { string popupScript = "<script language='JavaScript'> alert(' Código de Seguridad Incorrecto, vuelva a intentarlo.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtCaptcha.Text = ""; } } else { string popupScript = "<script language='JavaScript'> alert('El correo no tiene el formato correcto, sólo se permiten correos de la empresa.\\n\\n Por Ejemplo: [email protected] o [email protected]'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); } } else { string popupScript = "<script language='JavaScript'> alert(' Los códigos PIN NO coinciden'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtCaptcha.Text = ""; } } else { string popupScript = "<script language='JavaScript'> alert(' Las Claves Secretas NO Coinciden'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtCaptcha.Text = ""; } } else { string popupScript = "<script language='JavaScript'> alert('El código PIN es poco seguro, vuelva a intentarlo'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); } } else { string popupScript = "<script language='JavaScript'> alert('Estimado Usuario: \\n\\nPor seguridad su clave debe contener Número y letras ademas de un minimo de 6 caracteres.'); </script>"; Page.RegisterStartupScript("PopupScript", popupScript); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { #region Encoding string inputEmailOrPhone = HttpUtility.HtmlEncode(txtEmailOrPhone.Text); string inputPassword = HttpUtility.HtmlEncode(txtPassword.Text); string captchaText = HttpUtility.HtmlEncode(txtCaptcha.Text); #endregion #region Validations, Notifications & Authenticaiton Process divNotification.Visible = false; ltrNotification.Text = string.Empty; LOGSTAT.LoginTypeName logType = LOGSERV.IdentifyAndValidateEmailOrPhone(inputEmailOrPhone); SaUserModel.SaUser thisUser = new LOGSTAT.SaUser(); if (inputEmailOrPhone == string.Empty) { divNotification.Visible = true; ltrNotification.Text = LOGSTAT.msgPhoneEmailEmpty; } else if (inputPassword == string.Empty) { divNotification.Visible = true; ltrNotification.Text = LOGSTAT.msgPasswordEmpty; } else if (txtCaptcha.Text == string.Empty) { divNotification.Visible = true; ltrNotification.Text = LOGSTAT.msgCaptchaEmpty; } else if (logType == LOGSTAT.LoginTypeName.None) { divNotification.Visible = true; ltrNotification.Text = LOGSTAT.msgInvalidPhoneEmailFormat; } else if (txtCaptcha.Text != string.Empty) { CaptchaControl1.ValidateCaptcha(captchaText); if (!CaptchaControl1.UserValidated) { divNotification.Visible = true; ltrNotification.Text = LOGSTAT.msgCaptchaEmpty; } else { thisUser = logType == SaUserModel.LoginTypeName.Email ? SaUserService.QueryUserByEmail(inputEmailOrPhone) : (logType == SaUserModel.LoginTypeName.Phone ? SaUserService.QueryUserByGsmNumber(inputEmailOrPhone) : null); if (thisUser.Password != inputPassword) { divNotification.Visible = true; ltrNotification.Text = LOGSTAT.msgInvalidPassword; } else if (thisUser != null && thisUser.UserActive == true) { SaUserService.CreateAuthenticationCookies(inputEmailOrPhone); HttpCookie userCookie = new HttpCookie("userName", thisUser.Name + " " + thisUser.LastName); HttpContext.Current.Response.Cookies.Add(userCookie); string returnUrlString = Request.QueryString["ReturnUrl"] != null ? Request.QueryString["ReturnUrl"].ToString() : string.Empty; string redirectionUrl = !string.IsNullOrEmpty(returnUrlString) ? returnUrlString : "~/Home.aspx"; Response.Redirect(redirectionUrl, false); //if (!string.IsNullOrEmpty(returnUrlString)) //{ // Response.Redirect(returnUrlString, false); //} //else //{ // Response.Redirect("~/Home.aspx", false); //} } else { divNotification.Visible = true; ltrNotification.Text = LOGSTAT.msgUserDoesntExist; } } } #endregion txtCaptcha.Text = string.Empty; txtEmailOrPhone.Text = string.Empty; txtPassword.Text = string.Empty; } catch (Exception ex) { ltrResult.Text = ex.Message + " - " + ex.StackTrace; //EXP.RedirectToErrorPage(ex.Message); } }
protected void ibRecuperar_Click(object sender, ImageClickEventArgs e) { CaptchaControl1.ValidateCaptcha(txtCaptcha.Text); if (txtCorreo.Text == "" & txtUsuario.Text != "") { string popupScript = "<script language='JavaScript'> alert('El campo Correo es obligatorio.');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } else if (txtCorreo.Text != "" & txtUsuario.Text == "") { string popupScript = "<script language='JavaScript'> alert('El campo Usuario es obligatorio.');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } else if (txtCorreo.Text == "" && txtUsuario.Text == "") { string popupScript = "<script language='JavaScript'> alert('Los campos usuario y Correo son obligatorios.');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } else { if (txtCaptcha.Text != "") { if (CaptchaControl1.UserValidated) { respuesta = RP.verificaResetPassword(txtUsuario.Text, txtCorreo.Text); if (respuesta == true) { Controller_Login lo = new Controller_Login(); idUsu = lo.BuscarIDUsuario(txtUsuario.Text); lblpaso.Text = idUsu.ToString(); verifica = RP.verificaEstadoReset(Convert.ToInt32(idUsu.ToString())); if (verifica != false) { string popupScript = "<script language='JavaScript'> alert('¡Estimado Usuario:\\n\\n Ya existe una solicitud pendiente de cambio de contraseña en su correo electrónico. ! ');location.href='Login.aspx'</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } else { respInserM = RP.insertCambioMail(idUsu, Codigo); if (respInserM == true) { EnviarCorreo(); string popupScript = "<script language='JavaScript'> alert('Estimado Usuario:\\n\\n Los Datos solicitados han sido enviados a su correo electrónico.');location.href='Login.aspx'</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } else { string popupScript = "<script language='JavaScript'> alert('Estimado Usuario:\\n\\n Ya existe una solicitud pendiente de cambio de contraseña en su correo electrónico.');location.href='Login.aspx'</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } } } else { string popupScript = "<script language='JavaScript'> alert('Los datos proporcionados son incorrectos, favor corregir.');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } } else { string popupScript = "<script language='JavaScript'> alert('El código de seguridad no coincide, vuelve a intentarlo.');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); txtCaptcha.Text = ""; } } else { string popupScript = "<script language='JavaScript'> alert('El campo código de seguridad es obligatorio.');</script>"; Page.RegisterStartupScript("PopupScript", popupScript); } } }