コード例 #1
0
ファイル: cambiar.aspx.cs プロジェクト: jcarlos1987/MOD40
    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        SqlConnection conn1 = new SqlConnection(strConnString);

        try
        {
            SqlCommand command = new SqlCommand("SELECT T1.[id], T2.[nombre], T1.[del], T1.[sub], [user_type], [cargo],[depto] FROM [MOD40].[dbo].[User] T1 INNER JOIN [Panel_Control].[dbo].[Usuarios] T2 ON T1.[id]=T2.[id] WHERE T2.[user]='" + Request.Cookies["ID"].Value + "' AND T2.[pass]='" + PassAnterior.Text + "' AND T1.[id]=T2.[id]", conn1);
            conn1.Open();
            SqlDataReader reader = command.ExecuteReader();
            if (reader.HasRows)
            {
                PassAnterior.Attributes.Add("value", PassAnterior.Text);
                PassNueva.Focus();
            }
            else
            {
                PassAnterior.Attributes.Add("value", PassAnterior.Text);
                this.ClientScript.RegisterStartupScript(this.GetType(), "Error6", "alertify.error('La Contraseña Anterior no corresponde. Intenta de nuevo');", true);
                PassAnterior.Focus();
            }
        }
        catch (Exception Msj)
        {
            this.ClientScript.RegisterStartupScript(this.GetType(), "Error7", "alertify.error('" + Msj.Message + "');", true);
        }
    }
コード例 #2
0
    protected void PassAnterior_TextChanged(object sender, EventArgs e)
    {
        SqlConnection conn1 = new SqlConnection(strConnString);

        try
        {
            SqlCommand command = new SqlCommand("SELECT T1.[id], T2.[nombre], T1.[del], T1.[sub], [user_type], [cargo],[depto] FROM [Supervision].[dbo].[User] T1 INNER JOIN [Panel_Control].[dbo].[Usuarios] T2 ON T1.[id]=T2.[id] WHERE T2.[user]='" + Request.Cookies["User_Sup"].Value + "' AND T2.[pass]='" + PassAnterior.Text + "' AND T1.[id]=T2.[id]", conn1);
            conn1.Open();
            SqlDataReader reader = command.ExecuteReader();
            if (reader.HasRows)
            {
                LabelErrorPass.Text = "";
                PassAnterior.Attributes.Add("value", PassAnterior.Text);
                PassNueva.Focus();
            }
            else
            {
                PassAnterior.Attributes.Add("value", PassAnterior.Text);
                PassAnterior.Focus();
                LabelErrorPass.Text = @"<div id='card-alert' class='card red'>
                                    <div class='card-content white-text'>
                                      <p><i class='mdi-alert-error'></i> Alerta : La Constraseña Ingresada no es la correcta. Intenta de nuevo por favor. </p>" +
                                      @"</div>
                                    <button type='button' class='close white-text' data-dismiss='alert' aria-label='Close'>
                                      <span aria-hidden='true'>×</span>
                                    </button>
                                  </div>";
            }
        }
        catch (Exception Msj)
        {
            LabelMensaje.Text = @"<div id='card-alert' class='card red'>
                                    <div class='card-content white-text'>
                                      <p><i class='mdi-alert-error'></i> Alerta :" + Msj.Message + " </p>" +
                                @"</div>
                                    <button type='button' class='close white-text' data-dismiss='alert' aria-label='Close'>
                                      <span aria-hidden='true'>×</span>
                                    </button>
                                  </div>";
        }
    }