Advertisement
Guest User

practice

a guest
May 27th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.99 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.Windows.Forms;
  9.  
  10. namespace практика
  11. {
  12. public partial class Form1 : Form
  13. {
  14. //static string date_now = DateTime.Now.ToShortDateString();
  15. int n = 5;
  16. string[] sname = { "Иванов П", "Кузнецова С", "Демченко А", "Моисеев М", "Долохов Н" };
  17. int[] flat = { 18, 20, 22, 25, 29 };
  18. double[] money = { 0, 276, 156, 1264, 2783 };
  19. double[] money_before = { 0, 276, 156, 1264, 2783 };
  20. int[] dayp = {20, 23, 4, 15, 19};
  21. int[] monthp = {05, 05, 04, 05, 05};
  22. int[] yearp = {17, 17, 17, 17, 17};
  23. string secret_key = "1234";
  24.  
  25. public Form1()
  26. {
  27. InitializeComponent();
  28. }
  29.  
  30. private void Form1_Load(object sender, EventArgs e)
  31. {
  32. for (int i = 0; i < n; i++)
  33. comboBox1.Items.Add(Convert.ToString(flat[i]));
  34. }
  35.  
  36. private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  37. {
  38. for (int i = 0; i < n; i++)
  39. {
  40. if (comboBox1.Text == Convert.ToString(flat[i]))
  41. {
  42. int proverka = 0;
  43. if (textBox2.Text == "")
  44. MessageBox.Show("Введите день", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
  45. else proverka++;
  46. if (textBox3.Text == "")
  47. MessageBox.Show("Введите месяц", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
  48. else proverka++;
  49. if (textBox4.Text == "")
  50. MessageBox.Show("Введите год", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
  51. else proverka++;
  52. if (proverka == 3){
  53. label4.Text = sname[i];
  54. int day = Convert.ToInt32(textBox2.Text);
  55. int month = Convert.ToInt32(textBox3.Text);
  56. int year = Convert.ToInt32(textBox4.Text);
  57. if (month > monthp[i])
  58. {
  59. for (int k = 0; k < day; k++)
  60. money[i] += money[i] * 0.015;
  61. }
  62. money[i] = Convert.ToDouble(String.Format("{0:0.##}", money[i]));
  63. label5.Text = Convert.ToString(money[i]);
  64. money[i] = money_before[i];
  65. }
  66. }
  67. }
  68. }
  69.  
  70. private void button1_Click(object sender, EventArgs e)
  71. {
  72. for (int i = 0; i < n; i++)
  73. {
  74. if (comboBox1.Text == Convert.ToString(flat[i]))
  75. {
  76. if (textBox1.Text == secret_key)
  77. {
  78. money[i] = 0;
  79. label5.Text = Convert.ToString(money[i]);
  80. }
  81. }
  82.  
  83. }
  84. }
  85.  
  86. private void button2_Click(object sender, EventArgs e)
  87. {
  88. for (int i = 0; i < n; i++)
  89. {
  90. if (comboBox1.Text == Convert.ToString(flat[i]))
  91. {
  92. int proverka = 0;
  93. if (textBox2.Text == "")
  94. MessageBox.Show("Введите день", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
  95. else proverka++;
  96. if (textBox3.Text == "")
  97. MessageBox.Show("Введите месяц", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
  98. else proverka++;
  99. if (textBox4.Text == "")
  100. MessageBox.Show("Введите год", "Предупреждение", MessageBoxButtons.OK, MessageBoxIcon.Information);
  101. else proverka++;
  102. if (proverka == 3)
  103. {
  104. label4.Text = sname[i];
  105. int day = Convert.ToInt32(textBox2.Text);
  106. int month = Convert.ToInt32(textBox3.Text);
  107. int year = Convert.ToInt32(textBox4.Text);
  108. if (month > monthp[i])
  109. {
  110. for (int k = 0; k < day; k++)
  111. money[i] += money[i] * 0.015;
  112. }
  113. money[i] = Convert.ToDouble(String.Format("{0:0.##}", money[i]));
  114. label5.Text = Convert.ToString(money[i]);
  115. money[i] = money_before[i];
  116. }
  117. }
  118. }
  119. }
  120.  
  121.  
  122. }
  123. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement