Пример #1
0
        private void bRoleCreate_Click(object sender, EventArgs e)
        {
            FormCreateRole crRole = new FormCreateRole();

            crRole.UEForm = this;
            this.Visible  = false;
            if (crRole.ShowDialog() == DialogResult.OK)
            {
                BusStationEntities context = new BusStationEntities();
                Roles role = new Roles();
                role.RoleName = crRole.tbRoleName.Text;
                context.Roles.Add(role);
                context.SaveChanges();
                MessageBox.Show("Role Add");
                GetRoles();
            }
        }
Пример #2
0
        private void bBuyTicket_Click(object sender, EventArgs e)
        {
            BusStationEntities conect = new BusStationEntities();

            if (cbCityStart.Text != "" && cbCityEnd.Text != "" && cbSeats.Text != "")
            {
                DataBase.DataBaseBuses.Tickets ticket = new DataBase.DataBaseBuses.Tickets();
                ticket.ReleaseDate = DateTime.Now.Date;
                ticket.FlightId    = flight.FlightId;
                ticket.SeatId      = Convert.ToInt32(cbSeats.SelectedValue);
                ticket.DiscountId  = Convert.ToInt32(cbDiscount.SelectedValue);
                ticket.Sold        = true;
                conect.Tickets.Add(ticket);
                conect.SaveChanges();
                MessageBox.Show("Ticket Sold");
                RefreshSeats();
            }

            else
            {
                MessageBox.Show("Fill in all the fields");
            }
        }