-
Notifications
You must be signed in to change notification settings - Fork 0
/
MySponsorshipForm.cs
81 lines (69 loc) · 3.06 KB
/
MySponsorshipForm.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
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;
namespace InteractiveMap
{
public partial class MySponsorshipForm : Form
{
public MySponsorshipForm()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
Close();
RunnerMenuForm form = new RunnerMenuForm();
form.Show();
}
private void button4_Click(object sender, EventArgs e)
{
Close();
RunnerMenuForm form = new RunnerMenuForm();
form.Show();
}
private void MySponsorshipForm_Load(object sender, EventArgs e)
{
try
{
DataRow registration = this.registrationTableAdapter1.GetData().Select("[RunnerId] = " + RunnerDTO.Id + " AND [RegistrationStatusId] = 4").Last();
DataRow charity = this.charityTableAdapter1.GetData().Select("[CharityId] = '" + registration["CharityId"].ToString() + "'").First();
List<string> allRegistrations = new List<string> { };
foreach (DataRow registrationData in this.registrationTableAdapter1.GetData().Select("[RunnerId] = " + RunnerDTO.Id + " AND [RegistrationStatusId] = 4"))
{
allRegistrations.Add(registrationData["RegistrationId"].ToString());
}
label6.Text = charity["CharityName"].ToString();
label5.Text = charity["CharityDescription"].ToString();
pictureBox1.Image = Image.FromFile(@"D:\Download\desktopBackup\Колледж\удАЛЁНКА\Системное Программирование\InteractiveMap\charities\" + charity["CharityLogo"].ToString());
int sponsorsCount = 0;
float total = 0;
foreach (DataRow sponsor in this.sponsorshipTableAdapter1.GetData().Select("[RegistrationId] IN (" + String.Join(", ", allRegistrations.ToArray()) + ")"))
{
sponsorsCount++;
if (sponsorsCount <= 5)
{
Label SponsorName = this.Controls.Find("SponsorName" + sponsorsCount, true).First() as Label;
SponsorName.Text = sponsor["SponsorName"].ToString();
Label SponsorMoney = this.Controls.Find("SponsorMoney" + sponsorsCount, true).First() as Label;
SponsorMoney.Text = sponsor["Amount"].ToString();
}
total += float.Parse(sponsor["Amount"].ToString());
}
totalCost.Text = total.ToString() + "$";
} catch (Exception ex)
{
Console.WriteLine(ex);
MessageBox.Show("Что-то пошло не так");
}
}
private void SponsorMoney2_Click(object sender, EventArgs e)
{
}
}
}