Ejemplo n.º 1
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.º 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
 private void ButtonAddEditShedule_Click(object sender, RoutedEventArgs e)
 {
     if (!IsEdit)
     {
         if (textBlockAddEditDate.Text != string.Empty)
         {
             using (WFAEntity.API.MyDBContext objectMyDBContext =
                        new WFAEntity.API.MyDBContext())
             {
                 WFAEntity.API.MK_schedule objectShedule = new WFAEntity.API.MK_schedule(
                     textBlockAddEditDate.Text,
                     textBlockAddEditPrice.Text,
                     textBlockAddEditStart.Text,
                     textBlockAddEditEnd.Text,
                     (WFAEntity.API.Employees)ComboBoxAddEditEmployees.SelectedItem,
                     (WFAEntity.API.Other_services)ComboBoxAddEditServices.SelectedItem
                     );
                 try
                 {
                     objectMyDBContext.MK_schedule.Add(objectShedule);
                     objectMyDBContext.SaveChanges();
                     MessageBox.Show("Расписание добавлено");
                     this.DialogResult = true;
                     AF.ShowAll();
                 }
                 catch (Exception ex)
                 {
                     MessageBox.Show(ex.Message, "ОШИБКА", MessageBoxButton.OK, MessageBoxImage.Error);
                 }
             }
         }
         else
         {
             MessageBox.Show("Заполните все поля!", "Ошибка!");
             this.DialogResult = false;
         }
     }
     else
     {
         using (WFAEntity.API.MyDBContext objectMyDBContext =
                    new WFAEntity.API.MyDBContext())
         {
             WFAEntity.API.MK_schedule objectShedule = new WFAEntity.API.MK_schedule();
             objectShedule.Date       = textBlockAddEditDate.Text;
             objectShedule.Price      = textBlockAddEditPrice.Text;
             objectShedule.Start_time = textBlockAddEditStart.Text;
             objectShedule.End_time   = textBlockAddEditEnd.Text;
             try
             {
                 objectMyDBContext.MK_schedule.AddOrUpdate(EditShedule);
                 objectMyDBContext.SaveChanges();
                 MessageBox.Show("Расписание Редактировано");
                 this.DialogResult = true;
                 AF.ShowAll();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "ОШИБКА", MessageBoxButton.OK, MessageBoxImage.Error);
             }
         }
     }
 }