private void BtnAddPackage_Click(object sender, EventArgs e)
        {
            Packet package = new Packet();

            package.Name        = txtPackageName.Text;
            package.Price       = Convert.ToInt32(txtPackagePrice.Text);
            package.ActiveDays  = txtPackageDays.Text;
            package.ActiveHours = txtPackageHours.Text;
            fitness.Packets.Add(package);
            fitness.SaveChanges();

            foreach (var selectedService in flpServices.Controls)
            {
                CheckBox checkBox = selectedService as CheckBox;

                PacketService packetToService = new PacketService();
                if (checkBox.Checked == true)
                {
                    packetToService.ServiceId = Convert.ToInt32(checkBox.Tag);
                    packetToService.PacketId  = package.Id;
                }
                fitness.PacketServices.Add(packetToService);
            }
            MessageBox.Show("New Package successfully Added");
            fitness.SaveChanges();
            PackageData.DataSource = fitness.PacketServices.ToList();
        }
        private void OrderDetailss_Load(object sender, EventArgs e)
        {
            OrderDetail orderDetail = new OrderDetail();

            cmbEmployee.Items.Add(order.Employee);
            cmbCustomer.Items.Add(order.Customer);
            cmbEmployee.SelectedIndex = 0;
            cmbCustomer.SelectedIndex = 0;
            dtOrderDate.Value         = order.OrderDate.Value;
            txtPrice.Text             = price.ToString();

            if (selectedPackage != null)
            {
                cmbPackages.Items.Add(selectedPackage);
                cmbPackages.SelectedIndex = 0;
                orderDetail.PacketId      = selectedPackage.Id;
            }

            if (selectedService != null)
            {
                cmbServices.Items.Add(selectedService);
                cmbServices.SelectedIndex = 0;
                orderDetail.ServiceId     = selectedService.Id;
            }



            orderDetail.OrderId = order.Id;
            fitness.OrderDetails.Add(orderDetail);
            fitness.SaveChanges();
            MessageBox.Show("Order accepted");
        }
Beispiel #3
0
        private void BtnAddService_Click(object sender, EventArgs e)
        {
            FService service = new FService();
            string   name    = txtName.Text;
            int      price   = Convert.ToInt32(txtPrice.Text);

            service.Name  = name;
            service.Price = price;
            fitness.FServices.Add(service);
            fitness.SaveChanges();
            MessageBox.Show(" New Service succesfully Added");
            ServiceData.DataSource = fitness.FServices.ToList();
            this.Close();
        }
Beispiel #4
0
        private void BtnDeleteRole_Click(object sender, EventArgs e)
        {
            Role selectedRole = cmbDeleteRole.SelectedItem as Role;
            Role role         = fitness.Roles.FirstOrDefault(r => r.Id == selectedRole.Id);

            fitness.Roles.Remove(role);
            fitness.SaveChanges();
            MessageBox.Show("Role successfully Removed");
            Roledata.DataSource = fitness.Roles.Select(delegate(Role role1)
            {
                return(new
                {
                    Name = role1.Name
                });
            }).ToList();
            this.Close();
        }
Beispiel #5
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Customer customer = new Customer();

            customer.Name       = txtCustomerName.Text;
            customer.Surname    = txtCustomerSurname.Text;
            customer.AccessCard = Convert.ToInt32(txtAccesCard.Text);
            fitness.Customers.Add(customer);
            fitness.SaveChanges();
            MessageBox.Show("New Customer Successfully Added");
            txtAccesCard.Text       = "";
            txtCustomerName.Text    = "";
            txtCustomerSurname.Text = "";

            AddOrders addOrder = new AddOrders(fitness, employeeA, customer);

            addOrder.Show();
        }
        private void BtnDeleteService_Click(object sender, EventArgs e)
        {
            FService selectedService = cmbDeleteService.SelectedItem as FService;
            FService service         = fitness.FServices.FirstOrDefault(ser => ser.Id == selectedService.Id);

            fitness.FServices.Remove(service);
            fitness.SaveChanges();
            MessageBox.Show("Service successfully Removed");
            ServiceData.DataSource = fitness.FServices.Select(delegate(FService service1)
            {
                return(new
                {
                    Id = service1.Id,
                    name = service1.Name,
                    price = service1.Price
                });
            }).ToList();
            this.Close();
        }
Beispiel #7
0
        private void BtnDeleteEmployee_Click(object sender, EventArgs e)
        {
            Employee selectedEmployee = cmbDeleteEmp.SelectedItem as Employee;
            Employee employee         = fitness.Employees.FirstOrDefault(emp => emp.Id == selectedEmployee.Id);

            fitness.Employees.Remove(employee);
            fitness.SaveChanges();
            MessageBox.Show("Employee successfully Removed");
            data.DataSource = fitness.Employees.Select(delegate(Employee employe)
            {
                return(new
                {
                    Id = employe.Id,
                    name = employe.Name,
                    surname = employe.Surname,
                    username = employe.Username,
                    EmpRole = employe.Role
                });
            }).ToList();
            this.Close();
        }
Beispiel #8
0
        private void Admin_Load(object sender, EventArgs e)
        {
            dgwEmployees.DataSource = fitness1.Employees.Select(delegate(Employee employe)
            {
                return(new
                {
                    Id = employe.Id,
                    name = employe.Name,
                    surname = employe.Surname,
                    username = employe.Username,
                    EmpRole = employe.Role
                });
            }).ToList();
            dgwEmployees.Columns[0].Visible = false;


            dgwCustomers.DataSource = fitness1.Customers.Select(delegate(Customer customer)
            {
                return(new
                {
                    name = customer.Name,
                    surname = customer.Surname,
                    AccesCard = customer.AccessCard
                });
            }).ToList();



            dgwRoles.DataSource = fitness1.Roles.Select(delegate(Role role)
            {
                return(new
                {
                    Id = role.Id,
                    Name = role.Name
                });
            }).ToList();
            dgwRoles.Columns[0].Visible = false;

            dgwServices.DataSource = fitness1.FServices.Select(delegate(FService service)
            {
                return(new
                {
                    Id = service.Id,
                    Service = service.Name,
                    Price = service.Price
                });
            }).ToList();
            dgwServices.Columns[0].Visible = false;
            fitness1.SaveChanges();

            dgwPackage.DataSource = fitness1.Packets.Select(delegate(Packet package)
            {
                return(new
                {
                    Id = package.Id,
                    Name = package.Name,
                    Price = package.Price,
                    ActiveDays = package.ActiveDays,
                    ActiveHours = package.ActiveHours
                });
            }).ToList();
            dgwPackage.Columns[0].Visible = false;

            dgwOrderDetails.DataSource = fitness1.OrderDetails.Select(delegate(OrderDetail orderDetail)
            {
                return(new
                {
                    Id = orderDetail.Id,
                    packetName = orderDetail.Packet,
                    employeName = orderDetail.Order.Employee,
                    customerName = orderDetail.Order.Customer,
                    OrderDate = orderDetail.Order.OrderDate
                });
            }).ToList();
            dgwOrderDetails.Columns[0].Visible = false;

            fitness1.SaveChanges();
        }