private void SalesOfferLW_SelectionChanged(object sender, SelectionChangedEventArgs e) { this.TimeArrayIndex = SalesOfferLW.SelectedIndex; PurchaseOfferLW.Items.Clear(); SalesOffer so = (SalesOffer)SalesOfferLW.SelectedItem; List <PurchaseOffer> purchaseoffers = Controller.GetPurchaseOffersById(so); foreach (PurchaseOffer po in purchaseoffers) { ListViewItem item = new ListViewItem { Content = po }; if (po.Account.Username.Equals(account.Username)) { item.Background = new SolidColorBrush(Colors.Yellow); } PurchaseOfferLW.Items.Add(item); } // Doesn't work var view = (CollectionView)CollectionViewSource.GetDefaultView(purchaseoffers); view.SortDescriptions.Add(new SortDescription("Amount", ListSortDirection.Ascending)); }
public ActionResult DeleteConfirmed(int id) { SalesOffer salesOffer = db.SalesOffers.Find(id); db.SalesOffers.Remove(salesOffer); db.SaveChanges(); return(RedirectToAction("Index")); }
private int LoadMyOffers() { SalesOffer offer = new SalesOffer(); offer.Where.SalesPersonID.Value = UserID; offer.Query.Load(); return(offer.RowCount); }
public PurchaseOffer GetLastBid(SalesOffer so) { if (so.PurchaseOffers != null) { PurchaseOffer po = (PurchaseOffer)so.PurchaseOffers.OrderByDescending(i => i.Amount).FirstOrDefault(); return(po); } return(null); }
private void OfferButton_Click(object sender, RoutedEventArgs e) { SalesOffer so = (SalesOffer)SalesOfferLW.SelectedItem; if (so != null) { Controller.CreatePurchaseOffer(account, so, PriceInput.Text); } }
public static void CreatePurchaseOffer(Account account, SalesOffer salesoffer, string amount) { var context = new AuktionDatabaseEntities(); var po = new PurchaseOffer { Amount = amount, SalesOfferId = salesoffer.Id, AccountId = account.Id }; context.PurchaseOffers.Add(po); context.SaveChanges(); }
public ActionResult Edit([Bind(Include = "Id,MetalType,Amount,Deadline,AccountId")] SalesOffer salesOffer) { if (ModelState.IsValid) { db.Entry(salesOffer).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountId = new SelectList(db.Accounts, "Id", "Name", salesOffer.AccountId); return(View(salesOffer)); }
public static List <PurchaseOffer> GetPurchaseOffersById(SalesOffer salesoffer) { var context = new AuktionDatabaseEntities(); var query = from x in context.PurchaseOffers where x.SalesOfferId == salesoffer.Id select x; List <PurchaseOffer> list = new List <PurchaseOffer>(query); return(list); }
public ActionResult Create([Bind(Include = "Id,MetalType,Amount,Deadline,AccountId")] SalesOffer salesOffer) { if (ModelState.IsValid) { salesOffer.AccountId = Int32.Parse(Session["UserID"].ToString()); db.SalesOffers.Add(salesOffer); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AccountId = new SelectList(db.Accounts, "Id", "Name", salesOffer.AccountId); return(View(salesOffer)); }
private string FormatDateTime(SalesOffer offer) { DateTime now = DateTime.UtcNow; DateTime deadline = offer.Deadline; TimeSpan timeDiff = (deadline - now); string result = $"{timeDiff.Days} Days : {timeDiff.Hours} Hours : {timeDiff.Minutes} Min : {timeDiff.Seconds} Sec"; if (offer.Deadline < DateTime.Now) { result = "Udløbet"; } return(result); }
// GET: SalesOffers/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SalesOffer salesOffer = db.SalesOffers.Find(id); if (salesOffer == null) { return(HttpNotFound()); } return(View(salesOffer)); }
// GET: SalesOffers/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SalesOffer salesOffer = db.SalesOffers.Find(id); if (salesOffer == null) { return(HttpNotFound()); } ViewBag.AccountId = new SelectList(db.Accounts, "Id", "Name", salesOffer.AccountId); return(View(salesOffer)); }
private void LoadClientVolume(long ClientID) { try { SalesOffer offer = new SalesOffer(); offer.Where.ClientID.Value = ClientID; offer.Where.ClientApprove.Value = true; offer.Where.Status.Value = "Closed"; offer.Aggregate.OfferAmount.Function = MyGeneration.dOOdads.AggregateParameter.Func.Sum; if (offer.Query.Load()) { if (offer.DefaultView != null && offer.DefaultView.Count > 0) { LBL_clientBusinessVolume.Text = offer.s_OfferAmount; } } } catch (Exception ex) { LBL_MSG.Visible = true; LBL_MSG.Text = "LoadClientOrders:" + ex.Message; } }
private void LoadClientOpenOffer(long ClientID) { try { SalesOffer offer = new SalesOffer(); offer.Where.ClientID.Value = ClientID; offer.Where.Status.Value = "Closed"; offer.Where.Status.Operator = MyGeneration.dOOdads.WhereParameter.Operand.NotEqual; offer.Aggregate.ID.Function = MyGeneration.dOOdads.AggregateParameter.Func.Count; if (offer.Query.Load()) { if (offer.DefaultView != null && offer.DefaultView.Count > 0) { LBL_clientOpenOffers.Text = offer.s_ID; } } } catch (Exception ex) { LBL_MSG.Visible = true; LBL_MSG.Text = "LoadClientOpenOffer:" + ex.Message; } }
public SalesOffer Update(SalesOffer salesOffer) { return(_mapper.Map <SalesOffer>(_salesOfferDal.Update(salesOffer))); }
public SalesOffer Add(SalesOffer salesOffer) { return(_mapper.Map <SalesOffer>(_salesOfferDal.Add(salesOffer))); }