public void show_concerts() { ConcertContext db = new ConcertContext(); var concerts = db.Concerts.ToList(); if (concerts.Count > 3 * multi_c) { pictureBox3.Load(concerts[3 * multi_c].WallPaper); materialLabel6.Text = concerts[3 * multi_c].Name; materialLabel3.Text = concerts[3 * multi_c].Place; price1.Text = concerts[3 * multi_c].TicketPrice.ToString(); } else { pictureBox3.Hide(); materialLabel6.Hide(); materialLabel3.Hide(); price1.Hide(); pictureBox12.Hide(); pictureBox15.Hide(); materialFlatButton3.Hide(); } if (concerts.Count > 3 * multi_c + 1) { pictureBox4.Load(concerts[3 * multi_c + 1].WallPaper); materialLabel7.Text = concerts[3 * multi_c + 1].Name; materialLabel4.Text = concerts[3 * multi_c + 1].Place; price2.Text = concerts[3 * multi_c + 1].TicketPrice.ToString(); } else { pictureBox4.Hide(); materialLabel7.Hide(); materialLabel4.Hide(); price2.Hide(); pictureBox14.Hide(); pictureBox16.Hide(); materialFlatButton2.Hide(); } if (concerts.Count > 3 * multi_c + 2) { pictureBox11.Load(concerts[3 * multi_c + 2].WallPaper); materialLabel8.Text = concerts[3 * multi_c + 2].Name; materialLabel5.Text = concerts[3 * multi_c + 2].Place; price3.Text = concerts[3 * multi_c + 2].TicketPrice.ToString(); } else { //pictureBox1.Hide(); materialLabel8.Hide(); materialLabel5.Hide(); price3.Hide(); pictureBox13.Hide(); pictureBox17.Hide(); materialFlatButton1.Hide(); } }
public void MakeConcert(Singer s, string date, string place = "Arena") { Concert concert = new Concert(); concert.Singers = s; concert.Date = date; InformSinger(s, ref concert); ConcertContext db = new ConcertContext(); db.Concerts.Add(concert); db.SaveChanges(); }
private void materialFlatButton1_Click(object sender, EventArgs e) { ConcertContext cc = new ConcertContext(); var concert = cc.Concerts.Find(multi_c * 3 + 2); VisitorContext vc = new VisitorContext(); var visitor = vc.Visitors.Find(user_id); concert.Visitors.Add(visitor); visitor.Concerts.Add(concert); vc.SaveChanges(); cc.SaveChanges(); }
private void materialFlatButton3_Click(object sender, EventArgs e) { materialLabel2.Text = multi_c.ToString(); ConcertContext cc = new ConcertContext(); var concert = cc.Concerts.Find(multi_c * 3 + 1); var g = concert.Name; VisitorContext vc = new VisitorContext(); var visitor = vc.Visitors.Find(user_id); visitor.BuyTicket(ref concert); var f = visitor.Login; //Visitor vs = new Visitor(); //vs.cardNumber = visitor.cardNumber; //vs.CurrentSum = visitor.CurrentSum; //vs.Id = visitor.Id; //vs.Login = visitor.Login; //vs.Password = visitor.Password; //vs.phoneNumber = visitor.phoneNumber; //vs.profileImage = visitor.profileImage; //vs.rank = visitor.rank; //vs.Concerts = visitor.Concerts; //Concert cnc = new Concert(); //cnc.Date = concert.Date; //cnc.Id = concert.Id; //cnc.Manager = concert.Manager; //cnc.Name = concert.Name; //cnc.Place = concert.Place; //cnc.Singers = concert.Singers; //cnc.TicketPrice = concert.TicketPrice; //cnc.Tickets = concert.Tickets; //cnc.Visitors = concert.Visitors; //cnc.WallPaper = concert.WallPaper; cc.Entry(concert).State = EntityState.Modified; vc.Entry(visitor).State = EntityState.Modified; //visitor.Concerts.Add(concert); concert.Visitors.Add(visitor); vc.SaveChanges(); cc.SaveChanges(); }
private void button1_Click(object sender, EventArgs e) { ConcertContext db = new ConcertContext(); SingerContext dw = new SingerContext(); Concert concert = new Concert(); var FN = openFileDialog1.FileName.Split('\\'); var fileOfPic = "ConcertWallpapers\\" + FN.Last(); pictureBox2.Image.Save(fileOfPic); concert.Place = materialSingleLineTextField1.Text; concert.Tickets = Convert.ToInt32(materialSingleLineTextField2.Text); concert.TicketPrice = Convert.ToInt32(materialSingleLineTextField3.Text); concert.Name = materialSingleLineTextField4.Text; concert.WallPaper = fileOfPic; concert.Singers = dw.Singers.FirstOrDefault(p => p.Login == comboBox1.Text); concert.Date = dateTimePicker1.Text; ManagerContext mc = new ManagerContext(); concert.Manager = mc.Managers.Find(man_id); //concert.SingerName = comboBox1.Text; db.Concerts.Add(concert); db.SaveChanges(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { switch (comboBox1.SelectedIndex) { case 0: ConcertContext db = new ConcertContext(); var concerts = db.Concerts.OrderBy(p => p.Date).ToList(); if (concerts.Count > 3 * multi_c) { pictureBox3.Load(concerts[3 * multi_c].WallPaper); materialLabel6.Text = concerts[3 * multi_c].Name; materialLabel3.Text = concerts[3 * multi_c].Place; price1.Text = concerts[3 * multi_c].TicketPrice.ToString(); } else { pictureBox3.Hide(); materialLabel6.Hide(); materialLabel3.Hide(); price1.Hide(); pictureBox12.Hide(); pictureBox15.Hide(); materialFlatButton3.Hide(); } if (concerts.Count > 3 * multi_c + 1) { pictureBox4.Load(concerts[3 * multi_c + 1].WallPaper); materialLabel7.Text = concerts[3 * multi_c + 1].Name; materialLabel4.Text = concerts[3 * multi_c + 1].Place; price2.Text = concerts[3 * multi_c + 1].TicketPrice.ToString(); } else { pictureBox4.Hide(); materialLabel7.Hide(); materialLabel4.Hide(); price2.Hide(); pictureBox14.Hide(); pictureBox16.Hide(); materialFlatButton2.Hide(); } if (concerts.Count > 3 * multi_c + 2) { pictureBox11.Load(concerts[3 * multi_c + 2].WallPaper); materialLabel8.Text = concerts[3 * multi_c + 2].Name; materialLabel5.Text = concerts[3 * multi_c + 2].Place; price3.Text = concerts[3 * multi_c + 2].TicketPrice.ToString(); } else { //pictureBox1.Hide(); materialLabel8.Hide(); materialLabel5.Hide(); price3.Hide(); pictureBox13.Hide(); pictureBox17.Hide(); materialFlatButton1.Hide(); } break; case 1: ConcertContext db1 = new ConcertContext(); var concerts1 = db1.Concerts.OrderBy(p => p.TicketPrice).ToList(); if (concerts1.Count > 3 * multi_c) { pictureBox3.Load(concerts1[3 * multi_c].WallPaper); materialLabel6.Text = concerts1[3 * multi_c].Name; materialLabel3.Text = concerts1[3 * multi_c].Place; price1.Text = concerts1[3 * multi_c].TicketPrice.ToString(); } else { pictureBox3.Hide(); materialLabel6.Hide(); materialLabel3.Hide(); price1.Hide(); pictureBox12.Hide(); pictureBox15.Hide(); materialFlatButton3.Hide(); } if (concerts1.Count > 3 * multi_c + 1) { pictureBox4.Load(concerts1[3 * multi_c + 1].WallPaper); materialLabel7.Text = concerts1[3 * multi_c + 1].Name; materialLabel4.Text = concerts1[3 * multi_c + 1].Place; price2.Text = concerts1[3 * multi_c + 1].TicketPrice.ToString(); } else { pictureBox4.Hide(); materialLabel7.Hide(); materialLabel4.Hide(); price2.Hide(); pictureBox14.Hide(); pictureBox16.Hide(); materialFlatButton2.Hide(); } if (concerts1.Count > 3 * multi_c + 2) { pictureBox11.Load(concerts1[3 * multi_c + 2].WallPaper); materialLabel8.Text = concerts1[3 * multi_c + 2].Name; materialLabel5.Text = concerts1[3 * multi_c + 2].Place; price3.Text = concerts1[3 * multi_c + 2].TicketPrice.ToString(); } else { //pictureBox1.Hide(); materialLabel8.Hide(); materialLabel5.Hide(); price3.Hide(); pictureBox13.Hide(); pictureBox17.Hide(); materialFlatButton1.Hide(); } break; case 2: ConcertContext db2 = new ConcertContext(); var concerts2 = db2.Concerts.OrderBy(p => p.Id).ToList(); if (concerts2.Count > 3 * multi_c) { pictureBox3.Load(concerts2[3 * multi_c].WallPaper); materialLabel6.Text = concerts2[3 * multi_c].Name; materialLabel3.Text = concerts2[3 * multi_c].Place; price1.Text = concerts2[3 * multi_c].TicketPrice.ToString(); } else { pictureBox3.Hide(); materialLabel6.Hide(); materialLabel3.Hide(); price1.Hide(); pictureBox12.Hide(); pictureBox15.Hide(); materialFlatButton3.Hide(); } if (concerts2.Count > 3 * multi_c + 1) { pictureBox4.Load(concerts2[3 * multi_c + 1].WallPaper); materialLabel7.Text = concerts2[3 * multi_c + 1].Name; materialLabel4.Text = concerts2[3 * multi_c + 1].Place; price2.Text = concerts2[3 * multi_c + 1].TicketPrice.ToString(); } else { pictureBox4.Hide(); materialLabel7.Hide(); materialLabel4.Hide(); price2.Hide(); pictureBox14.Hide(); pictureBox16.Hide(); materialFlatButton2.Hide(); } if (concerts2.Count > 3 * multi_c + 2) { pictureBox11.Load(concerts2[3 * multi_c + 2].WallPaper); materialLabel8.Text = concerts2[3 * multi_c + 2].Name; materialLabel5.Text = concerts2[3 * multi_c + 2].Place; price3.Text = concerts2[3 * multi_c + 2].TicketPrice.ToString(); } else { //pictureBox1.Hide(); materialLabel8.Hide(); materialLabel5.Hide(); price3.Hide(); pictureBox13.Hide(); pictureBox17.Hide(); materialFlatButton1.Hide(); } break; } }