Esempio n. 1
0
 public OrderClothesUI(Order _order,Bag _bag,Customer _customer,Clothes _chonseClothes)
 {
     this.order = _order;
     this.bag = _bag;
     this.customer = _customer;
     this.chonseClothes = _chonseClothes;
 }
Esempio n. 2
0
 public OrderControl(Order _order,Bag _bag,Customer _customer,Cloth _chonseClothes)
 {
     this.order = _order;
     this.bag = _bag;
     this.customer = _customer;
     this.chonseCloth = _chonseClothes;
 }
Esempio n. 3
0
        public int Create(Order order)
        {
            shoppingCardDB.Orders.Add(order);
            Save();

            return order.PKOrderId;
        }
 public async Task<Order> UpdateOrderAsync(Order order)
 {
     if (!_context.Orders.Local.Any(o => o.Id == order.Id))
     {
         _context.Orders.Attach(order);
     }
     _context.Entry(order).State = EntityState.Modified;
     await _context.SaveChangesAsync();
     return order;
 }
Esempio n. 5
0
 partial void InsertOrder(Order instance);
Esempio n. 6
0
		private void detach_Orders(Order entity)
		{
			this.SendPropertyChanging();
			entity.Employee = null;
		}
Esempio n. 7
0
		private void attach_Orders(Order entity)
		{
			this.SendPropertyChanging();
			entity.Employee = this;
		}
        /// <summary>
        /// Determines whether [is order reserved] [the specified order].
        /// </summary>
        /// <param name="order">The order.</param>
        /// <returns>
        ///   <c>true</c> if [is order reserved] [the specified order]; otherwise, <c>false</c>.
        /// </returns>
        private bool IsOrderReserved(Order order)
        {
            Assert.ArgumentNotNull(order, "order");

              Assert.IsNotNull(order.PaymentMeans, "Order payment means cannot be null.");

              return this.paymentProviderFactory.GetProvider(order.PaymentMeans.PaymentChannelCode) is IReservable;
        }
