public void Create(ScheduleExcursionItem scheduleExcursionItem) { if (!Check(scheduleExcursionItem.TypeExcursion, scheduleExcursionItem.TimeStart)) { db.ScheduleExcursionItems.Add(scheduleExcursionItem); } }
public void Delete(ScheduleExcursionItem scheduleExcursionItem) { if (Check(scheduleExcursionItem.TypeExcursion, scheduleExcursionItem.TimeStart)) { db.ScheduleExcursionItems.Remove( db.ScheduleExcursionItems.FirstOrDefault( x => (x.TypeExcursion == scheduleExcursionItem.TypeExcursion) && (x.TimeStart == scheduleExcursionItem.TimeStart))); } }
private void DeleteExcursion(object sender, EventArgs e) { ScheduleExcursionItem scheduleExcursionItem = new ScheduleExcursionItem(); scheduleExcursionItem.InitialCost = _mainView.SelectMainTableInitialCost; scheduleExcursionItem.TicketsLeft = _mainView.SelectMainTableTicketLeft; scheduleExcursionItem.TimeFinish = _mainView.SelectMainTableTimeFinish; scheduleExcursionItem.TimeStart = _mainView.SelectMainTableTimeStart; scheduleExcursionItem.TypeExcursion = _mainView.SelectMainTableTypeExcursion; scheduleExcursionItem.Venue = _mainView.SelectMainTableVenue; unitOfWork.RepositoryScheduleExcursionItem.Delete(scheduleExcursionItem); }
private void SellTicketClick(object sender, EventArgs e) { SellTicket sellTicket = new SellTicket(); ScheduleExcursionItem scheduleExcursionItem = new ScheduleExcursionItem(); sellTicket.NameExcursion = _mainView.SelectMainTableTypeExcursion; sellTicket.PriceTicket = _mainView.PriceTickets; sellTicket.SellTime = DateTime.Now; sellTicket.TimeStart = _mainView.SelectMainTableTimeStart; sellTicket.TypeTicket = _mainView.TypeTicket; unitOfWork.RepositorySellTicket.Create(sellTicket); scheduleExcursionItem.TicketsLeft = _mainView.SelectMainTableTicketLeft - 1; scheduleExcursionItem.InitialCost = _mainView.SelectMainTableInitialCost; scheduleExcursionItem.TimeFinish = _mainView.SelectMainTableTimeFinish; scheduleExcursionItem.TimeStart = _mainView.SelectMainTableTimeStart; scheduleExcursionItem.TypeExcursion = _mainView.SelectMainTableTypeExcursion; scheduleExcursionItem.Venue = _mainView.SelectMainTableVenue; unitOfWork.RepositoryScheduleExcursionItem.Update(scheduleExcursionItem); //MessageBox.Show("Билет продан на '" + sellTicket.NameExcursion + "' " + sellTicket.TypeTicket + " по цене "+ sellTicket.PriceTicket.ToString()); }
public void Update(ScheduleExcursionItem scheduleExcursionItem) { if (Check(scheduleExcursionItem.TypeExcursion, scheduleExcursionItem.TimeStart)) { BindingList <ScheduleExcursionItem> ScheduleExcursionItems = GetAll(); foreach (ScheduleExcursionItem item in ScheduleExcursionItems) { if ((scheduleExcursionItem.TypeExcursion == item.TypeExcursion) && (scheduleExcursionItem.TimeStart == item.TimeStart)) { item.TypeExcursion = scheduleExcursionItem.TypeExcursion; item.InitialCost = scheduleExcursionItem.InitialCost; item.TicketsLeft = scheduleExcursionItem.TicketsLeft; item.TimeStart = scheduleExcursionItem.TimeStart; item.Venue = scheduleExcursionItem.Venue; item.TimeFinish = scheduleExcursionItem.TimeFinish; } } } }