Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        private void button1_Click_1(object sender, EventArgs e)
        {
            var login        = textBox1.Text;
            var password     = maskedTextBox1.Text;
            var cpassword    = maskedTextBox2.Text;
            var phone_number = maskedTextBox3.Text;
            var card_number  = maskedTextBox4.Text;
            var rank         = 1;

            if (materialRadioButton2.Checked)
            {
                rank = 2;
            }
            else if (materialRadioButton3.Checked)
            {
                rank = 3;
            }
            var FN        = openFileDialog1.FileName.Split('\\');
            var fileOfPic = "ProfileImages\\" + FN.Last();

            pictureBox1.Image.Save(fileOfPic); //"\\ProfileImages\\" +
            if (rank == 1)
            {
                VisitorContext vc      = new VisitorContext();
                Visitor        visitor = new Visitor();

                if (password == cpassword)
                {
                    visitor.Login        = login;
                    visitor.Password     = password;
                    visitor.phoneNumber  = phone_number;
                    visitor.cardNumber   = card_number;
                    visitor.rank         = rank;
                    visitor.profileImage = fileOfPic;
                    vc.Visitors.Add(visitor);
                    vc.SaveChanges();
                }
            }
            else if (rank == 2)
            {
                SingerContext sc     = new SingerContext();
                Singer        singer = new Singer();

                if (password == cpassword)
                {
                    singer.Login        = login;
                    singer.Password     = password;
                    singer.phoneNumber  = phone_number;
                    singer.cardNumber   = card_number;
                    singer.rank         = rank;
                    singer.profileImage = fileOfPic;
                    sc.Singers.Add(singer);
                    sc.SaveChanges();
                }
            }
            else
            {
                ManagerContext mc      = new ManagerContext();
                Manager        manager = new Manager();
                if (password == cpassword)
                {
                    manager.Login        = login;
                    manager.Password     = password;
                    manager.phoneNumber  = phone_number;
                    manager.cardNumber   = card_number;
                    manager.rank         = rank;
                    manager.profileImage = fileOfPic;
                    manager.Concerts     = null;
                    mc.Managers.Add(manager);
                    mc.SaveChanges();
                }
            }
        }
Ejemplo n.º 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            bool complete = false;

            if (!complete)
            {
                using (VisitorContext vc = new VisitorContext())
                {
                    var Visitors = vc.Visitors.Where(p => p.Login == textBox3.Text);
                    if (Visitors.Count() > 0)
                    {
                        complete = true;
                        foreach (var v in Visitors)
                        {
                            if (v.Password == textBox2.Text)
                            {
                                Form1 form1 = new Form1(v.Id, 1);
                                form1.Show();
                                break;
                            }
                        }
                    }
                }
            }
            if (complete)
            {
                this.Hide();
            }
            else
            {
                using (SingerContext sc = new SingerContext())
                {
                    var Singers = sc.Singers.Where(p => p.Login == textBox3.Text);
                    if (Singers.Count() > 0)
                    {
                        complete = true;
                        foreach (var s in Singers)
                        {
                            if (s.Password == textBox2.Text)
                            {
                                Form1 form1 = new Form1(s.Id, 2);
                                form1.Show();
                                break;
                            }
                        }
                    }
                }
            }
            if (complete)
            {
                this.Hide();
            }
            else
            {
                using (ManagerContext mc = new ManagerContext())
                {
                    var Managers = mc.Managers.Where(p => p.Login == textBox3.Text);
                    if (Managers.Count() > 0)
                    {
                        complete = true;
                        foreach (var m in Managers)
                        {
                            if (m.Password == textBox2.Text)
                            {
                                Form1 form1 = new Form1(m.Id, 3);
                                form1.Show();
                                break;
                            }
                        }
                    }
                }
            }
            if (complete)
            {
                this.Hide();
            }
            else
            {
                button2.Text = "Net";
            }
        }