private async void BtnAdd_Click(object sender, EventArgs e)
        {
            Packet   selectedPackage = cmbPackages.SelectedItem as Packet;
            FService selectedService = cmbServices.SelectedItem as FService;
            Order    order           = new Order();

            order.EmployeeId = employee.Id;
            order.CustomerId = customer.Id;
            order.OrderDate  = dtOrderDate.Value;
            int price = Convert.ToInt32(txtPrice.Text);

            fitness.Orders.Add(order);
            await fitness.SaveChangesAsync();

            if (cmbPackages.SelectedIndex >= 0 && cmbServices.SelectedIndex == -1)
            {
                cmbServices.Visible = false;
                selectedService     = null;
            }
            if (cmbServices.SelectedIndex >= 0 && cmbPackages.SelectedIndex == -1)
            {
                cmbPackages.Visible = false;
                selectedPackage     = null;
            }

            this.Close();
            OrderDetailss orderDetails = new OrderDetailss(fitness, order, selectedPackage, selectedService, price);

            orderDetails.ShowDialog();
        }
Exemple #2
0
 public UpdateService(FitnessEntities fitness1, FService service1, DataGridView data)
 {
     InitializeComponent();
     fitness     = fitness1;
     service     = service1;
     ServiceData = data;
 }
 public OrderDetailss(FitnessEntities fitness1, Order order1, Packet package1, FService service1, int price1)
 {
     InitializeComponent();
     fitness         = fitness1;
     order           = order1;
     selectedPackage = package1;
     selectedService = service1;
     price           = price1;
 }
Exemple #4
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();
        }
Exemple #5
0
        private void BtnUpdateService_Click(object sender, EventArgs e)
        {
            if (dgwServices.SelectedCells.Count > 0)
            {
                int selectedrowindex = dgwServices.SelectedCells[0].RowIndex;


                DataGridViewRow selectedRow = dgwServices.Rows[selectedrowindex];

                service1 = fitness1.FServices.Find(selectedRow.Cells["Id"].Value);
            }
            service2 = service1;
            UpdateService updateService = new UpdateService(fitness1, service2, dgwServices);

            updateService.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();
        }