예제 #1
0
    void Start()
    {
        deliveryZone = GetComponentInChildren <DeliveryZone>();

        storeName = deliveryItems.PopStoreName();
        DrawSigns();
    }
 public decimal GetDeliveryCharge(DeliveryMethod deliveryMethod, DeliveryZone zone)
 {
     try
     {
         return
             (Db.Set <DeliveryCharge>()
              .First(it => it.DeliveryMethodId == deliveryMethod.Id && it.ZoneId == zone.Id)
              .ChargeValue);
     }
     catch (Exception ex)
     {
         LogEventManager.Logger.Error(ex.Message, ex);
         throw;
     }
 }
예제 #3
0
 private void Update()
 {
     if (deliveryZone == null)
     {
         deliveryZone = GameManager.Instance.deliveryZone;
     }
     if (destroyZone == null)
     {
         destroyZone = GameManager.Instance.destoryZone;
     }
     if (inZone && !handIsColliding && activeHand == null)
     {
         transform.position = destroyZone.transform.position;
         Destroy(gameObject);
         deliveryZone.ChangeToNormalColor();
     }
 }
예제 #4
0
 internal static Order GenerateOrder(Contact contact, OrderState state, PaymentMethod payment, DeliveryMethod delivery, DeliveryZone deliveryZone)
 {
     return(new Order
     {
         Name = "Test",
         Code = "Test",
         PaymentMethodId = payment.Id,
         ContactId = contact.Id,
         OrderStateId = state.Id,
         DeliveryMethodId = delivery.Id,
         DeliveryZoneId = deliveryZone.Id,
         DeliveryCost = 200,
         Total = 2000,
         Comment = "Good choice",
         OrderDate = DateTime.Now,
         SortOrder = 0
     });
 }
