Esempio n. 1
0
        public IFluentPackingSlip CreatePackingSlipByView(PackingSlipView view)
        {
            decimal amount = 0;

            try
            {
                Task <PackingSlip> packingSlipTask = Task.Run(async() => await unitOfWork.packingSlipRepository.GetEntityBySlipDocument(view.SlipDocument));
                Task.WaitAll(packingSlipTask);


                if (packingSlipTask.Result != null)
                {
                    processStatus = CreateProcessStatus.AlreadyExists; return(this as IFluentPackingSlip);
                }


                foreach (var detail in view.PackingSlipDetailViews)
                {
                    amount += detail.ExtendedCost ?? 0;
                }
                view.Amount = amount;

                PackingSlip packingSlip = null;

                packingSlip = MapToEntity(view);

                AddPackingSlip(packingSlip);

                return(this as IFluentPackingSlip);
            }
            catch (Exception ex) { throw new Exception("CreatePackingSlipByView", ex); }
        }
Esempio n. 2
0
        public async Task <ActionResult <long> > Put(long id, [FromBody] PackingSlip packingSlip)
        {
            try
            {
                if (id != packingSlip.Id)
                {
                    return(BadRequest());
                }

                var result = await this.packingSlipService.GetPackingSlipAsync(id);

                if (result == null)
                {
                    return(NotFound());
                }


                //if (result.IsPOSUploaded)
                //    return BadRequest("POS is already uploaded. You can not update this Packing slip");


                await this.packingSlipService.UpdatePackingSlipAsync(packingSlip);

                return(id);
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Add a new packing slip
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int Add(PackingSlip model)
        {
            var paSl = this.context.PackingSlips.Add(model);

            this.context.SaveChanges();
            return(paSl.Id);
        }
Esempio n. 4
0
        public async Task <ActionResult <long> > Put(long id, [FromBody] PackingSlip packingSlip)
        {
            try
            {
                if (id != packingSlip.Id)
                {
                    return(BadRequest());
                }

                var result = await this.packingSlipService.GetPackingSlipAsync(id);

                if (result == null)
                {
                    return(NotFound());
                }

                await this.packingSlipService.UpdatePackingSlipAsync(packingSlip);

                return(id);
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));
            }
        }
Esempio n. 5
0
        private PackingSlip MapToEntity(PackingSlipView inputObject)
        {
            Mapper      mapper    = new Mapper();
            PackingSlip outObject = mapper.Map <PackingSlip>(inputObject);

            return(outObject);
        }
        public new void Setup()
        {
            ExpectedPackingSlip = new PackingSlip("Shipping");
            ExpectedPackingSlip.AddProduct($"{ExpectedProduct.Name} ({ExpectedProduct.ProductSubType})");

            _generatePackingSlipForPhysicalProduct = new GeneratePackingSlipForPhysicalProduct(MockServiceBus.Object);
        }
Esempio n. 7
0
        public void Apply(Order order)
        {
            var packingSlip = new PackingSlip("Royalty Department");

            packingSlip.AddProduct($"{order.Product.Name} ({order.Product.ProductSubType})");

            _serviceBus.PublishEvent(new PackingSlipDuplicated(packingSlip, order.Id));
        }
Esempio n. 8
0
 private async Task OnViewPackingSlip(PackingSlip selectedPackingSlip)
 {
     if (selectedPackingSlip == null)
     {
         return;
     }
     await NavigateTo(new PackingSlipsDetailLinesPage(selectedPackingSlip, true));
 }
Esempio n. 9
0
        public async Task <IActionResult> DeletePackingSlip([FromBody] PackingSlipView view)
        {
            PackingSlipModule invMod      = new PackingSlipModule();
            PackingSlip       packingSlip = await invMod.PackingSlip.Query().MapToEntity(view);

            invMod.PackingSlip.DeletePackingSlip(packingSlip).Apply();

            return(Ok(view));
        }
        public PackingSlip Generatepackingslip(string orderdetails)
        {
            PackingSlip _objpackingslip = new PackingSlip();

            _objpackingslip.PackingSlipid = generateID(10001);  // function to generate random ids
            _objpackingslip.type          = Enums.PackingSlipType.Original;
            _objpackingslip.addedservice  = null;
            return(_objpackingslip);
        }
        public PackingSlip Generatepackingslip(string orderdetails, bool isduplicate)
        {
            PackingSlip _objpackingslip = new PackingSlip();

            _objpackingslip.PackingSlipid = generateID(10001);
            _objpackingslip.type          = Enums.PackingSlipType.Duplicate;
            _objpackingslip.addedservice  = null;
            return(_objpackingslip);
        }
