Организационная структура принимающей организации



бет10/11
Дата01.07.2023
өлшемі0,85 Mb.
#103929
түріРеферат
1   2   3   4   5   6   7   8   9   10   11
Приложение А
Скрины программы

Рисунок 1- Окно авторизации пользователя

Рисунок 2- Окно регистрации пользователя

Рисунок 3- Окно подтверждения email адреса

Рисунок 4- Главное окно


Приложение Б
Листинг программы

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Net.Mail;
using System.Net;
using System.Security.Cryptography;

namespace WindowsFormsApplication25
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public static Random rand = new Random();
public static int val = rand.Next(100000, 999999);
private void button1_Click(object sender, EventArgs e)
{
MySqlConnection con = new MySqlConnection("server=127.0.0.1;user=root;password=;database=test");
MySqlCommand com = new MySqlCommand("SELECT * FROM user WHERE Login=@Login and Pass=@Pass
and Data=@Data", con);
con.Open();
string str = Form3.GetMD5Hash(textBox2.Text);
com.Parameters.AddWithValue("@Login", textBox1.Text);
com.Parameters.AddWithValue("@Pass", str);
com.Parameters.AddWithValue("@Data", textBox3.Text);
MySqlDataReader Dr = com.ExecuteReader();
if (Dr.HasRows == true)
{
MailAddress From = new MailAddress("freez-man@bk.ru", "SISTEM");
MailAddress To = new MailAddress(textBox3.Text);
MailMessage msg = new MailMessage(From, To);
msg.Subject = "Code";
msg.Body = "

" + val + "

";
msg.IsBodyHtml = true;
SmtpClient smpt = new SmtpClient("smpt.bk.ru", 587);
smpt.Credentials = new NetworkCredential("freez-man@bk.ru", "Magadan2906953");
smpt.EnableSsl = true;
smpt.Send(msg);
panel1.Visible = true;
}
else
{
MessageBox.Show("Такого логина или пароля не существует: \n\n1) Проверьте правильность ввода\n\n2)
Обратитесь к администартору", "Ошибка авторизации", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}

private void button2_Click(object sender, EventArgs e)
{
this.Hide();
Form3 reg = new Form3();
reg.Show();
}

private void button3_Click(object sender, EventArgs e)
{
int code = Convert.ToInt32(textBox4.Text);
if (code == val)
{
Form4 main = new Form4();
main.Show();
Hide();
}
else { MessageBox.Show("Пожалуйста, проверьте правильность введенных данных!"); }
}
}
}
Окно регистрации

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Net.Mail;
using System.Net;
using System.Security.Cryptography;

namespace WindowsFormsApplication25
{
public partial class Form3 : Form
{
public static Random rand = new Random();
public static int val = rand.Next(100000, 999999);

public Form3()
{
InitializeComponent();
}

public void button1_Click(object sender, EventArgs e)
{
if ((textBox2.Text == textBox3.Text) && (textBox4.Text.Length > 4) && (textBox1.Text.Length > 4) &&
(textBox2.Text.Length > 4))
{
MailAddress From = new MailAddress("freez-man@bk.ru", "SISTEM");
MailAddress To = new MailAddress(textBox4.Text);
MailMessage msg = new MailMessage(From, To);
msg.Subject = "Code";
msg.Body = "

Достарыңызбен бөлісу:
1   2   3   4   5   6   7   8   9   10   11




©emirsaba.org 2024
әкімшілігінің қараңыз

    Басты бет