예제 #5
0
        internal static void PopulateDefaultOrderCtx(DbContext context)
        {
            try
            {
                var nosex = new Sex
                {
                    Code        = "NOSEX",
                    DateCreated = DateTime.Now,
                    IsActive    = true,
                    Name        = "No sex selected"
                };
                if (!context.Set <Sex>().Any(it => it.Code.Equals(nosex.Code)))
                {
                    context.Set <Sex>().Add(nosex);
                }
                var networkDelivery = new DeliveryMethod
                {
                    Code        = "ELECTRONIC",
                    Name        = "Electronic delivery",
                    IsActive    = true,
                    Description = "Default",
                    SortOrder   = 0,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryMethod>().Any(it => it.Code.Equals(networkDelivery.Code)))
                {
                    context.Set <DeliveryMethod>().Add(networkDelivery);
                }
                var courierDelivery = new DeliveryMethod
                {
                    Code     = "ByCourier".ToUpper(),
                    Name     = "By Courier",
                    IsActive = true,

                    Description = "Default",
                    SortOrder   = 0,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryMethod>().Any(it => it.Code.Equals(courierDelivery.Code)))
                {
                    context.Set <DeliveryMethod>().Add(courierDelivery);
                }
                var postDelivery = new DeliveryMethod
                {
                    Code      = "Post".ToUpper(),
                    Name      = "Post",
                    IsActive  = true,
                    SortOrder = 0,

                    Description = "Default",
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryMethod>().Any(it => it.Code.Equals(postDelivery.Code)))
                {
                    context.Set <DeliveryMethod>().Add(postDelivery);
                }
                var storesDelivery = new DeliveryMethod
                {
                    Code        = "stores".ToUpper(),
                    Name        = "Our Stores",
                    Description = "Default",
                    IsActive    = true,
                    SortOrder   = 4,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryMethod>().Any(it => it.Code.Equals(storesDelivery.Code)))
                {
                    context.Set <DeliveryMethod>().Add(storesDelivery);
                }
                var formedState = new OrderState
                {
                    Code        = "FORMED",
                    Name        = "Formed",
                    IsActive    = true,
                    SortOrder   = 0,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <OrderState>().Any(it => it.Code.Equals(formedState.Code)))
                {
                    context.Set <OrderState>().Add(formedState);
                }
                var deliveredState = new OrderState
                {
                    Code        = "Delivered".ToUpper(),
                    Name        = "Delivered",
                    IsActive    = true,
                    SortOrder   = 1,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <OrderState>().Any(it => it.Code.Equals(deliveredState.Code)))
                {
                    context.Set <OrderState>().Add(deliveredState);
                }
                var paidState = new OrderState
                {
                    Code        = "paid".ToUpper(),
                    Name        = "Paid",
                    IsActive    = true,
                    SortOrder   = 2,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <OrderState>().Any(it => it.Code.Equals(paidState.Code)))
                {
                    context.Set <OrderState>().Add(paidState);
                }
                var awaitingPaymentState = new OrderState
                {
                    Code        = "AwaitingPayment".ToUpper(),
                    Name        = "Awaiting Payment",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <OrderState>().Any(it => it.Code.Equals(awaitingPaymentState.Code)))
                {
                    context.Set <OrderState>().Add(awaitingPaymentState);
                }

                var creditCardPayment = new PaymentMethod
                {
                    Code        = "CreditPayment".ToUpper(),
                    Name        = "Credit Card Payment",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <PaymentMethod>().Any(it => it.Code.Equals(creditCardPayment.Code)))
                {
                    context.Set <PaymentMethod>().Add(creditCardPayment);
                }
                var cashPayment = new PaymentMethod
                {
                    Code        = "PayCash".ToUpper(),
                    Name        = "Pay With Cash",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <PaymentMethod>().Any(it => it.Code.Equals(cashPayment.Code)))
                {
                    context.Set <PaymentMethod>().Add(cashPayment);
                }
                var paypalPayment = new PaymentMethod
                {
                    Code        = "paypal".ToUpper(),
                    Name        = "PayPal",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <PaymentMethod>().Any(it => it.Code.Equals(paypalPayment.Code)))
                {
                    context.Set <PaymentMethod>().Add(paypalPayment);
                }
                var moneyOrder = new OrderType
                {
                    Code        = "moneyOrder".ToUpper(),
                    Name        = "Money Order",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <OrderType>().Any(it => it.Code.Equals(moneyOrder.Code)))
                {
                    context.Set <OrderType>().Add(moneyOrder);
                }

                var auctionOrder = new OrderType
                {
                    Code        = "auctionOrder".ToUpper(),
                    Name        = "Auction Order",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <OrderType>().Any(it => it.Code.Equals(auctionOrder.Code)))
                {
                    context.Set <OrderType>().Add(auctionOrder);
                }
                var goodOrder = new OrderType
                {
                    Code        = "goodOrder".ToUpper(),
                    Name        = "Good Order",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <OrderType>().Any(it => it.Code.Equals(goodOrder.Code)))
                {
                    context.Set <OrderType>().Add(goodOrder);
                }
                var russiaDeliveryZone = new DeliveryZone
                {
                    Code        = "russia".ToUpper(),
                    Name        = "Russia",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryZone>().Any(it => it.Code.Equals(russiaDeliveryZone.Code)))
                {
                    context.Set <DeliveryZone>().Add(russiaDeliveryZone);
                }

                var moscowDeliveryZone = new DeliveryZone
                {
                    Code        = "moscow".ToUpper(),
                    Name        = "Moscow",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryZone>().Any(it => it.Code.Equals(moscowDeliveryZone.Code)))
                {
                    context.Set <DeliveryZone>().Add(moscowDeliveryZone);
                }
                var ysenevoDeliveryZone = new DeliveryZone
                {
                    Code        = "ysenevo".ToUpper(),
                    Name        = "Ysenevo",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryZone>().Any(it => it.Code.Equals(ysenevoDeliveryZone.Code)))
                {
                    context.Set <DeliveryZone>().Add(ysenevoDeliveryZone);
                }
                var uZAODeliveryZone = new DeliveryZone
                {
                    Code        = "UZAO".ToUpper(),
                    Name        = "UZAO",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryZone>().Any(it => it.Code.Equals(uZAODeliveryZone.Code)))
                {
                    context.Set <DeliveryZone>().Add(uZAODeliveryZone);
                }
                var pechatnikiDeliveryZone = new DeliveryZone
                {
                    Code        = "pechatniki".ToUpper(),
                    Name        = "Pechatniki",
                    IsActive    = true,
                    SortOrder   = 3,
                    DateCreated = DateTime.Now
                };
                if (!context.Set <DeliveryZone>().Any(it => it.Code.Equals(pechatnikiDeliveryZone.Code)))
                {
                    context.Set <DeliveryZone>().Add(pechatnikiDeliveryZone);
                }
                var deliveryCharge = new DeliveryCharge
                {
                    ChargeValue      = 1000,
                    DeliveryMethodId = courierDelivery.Id,
                    ZoneId           = pechatnikiDeliveryZone.Id
                };
                if (!context.Set <DeliveryCharge>().Any(it => it.DeliveryMethodId == deliveryCharge.DeliveryMethodId && it.ZoneId == deliveryCharge.ZoneId))
                {
                    context.Set <DeliveryCharge>().Add(deliveryCharge);
                }
                context.SaveChanges();
            }
            catch (Exception ex)
            {
                LogEventManager.Logger.Error(ex.Message, ex);
                throw;
            }
        }