Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- namespace практика
- {
- public partial class Form1 : Form
- {
- //static string date_now = DateTime.Now.ToShortDateString();
- int n = 5;
- string[] sname = { "Иванов П", "Кузнецова С", "Демченко А", "Моисеев М", "Долохов Н" };
- int[] flat = { 18, 20, 22, 25, 29 };
- double[] money = { 0, 276, 156, 1264, 2783 };
- double[] money_before = { 0, 276, 156, 1264, 2783 };
- int[] dayp = {20, 23, 4, 15, 19};
- int[] monthp = {05, 05, 04, 05, 05};
- int[] yearp = {17, 17, 17, 17, 17};
- string secret_key = "1234";
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- for (int i = 0; i < n; i++)
- comboBox1.Items.Add(Convert.ToString(flat[i]));
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- for (int i = 0; i < n; i++)
- {
- if (comboBox1.Text == Convert.ToString(flat[i]))
- {
- int proverka = 0;
- if (textBox2.Text == "")
- MessageBox.Show("Введите день", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else proverka++;
- if (textBox3.Text == "")
- MessageBox.Show("Введите месяц", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else proverka++;
- if (textBox4.Text == "")
- MessageBox.Show("Введите год", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else proverka++;
- if (proverka == 3){
- label4.Text = sname[i];
- int day = Convert.ToInt32(textBox2.Text);
- int month = Convert.ToInt32(textBox3.Text);
- int year = Convert.ToInt32(textBox4.Text);
- if (month > monthp[i])
- {
- for (int k = 0; k < day; k++)
- money[i] += money[i] * 0.015;
- }
- money[i] = Convert.ToDouble(String.Format("{0:0.##}", money[i]));
- label5.Text = Convert.ToString(money[i]);
- money[i] = money_before[i];
- }
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < n; i++)
- {
- if (comboBox1.Text == Convert.ToString(flat[i]))
- {
- if (textBox1.Text == secret_key)
- {
- money[i] = 0;
- label5.Text = Convert.ToString(money[i]);
- }
- }
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < n; i++)
- {
- if (comboBox1.Text == Convert.ToString(flat[i]))
- {
- int proverka = 0;
- if (textBox2.Text == "")
- MessageBox.Show("Введите день", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else proverka++;
- if (textBox3.Text == "")
- MessageBox.Show("Введите месяц", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else proverka++;
- if (textBox4.Text == "")
- MessageBox.Show("Введите год", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
- else proverka++;
- if (proverka == 3)
- {
- label4.Text = sname[i];
- int day = Convert.ToInt32(textBox2.Text);
- int month = Convert.ToInt32(textBox3.Text);
- int year = Convert.ToInt32(textBox4.Text);
- if (month > monthp[i])
- {
- for (int k = 0; k < day; k++)
- money[i] += money[i] * 0.015;
- }
- money[i] = Convert.ToDouble(String.Format("{0:0.##}", money[i]));
- label5.Text = Convert.ToString(money[i]);
- money[i] = money_before[i];
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement