private void AddOrderItem() { float quantityInput; bool isExist = false; Checkout.Products = new List <CheckoutProductModel>(); try { ConsoleHelper.CleanTheConsole(this.Description); while (isExist == false) { ProductModel selectedProduct = null; var inputProductCodeCommand = new ProductCommand(selectedProduct, ProductAction.InputProductCode); inputProductCodeCommand.ExecuteAction(); selectedProduct = inputProductCodeCommand.Product; if (selectedProduct != null) { isExist = selectedProduct.Code.Equals(CommonUtils.EXIT_STRING); } if (isExist == false) { quantityInput = this.InputQuantity(); AddQuantityToCheckoutProductModel(selectedProduct, quantityInput); } } } catch (Exception ex) { throw ex; } }
private void AddNewPrice() { bool isExist = false; try { ConsoleHelper.CleanTheConsole(this.Description); while (isExist == false) { ProductModel selectedProduct = null; var inputProductCodeCommand = new ProductCommand(selectedProduct, ProductAction.InputProductCode); inputProductCodeCommand.ExecuteAction(); selectedProduct = inputProductCodeCommand.Product; if (selectedProduct != null) { isExist = selectedProduct.Code.Equals(CommonUtils.EXIT_STRING); } if (isExist == false) { ShowAndUpdatePrice(selectedProduct); } ConsoleHelper.DrawHorizontalLine('-', 50); } ConsoleHelper.DrawHorizontalLine('=', 50); } catch (Exception ex) { throw ex; } }
private void ManagePromotion() { bool isExist = false; try { ConsoleHelper.CleanTheConsole(this.Description); while (isExist == false) { ProductModel selectedProduct = null; var inputProductCodeCommand = new ProductCommand(selectedProduct, ProductAction.InputProductCode); inputProductCodeCommand.ExecuteAction(); selectedProduct = inputProductCodeCommand.Product; if (selectedProduct != null) { isExist = selectedProduct.Code.Equals(CommonUtils.EXIT_STRING); } if (isExist == false) { PromotionModel = new PromotionModel(); InputPromotionType(); if (PromotionModel.PromotionTypeId == (int)PromotionTypeEnum.Buy_X_Give_Y) { InputQuantityDiscount(); } else if (PromotionModel.PromotionTypeId == (int)PromotionTypeEnum.SaleOff_X_Percent) { InputPercentDiscount(); } AddAdditionalDataToPromotion(selectedProduct); promotionService.AddPromotion(PromotionModel); } } } catch (Exception ex) { throw ex; } }