Anonim_999

1

May 9th, 2022
951
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 18.30 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Windows.Forms;
  4.  
  5. namespace WindowsFormsApplication1
  6. {
  7.     public partial class Form1 : Form
  8.     {
  9.         private Button loginButton;
  10.         private Button siginUpTumbler;
  11.         private TextBox passwordTextbox;
  12.         private TextBox loginTextBox;
  13.         private Label PasswordLabel;
  14.         private Label LoginLabel;
  15.         private Label SiginUpLoginLabel;
  16.         private Label SiginUpPasswordLabel;
  17.         private Label MainSiginUpLabel;
  18.         private TextBox SiginUpLoginTextBox;
  19.         private TextBox SiginUpPasswordTextBox;
  20.         private Button SiginUpButton;
  21.         private Button LoginTumbler;
  22.         private Label MainLoginLabel;
  23.         private DataBase _dataBase = new DataBase();
  24.  
  25.         public Form1()
  26.         {
  27.             InitializeComponent();
  28.         }
  29.  
  30.  
  31.         private void InitializeComponent()
  32.         {
  33.             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
  34.             this.loginButton = new System.Windows.Forms.Button();
  35.             this.siginUpTumbler = new System.Windows.Forms.Button();
  36.             this.passwordTextbox = new System.Windows.Forms.TextBox();
  37.             this.loginTextBox = new System.Windows.Forms.TextBox();
  38.             this.MainLoginLabel = new System.Windows.Forms.Label();
  39.             this.PasswordLabel = new System.Windows.Forms.Label();
  40.             this.LoginLabel = new System.Windows.Forms.Label();
  41.             this.SiginUpLoginLabel = new System.Windows.Forms.Label();
  42.             this.SiginUpPasswordLabel = new System.Windows.Forms.Label();
  43.             this.MainSiginUpLabel = new System.Windows.Forms.Label();
  44.             this.SiginUpLoginTextBox = new System.Windows.Forms.TextBox();
  45.             this.SiginUpPasswordTextBox = new System.Windows.Forms.TextBox();
  46.             this.SiginUpButton = new System.Windows.Forms.Button();
  47.             this.LoginTumbler = new System.Windows.Forms.Button();
  48.             this.SuspendLayout();
  49.             //
  50.             // loginButton
  51.             //
  52.             this.loginButton.BackColor = System.Drawing.Color.IndianRed;
  53.             this.loginButton.Font = new System.Drawing.Font("Times New Roman", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  54.             this.loginButton.Location = new System.Drawing.Point(567, 239);
  55.             this.loginButton.Name = "loginButton";
  56.             this.loginButton.Size = new System.Drawing.Size(92, 37);
  57.             this.loginButton.TabIndex = 0;
  58.             this.loginButton.Text = "Войти";
  59.             this.loginButton.UseVisualStyleBackColor = false;
  60.             this.loginButton.Click += new System.EventHandler(this.button1_Click_1);
  61.             //
  62.             // siginUpTumbler
  63.             //
  64.             this.siginUpTumbler.BackColor = System.Drawing.Color.MediumSpringGreen;
  65.             this.siginUpTumbler.Font = new System.Drawing.Font("Times New Roman", 15.75F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  66.             this.siginUpTumbler.Location = new System.Drawing.Point(1057, 26);
  67.             this.siginUpTumbler.Name = "siginUpTumbler";
  68.             this.siginUpTumbler.Size = new System.Drawing.Size(138, 47);
  69.             this.siginUpTumbler.TabIndex = 1;
  70.             this.siginUpTumbler.Text = "Регистация";
  71.             this.siginUpTumbler.UseVisualStyleBackColor = false;
  72.             this.siginUpTumbler.Click += new System.EventHandler(this.button2_Click);
  73.             //
  74.             // passwordTextbox
  75.             //
  76.             this.passwordTextbox.Location = new System.Drawing.Point(539, 213);
  77.             this.passwordTextbox.Name = "passwordTextbox";
  78.             this.passwordTextbox.Size = new System.Drawing.Size(156, 22);
  79.             this.passwordTextbox.TabIndex = 2;
  80.             this.passwordTextbox.TextChanged += new System.EventHandler(this.passwordTextbox_TextChanged);
  81.             //
  82.             // loginTextBox
  83.             //
  84.             this.loginTextBox.Location = new System.Drawing.Point(539, 187);
  85.             this.loginTextBox.Name = "loginTextBox";
  86.             this.loginTextBox.Size = new System.Drawing.Size(156, 22);
  87.             this.loginTextBox.TabIndex = 3;
  88.             this.loginTextBox.TextChanged += new System.EventHandler(this.loginTextBox_TextChanged);
  89.             //
  90.             // MainLoginLabel
  91.             //
  92.             this.MainLoginLabel.AutoSize = true;
  93.             this.MainLoginLabel.BackColor = System.Drawing.Color.Orange;
  94.             this.MainLoginLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  95.             this.MainLoginLabel.Font = new System.Drawing.Font("Times New Roman", 26.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  96.             this.MainLoginLabel.Location = new System.Drawing.Point(567, 134);
  97.             this.MainLoginLabel.Name = "MainLoginLabel";
  98.             this.MainLoginLabel.Size = new System.Drawing.Size(116, 53);
  99.             this.MainLoginLabel.TabIndex = 4;
  100.             this.MainLoginLabel.Text = "Вход";
  101.             this.MainLoginLabel.Click += new System.EventHandler(this.label1_Click_1);
  102.             //
  103.             // PasswordLabel
  104.             //
  105.             this.PasswordLabel.AutoSize = true;
  106.             this.PasswordLabel.BackColor = System.Drawing.Color.Orange;
  107.             this.PasswordLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  108.             this.PasswordLabel.Location = new System.Drawing.Point(482, 220);
  109.             this.PasswordLabel.Name = "PasswordLabel";
  110.             this.PasswordLabel.Size = new System.Drawing.Size(63, 17);
  111.             this.PasswordLabel.TabIndex = 5;
  112.             this.PasswordLabel.Text = "Пароль";
  113.             this.PasswordLabel.Click += new System.EventHandler(this.label2_Click);
  114.             //
  115.             // LoginLabel
  116.             //
  117.             this.LoginLabel.AutoSize = true;
  118.             this.LoginLabel.BackColor = System.Drawing.Color.Orange;
  119.             this.LoginLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  120.             this.LoginLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  121.             this.LoginLabel.Location = new System.Drawing.Point(488, 192);
  122.             this.LoginLabel.Name = "LoginLabel";
  123.             this.LoginLabel.Size = new System.Drawing.Size(54, 19);
  124.             this.LoginLabel.TabIndex = 6;
  125.             this.LoginLabel.Text = "Логин";
  126.             this.LoginLabel.Click += new System.EventHandler(this.LoginLabel_Click);
  127.             //
  128.             // SiginUpLoginLabel
  129.             //
  130.             this.SiginUpLoginLabel.AutoSize = true;
  131.             this.SiginUpLoginLabel.BackColor = System.Drawing.Color.Orange;
  132.             this.SiginUpLoginLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  133.             this.SiginUpLoginLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  134.             this.SiginUpLoginLabel.Location = new System.Drawing.Point(481, 192);
  135.             this.SiginUpLoginLabel.Name = "SiginUpLoginLabel";
  136.             this.SiginUpLoginLabel.Size = new System.Drawing.Size(54, 19);
  137.             this.SiginUpLoginLabel.TabIndex = 12;
  138.             this.SiginUpLoginLabel.Text = "Логин";
  139.             this.SiginUpLoginLabel.Visible = false;
  140.             this.SiginUpLoginLabel.Click += new System.EventHandler(this.SiginUpLoginLabel_Click);
  141.             //
  142.             // SiginUpPasswordLabel
  143.             //
  144.             this.SiginUpPasswordLabel.AutoSize = true;
  145.             this.SiginUpPasswordLabel.BackColor = System.Drawing.Color.Orange;
  146.             this.SiginUpPasswordLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  147.             this.SiginUpPasswordLabel.Location = new System.Drawing.Point(475, 220);
  148.             this.SiginUpPasswordLabel.Name = "SiginUpPasswordLabel";
  149.             this.SiginUpPasswordLabel.Size = new System.Drawing.Size(63, 17);
  150.             this.SiginUpPasswordLabel.TabIndex = 11;
  151.             this.SiginUpPasswordLabel.Text = "Пароль";
  152.             this.SiginUpPasswordLabel.Visible = false;
  153.             this.SiginUpPasswordLabel.Click += new System.EventHandler(this.SiginUpPasswordLabel_Click);
  154.             //
  155.             // MainSiginUpLabel
  156.             //
  157.             this.MainSiginUpLabel.AutoSize = true;
  158.             this.MainSiginUpLabel.BackColor = System.Drawing.Color.Orange;
  159.             this.MainSiginUpLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
  160.             this.MainSiginUpLabel.Font = new System.Drawing.Font("Times New Roman", 26.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  161.             this.MainSiginUpLabel.Location = new System.Drawing.Point(501, 134);
  162.             this.MainSiginUpLabel.Name = "MainSiginUpLabel";
  163.             this.MainSiginUpLabel.Size = new System.Drawing.Size(279, 53);
  164.             this.MainSiginUpLabel.TabIndex = 10;
  165.             this.MainSiginUpLabel.Text = "Регистрация";
  166.             this.MainSiginUpLabel.Visible = false;
  167.             this.MainSiginUpLabel.Click += new System.EventHandler(this.MainSiginUpLabel_Click);
  168.             //
  169.             // SiginUpLoginTextBox
  170.             //
  171.             this.SiginUpLoginTextBox.Location = new System.Drawing.Point(532, 187);
  172.             this.SiginUpLoginTextBox.Name = "SiginUpLoginTextBox";
  173.             this.SiginUpLoginTextBox.Size = new System.Drawing.Size(156, 22);
  174.             this.SiginUpLoginTextBox.TabIndex = 9;
  175.             this.SiginUpLoginTextBox.Visible = false;
  176.             this.SiginUpLoginTextBox.TextChanged += new System.EventHandler(this.SiginUpLoginTextBox_TextChanged);
  177.             //
  178.             // SiginUpPasswordTextBox
  179.             //
  180.             this.SiginUpPasswordTextBox.Location = new System.Drawing.Point(532, 213);
  181.             this.SiginUpPasswordTextBox.Name = "SiginUpPasswordTextBox";
  182.             this.SiginUpPasswordTextBox.Size = new System.Drawing.Size(156, 22);
  183.             this.SiginUpPasswordTextBox.TabIndex = 8;
  184.             this.SiginUpPasswordTextBox.Visible = false;
  185.             this.SiginUpPasswordTextBox.TextChanged += new System.EventHandler(this.SiginUpPasswordTextBox_TextChanged);
  186.             //
  187.             // SiginUpButton
  188.             //
  189.             this.SiginUpButton.BackColor = System.Drawing.Color.IndianRed;
  190.             this.SiginUpButton.Font = new System.Drawing.Font("Times New Roman", 14.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  191.             this.SiginUpButton.Location = new System.Drawing.Point(518, 282);
  192.             this.SiginUpButton.Name = "SiginUpButton";
  193.             this.SiginUpButton.Size = new System.Drawing.Size(201, 37);
  194.             this.SiginUpButton.TabIndex = 7;
  195.             this.SiginUpButton.Text = "Зарегистрироваться";
  196.             this.SiginUpButton.UseVisualStyleBackColor = false;
  197.             this.SiginUpButton.Visible = false;
  198.             this.SiginUpButton.Click += new System.EventHandler(this.SiginUpButton_Click);
  199.             //
  200.             // LoginTumbler
  201.             //
  202.             this.LoginTumbler.BackColor = System.Drawing.Color.MediumSpringGreen;
  203.             this.LoginTumbler.Font = new System.Drawing.Font("Times New Roman", 15.75F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(204)));
  204.             this.LoginTumbler.Location = new System.Drawing.Point(1057, 79);
  205.             this.LoginTumbler.Name = "LoginTumbler";
  206.             this.LoginTumbler.Size = new System.Drawing.Size(138, 47);
  207.             this.LoginTumbler.TabIndex = 13;
  208.             this.LoginTumbler.Text = "Вход";
  209.             this.LoginTumbler.UseVisualStyleBackColor = false;
  210.             this.LoginTumbler.Visible = false;
  211.             this.LoginTumbler.Click += new System.EventHandler(this.button4_Click);
  212.             //
  213.             // Form1
  214.             //
  215.             this.BackColor = System.Drawing.SystemColors.ControlDark;
  216.             this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  217.             this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
  218.             this.ClientSize = new System.Drawing.Size(1221, 607);
  219.             this.Controls.Add(this.LoginTumbler);
  220.             this.Controls.Add(this.SiginUpLoginLabel);
  221.             this.Controls.Add(this.SiginUpPasswordLabel);
  222.             this.Controls.Add(this.MainSiginUpLabel);
  223.             this.Controls.Add(this.SiginUpLoginTextBox);
  224.             this.Controls.Add(this.SiginUpPasswordTextBox);
  225.             this.Controls.Add(this.SiginUpButton);
  226.             this.Controls.Add(this.LoginLabel);
  227.             this.Controls.Add(this.PasswordLabel);
  228.             this.Controls.Add(this.MainLoginLabel);
  229.             this.Controls.Add(this.loginTextBox);
  230.             this.Controls.Add(this.passwordTextbox);
  231.             this.Controls.Add(this.siginUpTumbler);
  232.             this.Controls.Add(this.loginButton);
  233.             this.Name = "Form1";
  234.             this.Load += new System.EventHandler(this.Form1_Load);
  235.             this.ResumeLayout(false);
  236.             this.PerformLayout();
  237.  
  238.         }
  239.  
  240.         public void ChangeLoginVisible(bool visible)
  241.         {
  242.             MainLoginLabel.Visible = visible;
  243.             PasswordLabel.Visible = visible;
  244.             LoginLabel.Visible = visible;
  245.             passwordTextbox.Visible = visible;
  246.             loginTextBox.Visible = visible;
  247.             loginButton.Visible = visible;
  248.             siginUpTumbler.Visible = visible;
  249.         }
  250.  
  251.         public void ChangeSiginUpVisible(bool visible)
  252.         {
  253.             MainSiginUpLabel.Visible = visible;
  254.             SiginUpLoginLabel.Visible = visible;
  255.             SiginUpPasswordLabel.Visible = visible;
  256.             SiginUpLoginTextBox.Visible = visible;
  257.             SiginUpPasswordTextBox.Visible = visible;
  258.             SiginUpButton.Visible = visible;
  259.             LoginTumbler.Visible = visible;
  260.         }
  261.  
  262.         private void Form1_Load(object sender, EventArgs e)
  263.         {
  264.            
  265.         }
  266.  
  267.         private void button1_Click_1(object sender, EventArgs e)
  268.         {
  269.             if (loginTextBox.Text != "" && passwordTextbox.Text != "")
  270.             {
  271.                 if (loginTextBox.Text.Length < 34 && passwordTextbox.Text.Length < 34)
  272.                 {
  273.                     if (_dataBase.FindUser(loginTextBox.Text,passwordTextbox.Text))
  274.                     {
  275.                         Form5 choiseRoute = new Form5();
  276.                         choiseRoute.Show();
  277.                         Hide();
  278.                     }
  279.                     else
  280.                         MessageBox.Show("Пользователь не найден или введен не правильно логин и пароль");
  281.                 }
  282.                 else
  283.                     MessageBox.Show("Слишком много символов в логине или пароле");
  284.             }
  285.             else
  286.                 MessageBox.Show("Введите данные во все поля");
  287.         }
  288.  
  289.         private void button2_Click(object sender, EventArgs e)
  290.         {
  291.             ChangeSiginUpVisible(true);
  292.             ChangeLoginVisible(false);
  293.         }
  294.  
  295.         private void button4_Click(object sender, EventArgs e)
  296.         {
  297.             ChangeLoginVisible(true);
  298.             ChangeSiginUpVisible(false);
  299.         }
  300.  
  301.         private void SiginUpButton_Click(object sender, EventArgs e)
  302.         {
  303.             if (SiginUpLoginTextBox.Text != "" && SiginUpPasswordTextBox.Text != "")
  304.             {
  305.                 if (SiginUpLoginTextBox.Text.Length < 34 && SiginUpPasswordTextBox.Text.Length < 34)
  306.                 {
  307.                     if (_dataBase.CheckLoginInStock(SiginUpLoginTextBox.Text))
  308.                         MessageBox.Show("Пользователь с таким логином уже есть!");
  309.                     else
  310.                     {
  311.                         _dataBase.AddUser(SiginUpLoginTextBox.Text, SiginUpPasswordTextBox.Text);
  312.                         Form2 AllNameForm = new Form2();
  313.                         AllNameForm.Show();
  314.                         Hide();
  315.                     }
  316.                 }
  317.                 else
  318.                     MessageBox.Show("Слишком много символов в логине или пароле");
  319.             }
  320.             else
  321.                 MessageBox.Show("Введите данные во все поля");
  322.         }
  323.  
  324.         private void MainSiginUpLabel_Click(object sender, EventArgs e)
  325.         {
  326.  
  327.         }
  328.  
  329.         private void SiginUpLoginTextBox_TextChanged(object sender, EventArgs e)
  330.         {
  331.  
  332.         }
  333.  
  334.         private void SiginUpPasswordTextBox_TextChanged(object sender, EventArgs e)
  335.         {
  336.  
  337.         }
  338.  
  339.         private void SiginUpLoginLabel_Click(object sender, EventArgs e)
  340.         {
  341.  
  342.         }
  343.  
  344.         private void SiginUpPasswordLabel_Click(object sender, EventArgs e)
  345.         {
  346.  
  347.         }
  348.  
  349.         private void loginTextBox_TextChanged(object sender, EventArgs e)
  350.         {
  351.  
  352.         }
  353.  
  354.         private void passwordTextbox_TextChanged(object sender, EventArgs e)
  355.         {
  356.  
  357.         }
  358.  
  359.         private void LoginLabel_Click(object sender, EventArgs e)
  360.         {
  361.  
  362.         }
  363.  
  364.         private void label1_Click_1(object sender, EventArgs e)
  365.         {
  366.  
  367.         }
  368.  
  369.         private void label2_Click(object sender, EventArgs e)
  370.         {
  371.  
  372.         }
  373.         private void label1_Click(object sender, EventArgs e)
  374.         {
  375.  
  376.         }
  377.  
  378.         private void button1_Click(object sender, EventArgs e)
  379.         {
  380.  
  381.         }
  382.     }
  383. }
  384.  
Advertisement
Add Comment
Please, Sign In to add comment