Esempio n. 12
0
        private void LogPackingSlipRows(PackingSlip packingSlip)
        {
            _logger.Log("Products on Packing Slip:", MessageType.Information);

            foreach (var product in packingSlip.Products)
            {
                _logger.Log(product, MessageType.Information);
            }
        }
Esempio n. 13
0
        public void Apply(Order order)
        {
            var packingSlip = new PackingSlip("Shipping");

            packingSlip.AddProduct($"{order.Product.Name} ({order.Product.ProductSubType})");

            order.SetPackingSlip(packingSlip);

            _serviceBus.PublishEvent(new PackingSlipCreated(packingSlip, order.Id));
        }
Esempio n. 14
0
        /// <summary>
        /// This is a "mock" function, as both the payments and handlers are very light, and i don't get it from the req where to register the event processors they are wrapped in this function here.
        /// The main point of the function is to show that IMessenger needs to be injected in the place where the "processors" are going to be registered.
        /// </summary>
        /// <param name="msg"></param>
        public static void Setup(IMessenger msg, IEmailService mail)
        {
            var membershipRepo = new Dictionary <Guid, Membership>();//this should be injected as well

            msg.Subscribe <PhysicalProductPayment>(p =>
            {
                var slip = new PackingSlip();
                slip.Products.Add(p.Payload.ProductID);
                slip.Generate();

                CommissionPaymentGenerator(p.Payload.Total, p.Payload.AgentID);
            });

            msg.Subscribe <BookPayment>(b =>
            {
                var slip = new PackingSlip();
                slip.Products.Add(b.Payload.ProductID);
                slip.Departments.Add("royality");
                slip.Generate();

                CommissionPaymentGenerator(b.Payload.Total, b.Payload.AgentID);
            });

            msg.Subscribe <MembershipPayment>(m =>
            {
                var ms = new Membership(m.Payload.MebershipID)
                {
                    Email = m.Payload.Email
                };
                ms.Activate();
                membershipRepo[ms.ID] = ms;

                mail.SendActivationEmail(m.Payload.Email);
            });

            msg.Subscribe <UpgradeMembershipPayment>(m =>
            {
                membershipRepo[m.Payload.MebershipID].Upgrade();

                mail.SendUpgradeEmail(membershipRepo[m.Payload.MebershipID].Email);
            });

            msg.Subscribe <VideoPayment>(v =>
            {
                var slip = new PackingSlip();
                slip.Products.Add(v.Payload.ProductID);
                if (v.Payload.VideoName == "Learning to Ski")
                {
                    slip.Products.Add(ProductNameToProductID("First Aid"));
                }

                slip.Generate();
            });
        }
Esempio n. 15
0
        public void Setup()
        {
            _expectedPackingSlip = new PackingSlip("Any Packing Slip");
            _expectedProduct     = new Product(new ProductConfig {
                Name = "Any Product"
            });

            _order = new Order(new OrderConfig {
                Id = "An Order"
            });
        }
        private static void Product(out RuleBase _rule, out PaymentOrderType selectedPaymentoption)
        {
            selectedPaymentoption = PaymentOrderType.Product;
            _rule = new RuleBase();
            PackingSlip _slip = _rule.Generatepackingslip("Order No:909");

            Console.WriteLine("Packing slip generated");

            double _agentcommision = _rule.GenerateAgentcommision(500.00);

            Console.WriteLine("agent commision generated for Rs {0}", _agentcommision);
        }
Esempio n. 17
0
 public PackingSlipView(PackingSlip packingSlip)
 {
     this.PackingSlipId          = packingSlip.PackingSlipId;
     this.SupplierId             = packingSlip.SupplierId;
     this.ReceivedDate           = packingSlip.ReceivedDate;
     this.SlipDocument           = packingSlip.SlipDocument;
     this.PONumber               = packingSlip.PONumber;
     this.Remark                 = packingSlip.Remark;
     this.SlipType               = packingSlip.SlipType;
     this.Amount                 = packingSlip.Amount;
     this.PackingSlipDetailViews = new List <PackingSlipDetailView>();
 }
