示例#1
0
 internal OrderViewModel(OrderDto orderDto)
 {
     OrderId = orderDto.OrderId;
     _description = orderDto.Description;
     _quantity = orderDto.Quantity.ToString(CultureInfo.InvariantCulture);
     _originalValue = (OrderViewModel)MemberwiseClone(); //Undo op
     _orderServiceManager = ServiceLocator.ServiceProvider.Instance.Get<IOrderServiceManager>();
 }
示例#2
0
 public static BusinessLayer.Order FromDto(OrderDto orderDto)
 {
     return new BusinessLayer.Order
                {
                    Id = orderDto.Id,
                    Id_waiter = orderDto.IdWaiter,
                    Id_table = orderDto.IdTable,
                    Comment = orderDto.Comment,
                    Closed = orderDto.Closed
                };
 }
			public void Example()
			{
				Mapper.Initialize(cfg =>
				{
					cfg.CreateMap<OrderDto, Order>()
						.ForMember(dest => dest.Id, opt => opt.Ignore());
				});

				Mapper.AssertConfigurationIsValid();

				var orderDto = new OrderDto {Amount = 50m};

				var order = new Order {Id = 4};

				Mapper.Map(orderDto, order);

				order.Amount.ShouldEqual(50m);
			}
示例#4
0
 public void UpdateOrder(OrderDto orderDto)
 {
     OrderServiceClient orderServiceClient = new OrderServiceClient();
     try
     {
         orderServiceClient.UpdateOrder(new UpdateOrderRequest
                                            {
                                                OrderDto = orderDto
                                            });
     }
     catch (Exception exception)
     {
         string message = string.Format("An error occured while in type :{0} , method :{1} ", "OrderServiceManager", MethodBase.GetCurrentMethod().Name);
         CommonLogManager.Log.Error(message, exception);
         throw;
     }
     finally
     {
         orderServiceClient.Close();
     }
 }
示例#5
0
 public OrderDto Insert(OrderDto order)
 {
     return(_orderRepository.Insert(order));
 }
