Esempio n. 1
0
 public ActionResult Confirm(Order vm)
 {
     var order = Repository.GetOrder(_shopId);
     if (order == null)
         return RedirectToAction("index");
     CloseOrder(order);
     SendEmail(
         Config.ShopEmailRecipient,
         String.Format(SitePhrases.LabelShopOrderEmailSubject, Config.Name),
         String.Format(SitePhrases.LabelShopOrderEmailBody, String.Format(
             "{0}: {1}<br/><br/>{2}<br/>{3}<br/>{4}<br/>{5}<br/>{6}<br/>{7}<br/><br/>{8}<br/>{9}: {10:f2}<br/>{11}: {12:f2}<br/>{13}: {14:f2}",
             Phrases.LabelOrderId,
             order.Id,
             order.Name,
             order.Address,
             order.Postcode,
             order.City,
             order.Phone,
             order.Email,
             String.Join("<br/>", order.OrderLines.Select(l => String.Format(
                 "{0} : {1} : {2:f2}",
                 l.Edition.Isbn,
                 l.Edition.Name,
                 l.Edition.Price
                 )).ToArray()),
             Phrases.LabelOrderSubtotal,
             order.Subtotal,
             Phrases.LabelOrderDistributionCost,
             order.DistributionCost,
             Phrases.LabelOrderTotal,
             order.Subtotal + order.DistributionCost
             )
         )
     );
     return RedirectToAction("receipt", new { id = order.ExternalId });
 }
Esempio n. 2
0
 public ActionResult DeleteOrder(Order vm)
 {
     Repository.Delete(Repository.GetOrder(vm.Id));
     Repository.Save();
     return RedirectToAction("orders");
 }
Esempio n. 3
0
 partial void DeleteOrder(Order instance);
Esempio n. 4
0
 partial void UpdateOrder(Order instance);
Esempio n. 5
0
 partial void InsertOrder(Order instance);
Esempio n. 6
0
 public void Delete(Order order)
 {
     _db.OrderLines.DeleteAllOnSubmit(order.OrderLines);
     _db.Orders.DeleteOnSubmit(order);
 }
Esempio n. 7
0
 public void Add(Order order)
 {
     _db.Orders.InsertOnSubmit(order);
 }
Esempio n. 8
0
 private void CloseOrder(Order order)
 {
     CalculateDistributionCost(order);
     order.ClosedAt = DateTime.Now;
     Repository.Save();
     Response.Cookies[CookieName].Value = Guid.NewGuid().ToString();
 }
Esempio n. 9
0
 private void CalculateDistributionCost(Order order)
 {
     if (order == null) return;
     order.DistributionCost = order.Subtotal >= Config.DistributionCostLimit ? 0 : Config.DistributionCostAmount;
 }