Esempio n. 9
0
        public ActionResult OrderDetail(OrderViewModel model)
        {
            OrderRepository orderRepo = new OrderRepository();
            OrderDetailRepository orderDetailRepo = new OrderDetailRepository();

            ShippingAddressRepository shARepo = new ShippingAddressRepository();

            Data.Order order = new Order();

            Data.OrderDetail orderDetail = new Data.OrderDetail();

            UserAddress userAddress = new UserAddress();

            IEnumerable<Data.User> userList =userRepo.GetAllUsers();

            Data.User user = new Data.User();

            string body = null;

            using (StreamReader sr = new StreamReader(Server.MapPath("~/Template/EmailTemp.html")))
            {
                body = sr.ReadToEnd();

            }

            if (User.Identity.IsAuthenticated)
            {

                string userEmail = User.Identity.Name;
                currentUer = userRepo.GetByEmail(userEmail);

                order.FKUserId = currentUer.PKUserId;

                int orderId = orderRepo.Create(order);
                order.User = currentUer;

                productId = (IList<string>)Session["ProId"];

                foreach (var item in productId)
                {
                    int id = Convert.ToInt32(item);
                    orderDetail.FKOrderId = orderId;
                    orderDetail.FKProductId = id;
                    orderDetail.Status = "In Store";
                    orderDetail.Quantity = (int)prodReop.GetById(id).Quantity;
                    orderDetail.Cost = (decimal)prodReop.GetById(id).Price;

                    orderDetailRepo.Create(orderDetail);

                }
                model.UserName = currentUer.FirstName+" "+currentUer.LastName;
                userAddress = shARepo.GetAddressByUserId(currentUer.PKUserId);
                model.Address = userAddress.Address;
                model.Mobile = userAddress.Mobile;
                AddCart();
                model.Carts = cartReop.GetCartItems(currentUer.PKUserId);
                model.SubPrice = cart.Quantity * cart.Price;
                model.TotalPrice = Convert.ToDecimal(GetItemsPrice());
                TempData["Tax"] = .25;

               body = body.Replace("[UserName]", currentUer.FirstName + " " + currentUer.LastName);
                body = body.Replace("[Mobile]", userAddress.Mobile);
                body = body.Replace("[Adderss]", userAddress.Address);
                body = body.Replace("[Date]", DateTime.Now.ToString());
                body = RazorEngine.Razor.Parse(body, model);

                body = body.Replace("[SubPrice]", model.SubPrice.ToString());
                //body = body.Replace("[Tax]", tax.ToString());
                body = body.Replace("[TotalPrice]", model.TotalPrice.ToString());

                EmailUtility.SendEmail(userEmail, "E-Shop", body, null);
                cartReop.EmptyCart(currentUer.PKUserId);

                return View("OrderDetail", model);
            }

            else
            {
                user.UserName = model.FirstName + " " + model.LastName;
                user.FirstName = model.FirstName;
                user.LastName = model.LastName;
                user.EmailId = model.Email;
                user.Password = model.Password;
                user.Role = "U";
                userId = userRepo.Create(user);
                order.FKUserId = userId;
                int orderId = orderRepo.Create(order);
                productId = (IList<string>)Session["ProId"];

                foreach (var item in productId)
                {
                    int id = Convert.ToInt32(item);
                    orderDetail.FKOrderId = orderId;
                    orderDetail.FKProductId = id;
                    orderDetail.Status = "In Store";
                    orderDetail.Quantity = (int)prodReop.GetById(id).Quantity;
                    orderDetail.Cost = (decimal)prodReop.GetById(id).Price;
                    orderDetailRepo.Create(orderDetail);

                }
                userAddress.FKUserId = userId;
                userAddress.Address = model.Address;
                userAddress.City = model.City;
                userAddress.State = model.State;
                userAddress.Mobile = model.Mobile;
                userAddress.Country = model.Country;

                userAddress.ZipCode = Convert.ToInt32(model.Zipcode);
                shARepo.Create(userAddress);

                TempData["UserName"] = model.FirstName + " " + model.LastName;
                TempData["Adderss"] = model.Address;
                TempData["Mobile"] = model.Mobile;
                TempData["Tax"] = .25;
                AddCart();
                model.Carts = cartReop.GetCartItems(userId);
                model.SubPrice = cart.Quantity * cart.Price;
                model.TotalPrice = Convert.ToDecimal(GetItemsPrice());

                decimal tax = Convert.ToDecimal(model.TotalPrice) * Convert.ToDecimal(.25f);

                body = body.Replace("[UserName]", model.FirstName + " " + model.LastName);
                body = body.Replace("[Mobile]", model.Mobile);
                body = body.Replace("[Adderss]", model.Address);
                body = body.Replace("[Date]", DateTime.Now.ToString());
                body = RazorEngine.Razor.Parse(body, model);

                body = body.Replace("[SubPrice]", model.SubPrice.ToString());
                body = body.Replace("[Tax]", tax.ToString());
                body = body.Replace("[TotalPrice]", model.TotalPrice.ToString());

               EmailUtility.SendEmail(model.Email, "E-Shop", body, null);
               cartReop.EmptyCart(userId);

                return PartialView("_OrderDetail", model);
            }
        }
        public override void CancelOrder(Order order)
        {
            Assert.ArgumentNotNull(order, "order");

              Assert.IsTrue(this.orderSecurity.CanCancel(order), Texts.YouDoNotHaveTheNecessaryPermissionsToCancelTheOrder);

              this.innerProcessor.Order = order;
              this.innerProcessor.Process(this.processingStrategy);

              this.repository.Save(new Collection<Order> { order });
        }
Esempio n. 11
0
		private void attach_Orders(Order entity)
		{
			this.SendPropertyChanging();
			entity.Customer = this;
		}
Esempio n. 12
0
 // Hàm tạo đơn hàng 
 public void createOrder(string _name,string _email,string _address,string _phonenumber)
 {
     string date = "";
     customer = new Customer(_name, _email, _address, _phonenumber);
     order = new Order(bag, customer, date);
 }
Esempio n. 13
0
 public void Update(Order order)
 {
     shoppingCardDB.Entry(order).State = EntityState.Modified;
     Save();
 }
Esempio n. 14
0
        public ActionResult OrderDetail(OrderViewModel model)
        {
            OrderRepository orderRepo = new OrderRepository();
            OrderDetailRepository orderDetailRepo = new OrderDetailRepository();
            ProductRepository prodReop = new ProductRepository();

            Data.Order order = new Order();
            Data.OrderDetail orderDetail = new Data.OrderDetail();
            IEnumerable<Data.User> userList = userRepo.GetAllUsers();
            Data.User user = new Data.User();

            if (User.Identity.IsAuthenticated)
            {
                return PartialView("_OrderDetail", model);
            }
            else
            {

                foreach (Data.User u in userList)
                {
                    if (model.Email == u.EmailId)
                    {
                        //throw new ApplicationException("Email is already registered");
                        TempData["Msg"] = "Email is already registerd";
                        return RedirectToAction("CheckOut");
                    }
                }

                user.UserName = model.FirstName + " " + model.LastName;
                user.FirstName = model.FirstName;
                user.LastName = model.LastName;
                user.EmailId = model.Email;
                user.Password = model.Password;
                user.Role = "U";
                int userId = userRepo.Create(user);
                order.FKUserId = userId;
                int orderId = orderRepo.Create(order);
                productId = (IList<string>)Session["ProId"];

                foreach (var item in productId)
                {
                    int id = Convert.ToInt32(item);
                    orderDetail.FKOrderId = orderId;
                    orderDetail.FKProductId = id;
                    orderDetail.Status = "In Store";
                    orderDetail.Quantity = (int)prodReop.GetById(id).Quantity;
                    orderDetail.Cost = (decimal)prodReop.GetById(id).Price;
                    orderDetailRepo.Create(orderDetail);
                    //products.Add(db.Products.Find(productId));
                }

            }

            return PartialView("_OrderDetail", model);
        }
Esempio n. 15
0
 partial void UpdateOrder(Order instance);
Esempio n. 16
0
 partial void DeleteOrder(Order instance);
Esempio n. 17
0
 public async Task<Order> AddOrderAsync(Order order)
 {
     _context.Orders.Add(order);
     await _context.SaveChangesAsync();
     return order;
 }
Esempio n. 18
0
		private void detach_Orders(Order entity)
		{
			this.SendPropertyChanging();
			entity.Customer = null;
		}
        /// <summary>
        /// Confirms the payment.
        /// </summary>
        /// <param name="changes">The changes.</param>
        /// <param name="order">The order.</param>
        /// <returns>
        /// The payment.
        /// </returns>
        private bool ConfirmPayment(IDictionary changes, Order order)
        {
            var stateChanged = changes.Values.OfType<State>().FirstOrDefault(s => s.Code == OrderStateCode.InProcess);
              if (stateChanged != null && this.IsOrderReserved(order))
              {
            if (order.ReservationTicket.CapturedAmount == 0)
            {
              var substateChanged = stateChanged.Substates.SingleOrDefault(s => s.Code == OrderStateCode.InProcessCapturedInFull && s.Active);
              if (substateChanged != null)
              {
            return this.View.ShowConfirmationDialog(Translate.Text(Texts.DoYouWantToProceed), Translate.Text(Texts.TheFullAmountWillBeCapturedFromTheCustomerAccountIfYouProceed));
              }
            }
              }

              return true;
        }
    /// <summary>
    /// Called when the order has saving.
    /// </summary>
    /// <param name="sender">The sender.</param>
    /// <param name="e">The <see><cref>EntitySaveEventArgs{T}.Ecommerce.OrderManagement.Orders.Order&amp;gt;</cref></see> instance containing the event data.</param>
    protected virtual void OnOrderSaving([NotNull] object sender, [NotNull] SaveEntityEventArgs<Order> e)
    {
      Debug.ArgumentNotNull(sender, "sender");
      Debug.ArgumentNotNull(e, "e");

      if (this.StrategyResolver == null && Context.Entity != null)
      {
        this.StrategyResolver = Context.Entity.Resolve<OrderProcessingStrategyResolver>();
      }

      Assert.IsNotNull(this.StrategyResolver, "Unable to save the order. Strategy Resolver cannot be null.");

      IEnumerable<OrderProcessingStrategy> strategies = this.StrategyResolver.GetStrategies(e.OldEntity, e.NewEntity);
      Dictionary<string, object> parameters = new Dictionary<string, object> { { "oldOrder", e.OldEntity } };

      Assert.IsNotNull(this.OrderProcessor, "Unable to save the order. Order Processor cannot be null.");
      foreach (OrderProcessingStrategy strategy in strategies)
      {
        this.OrderProcessor.OrderProcessingStrategy = strategy;
        this.OrderProcessor.ProcessOrder(e.NewEntity, parameters);
      }

      this.oldEntity = e.OldEntity;

      var orderSaving = this.OrderSaving;
      if (orderSaving != null)
      {
        orderSaving(this, e);
      }
    }
Esempio n. 21
0
 /// <summary>
 /// Represents the Order By clause in SQL
 /// </summary>
 /// <param name="fields">Fields to order by</param>
 /// <param name="order">Ascending or Descending order</param>
 public OrderBy(string[] fields, Order order = Order.Ascending)
 {
     Fields = fields;
     OrderValue = order;
 }