Esempio n. 18
0
        public async Task <ActionResult <Int32> > Post([FromBody] PackingSlip packingSlip)
        {
            try
            {
                var result = await this.packingSlipService.AddPackingSlipAsync(packingSlip);

                return(result);
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));
            }
        }
        public DrvRoutesNotifyCustomerPageViewModel(PackingSlip packingSlip)
        {
            _packingSlip = packingSlip;

            DurationList = new ObservableCollection <KeyValuePair <string, string> > {
                new KeyValuePair <string, string>("15", $"15 {nameof(AppResources.Minutes).Translate()}"),
                new KeyValuePair <string, string>("30", $"30 {nameof(AppResources.Minutes).Translate()}"),
                new KeyValuePair <string, string>("45", $"45 {nameof(AppResources.Minutes).Translate()}"),
                new KeyValuePair <string, string>("60", $"60 {nameof(AppResources.Minutes).Translate()}"),
                new KeyValuePair <string, string>("C", nameof(AppResources.Custom).Translate()),
                new KeyValuePair <string, string>("A", nameof(AppResources.Calculated).Translate())
            };
            SelectedDuration = _durationList[0];
        }
        private static void Video(out RuleBase _rule, out string video, out PaymentOrderType selectedPaymentoption)
        {
            selectedPaymentoption = PaymentOrderType.Video;
            _rule = new RuleBase();
            Console.WriteLine("Provide the name of the video");
            video = Console.ReadLine();

            PackingSlip _slip = _rule.getvideourl(video);

            foreach (var item in _slip.addedservice)
            {
                Console.WriteLine("Access to video provided follow the link:" + item.videourl);
            }
        }
 public PackingSlipsSelectProofDeliveryBarcodePageViewModel(PackingSlip packingSlip)
 {
     _packingSlip           = packingSlip;
     IsAscending            = true;
     Title                  = $"{nameof(AppResources.ProofsOfDeliveryFor).Translate()} {_packingSlip.Order.Key}";
     BarcodeSelectedCommand = new AsyncDelegateCommand(OnBarcodeSelected);
     FilterTriggerCommand   = new Command <SortColumnItem>(OnFilterTriggered);
     SortColumns            = new ObservableCollection <SortColumnItem>
     {
         new SortColumnItem("barcode", nameof(AppResources.Barcode).Translate()),
         new SortColumnItem("dateScanned", nameof(AppResources.DateScanned).Translate())
     };
     SelectedSortColumn = SortColumns[0];
 }
Esempio n. 22
0
        public async Task <IActionResult> UpdatePackingSlip([FromBody] PackingSlipView view)
        {
            PackingSlipModule invMod = new PackingSlipModule();

            PackingSlip packingSlip = await invMod.PackingSlip.Query().MapToEntity(view);


            invMod.PackingSlip.UpdatePackingSlip(packingSlip).Apply();

            PackingSlipView retView = await invMod.PackingSlip.Query().GetViewById(packingSlip.PackingSlipId);


            return(Ok(retView));
        }
        private static void Books(out RuleBase _rule, out PaymentOrderType selectedPaymentoption)
        {
            _rule = new RuleBase();
            selectedPaymentoption = PaymentOrderType.Books;

            PackingSlip originalpackingslip = _rule.Generatepackingslip("Order:1020");
            PackingSlip royality_dep        = _rule.Generatepackingslip("Order:1020", true);

            Console.WriteLine("Packing slips generated");

            double _agentcommision = _rule.GenerateAgentcommision(500.00);

            Console.WriteLine("agent commision generated for Rs {0}", _agentcommision);
        }
 /// <summary>
 /// AddFirstAidVideotoPackingSlip method has logic to add firstadidvideo to packing Slip
 /// </summary>
 /// <param name="type"></param>
 public void AddFirstAidVideotoPackingSlip(PaymentForOrder type)
 {
     // Method intentionally left empty.
     PackingSlip pckslip = new PackingSlip()
     {
         PackingSlipId = System.Guid.NewGuid(), OrderId = 1, AddressDetails = "Test Address", ShippedItemDetails = new PaymentItem()
         {
             ItemId = 2, ItemName = "First Aid", Price = 0
         }
     };
     PackingSlipResponseContext taskReponseContext = new PackingSlipResponseContext
     {
         PackingSlipDetails = pckslip
     };
 }
Esempio n. 25
0
        public async Task <ActionResult> Post([FromBody] PackingSlip packingSlip)
        {
            try
            {
                logger.LogInformation("customer invoice created");
                await this.packingSlipService.CreateInvoiceAsync(packingSlip);

                return(Ok());
            }
            catch (Exception ex)
            {
                logger.LogError("Error in invoice creation {0} ", ex.StackTrace);
                return(StatusCode(500, ex.ToString()));
            }
        }
Esempio n. 26
0
        public async Task <ActionResult <bool> > VerifyShipment([FromBody] PackingSlip packingSlip)
        {
            try
            {
                var claimsIdentity = this.User.Identity as ClaimsIdentity;
                int userId         = Convert.ToInt32(claimsIdentity.FindFirst(ClaimTypes.Name)?.Value);

                var result = await this.packingSlipService.VerifyPackingSlipAsync(packingSlip, userId);

                return(Ok(result));
            }
            catch (Exception ex)
            {
                return(StatusCode(500, ex.ToString()));
            }
        }
 public DrvManifestUpcomingDeliveriesPageViewModel(PackingSlip packingSlip, string customerAccount)
 {
     _packingSlip         = packingSlip;
     _customerAccount     = customerAccount;
     EmailCustomerCommand = new AsyncDelegateCommand(OnEmailCustomer);
     SelectAllCommand     = new Command(OnSelectAll);
     SortColumns          = new ObservableCollection <SortColumnItem>
     {
         new SortColumnItem(UpcomingDeliveriesSortColumns.IsSelected, nameof(AppResources.Selected).Translate()),
         new SortColumnItem(UpcomingDeliveriesSortColumns.OrderNumber, nameof(AppResources.OrderNumber).Translate()),
         new SortColumnItem(UpcomingDeliveriesSortColumns.PurchaseOrder, nameof(AppResources.PurchaseOrder).Translate()),
         new SortColumnItem(UpcomingDeliveriesSortColumns.DeliveryDate, nameof(AppResources.DeliveryDate).Translate()),
     };
     SelectedSortColumn   = _sortColumns[0];
     FilterTriggerCommand = new Command <SortColumnItem>(OnFilterTriggered);
 }
Esempio n. 28
0
        public PackingSlipsDetailLinesPageViewModel(PackingSlip slip, bool loadFromServer)
        {
            _loadFromServer           = loadFromServer;
            PackingSlip               = slip;
            ToggleHeaderFrameCommand  = new Command(() => ShowHeaderFrame = !_showHeaderFrame);
            DownloadPdfCommand        = new AsyncDelegateCommand(OnDownloadPdf);
            ViewPdfCommand            = new AsyncDelegateCommand(OnViewPdf);
            ViewProofDeliveryCommand  = new AsyncDelegateCommand(OnViewProofOfDelivery);
            ToggleActionsFrameCommand = new Command <bool>((isExpanded) => ShowActionsFrame = isExpanded);
            OpenOrderCommand          = new AsyncDelegateCommand(OnOpenOrder);

            ToggleLinesCommand = new Command <bool>((b) =>
            {
                ShowLines = b;
            });
        }
Esempio n. 29
0
        public async Task <IActionResult> AddPackingSlip([FromBody] PackingSlipView view)
        {
            PackingSlipModule invMod = new PackingSlipModule();

            NextNumber nnPackingSlip = await invMod.PackingSlip.Query().GetNextNumber();

            view.PackingSlipNumber = nnPackingSlip.NextNumberValue;

            PackingSlip packingSlip = await invMod.PackingSlip.Query().MapToEntity(view);

            invMod.PackingSlip.AddPackingSlip(packingSlip).Apply();

            PackingSlipView newView = await invMod.PackingSlip.Query().GetViewByNumber(view.PackingSlipNumber);


            return(Ok(newView));
        }
        /// <summary>
        /// Method for generating PackingSlip details
        /// </summary>
        /// <param name="orderId">Order Id number</param>
        /// <returns>PackingSlipResponseContext</returns>
        public PackingSlipResponseContext GeneratePackingSlip(int orderId)
        {
            PackingSlip pckslip = new PackingSlip()
            {
                PackingSlipId = System.Guid.NewGuid(), OrderId = orderId, AddressDetails = "Test Address", ShippedItemDetails = new PaymentItem()
                {
                    ItemId = 1, ItemName = "DrugsContainer", Price = 60000
                }
            };
            PackingSlipResponseContext taskReponseContext = new PackingSlipResponseContext
            {
                PackingSlipDetails = pckslip
                                     // PackingSlipDetails = _unitOfWork.PackingSlipRepository.GetById(x => x.OrderId == OrderId)
            };

            return(taskReponseContext);
        }