示例#6
0
        public OrderDto MakeNewOrder(NewOrder newOrder)
        {
            bool     success  = false;
            string   status   = "Wrong token";
            OrderDto orderDto = new OrderDto()
            {
                Success = success,
                Status  = status
            };

            try
            {
                int userId;
                if (newOrder.UserToken == string.Empty || Security.Security.UserTokens.Any(i => i.Value == newOrder.UserToken))
                {
                    User user = null;
                    if (newOrder.UserToken != string.Empty)
                    {
                        userId = Security.Security.UserTokens.FirstOrDefault(i => i.Value == newOrder.UserToken).Key;
                        user   = _dbContext.Users.FirstOrDefault(i => i.Id == userId);
                        if (user == null)
                        {
                            throw new UserNotFoundException("There is no user with given data.");
                        }
                    }


                    Order order = new Order()
                    {
                        DateOfOrder = DateTime.Now,
                        UserData    = new UserData()
                        {
                            Email   = newOrder.UserData.Email,
                            Name    = newOrder.UserData.Name,
                            Surname = newOrder.UserData.Surname
                        }
                    };
                    if (user == null)
                    {
                        _dbContext.Orders.Add(order);
                    }
                    else
                    {
                        user.Orders.Add(order);
                    }

                    List <Position> positionsToOrder = new List <Position>();
                    foreach (var item in newOrder.TicketsWithClassDiscounts)
                    {
                        for (int j = 0; j < item.NumberOfTickets; j++)
                        {
                            Position position = new Position()
                            {
                                SocialClassDiscount =
                                    _dbContext.SocialClassDiscounts.FirstOrDefault(i => i.Id == item.SocialClassDiscountId),
                                Ticket = _dbContext.Tickets.Include(i => i.Zone)
                                         .FirstOrDefault(i => i.Id == item.TicketTypeId),
                                PeriodicDiscount = _dbContext.PeriodicDiscounts.FirstOrDefault(i =>
                                                                                               i.StartTime >= DateTime.Now &&
                                                                                               i.FinishTime <= DateTime.Now),
                                CanBeUsed = true
                            };
                            positionsToOrder.Add(position);
                            order.Positions.Add(position);
                        }
                    }

                    _dbContext.SaveChanges();

                    success          = true;
                    status           = "";
                    orderDto.Status  = status;
                    orderDto.Success = success;
                    orderDto.Tickets = positionsToOrder.Select(i => new TicketDto()
                    {
                        Id     = i.Id,
                        Name   = i.Ticket.Name,
                        Number = positionsToOrder.Count(j => j.Ticket.Id == i.Ticket.Id),
                        Price  = i.Ticket.Price,
                        Zone   = new ZoneWithAttractionsInformationDto()
                        {
                            ZoneId      = i.Ticket.Zone.Id,
                            Name        = i.Ticket.Zone.Name,
                            Attractions = _dbContext.Attractions.Where(j => j.Zone.Id == i.Ticket.Zone.Id).Select(j =>
                                                                                                                  new AttractionPrimaryInformationDto()
                            {
                                AttractionId = j.Id,
                                Name         = j.Name
                            })
                        }
                    });
                    orderDto.OrderId = order.Id;
                }
            }
            catch (Exception ex)
            {
                orderDto.Status  = ex.Message;
                orderDto.Success = false;
            }

            return(orderDto);
        }
 public void OrderResult(OrderDto order)
 {
     Order = order;
     Debug.WriteLine($"Result: Order[ OrderID={order.OrderID}, CustomerID={order.CustomerID}, EmployeeID={order.EmployeeID}]");
 }
        public virtual ActionResult UpdateQtyDetails(EditQtyProductDto dto, string qtyType)
        {
            bool    isSuccess    = false;
            string  alertMessage = string.Empty;
            decimal?qtyBefore    = dto.EditQuantity;
            int?    createdBy    = WebSecurity.GetUserId(User.Identity.Name);

            if (ModelState.IsValid)
            {
                if (!qtyType.IsNull())
                {
                    switch (qtyType.ToLower())
                    {
                    case "add":
                        dto.EditQuantity = dto.EditQuantity + dto.OldQuantity;
                        break;

                    case "minus":
                        dto.EditQuantity = dto.OldQuantity - dto.EditQuantity;
                        break;

                    default:
                        break;
                    }

                    ProductDto newDetails = new ProductDto()
                    {
                        ProductId          = dto.ProductId,
                        CategoryId         = dto.CategoryId,
                        QuantityUnitId     = dto.QuantityUnitId,
                        ProductCode        = dto.ProductCode,
                        ProductName        = dto.ProductName,
                        ProductDescription = dto.ProductDescription,
                        ProductSize        = dto.ProductSize,
                        CurrentNum         = dto.CurrentNum,
                        DRNum     = dto.DRNum,
                        CartonNum = dto.CartonNum,
                        Quantity  = dto.EditQuantity
                    };

                    if (qtyType.ToLower() == "minus")
                    {
                        SalesOrderDto orderDto = new SalesOrderDto()
                        {
                            CreatedBy    = createdBy,
                            DateCreated  = DateTime.Now,
                            SalesNo      = "PL" + Constants.SalesTemplate,
                            CustomerId   = 0,
                            SalesOrderId = 0,
                            IsPrinted    = false,
                            IsCorrected  = false
                        };
                        var salesOrderId = _orderService.SaveSalesOrder(orderDto);

                        if (salesOrderId == 0)
                        {
                            alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "saving in sales order");
                        }
                        else
                        {
                            SalesOrderDetailDto orderDetailDto = new SalesOrderDetailDto()
                            {
                                SalesOrderId = salesOrderId,
                                ProductId    = newDetails.ProductId,
                                SalesPrice   = 0,
                                Quantity     = (decimal)qtyBefore,
                                UnitPrice    = 0,
                                DateCreated  = DateTime.Now,
                                CreatedBy    = createdBy
                            };
                            isSuccess = _orderService.SaveSalesOrderDetail(orderDetailDto);


                            if (!isSuccess)
                            {
                                alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "saving in sales order details");
                            }
                            else
                            {
                                isSuccess = _inventoryService.UpdateDetails(newDetails);

                                if (!isSuccess)
                                {
                                    alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "updating in product");
                                }
                                else
                                {
                                    alertMessage = Messages.UpdateSuccess;
                                }
                            }
                        }
                    }
                    else
                    {
                        OrderDto orders = new OrderDto()
                        {
                            OrderId = 0, DateCreated = DateTime.Now, CreatedBy = createdBy
                        };
                        var retPurchaseOrderId = _orderService.SaveOrder(orders);
                        if (retPurchaseOrderId == 0)
                        {
                            alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "saving in purchase order");
                        }
                        else
                        {
                            OrderDetailDto orderDetails = new OrderDetailDto()
                            {
                                OrderDetailId = 0,
                                OrderId       = retPurchaseOrderId,
                                ProductId     = newDetails.ProductId,
                                Quantity      = Convert.ToDecimal(qtyBefore),
                                SupplierId    = dto.SupplierId
                            };

                            if (!_orderService.SaveOrderDetail(orderDetails))
                            {
                                alertMessage = (string.Format(Messages.ErrorOccuredDuringProcessingThis, "saving in purchase order details"));
                            }
                            else
                            {
                                isSuccess = _inventoryService.UpdateDetails(newDetails);

                                if (!isSuccess)
                                {
                                    alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "updating in product");
                                }
                                else
                                {
                                    alertMessage = Messages.UpdateSuccess;
                                }
                            }
                        }
                    }
                }
            }

            var jsonResult = new
            {
                isSuccess    = isSuccess,
                alertMessage = alertMessage
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
示例#9
0
 public async Task <ActionResult <Order> > CreateOrder(OrderDto orderDto)
 {
     var email = HttpContext.User?.Claims?.FirstOrDefault(x => x.Type == ClaimTypes)
 }
示例#10
0
 public SelectedOrderChangedEventArgs(OrderDto order)
 {
     Order = order;
 }
示例#11
0
 public void editOrder(String idOrder)
 {
     this.orderDTO    = OrderDao.getOderByID(idOrder);
     this.currentMode = CONS_MODE_EDIT;
 }
示例#12
0
        public async Task <IActionResult> Save(OrderDto orderDto)
        {
            var orderSave = await _orderService.AddAsync(_mapper.Map <Order>(orderDto));

            return(Created(string.Empty, _mapper.Map <OrderDto>(orderSave)));
        }
示例#13
0
 public async Task <ActionResult <Order> > CreateOrder(OrderDto orderDto)
 {
     var email =
 }
示例#14
0
 public OrderDto Update(int orderId, OrderDto order)
 {
     order.OrderId = orderId;
     return(_orderRepository.Update(order));
 }
示例#15
0
        public ActionResult CreateOrder(orderModelApi orderDelta)
        {
            // Here we display the errors if the validation has failed at some point.


            bool     shippingRequired = false;
            Customer customer         = _customerService.GetCustomerById(orderDelta.CustomerId.Value);

            if (orderDelta.OrderItemDtos != null)
            {
                bool shouldReturnError = ValidateEachOrderItem(orderDelta.OrderItemDtos);

                if (shouldReturnError)
                {
                }

                shouldReturnError = AddOrderItemsToCart(orderDelta.OrderItemDtos, customer, orderDelta.StoreId ?? _storeContext.CurrentStore.Id);



                shippingRequired = IsShippingAddressRequired(orderDelta.OrderItemDtos);
            }

            if (shippingRequired)
            {
                bool isValid = true;

                isValid &= SetShippingOption(orderDelta.ShippingRateComputationMethodSystemName,
                                             orderDelta.ShippingMethod,
                                             orderDelta.StoreId ?? _storeContext.CurrentStore.Id,
                                             customer,
                                             BuildShoppingCartItemsFromOrderItemDtos(orderDelta.OrderItemDtos.ToList(),
                                                                                     customer.Id,
                                                                                     orderDelta.StoreId ?? _storeContext.CurrentStore.Id));

                //isValid &= ValidateAddress(orderDelta.ShippingAddress, "shipping_address");

                //if (!isValid)
                //{
                //    return Error(HttpStatusCode.BadRequest);
                //}
            }

            //if (!OrderSettings.DisableBillingAddressCheckoutStep)
            //{
            //    bool isValid = ValidateAddress(orderDelta.Dto.BillingAddress, "billing_address");

            //    if (!isValid)
            //    {
            //        return Error(HttpStatusCode.BadRequest);
            //    }
            //}



            Core.Domain.Orders.Order newOrder = new Core.Domain.Orders.Order();

            newOrder.BillingAddress.Address1 = orderDelta.BillingAddress.Address1;
            newOrder.BillingAddress.Address2 = orderDelta.BillingAddress.Address2;
            newOrder.BillingAddress.City     = orderDelta.BillingAddress.City;

            newOrder.BillingAddress.Company            = orderDelta.BillingAddress.Company;
            newOrder.BillingAddress.Country.Name       = orderDelta.BillingAddress.CountryName;
            newOrder.BillingAddress.CountryId          = orderDelta.BillingAddress.CountryId;
            newOrder.BillingAddress.Email              = orderDelta.BillingAddress.Email;
            newOrder.BillingAddress.FaxNumber          = orderDelta.BillingAddress.FaxNumber;
            newOrder.BillingAddress.FirstName          = orderDelta.BillingAddress.FirstName;
            newOrder.BillingAddress.LastName           = orderDelta.BillingAddress.LastName;
            newOrder.BillingAddress.PhoneNumber        = orderDelta.BillingAddress.PhoneNumber;
            newOrder.BillingAddress.StateProvince.Name = orderDelta.BillingAddress.StateProvinceName;
            newOrder.BillingAddress.StateProvinceId    = orderDelta.BillingAddress.StateProvinceId;
            newOrder.BillingAddress.ZipPostalCode      = orderDelta.BillingAddress.ZipPostalCode;
            newOrder.BillingAddress.CreatedOnUtc       = orderDelta.BillingAddress.CreatedOnUtc;



            newOrder.ShippingAddress.Address1 = orderDelta.ShippingAddress.Address1;
            newOrder.ShippingAddress.Address2 = orderDelta.ShippingAddress.Address2;
            newOrder.ShippingAddress.City     = orderDelta.ShippingAddress.City;

            newOrder.ShippingAddress.Company            = orderDelta.ShippingAddress.Company;
            newOrder.ShippingAddress.Country.Name       = orderDelta.ShippingAddress.CountryName;
            newOrder.ShippingAddress.CountryId          = orderDelta.ShippingAddress.CountryId;
            newOrder.ShippingAddress.Email              = orderDelta.ShippingAddress.Email;
            newOrder.ShippingAddress.FaxNumber          = orderDelta.ShippingAddress.FaxNumber;
            newOrder.ShippingAddress.FirstName          = orderDelta.ShippingAddress.FirstName;
            newOrder.ShippingAddress.LastName           = orderDelta.ShippingAddress.LastName;
            newOrder.ShippingAddress.PhoneNumber        = orderDelta.ShippingAddress.PhoneNumber;
            newOrder.ShippingAddress.StateProvince.Name = orderDelta.ShippingAddress.StateProvinceName;
            newOrder.ShippingAddress.StateProvinceId    = orderDelta.ShippingAddress.StateProvinceId;
            newOrder.ShippingAddress.ZipPostalCode      = orderDelta.ShippingAddress.ZipPostalCode;
            newOrder.ShippingAddress.CreatedOnUtc       = orderDelta.ShippingAddress.CreatedOnUtc;
            // If the customer has something in the cart it will be added too. Should we clear the cart first?
            newOrder.Customer   = customer;
            newOrder.OrderItems = orderDelta.OrderItemDtos;
            // The default value will be the currentStore.id, but if it isn't passed in the json we need to set it by hand.
            if (!orderDelta.StoreId.HasValue)
            {
                newOrder.StoreId = _storeContext.CurrentStore.Id;
            }

            PlaceOrderResult placeOrderResult = PlaceOrder(newOrder, customer);

            if (!placeOrderResult.Success)
            {
                foreach (var error in placeOrderResult.Errors)
                {
                    // ModelState.AddModelError("order placement", error);
                }

                // return Error(HttpStatusCode.BadRequest);
            }

            //   _customerActivityService.InsertActivity("AddNewOrder",_localizationService.GetResource("ActivityLog.AddNewOrder"), newOrder.Id);

            var ordersRootObject = new OrdersRootObject();

            OrderDto placedOrderDto = placeOrderResult.PlacedOrder.();

            ordersRootObject.Orders.Add(placedOrderDto);

            var json = _jsonFieldsSerializer.Serialize(ordersRootObject, string.Empty);

            return(new RawJsonActionResult(json));
        }
示例#16
0
        /// <summary>
        /// 下订单
        /// </summary>
        /// <param name="orderId">本地订单id</param>
        /// <param name="skuNums">商品id 数量集合</param>
        /// <param name="name">用户名</param>
        /// <param name="mobile">手机</param>
        /// <param name="email">邮箱</param>
        /// <param name="address">地址</param>
        /// <param name="zip">邮编</param>
        /// <param name="phone">座机</param>
        /// <param name="remark">备注</param>
        /// <param name="province">省份</param>
        /// <param name="city">市</param>
        /// <param name="county">县区</param>
        /// <param name="town">城镇</param>
        /// <returns></returns>
        public OperateResult <JDOrderDto> CreateOrder(string orderId, List <SkuNum> skuNums, string name, string mobile, string address, string phone, string remark, int province, int city, int county, InvoiceType invoiceType, int town = 0)
        {
            //检查参数
            if (skuNums == null || skuNums.Count == 0 || name.IsNullOrEmpty() || mobile.IsNullOrEmpty() || orderId.IsNullOrEmpty())
            {
                return(ErrorResult(JDErrorCode.sys_params_empty, default(JDOrderDto)));
            }

            if ((name.IsNotNullOrEmpty() && name.Length > 10) || (mobile.IsNotNullOrEmpty() && mobile.Length != 11) || (remark.IsNotNullOrEmpty() && remark.Length > 100))
            {
                return(ErrorResult(JDErrorCode.sys_params_invalid, default(JDOrderDto)));
            }


            var skuIdList = skuNums.Select(x => x.skuId).ToList();
            //检查商品可售性
            var saleResult = service.CheckProductCanSale(skuIdList);

            if (!saleResult.success)
            {
                return(ErrorResult(saleResult.code, default(JDOrderDto)));
            }
            //id name集合
            var skuDic = saleResult.result.ToDictionary(x => x.skuId, x => x.name);

            //判断商品是否全部可售
            if (saleResult.result.Where(x => x.saleState == YesOrNoCode.No).Any())
            {
                var cantSaleNames = saleResult.result.Where(x => x.saleState == YesOrNoCode.No).Select(x => x.name).ToList();
                return(ErrorResult($"商品{string.Join(",", cantSaleNames)}不可售", default(JDOrderDto)));
            }
            //库存
            var stockResult = service.CheckStockForOne(skuNums, province, city, county, town);

            if (stockResult.result.Where(x => x.stockStateDesc == "无货").Any())
            {
                var cantSaleNames = stockResult.result.Where(x => x.stockStateDesc == "无货").Select(x => skuDic.ContainsKey(x.skuId) ? skuDic[x.skuId] : "").ToList();
                return(ErrorResult($"商品{string.Join(",", cantSaleNames)}无货", default(JDOrderDto)));
            }

            //检查地区限制
            var areaLimitResult = service.CheckProductAreaLimit(skuIdList, province, city, county, town);

            if (!areaLimitResult.success)
            {
                return(ErrorResult(areaLimitResult.code, default(JDOrderDto)));
            }
            if (areaLimitResult.result.Where(x => x.isAreaRestrict == true).Any())
            {
                var cantSaleNames = areaLimitResult.result.Where(x => x.isAreaRestrict == true).Select(x => skuDic.ContainsKey(x.skuId) ? skuDic[x.skuId] : "").ToList();
                return(ErrorResult($"商品{string.Join(",", cantSaleNames)}地区限制不可售", default(JDOrderDto)));
            }

            //统计下单
            var orderModel = new OrderDto()
            {
                thirdOrder = orderId,
                name       = name,
                mobile     = mobile,
                phone      = phone,
                address    = address,
                province   = province,
                city       = city,
                county     = county,
                town       = town,
                sku        = skuNums.Select(x => new OrderSku()
                {
                    num = x.num, skuId = x.skuId
                }).ToList(),
                remark      = remark,
                invoiceType = invoiceType
            };
            var orderResult = service.CreateOrder(orderModel);

            if (!orderResult.success)
            {
                return(ErrorResult(orderResult.code, default(JDOrderDto)));
            }

            //京东订单id
            var jdOrderId = orderResult.result.jdOrderId;

            //确认预占库存订单
            var occupyStockResult = service.ConfirmOccupyStock(jdOrderId);

            if (!occupyStockResult.success)
            {
                return(ErrorResult(orderResult.resultMessage, default(JDOrderDto)));
            }


            return(Result(orderResult.result));
        }
示例#17
0
        public async Task <ActionResult <OrderDto> > UpdateOrderAsync(OrderDto order)
        {
            var updatedOrder = await this._dal.UpdateOrderAsync(order);

            return(Ok(updatedOrder));
        }
示例#18
0
        public async Task <ActionResult <OrderDto> > CreateOrderAsync(OrderDto order)
        {
            var newOrder = await this._dal.CreateOrderAsync(order);

            return(Ok(newOrder));
        }
示例#19
0
 public void LoadFinishOrderView(OrderDto order)
 {
     var view = FormFactory.Create<FrmFinishOrder>();
     view.Order = order;
     LoadView(view);
 }
示例#20
0
 public void LoadCancelBuildedOrderView(OrderDto order)
 {
     var view = FormFactory.Create<FrmCancelBuildedOrder>();
     view.Order = order;
     LoadView(view);
 }
示例#21
0
        public async Task <IActionResult> UpdateAsync([FromBody] OrderDto order)
        {
            await _orderBl.UpdateAsync(order);

            return(Ok());
        }
示例#22
0
 private Order MapDtoToEntity(OrderDto order)
 {
     return(_mapper.Map <OrderDto, Order>(order));
 }
示例#23
0
        public IActionResult Update(OrderDto orderDto)
        {
            var orderupdate = _orderService.Update(_mapper.Map <Order>(orderDto));

            return(NoContent());
        }
示例#24
0
 public Order(OrderDto order)
 {
     UserId      = order.UserId;
     OrderPlaced = order.OrderPlaced;
     OrderTotal  = order.OrderTotal;
 }
示例#25
0
        private void SelectNotReadyOrderLineFromOrder(ActionExecutionContext context, OrderDto orderDto)
        {
            var submenuOrder = new MenuBuilder()
                               .Title("SELECT ORDERLINE: ")
                               .RunnableOnce();

            var orderLines = _orderLineApi.GetNotReadyOrderLinesWithOrderId(orderDto.Number);

            foreach (var orderLine in orderLines)
            {
                var currentOrderLine = orderLine;
                var temp             = currentOrderLine.ProductName + " " + currentOrderLine.Quantity + " " + currentOrderLine.Cost;

                submenuOrder.Item(temp, ctx => SetOrderLineStatusAsReady(ctx, currentOrderLine.Id, orderDto.Id));
            }

            submenuOrder.GetMenu().Run();
        }
示例#26
0
 public IActionResult Post([FromBody] OrderDto dto)
 {
     return(Ok(new { id = OrderService.Create(dto) }));
 }
示例#27
0
 public async Task OnGet(int id)
 {
     Order = await _orderProxy.GetAsync(id);
 }
示例#28
0
 public IActionResult Put(int id, [FromBody] OrderDto dto)
 {
     OrderService.Update(id, dto);
     return(Ok());
 }
示例#29
0
 public OrderVM(OrderDto row)
 {
     OrderId   = row.OrderId;
     UserId    = row.UserId;
     CreatedOn = row.CreatedOn;
 }
示例#30
0
 public async Task <ActionResult <Order> > CreateOrder(OrderDto orderDto)
 {
     var email = HttpContext.User.RetrieveEmailFromPrincipal()
 }
        public virtual ActionResult SaveDetails(ProductDto dto)
        {
            bool   isSuccess    = false;
            string alertMessage = string.Empty;

            if (ModelState.IsValid)
            {
                dto.ProductId = 0;
                var duplicate = _inventoryService.GetAll().Where(c => c.ProductCode == dto.ProductCode).Count();

                if (duplicate >= 1)
                {
                    alertMessage = string.Format(Messages.DuplicateItem, "Product");
                }
                else
                {
                    var productValidity = _inventoryService.ValidateSaveProduct(dto);


                    if (!productValidity.IsSuccess)
                    {
                        alertMessage = productValidity.ErrorMessage;
                    }
                    else
                    {
                        var retProductId = _inventoryService.SaveDetails(dto);

                        if (retProductId > 0)
                        {
                            OrderDto orders = new OrderDto()
                            {
                                OrderId = 0, DateCreated = DateTime.Now, CreatedBy = 1
                            };
                            var retPurchaseOrderId = _orderService.SaveOrder(orders);
                            if (retPurchaseOrderId > 0)
                            {
                                OrderDetailDto orderDetails = new OrderDetailDto()
                                {
                                    OrderDetailId = 0,
                                    OrderId       = retPurchaseOrderId,
                                    ProductId     = retProductId,
                                    Quantity      = Convert.ToDecimal(dto.Quantity),
                                    SupplierId    = dto.SupplierId
                                };

                                if (_orderService.SaveOrderDetail(orderDetails))
                                {
                                    isSuccess    = true;
                                    alertMessage = Messages.InsertSuccess;
                                }
                            }
                        }
                        else
                        {
                            alertMessage = string.Format(Messages.ErrorOccuredDuringProcessingThis, "saving details of product");
                        }
                    }
                }
            }
            else
            {
                alertMessage = Messages.ErrorOccuredDuringProcessingOrRequiredFields;
            }


            var jsonResult = new
            {
                isSuccess    = isSuccess,
                alertMessage = alertMessage
            };

            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
示例#32
0
 public static void Map(this OrderDto OrderDto, Order Order)
 {
     Order.OrderId         = OrderDto.OrderId;
     Order.OrderCustomerId = OrderDto.OrderCustomerId;
     Order.OrderDate       = OrderDto.OrderDate;
 }
示例#33
0
        public async Task <AjaxResponse <bool> > Update([FromBody] OrderDto dto)
        {
            var res = await _appservice.Update(dto);

            return(new AjaxResponse <bool>(res));
        }
示例#34
0
 public async Task <ActionResult <Order> > CreateOrder(OrderDto orderDto)
 {
     var email   = HttpContext.User.RetrieveEmailFromPrincipal();
     var address = _mapper.Map <AddressDto, Address>(orderDto.ShipToAddess);
     var order   = await _orderService.CreateOrderAsync(email, orederD);
 }
示例#35
0
 public Task UpdateOrder(OrderDto order)
 {
     return(Clients.All.UpdateOrder(order));
 }
示例#36
0
 public OrderDtoBuilder()
 {
     _orderDto = WithDefaults();
 }
示例#37
0
 protected override void Because_of()
 {
     _result = Mapper.Map<Order, OrderDto>(new Order {Customer = new Customer {Æøå = "Bob"}});
 }
示例#38
0
 public OrderDto PostOrder(OrderDto newOrder, int userId)
 {
     return(_ordersService.AddOrder(newOrder, userId));
 }