public AdminAddTransport() { centers = controller.GetDBCenters(); InitializeComponent(); AddTruckCenter.ItemsSource = centers; AddTruckCenter.DisplayMemberPath = "CenterName"; }
void SetControlsContent() { try { if (trucks != null) { trucks.Clear(); } if (centers != null) { centers.Clear(); } var cc = controller.GetDBCenters().Where(c => c.Id != 17); foreach (Center center in cc) { centers.Add(center); } trucks = controller.GetTrucks(employee.center); Transport.ItemsSource = trucks; Transport.DisplayMemberPath = "Id"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public CreateARequier(Product prod, Center ToCenter, int number) { try { CenterTo = ToCenter; Matr = new int[Centers.Count][]; Matr[0] = new int[] { 0, 276, 351, 289 }; Matr[1] = new int[] { 276, 0, 235, 565 }; Matr[2] = new int[] { 351, 235, 0, 632 }; Matr[3] = new int[] { 289, 565, 632, 0 }; controller = new RepositoryController(); CentersObjects = controller.GetDBCenters(); CentersObjects.Remove(ToCenter); CentersWithProducts = new ObservableCollection <Center>(); ProductPosition position; foreach (Center center in CentersObjects) { position = controller.GetDBCenterProductsPosition(center).Where(p => p.product.Id == prod.Id).Where(pp => pp.numberOfProduct >= number).FirstOrDefault(); if (position != null && center.CenterName != ToCenter.CenterName) { CentersWithProducts.Add(center); } } if (CentersWithProducts.Count != 0) { CenterFrom = CentersWithProducts[0]; for (int i = 0; i < CentersWithProducts.Count; i++) { if (GetDistance(CentersWithProducts[i]) < GetDistance(CenterFrom)) { CenterFrom = CentersWithProducts[i]; } } } else { throw new Exception("Ни в одном центре нет такого количества товаров"); } //Создать заказ и отправить в БД requier = new Require(number, prod, CenterTo, CenterFrom); OpenCloseOrder.GetInstance(EmployeeWindow.GetInstance().employe).Requiers.Add(requier); } catch (Exception e) { MessageBox.Show(e.Message); } }
public AdminAddEmployee() { try { centers = controller.GetDBCenters(); InitializeComponent(); AddEmployeeCenter.ItemsSource = centers; AddEmployeeCenter.DisplayMemberPath = "CenterName"; AddEmployeeRole.ItemsSource = roles; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public AdminGenerateRequier() { try { centers = controller.GetDBCenters(); products = controller.GetDBProducts(); InitializeComponent(); FromCenter.ItemsSource = centers; FromCenter.DisplayMemberPath = "CenterName"; ToCenter.ItemsSource = centers; ToCenter.DisplayMemberPath = "CenterName"; Products.ItemsSource = products; Products.DisplayMemberPath = "Name"; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void GenerateTripInfo(Truck truck) { ObservableCollection <Center> centers = controller.GetDBCenters(); foreach (Center center in centers) { if (!center.CenterName.Equals(truck.CurrentCenter.CenterName)) { ObservableCollection <TruckSlot> SlotsTocenter = new ObservableCollection <TruckSlot>(); var truckSlots = Slots.Where(s => s.ToCenter.Id == center.Id); foreach (var slot in truckSlots) { SlotsTocenter.Add((TruckSlot)slot); } FromCentersTrips.Add(new ToCenterSlotsCountingInfo(SlotsTocenter, center, truck)); } } }
void SetControlsContent() { try { if (trucks != null) { trucks.Clear(); } if (centers != null) { centers.Clear(); } var cc = controller.GetDBCenters().Where(c => c.Id != 17); foreach (Center center in cc) { centers.Add(center); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public void SendInTrip() { CurrentCenter = controller.GetDBCenters().Where(c => c.Id == 17).FirstOrDefault(); SetBusy(); controller.UpdateTruck(this); }