TFS_ANTIGUO/SIGPC/wcfSigdd/WindowsApplication__Encriptar/Encriptar.cs
kledezma 7fdadc4709 KLB
git-tfs-id: [http://192.168.1.10:8080/tfs/AyA]$/SINORT;C519
2021-01-22 15:05:35 +00:00

67 lines
2 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Helper;
namespace WindowsApplication_OTSI_Encriptar
{
public partial class frmEncriptador : Form
{
public frmEncriptador()
{
InitializeComponent();
}
private void encriptarToolStripMenuItem_Click(object sender, EventArgs e)
{
lblOriginal.Text = "Texto Original";
lblEncriptado.Text = "Texto Encriptado";
btnAceptar.Text = "Encriptar";
txtEncriptado.Text = "";
txtOriginal.Text = "";
}
private void desencriptarToolStripMenuItem_Click(object sender, EventArgs e)
{
lblOriginal.Text = "Texto Encriptado";
lblEncriptado.Text = "Texto Original";
btnAceptar.Text = "Desencriptar";
txtEncriptado.Text = "";
txtOriginal.Text = "";
}
private void btnAceptar_Click(object sender, EventArgs e)
{
try
{
Helper.CryptographyManager cmManager = new Helper.CryptographyManager();
if (lblOriginal.Text == "Texto Original")
{
txtEncriptado.Text = cmManager.Encriptar(txtOriginal.Text);
}
else
{
txtEncriptado.Text = cmManager.Desencriptar(txtOriginal.Text);
}
}
catch (Exception ex)
{
MessageBox.Show("Error en el proceso: " + ex.Message,"Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnLimpiar_Click(object sender, EventArgs e)
{
txtEncriptado.Text = "";
txtOriginal.Text = "";
}
}
}