Exemplo n.º 1
0
        public async Task <ResponseViewModel <bool> > AddOrder(Order00EditViewModel orderEntity)
        {
            var data = new ResponseViewModel <bool>();

            var order = new OrderEntity
            {
                //Id =
                SHOP_ID      = orderEntity.SHOP_ID,
                ORDER_ID     = orderEntity.ORDER_ID,
                INPUT_DATE   = orderEntity.INPUT_DATE,
                ORD_USER     = orderEntity.ORD_USER,
                EXPECT_DATE  = orderEntity.EXPECT_DATE,
                STATUS       = orderEntity.STATUS,
                ORD_TYPE     = orderEntity.ORD_TYPE,
                OUT_SHOP     = orderEntity.OUT_SHOP,
                EXPORTED_ID  = orderEntity.EXPORTED_ID,
                EXPORTED     = orderEntity.EXPORTED,
                APP_USER     = orderEntity.APP_USER,
                APP_DATE     = orderEntity.APP_DATE,
                Memo         = orderEntity.Memo,
                LOCKED       = 0,
                ORD_DEP_ID   = "",
                CRT_DATETIME = DateTime.Now,
                CRT_USER_ID  = "",
                //MOD_DATETIME = null,
                MOD_USER_ID = "",
                //LAST_UPDATE = null,
                Trans_STATUS = 0
            };

            data.Data = await _orderProvider.AddOrder(order);

            return(data);
        }
Exemplo n.º 2
0
        // Order Functions started
        public int AddOrder(OrderDTO obj)
        {
            OrderProvider provider = new OrderProvider();

            if (provider.GetOrderById(obj.OrderId) == null)
            {
                provider.AddOrder(obj);
                return(1);
            }
            return(-1);
        }
Exemplo n.º 3
0
        public ActionResult Create(CreateEditViewModel model, FormCollection form)
        {
            var order        = new Order();
            var orderDetails = new List <OrderDetail>();

            mapper.Map(model, order);
            mapper.Map(OrderDetailSessionWrapper.Detail, orderDetails);
            order.LocationId = 1;
            order.DiscValue  = order.DiscPercent > 0 ? order.DiscPercent / 100 * OrderDetailSessionWrapper.TotalOrder : order.DiscValue;
            order.OrderDetails.AddRange(orderDetails);

            CalculateOrderChargesAndDiscount(order, OrderDetailSessionWrapper.TotalOrder);

            orderProvider.AddOrder(order);
            return(RedirectToAction("OrderConfirmation", new { orderId = order.Id }));
        }