private void Country_Load(object sender, EventArgs e) { a = true; b = true; Dictionary <int, RadioButton> radioButton = new Dictionary <int, RadioButton>(); Dictionary <int, RichTextBox> richTextBox = new Dictionary <int, RichTextBox>(); int x2 = 10; int y2 = 20; int x3 = 10; int y3 = 60; for (int i = 0; i < DataBase.Mass[idCountry].City[idCity].Hotel.Count; i++) { radioButton[i] = new RadioButton(); radioButton[i].AutoSize = true; radioButton[i].Text = DataBase.Mass[idCountry].City[idCity].Hotel[i].Name; radioButton[i].Cursor = Cursors.Hand; radioButton[i].Location = new Point(x2, y2); richTextBox[i] = new RichTextBox(); richTextBox[i].Text = DataBase.Mass[idCountry].City[idCity].Hotel[i].Describe; richTextBox[i].ReadOnly = true; richTextBox[i].Font = new Font(Font, FontStyle.Regular); richTextBox[i].Size = new Size(250, 100); richTextBox[i].Location = new Point(x3, y3); panel1.Controls.Add(radioButton[i]); panel1.Controls.Add(richTextBox[i]); y2 += 150; y3 += 150; } Korzina = Seria.In(@"2.xml", Korzina); }
public void Out(string way, Korzina p) { FileStream file = new FileStream(way, FileMode.Create); XmlSerializer fileName = new XmlSerializer(typeof(Korzina)); fileName.Serialize(file, p); file.Close(); }
public Country(int i1, int i, int iname, Korzina m, CountryDataBase P1) { idCountry = i1; DataBase = P1; Korzina = m; IndexName = iname; idCity = i; InitializeComponent(); }
public Korzina In(string way, Korzina p) { FileStream file1 = new FileStream(way, FileMode.Open); XmlSerializer filename1 = new XmlSerializer(typeof(Korzina)); p = (Korzina)filename1.Deserialize(file1); file1.Close(); return(p); }
private void Form3_Load(object sender, EventArgs e) { //Seria.Out(@"4.xml", c.Mass1); c.Mass1 = Seria.In(@"4.xml", c.Mass1); Korzina = Seria.In(@"2.xml", Korzina); Mass = Seria.In(@"3.xml", Mass); foreach (var item in Mass) { foreach (var item1 in item.City) { checkedListBox1.Items.Add(item1.Name); } } }
private void Main_Load(object sender, EventArgs e) { panel2.Hide(); List = Seria.In(@"1.xml", List); //FileStream file1 = new FileStream(@"3.xml", FileMode.Create); //XmlSerializer fileName1 = new XmlSerializer(typeof(List<Massive>)); //fileName1.Serialize(file1, p.Mass); //file1.Close(); //Seria.Out(@"3.xml", DataBase.Mass); DataBase.Mass = Seria.In(@"3.xml", DataBase.Mass); panel1.Hide(); KorzinaLabel.Hide(); IElLabel.Hide(); Counter.Hide(); Delete.Hide(); button3.Hide(); dateTimePicker1.Hide(); numericUpDown1.Hide(); label3.Hide(); int x2 = 10; int y2 = 20; int x3 = 200; int y3 = y2; int q = 0; int sum1 = 0; int sum2 = 0; int i = 0; foreach (var item in DataBase.Mass) { CountryBox.Items.Add(""); CountryBox.Items[i] = item.Country; i++; } Korzina = Seria.In(@"2.xml", Korzina); int q1 = Korzina.Cost.Count(); int q3 = q1 * 2; int q4 = Korzina.CostCur.Count() + q1 * 2; int q2 = Korzina.Cost.Count() * 2 + Korzina.CostCur.Count() * 2; Counter.Minimum = 1; numericUpDown1.Minimum = 1; for (int asd = 0; asd < Korzina.Index.Count; asd++) { if (Korzina.Index[asd] == IndexName) { sum2++; } } Counter.Maximum = sum2; numericUpDown1.Maximum = sum2; for (int j = 0; j < Korzina.Hotel.Count(); j++, q++, q1++) { if (IndexName == Korzina.Index[j]) { label[q] = new Label(); label[q].AutoSize = true; label[q].Text = Korzina.Hotel[j]; label[q].Location = new Point(x2, y2); label[q1] = new Label(); label[q1].AutoSize = true; label[q1].Text = Convert.ToString(Korzina.Cost[j]) + " $"; label[q1].Location = new Point(x3, y3); sum1 += Korzina.Cost[j]; panel1.Controls.Add(label[q]); panel1.Controls.Add(label[q1]); y2 += 60; y3 += 60; } } int x6 = x2; int y6 = y3; label[q2] = new Label(); label[q2].Text = Convert.ToString(sum1) + " $ Суммарная стоимость"; label[q2].AutoSize = true; label[q2].Location = new Point(x6, y6); panel1.Controls.Add(label[q2]); }