Ejemplo n.º 1
0
        private void ButtonAddEditServices_Click(object sender, RoutedEventArgs e)
        {
            if (!IsEdit)
            {
                if (textBlockAddEditName.Text != string.Empty)
                {
                    WFAEntity.API.Other_services objectServices = new WFAEntity.API.Other_services(
                        textBlockAddEditName.Text,
                        textBlockAddEditThe_cost.Text,
                        (WFAEntity.API.Employees)ComboBoxAddEditName.SelectedItem
                        );

                    try
                    {
                        using (WFAEntity.API.MyDBContext objectMyDBContext =
                                   new WFAEntity.API.MyDBContext())
                        {
                            objectMyDBContext.Other_services.Add(objectServices);
                            objectMyDBContext.SaveChanges();
                        }
                        MessageBox.Show("Услуга добавлена");
                        this.DialogResult = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "ОШИБКА", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    MessageBox.Show("Заполните все поля!", "Ошибка!");
                    this.DialogResult = false;
                }
            }
        }
Ejemplo n.º 2
0
 public static void Fill()
 {
     using (WFAEntity.API.MyDBContext objectMyDBContext = new WFAEntity.API.MyDBContext())
     {
         if (objectMyDBContext.Database.Exists() == false)
         {
             Employees employe1 = new Employees("Владимир", "Савин", "Алексеевич", "Пушкина, 4", "02.15.2003", "Администратор", "KING", "1111", "29541514");
             objectMyDBContext.Employees.Add(employe1);
             objectMyDBContext.SaveChanges();
             Employees employe2 = new Employees("Мишуто", "Максим", "Витальевич", "Блохина, 2", "06.04.2004", "Посетитель", "Maks", "1234", "1445124785");
             objectMyDBContext.Employees.Add(employe2);
             objectMyDBContext.SaveChanges();
             Employees employe3 = new Employees("Абрамович", "Даниил", "Владимирович", "Пушкина, 2", "03.09.2003", "Кассир", "ABR", "1234", "1445124785");
             objectMyDBContext.Employees.Add(employe3);
             objectMyDBContext.SaveChanges();
             Skates_hire skatesHire1 = new Skates_hire("1", "10:00", "1", "м", employe1);
             objectMyDBContext.Skates_hire.Add(skatesHire1);
             objectMyDBContext.SaveChanges();
             Skates_hire skatesHire2 = new Skates_hire("2", "20:00", "2", "м", employe2);
             objectMyDBContext.Skates_hire.Add(skatesHire2);
             objectMyDBContext.SaveChanges();
             Skates_hire skatesHire3 = new Skates_hire("3", "11:00", "3", "м", employe1);
             objectMyDBContext.Skates_hire.Add(skatesHire3);
             objectMyDBContext.SaveChanges();
             Skates_hire skatesHire4 = new Skates_hire("4", "12:00", "4", "м", employe2);
             objectMyDBContext.Skates_hire.Add(skatesHire4);
             objectMyDBContext.SaveChanges();
             Client client1 = new Client("Игорев", "Игорь", "Игоревич", "Блохина 46", "294512486");
             objectMyDBContext.Client.Add(client1);
             objectMyDBContext.SaveChanges();
             Other_services service1 = new Other_services("Коньки на прокат", "10", employe2);
             objectMyDBContext.Other_services.Add(service1);
             objectMyDBContext.SaveChanges();
             MK_schedule MK_schedule1 = new MK_schedule("16.02.2020", "200", "17:00", "18:00", employe2, service1);
             objectMyDBContext.MK_schedule.Add(MK_schedule1);
             objectMyDBContext.SaveChanges();
             Ticket ticket1 = new Ticket("5", "200", "Есть", client1, MK_schedule1, service1, skatesHire2);
             objectMyDBContext.Ticket.Add(ticket1);
             objectMyDBContext.SaveChanges();
         }
     }
 }
Ejemplo n.º 3
0
 public Ticket(string Cost, string Amount, string Status, Client Client, MK_schedule MK_schedule, Other_services Other_services, Skates_hire Skates_hire, int ID_Ticket = 0)
 {
     this.Cost   = Cost;
     this.Amount = Amount;
     this.Status = Status;
     //this.Client = Client;
     this.ID_Client         = Client.ID_Client;
     this.ID_MK_schedule    = MK_schedule.ID_MK_schedule;
     this.ID_other_services = Other_services.ID_other_services;
     this.ID_skates_hire    = Skates_hire.ID_skates_hire;
     this.ID_Ticket         = ID_Ticket;
 }
Ejemplo n.º 4
0
 public MK_schedule(string Date, string Price, string Start_time, string End_time, Employees Employees, Other_services Other_services, int ID_MK_schedule = 0)
 {
     this.Date       = Date;
     this.Price      = Price;
     this.Start_time = Start_time;
     this.End_time   = End_time;
     //this.Employees = Employees;
     this.ID_employees      = Employees.ID_employees;
     this.ID_other_services = Other_services.ID_other_services;
     this.ID_MK_schedule    = ID_MK_schedule;
 }