private void pictureBox7_Click(object sender, EventArgs e) { materialTabControl1.SelectedIndex = 5; MailContext mx = new MailContext(); dataGridView1.DataSource = mx.Mails.Where(p => p.SenderId == user_id).ToList(); }
private void materialRaisedButton7_Click(object sender, EventArgs e) { MailContext PostOffice = new MailContext(); SenderContext sx = new SenderContext(); //Text = textBox5.Text; //anyone.Snd = sx.Senders.ToList()[user_id - 1]; anyone.SenderId = user_id; label3.Text = user_id.ToString(); PostOffice.Mails.Add(anyone); PostOffice.SaveChanges(); //Random runt = new Random(); //label3.Text = runt.Next().ToString(); materialTabControl1.SelectedIndex = 1; }
private void comboBox5_SelectedIndexChanged(object sender, EventArgs e) { MailContext mx = new MailContext(); switch (comboBox5.SelectedIndex) { case 0: dataGridView1.DataSource = mx.Mails.Where(p => p.SenderId == user_id).OrderBy(p => p.Id).ToList(); break; case 1: dataGridView1.DataSource = mx.Mails.Where(p => p.SenderId == user_id).OrderBy(p => p.Mass).ToList(); break; case 2: dataGridView1.DataSource = mx.Mails.Where(p => p.SenderId == user_id).OrderBy(p => p.Price).ToList(); break; } }
private void materialRaisedButton7_Click(object sender, EventArgs e) { MailContext PostOffice = new MailContext(); Mail list = new Mail(); int visota = Convert.ToInt32(textBox16.Text); int dovchina = Convert.ToInt32(textBox14.Text); int shirina = Convert.ToInt32(textBox15.Text); int cina = Convert.ToInt32(textBox10.Text); string cityfrom = comboBox1.Text; string cityto = comboBox4.Text; bool pakuvanna = false; if (materialCheckBox1.Checked) { pakuvanna = true; } bool baking = false; if (materialCheckBox2.Checked) { baking = true; } Text = textBox2.Text; list.Mass = Convert.ToInt32(Text); list.Height = visota; list.Width = shirina; list.Length = dovchina; list.Price = cina; list.Packaging = pakuvanna; list.Backmail = baking; list.City1 = cityfrom; list.City2 = cityto; list.Status = "In start city"; //list.SenderName = "Popov"; //PostOffice.Mails.Add(list); //PostOffice.SaveChanges(); Form2 form = new Form2(list, user_id); form.Show(); }