private void ButtonAddBuyer_Click(object sender, RoutedEventArgs e) { try { if (!string.IsNullOrWhiteSpace(_newBuyer.Error)) { return; } int _idCounter = 1; foreach (Buyer buyer in buyerRepository.GetAll()) { _idCounter++; } _newBuyer.BuyerID = _idCounter++; _newBuyer.BuyerName = TextBoxAddBuyerName.Text; _newBuyer.BuyerAdress = TextBoxAddBuyerAdress.Text; _newBuyer.BuyerUNP = Int32.Parse(TextBoxAddBuyerUNP.Text); _newBuyer.BuyerPhone = TextBoxAddBuyerPhone.Text; _newBuyer.BuyerRequest = TextBoxAddBuyerRequest.Text; buyerRepository.AddBuyer(_newBuyer); MessageBox.Show("Данные добавлены."); this.Close(); } catch (System.Exception ex) { MessageBox.Show(ex.Message, "Ошибка"); } }
private void UpdateSelectedBuyer() { buyerRepository = new BuyerRepository(); showBuyer.Items.Clear(); foreach (Buyer buyer in buyerRepository.GetAll()) { showBuyer.Items.Add(buyer); } }
public IList <Buyer> GetAll() { var buyers = _buyerRepository.GetAll(); if (buyers == null) { return(new List <Buyer>()); } return(buyers); }
public ActionResult UserList() { var x = _buyerRepository.GetAll().ToList(); var y = _sellerRepository.GetAll().ToList(); var z = new BuyerSellersViewModel() { Buyers = x, Sellers = y }; return(View(z)); }
public IEnumerable <Buyer> GetAll() { List <Buyer> ListBuyer = new List <Buyer>(); foreach (Buyer OneBuyer in _repository.GetAll()) { Buyer NewBuyer = new Buyer(); NewBuyer = OneBuyer; NewBuyer.Vouchers = null; NewBuyer.Orders = null; NewBuyer.Interactions = null; ListBuyer.Add(NewBuyer); } return(ListBuyer); }
IEnumerable <Buyer> IBuyerBusinessService.GetAll() { return(repository.GetAll()); }
private void Window_Loaded(object sender, RoutedEventArgs e) { foreach (var buyer in buyerRepo.GetAll()) { buyers.Add(buyer); } foreach (var owner in ownerRepository.GetAll()) { owners.Add(owner); } int buyersCount = buyers.Count; int ownersCount = owners.Count; int[] data = new int[2] { buyersCount, ownersCount }; var sum = data.Sum(); var angles = data.Select(d => d * 2.0 * Math.PI / sum); var radius = 100.0; var startAngle = 0.0; var centerPoint = new Point(radius, radius); var xyradius = new Size(radius, radius); foreach (var angle in angles) { var endAngle = startAngle + angle; var startPoint = centerPoint; startPoint.Offset(radius * Math.Cos(startAngle), radius * Math.Sin(startAngle)); var endPoint = centerPoint; endPoint.Offset(radius * Math.Cos(endAngle), radius * Math.Sin(endAngle)); var angleDeg = angle * 180.0 / Math.PI; Path p = new Path() { Stroke = Brushes.Black, Fill = Brushes.Green, Data = new PathGeometry( new PathFigure[] { new PathFigure(centerPoint, new PathSegment[] { new LineSegment(startPoint, isStroked: true), new ArcSegment(endPoint, xyradius, angleDeg, angleDeg > 180, SweepDirection.Clockwise, isStroked: true) }, closed: true) }) }; container.Children.Add(p); startAngle = endAngle; } }
public async Task <IEnumerable <Buyer> > GetAll() { return(await _buyerRepository.GetAll()); }