Advertisement
AlexRaynor

ВинФормы бронирование

Feb 18th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.40 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApp1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         ProgressBar[] ProgressBars;
  16.         int Total = 32;
  17.          
  18.  
  19.     public Form1()
  20.         {
  21.             InitializeComponent();
  22.             ProgressBars = new ProgressBar[]
  23.             {
  24.                 progressBar1,
  25.             progressBar2,
  26.             progressBar3,
  27.             progressBar4,
  28.  
  29.             };
  30.  
  31.            
  32.  
  33.  
  34.  
  35.         }
  36.  
  37.         private void BuyButtonClick(object sender, EventArgs e)
  38.         {
  39.            
  40.             Button button = (Button)sender;
  41.            int tableNumber = Convert.ToInt32(button.Tag.ToString());
  42.             ProgressBar table = ProgressBars[tableNumber];
  43.            
  44.             if (table.Value != table.Maximum)
  45.             {
  46.                
  47.                 table.Value++;
  48.                 logLabel.Text = "Столик забронирован";
  49.                 Total--;
  50.                 label5.Text = " Осталось столиков: " + (Total);
  51.                
  52.             }
  53.             else
  54.             {
  55.                 logLabel.Text = "За столиком нет мест";
  56.             }
  57.         }
  58.  
  59.        
  60.        
  61.     }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement