コード例 #1
0
 internal static ShipmentStateDto ToShipmentStateDto(this ShipmentState shipmentState)
 {
     return(new ShipmentStateDto {
         Key = shipmentState.Key,
         ShipmentKey = shipmentState.ShipmentKey,
         ShipmentStatus = shipmentState.ShipmentStatus.ToString(),
         CreatedOn = shipmentState.CreatedOn
     });
 }
コード例 #2
0
ファイル: Shipment.cs プロジェクト: vercetti-vice/EShop
 public Shipment([NotNull] string ownerId, [NotNull] string courierId, string trackingNumber, string details,
                 DateTime createdTime, ShipmentState state)
 {
     OwnerId        = ownerId ?? throw new ArgumentNullException();
     CourierId      = courierId ?? throw new ArgumentNullException();
     TrackingNumber = trackingNumber;
     Details        = details;
     CreatedTime    = createdTime;
     State          = state;
 }
コード例 #3
0
ファイル: DbOpp.cs プロジェクト: filmihaylov/WpfApp
        public void UpdatePackageState(ShipmentState state, PackageCondition packageCondition, PackageState packageState, string notes, Package package)
        {
            var packageForUpdate = db.Packages.Where(p => p.Id == package.Id).FirstOrDefault();

            packageForUpdate.Condition       = packageCondition;
            packageForUpdate.Status          = packageState;
            packageForUpdate.Notes           = notes;
            packageForUpdate.Shipment.Status = state;

            db.SaveChanges();
        }
コード例 #4
0
ファイル: DeliveryService.cs プロジェクト: filmihaylov/WpfApp
        public void UpdatePackageState(ShipmentState state, PackageCondition packageCondition, PackageState packageState, string notes, Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException("shipment");
            }

            DbOpp db = new DbOpp();

            db.UpdatePackageState(state, packageCondition, packageState, notes, package);
        }
コード例 #5
0
            private static ShipmentState InsertShipmentState(Guid ShipmentKey, ShipmentStatus status)
            {
                var shipmentState = new ShipmentState {
                    Key            = Guid.NewGuid(),
                    ShipmentKey    = ShipmentKey,
                    ShipmentStatus = status,
                    CreatedOn      = DateTime.Now
                };

                return(shipmentState);
            }
コード例 #6
0
ファイル: ShipmentsController.cs プロジェクト: uwitec/wms-8
        public static IEnumerable <IShipmentState> ToShipmentStateCollection(IEnumerable <string> ids)
        {
            var states = new List <ShipmentState>();

            foreach (var id in ids)
            {
                var s = new ShipmentState();
                s.ShipmentId = id;
                states.Add(s);
            }
            return(states);
        }
コード例 #7
0
        private ShipmentState InsertShipmentState(Guid ShipmentKey, ShipmentStatus status)
        {
            var shipmentState = new ShipmentState {
                Key            = Guid.NewGuid(),
                ShipmentKey    = ShipmentKey,
                ShipmentStatus = status,
                CreatedOn      = DateTime.Now
            };

            _shipmentStateRepository.Add(shipmentState);
            _shipmentStateRepository.Save();

            return(shipmentState);
        }
コード例 #8
0
        public IShipmentState Get(string id, bool nullAllowed)
        {
            IShipmentState state = CurrentSession.Get <ShipmentState> (id);

            if (!nullAllowed && state == null)
            {
                state = new ShipmentState();
                (state as ShipmentState).ShipmentId = id;
            }
            if (ReadOnlyProxyGenerator != null && state != null)
            {
                return(ReadOnlyProxyGenerator.CreateProxy <IShipmentState>(state, new Type[] { typeof(ISaveable) }, _readOnlyPropertyNames));
            }
            return(state);
        }
コード例 #9
0
 public bool Equals(Entry other)
 {
     return(other != null && Code.Equals(other.Code) &&
            Volume.Equals(other.Volume) &&
            Count.Equals(other.Count) &&
            Date.Equals(other.Date) &&
            Type.Equals(other.Type) &&
            Sender.Equals(other.Sender) &&
            Recipient.Equals(other.Recipient) &&
            ShipmentCountry.Equals(other.ShipmentCountry) &&
            ShipmentState.Equals(other.ShipmentState) &&
            ShipmentRailRoad.Equals(other.ShipmentRailRoad) &&
            ShipmentStation.Equals(other.ShipmentStation) &&
            DestinationCountry.Equals(other.DestinationCountry) &&
            DestinationState.Equals(other.DestinationState) &&
            DestinationRailRoad.Equals(other.DestinationRailRoad) &&
            DestinationStation.Equals(other.DestinationStation));
 }
コード例 #10
0
        public override int GetHashCode()
        {
            var hashCode = 352033288;

            hashCode = hashCode * -1521134295 + Code.GetHashCode();
            hashCode = hashCode * -1521134295 + Volume.GetHashCode();
            hashCode = hashCode * -1521134295 + Count.GetHashCode();
            hashCode = hashCode * -1521134295 + Date.GetHashCode();
            hashCode = hashCode * -1521134295 + Type.GetHashCode();
            hashCode = hashCode * -1521134295 + Sender.GetHashCode();
            hashCode = hashCode * -1521134295 + Recipient.GetHashCode();
            hashCode = hashCode * -1521134295 + ShipmentCountry.GetHashCode();
            hashCode = hashCode * -1521134295 + ShipmentState.GetHashCode();
            hashCode = hashCode * -1521134295 + ShipmentRailRoad.GetHashCode();
            hashCode = hashCode * -1521134295 + ShipmentStation.GetHashCode();
            hashCode = hashCode * -1521134295 + DestinationCountry.GetHashCode();
            hashCode = hashCode * -1521134295 + DestinationState.GetHashCode();
            hashCode = hashCode * -1521134295 + DestinationRailRoad.GetHashCode();
            hashCode = hashCode * -1521134295 + DestinationStation.GetHashCode();
            return(hashCode);
        }
        public ActionResult AddShipmentStateFor(ShipmentState state, int waybillId, string deliveredTo, string deliveredAt)
        {
            if (ModelState.IsValid)
            {
                var shipment = db.Shipments.Where(s => s.WaybillId == waybillId).First();
                if (shipment != null)
                {
                    db.ShipmentStates.Add(state);
                    if (state.Description.ToLower() == "delivered")
                    {
                        shipment.Status      = "Delivered";
                        shipment.DeliveredAt = deliveredAt;
                        shipment.DeliveredTo = deliveredTo;

                        //send email to sender when delivered
                        if (shipment.NotifySender)
                        {
                            SendShipmentNotification(shipment.ShippingAccount.Email, shipment.WaybillId, false);
                        }
                    }
                    else
                    {
                        //shipment.Status = state.Description;
                        if (shipment.Status == "Picked Up")
                        {
                            shipment.Status = "Shipped";

                            //send email to recipient when shipped
                            SendShipmentNotification(shipment.RecipientEmail, shipment.WaybillId, true);
                        }
                    }

                    shipment.ShipmentStates.Add(state);
                }

                db.SaveChanges();
            }

            return(RedirectToAction("Track", new { waybillId = waybillId }));
        }
コード例 #12
0
        private void mainFunction(Order order)
        {
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": POST Request received. OrderId: " + order.OrderID.Value.ToString());
            }

            //write data in DB
            MySqlConnection con = new MySqlConnection("server=localhost; user id = root; database = shopdb; password ="******"insert into shopdb.controller(OrderID,CustomerName,CustomerAddress,CustomerEmail,ArticleId,Quantity,Price,OrderSize,OrderWeight) values('" + order.OrderID + "','" + order.CustomerName + "','" + order.CustomerAddress + "','" + order.CustomerEMail + "','" + order.ArticleID + "','" + order.Quantity + "','" + order.Price + "','" + order.OrderSize + "','" + order.OrderWeight + "');";
            MySqlCommand command = new MySqlCommand(Query, con);

            command.ExecuteReader();
            con.Close();

            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Database Updated - initial Request");
            }

            //new Invoice Request
            InvoiceRequest invRequest = new InvoiceRequest(order.OrderID, order.Price, order.CustomerName, order.CustomerAddress);

            httpMachine.Invoicepost(invRequest);
            System.Threading.Thread.Sleep(1000);
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Sent POST to Invoice API. OrderId: " + order.OrderID.Value.ToString());
            }

            //warten, bis der Invoice Request abgeschlossen ist
            InvoiceState invState = httpMachine.Invoiceget(order.OrderID.Value);

            while (!invState.PaymentState.Equals("completed"))
            {
                using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
                {
                    sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Invoice not paid yet, waiting 5 Seconds. OrderId: " + order.OrderID.Value.ToString());
                }
                System.Threading.Thread.Sleep(5000);
                invState = httpMachine.Invoiceget(order.OrderID.Value);
            }
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Invoice paid");
            }

            //DB schreiben
            con = new MySqlConnection("server=localhost; user id = root; database = shopdb; password ="******"update controller set PaymentState = 1 where OrderId = " + order.OrderID.Value.ToString());
            MySqlCommand command2 = new MySqlCommand(Query, con);

            command2.ExecuteReader();
            con.Close();
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Database Updated - InvoiceState");
            }

            //new Inventory Request
            InventoryRequest ivtRequest = new InventoryRequest(order.OrderID, order.ArticleID, order.Quantity);

            httpMachine.Inventorypost(ivtRequest);
            System.Threading.Thread.Sleep(1000);
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Sent POST to Inventory API. OrderId: " + order.OrderID.Value.ToString());
            }

            //warten, bis der Inventory Request abgeschlossen ist
            InventoryState ivtState = httpMachine.Inventoryget(order.OrderID.Value);

            while (!ivtState.InventoryStateProperty.Equals("completed"))
            {
                using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
                {
                    sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Inventory not yet commissioned, waiting 5 Seconds. OrderId: " + order.OrderID.Value.ToString());
                }
                System.Threading.Thread.Sleep(5000);
                ivtState = httpMachine.Inventoryget(order.OrderID.Value);
            }
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Inventory commissioned");
            }

            //DB schreiben
            con = new MySqlConnection("server=localhost; user id = root; database = shopdb; password ="******"update controller set InventoryState = 1 where OrderId = " + order.OrderID.Value.ToString());
            MySqlCommand command3 = new MySqlCommand(Query, con);

            command3.ExecuteReader();
            con.Close();
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Database Updated - InventoryState");
            }

            //new Shipment Request
            ShipmentRequest shpRequest = new ShipmentRequest(order.OrderID, order.OrderSize, order.OrderWeight, order.CustomerName, order.CustomerAddress, order.CustomerEMail);

            httpMachine.Shipmentpost(shpRequest);
            System.Threading.Thread.Sleep(1000);
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Sent POST to Shipment API. OrderId: " + order.OrderID.Value.ToString());
            }

            //warten, bis der Shipment Request abgeschlossen ist
            ShipmentState shpState = httpMachine.Shipmentget(order.OrderID.Value);

            while (!shpState.Status.Equals("Delivered"))
            {
                using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
                {
                    sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Shipment not completed, waiting 5 Seconds. OrderId: " + order.OrderID.Value.ToString());
                }
                System.Threading.Thread.Sleep(5000);
                shpState = httpMachine.Shipmentget(order.OrderID.Value);
            }
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Shipment completed");
            }

            //DB schreiben
            con = new MySqlConnection("server=localhost; user id = root; database = shopdb; password ="******"update controller set ShipmentState = 1 where OrderId = " + order.OrderID.Value.ToString());
            MySqlCommand command4 = new MySqlCommand(Query, con);

            command4.ExecuteReader();
            con.Close();
            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Database Updated - ShipmentState");
            }

            using (StreamWriter sw = new StreamWriter(@"C:\temp\ShopStantly.log", true))
            {
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": _________________");
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": Request completed");
                sw.WriteLine(DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") + ": _________________");
            }
        }
コード例 #13
0
        public static OrderFromCartDraft DefaultOrderFromCartDraftWithShipmentState(OrderFromCartDraft draft, Cart cart, ShipmentState shipmentState)
        {
            var orderFromCartDraft = DefaultOrderFromCartDraft(draft, cart);

            orderFromCartDraft.ShipmentState = shipmentState;
            return(orderFromCartDraft);
        }