예제 #1
0
        public OrderTotal GetSingleOrderDetails(int orderId)
        {
            var orderLineItems = GetLineItemDetailsByOrderId(orderId);
            var orderSum       = GetOrderTotal(orderId);
            var sql            = @"
                        select *
                        from [Order]
                        where OrderId = @OrderId;
                      ";

            using (var db = new SqlConnection(connectionString))
            {
                var parameters = new { OrderId = orderId };
                var result     = db.QueryFirstOrDefault <Order>(sql, parameters);
                var orderTotal = new OrderTotal()
                {
                    OrderId   = orderId,
                    LineItems = orderLineItems,
                    Total     = orderSum,
                    UserId    = result.UserId,
                    PaymentId = result.PaymentId
                };
                return(orderTotal);
            }
        }
예제 #2
0
        protected void updateTable()
        {
            List <Order> orders = new List <Order>();

            if (chkPending.Checked)
            {
                orders.AddRange(db.orders.Where(x => x.status == "pending").ToList());
            }
            if (chkConfirmed.Checked)
            {
                orders.AddRange(db.orders.Where(x => x.status == "confirmed").ToList());
            }
            if (chkCanceled.Checked)
            {
                orders.AddRange(db.orders.Where(x => x.status == "canceled").ToList());
            }

            orders = orders.Where(x => x.date.ToShortDateString().Contains(txtDate.Text) && x.salesmanName.Contains(txtStaff.Text) && x.custName.Contains(txtCustName.Text)).OrderBy(x => x.id).ToList();

            List <OrderTotal> orderTotals = new List <OrderTotal>();

            foreach (Order order in orders)
            {
                decimal total = 0;
                foreach (OrderLine orderLine in db.orderLines.Where(x => x.orderID == order.id))
                {
                    Product product = db.products.Single(x => x.id == orderLine.productID);
                    total += orderLine.quantity * product.price * (1 - orderLine.discount);
                }
                OrderTotal orderTotal = new OrderTotal(order, total);
                orderTotals.Add(orderTotal);
            }
            gvOrder.DataSource = orderTotals;
            gvOrder.DataBind();
        }
예제 #3
0
        private void CalculateTotals(BindingList <OrderTotal> totals)
        {
            // Calculate subtotal
            decimal subtotal = 0;

            foreach (OrderProduct op in order.Products)
            {
                subtotal += op.Total;
            }
            OrderTotal subtotalOT = (from o_total in totals where o_total.Code == "sub_total" select o_total).First();
            OrderTotal total      = (from o_total in totals where o_total.Code == "total" select o_total).First();

            subtotalOT.Value = subtotal;
            total.Value      = subtotal;
            foreach (OrderTotal ot in totals)
            {
                if (ot.Code != "sub_total" && ot.Code != "total")
                {
                    total.Value += ot.Value;
                }
            }
            order.Total = total.Value;
            // Update total string
            StringBuilder sb      = new StringBuilder();
            var           _totals = totals.OrderBy(o => o.SortOrder);

            foreach (OrderTotal o in _totals)
            {
                sb.AppendLine($"{o.Title}: ${o.Value.ToString("#.##")}");
            }
            Totals = sb.ToString();
        }
예제 #4
0
    private void DrawFooter()
    {
        OrderTotal ordTot = new OrderTotal('?');

        foreach (string l in footer)
        {
            line = ordTot.GetTotalCantidad(l);
            line = AlignRightText(line.Length) + line;

            gfx.DrawString(line, printFont, Brushes.Black, leftMargin, YPosition(), new StringFormat());
            leftMargin = 0;

            line = "" + ordTot.GetTotalName(l);
            gfx.DrawString(line, printFont, Brushes.Black, leftMargin, YPosition(), new StringFormat());
            count++;
        }
        leftMargin = 0;
        DrawEspacio();


        line = DottedLine();

        gfx.DrawString(line, printFont, Brushes.Black, leftMargin, YPosition(), new StringFormat());

        count++;
        DrawEspacio();
    }
예제 #5
0
        protected override Decimal Execute(CodeActivityContext context)
        {
            Decimal result = 0;

            switch (ShipVia.Get(context))
            {
            case "normal":
                if (OrderTotal.Get(context) >= _freeThreshold)
                {
                    _isFreeShipping = true;
                }
                else
                {
                    result = (Weight.Get(context) * _normalRate);
                }
                break;

            case "express":
                result = (Weight.Get(context) * _expressRate);
                break;
            }

            if ((result < _minimum) && (!_isFreeShipping))
            {
                result = _minimum;
            }

            return(result);
        }
예제 #6
0
        private void button1_Click(object sender, EventArgs e) //Button to enter the Order ID for Record Display
        {
            int    ID  = Convert.ToInt32(txtEnterID.Text);     //Converts the string in the text box into integer datatype
            Orders who = new Orders();                         //Object declaration


            who = DataLayer.OrdersDB.GetOrdersDB(Convert.ToString(ID));      //Object path
            // Data elements to be displayed in labels
            lblOrderID.Text      = who.OrderID.ToString();
            lblCustomerID.Text   = who.CustomerID.ToString();
            lblOrderDate.Text    = Convert.ToDateTime(who.OrderDate).ToString();
            lblRequiredDate.Text = Convert.ToDateTime(who.RequiredDate).ToString();
            lblShippedDate.Text  = Convert.ToDateTime(who.ShippedDate).ToString();

            // Trial 1:  Calculating the Order Total from the data in the Order Details Table
            OrderDetails Total = new OrderDetails();

            Total = DataLayer.OrderDetailsDB.GetOrderDetailsDB(Convert.ToString(ID));
            Double D = Convert.ToDouble(Total.Discount);
            Double Q = Convert.ToDouble(Total.Quantity);
            Double P = Convert.ToDouble(Total.UnitPrice);
            Double OrderTotal;

            OrderTotal = P * (1 - D) * Q;
            // Displaying the Order Total
            lblOrderTotal.Text = OrderTotal.ToString();
        }
예제 #7
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Address != null)
         {
             hashCode = hashCode * 59 + Address.GetHashCode();
         }
         if (OrderTotal != null)
         {
             hashCode = hashCode * 59 + OrderTotal.GetHashCode();
         }
         if (OrderDate != null)
         {
             hashCode = hashCode * 59 + OrderDate.GetHashCode();
         }
         if (ArrivalDate != null)
         {
             hashCode = hashCode * 59 + ArrivalDate.GetHashCode();
         }
         if (Items != null)
         {
             hashCode = hashCode * 59 + Items.GetHashCode();
         }
         if (OrderId != null)
         {
             hashCode = hashCode * 59 + OrderId.GetHashCode();
         }
         return(hashCode);
     }
 }
 public ShippingTabViewModel(OrderData order, IEnumerable <ShippingMethod> shippingMethods, IEnumerable <Country> countries, Func <int, IEnumerable <Zone> > getZonesFn)
     : base(order, order.ShippingAddress, countries, getZonesFn)
 {
     ShippingMethods = shippingMethods;
     curOrderTotal   = (from ot in order.OrderTotals
                        where ot.Code == order.ShippingMethod.Code
                        select ot).FirstOrDefault();
 }
예제 #9
0
 public OrderPlacedEvent(Guid userId,
                         ExpressAddressInfo expressAddressInfo,
                         OrderTotal orderTotal,
                         DateTime reservationExpirationDate) : base(orderTotal)
 {
     UserId                    = userId;
     ExpressAddressInfo        = expressAddressInfo;
     ReservationExpirationDate = reservationExpirationDate;
 }
예제 #10
0
 public OrderSuccessedEvent(
     Guid userId,
     OrderTotal orderTotal,
     ExpressAddressInfo expressAddressInfo,
     PayInfo payInfo) : base(orderTotal)
 {
     UserId             = userId;
     ExpressAddressInfo = expressAddressInfo;
     PayInfo            = payInfo;
 }
예제 #11
0
        /// <summary>
        /// Displays the sales order content and calls "CalculateSalesOrderValue" method to calculate the sales order totals
        /// </summary>
        /// <param name="_salesOrderContent"></param>
        private void DisplaySalesOrderContent(List <OrderProductModel> _salesOrderContent)
        {
            SalesOrderContentList = _salesOrderContent;

            SalesOrderContentListBox.DataSource    = null;
            SalesOrderContentListBox.DisplayMember = "ProductName";
            SalesOrderContentListBox.DataSource    = SalesOrderContentList;

            SalesOrderTotal = RMS_Logic.SalesLogic.CalculateSalesOrderTotal(taxToUse, SalesOrderContentList);
            DisplaySalesOrderTotals(SalesOrderTotal);
        }
예제 #12
0
 public string TotalAmountPaid()
 {
     if (IsPaid)
     {
         return(OrderTotal.ToString());
     }
     else
     {
         return("0");
     }
 }
예제 #13
0
        public ActionResult Edit([Bind(Include = "ID,Name,Date,OrderID,ProductID,Price,Amount,Total ")] OrderTotal orderTotal)
        {
            OrderInfo orderinfo = db.OrderInfos.Find(orderTotal.ID);

            orderinfo.Price  = orderTotal.Price;
            orderinfo.Amount = orderTotal.Amount;
            orderinfo.Total  = orderTotal.Price * orderTotal.Amount;
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
        public OrderTotal CalculateSalesOrderTotal(TaxModel taxToUse, List <OrderProductModel> SalesOrderContentList)
        {
            List <SalesPriceModel> SalesPricesList = GlobalConfig.Connection.GetSalesPrices_All().Where(p => p.CurrentlyActivePrice == true).ToList();
            OrderTotal             salesOrderTotal = new OrderTotal();

            for (int i = 0; i < SalesOrderContentList.Count; i++)
            {
                salesOrderTotal += CalculateSalesOrderRowTotals(taxToUse, i, SalesPricesList, SalesOrderContentList);
            }

            return(salesOrderTotal);
        }
        /// <summary>
        /// Calculates the sales order totals for the current row and retrieves the grand total
        /// </summary>
        private OrderTotal CalculateSalesOrderRowTotals(TaxModel taxToUse, int rowIndex,
                                                        List <SalesPriceModel> SalesPricesList, List <OrderProductModel> SalesOrderContentList)
        {
            decimal productPrice = SalesPricesList.Where(p => p.ProductId == SalesOrderContentList[rowIndex].ProductId && p.CurrentlyActivePrice == true)
                                   .Single().SalesPrice;
            OrderTotal salesOrderTotal = new OrderTotal();

            salesOrderTotal.Total     += SalesOrderContentList[rowIndex].OrderedQuantity * productPrice;
            salesOrderTotal.TaxTotal  += SalesOrderContentList[rowIndex].OrderedQuantity * (productPrice / 100 * (taxToUse.Percent));
            salesOrderTotal.GrandTotal = salesOrderTotal.Total + salesOrderTotal.TaxTotal;

            return(salesOrderTotal);
        }
예제 #16
0
    public DiningRoomGUI()
    {
        this.MakeOrderEvent += this.makeOrderHandler;
        this.Activated      += this.ActivatedHandler;
        BackColor            = Color.Silver;
        Size = new Size(600, 600);
        Text = "Dining Room";
        PurchaseOptions foods  = new PurchaseOptions(this, 25, new string[] { "Arroz de Marisco : 15€", "Massa à labrador : 5€", "Prego em Prato : 5,5€" }, "Kitchen");
        PurchaseOptions drinks = new PurchaseOptions(this, 300, new string[] { "Cerveja : 1,5€", "Água : 1€", "Coca-Cola : 1,20€" }, "Bar");

        this.tables      = new Tables(this, 150, 8);
        this.orderTotal  = new OrderTotal(this, 200);
        this.readyOrders = new ReadyOrders(25, 300);
    }
예제 #17
0
        protected override IAsyncResult BeginExecute(
            AsyncCodeActivityContext context,
            AsyncCallback callback, object state)
        {
            CalcShippingAsyncArgs parameters = new CalcShippingAsyncArgs
            {
                Weight     = Weight.Get(context),
                OrderTotal = OrderTotal.Get(context),
                ShipVia    = ShipVia.Get(context),
            };

            Func <CalcShippingAsyncArgs, Decimal> asyncWork = a => Calculate(a);

            context.UserState = asyncWork;
            return(asyncWork.BeginInvoke(parameters, callback, state));
        }
        public static SetOrderReferenceDetailsResponse SetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
                                                                                IOffAmazonPaymentsService service, string orderReferenceId, string orderAmount)
        {
            SetOrderReferenceDetailsRequest setOrderRequest = new SetOrderReferenceDetailsRequest();

            setOrderRequest.SellerId = propertiesCollection.MerchantID;
            setOrderRequest.AmazonOrderReferenceId = orderReferenceId;
            //setup the currency and amount as an ordertotal object
            OrderReferenceAttributes attributes = new OrderReferenceAttributes();
            OrderTotal orderTotal = new OrderTotal();

            orderTotal.Amount       = orderAmount;
            orderTotal.CurrencyCode = propertiesCollection.CurrencyCode;
            attributes.OrderTotal   = orderTotal;
            setOrderRequest.OrderReferenceAttributes = attributes;
            return(SetOrderReferenceDetailsSample.InvokeSetOrderReferenceDetails(service, setOrderRequest));
        }
예제 #19
0
        private void DrawTotales()
        {
            OrderTotal orderTotal = new OrderTotal('?');

            foreach (string totale in this.totales)
            {
                this.line = orderTotal.GetTotalCantidad(totale);
                this.line = this.AlignRightText(this.line.Length) + this.line;
                this.gfx.DrawString(this.line, this.printFont, (Brush)this.myBrush, this.leftMargin, this.YPosition(), new StringFormat());
                this.leftMargin = 0.0f;
                this.line       = "      " + orderTotal.GetTotalName(totale);
                this.gfx.DrawString(this.line, this.printFont, (Brush)this.myBrush, this.leftMargin, this.YPosition(), new StringFormat());
                ++this.count;
            }
            this.leftMargin = 0.0f;
            //this.DrawEspacio();
            //this.DrawEspacio();
        }
예제 #20
0
        public IActionResult Get(Int32 OrderId)
        {
            try
            {
                OrderDetailProvider Provider = new OrderDetailProvider(OrderDB);
                OrderTotal          Total    = Provider.GetTotalForOrder(OrderId);

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

                return(new ObjectResult(Total));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }
예제 #21
0
        /// <summary>
        /// Returns true if Order instances are equal
        /// </summary>
        /// <param name="other">Instance of Order to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Order other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Address == other.Address ||
                     Address != null &&
                     Address.Equals(other.Address)
                     ) &&
                 (
                     OrderTotal == other.OrderTotal ||
                     OrderTotal != null &&
                     OrderTotal.Equals(other.OrderTotal)
                 ) &&
                 (
                     OrderDate == other.OrderDate ||
                     OrderDate != null &&
                     OrderDate.Equals(other.OrderDate)
                 ) &&
                 (
                     ArrivalDate == other.ArrivalDate ||
                     ArrivalDate != null &&
                     ArrivalDate.Equals(other.ArrivalDate)
                 ) &&
                 (
                     Items == other.Items ||
                     Items != null &&
                     Items.Equals(other.Items)
                 ) &&
                 (
                     OrderId == other.OrderId ||
                     OrderId != null &&
                     OrderId.Equals(other.OrderId)
                 ));
        }
예제 #22
0
        public ActionResult PayOrder(OrderTotal orders)
        {
            using (var client = new HttpClient())
            {
                OrderTotal toBePaid = null;
                var        orderID  = orders.id;
                client.BaseAddress = new Uri(baseUrl);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                var responseTask = client.GetAsync("order/id/" + orderID);
                responseTask.Wait();
                var result = responseTask.Result;
                if (result.IsSuccessStatusCode)
                {
                    var readTask = result.Content.ReadAsStringAsync().Result;
                    toBePaid = JsonConvert.DeserializeObject <OrderTotal>(readTask);
                }

                return(View(toBePaid));
            }
        }
        public static AuthorizeResponse AuthorizeAction(OffAmazonPaymentsServicePropertyCollection propertiesCollection, 
            IOffAmazonPaymentsService service, string orderReferenceId, String orderAmount, int indicator, int authorizationOption)
        {
            //initiate the authorization request
            AuthorizeRequest authRequest = new AuthorizeRequest();
            authRequest.AmazonOrderReferenceId = orderReferenceId;
            authRequest.SellerId = propertiesCollection.MerchantID;
            Price price = new Price();
            //get the ordertotal object from the setOrderReference's response
            OrderTotal authOrderTotal = new OrderTotal();
            price.Amount = orderAmount;
            price.CurrencyCode = propertiesCollection.CurrencyCode;
            authRequest.AuthorizationAmount = price;
            authRequest.AuthorizationReferenceId = orderReferenceId.Replace('-', 'a') + "authRef" + indicator.ToString();
            //If Fast Authorization is required, set the transaction timeout in the request to 0.
            if (authorizationOption == 2)
            {
                authRequest.TransactionTimeout = 0;
            }

            return AuthorizeSample.InvokeAuthorize(service, authRequest);
        }
        public static AuthorizeResponse AuthorizeAction(OffAmazonPaymentsServicePropertyCollection propertiesCollection,
                                                        IOffAmazonPaymentsService service, string orderReferenceId, String orderAmount, int indicator, int authorizationOption)
        {
            //initiate the authorization request
            AuthorizeRequest authRequest = new AuthorizeRequest();

            authRequest.AmazonOrderReferenceId = orderReferenceId;
            authRequest.SellerId = propertiesCollection.MerchantID;
            Price price = new Price();
            //get the ordertotal object from the setOrderReference's response
            OrderTotal authOrderTotal = new OrderTotal();

            price.Amount       = orderAmount;
            price.CurrencyCode = propertiesCollection.CurrencyCode;
            authRequest.AuthorizationAmount      = price;
            authRequest.AuthorizationReferenceId = orderReferenceId.Replace('-', 'a') + "authRef" + indicator.ToString();
            //If Fast Authorization is required, set the transaction timeout in the request to 0.
            if (authorizationOption == 2)
            {
                authRequest.TransactionTimeout = 0;
            }

            return(AuthorizeSample.InvokeAuthorize(service, authRequest));
        }
        /// <summary>
        /// Calculates the Purchase Order total Value
        /// </summary>
        public OrderTotal CalculatePurchaseOrderTotal(List <PurchaseOrderDetails_Join> PurchaseOrderContentList)
        {
            OrderTotal purchaseOrderTotal = new OrderTotal();
            TaxModel   taxToUse           = GlobalConfig.Connection.GetTaxSingle(PurchaseOrderContentList[0].TaxId) == null?
                                            GlobalConfig.Connection.GetTaxes_All().Where(t => t.DefaultSelectedTax).Single() :
                                                GlobalConfig.Connection.GetTaxSingle(PurchaseOrderContentList[0].TaxId);

            for (int i = 0; i < PurchaseOrderContentList.Count; i++)
            {
                if (ValidatePurchaseOrderTotalCalculations(taxToUse, i, PurchaseOrderContentList))
                {
                    if (PurchaseOrderContentList[i].TaxId != 0 && taxToUse.Id != PurchaseOrderContentList[i].TaxId)
                    {
                        taxToUse = GlobalConfig.Connection.GetTaxSingle(PurchaseOrderContentList[i].TaxId);
                    }

                    purchaseOrderTotal.Total     += PurchaseOrderContentList[i].Quantity * PurchaseOrderContentList[i].PurchasePrice;
                    purchaseOrderTotal.TaxTotal  += PurchaseOrderContentList[i].Quantity * (PurchaseOrderContentList[i].PurchasePrice / 100 * (taxToUse.Percent));
                    purchaseOrderTotal.GrandTotal = purchaseOrderTotal.Total + purchaseOrderTotal.TaxTotal;
                }
            }

            return(purchaseOrderTotal);
        }
예제 #26
0
        public IActionResult GetAllOrders()
        {
            List <OrderTotal> orderTotals = new List <OrderTotal>();

            IEnumerable <Order> Orders = _database.Orders.Include(x => x.OrderLines).ThenInclude(x => x.Product).Include(x => x.Customers)
                                         .OrderBy(x => x.Customers)
                                         .ToList();

            foreach (Order item in Orders)
            {
                OrderTotal individualOrder = new OrderTotal();

                individualOrder.FirstName = item.Customers.FirstName;
                individualOrder.LastName  = item.Customers.LastName;

                individualOrder.CreatedDate = item.CreatedDate;
                individualOrder.OrderLines  = item.OrderLines;

                decimal?        total    = 0;
                decimal?        Sub      = 0;
                List <decimal?> SubTotal = new List <decimal?>();


                foreach (OrderLine orderlines in item.OrderLines)
                {
                    Sub    = orderlines.Quantity * orderlines.Product.Price;
                    total += Sub;
                    SubTotal.Add(Sub);
                }
                individualOrder.Price    = total;
                individualOrder.SubTotal = SubTotal;
                orderTotals.Add(individualOrder);
            }

            return(Ok(orderTotals));
        }
예제 #27
0
        public OrderTotal GetOrderTotals()
        {
            DateTime today        = DateTime.Today;
            DateTime startOfToday = new DateTime(today.Year, today.Month, today.Day, 0, 0, 0);
            DateTime endOfToday   = new DateTime(today.Year, today.Month, today.Day, 23, 59, 59);

            var orders = from p in _context.Orders
                         select p;

            var pendingTodayOrders   = orders.Where(o => o.OrderStatus != "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= startOfToday && o.OrderDate <= endOfToday).ToList();
            var pendingWeekOrders    = orders.Where(o => o.OrderStatus != "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= FirstDateOfWeekISO8601(today.Year, GetIso8601WeekOfYear(today)) && o.OrderDate <= endOfToday).ToList();
            var pendingMonthOrders   = orders.Where(o => o.OrderStatus != "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= new DateTime(today.Year, today.Month, 1, 0, 0, 0) && o.OrderDate <= endOfToday).ToList();
            var pendingYearOrders    = orders.Where(o => o.OrderStatus != "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= new DateTime(today.Year, 1, 1, 0, 0, 0) && o.OrderDate <= endOfToday).ToList();
            var pendingAllOrders     = orders.Where(o => o.OrderStatus != "Completed").ToList();
            var completedTodayOrders = orders.Where(o => o.OrderStatus == "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= startOfToday && o.OrderDate <= endOfToday).ToList();
            var completedWeekOrders  = orders.Where(o => o.OrderStatus == "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= FirstDateOfWeekISO8601(today.Year, GetIso8601WeekOfYear(today)) && o.OrderDate <= endOfToday).ToList();
            var completedMonthOrders = orders.Where(o => o.OrderStatus == "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= new DateTime(today.Year, today.Month, 1, 0, 0, 0) && o.OrderDate <= endOfToday).ToList();
            var completedYearOrders  = orders.Where(o => o.OrderStatus == "Completed" && o.OrderStatus != "Voided" && o.OrderDate >= new DateTime(today.Year, 1, 1, 0, 0, 0) && o.OrderDate <= endOfToday).ToList();
            var completedAllOrders   = orders.Where(o => o.OrderStatus == "Completed").ToList();

            OrderTotal orderTotals = new OrderTotal
            {
                PendingToday     = TotalOrderGrandTotals(pendingTodayOrders),
                PendingWeek      = TotalOrderGrandTotals(pendingWeekOrders),
                PendingMonth     = TotalOrderGrandTotals(pendingMonthOrders),
                PendingYear      = TotalOrderGrandTotals(pendingYearOrders),
                PendingAllTime   = TotalOrderGrandTotals(pendingAllOrders),
                CompletedToday   = TotalOrderGrandTotals(completedTodayOrders),
                CompletedWeek    = TotalOrderGrandTotals(completedWeekOrders),
                CompletedMonth   = TotalOrderGrandTotals(completedMonthOrders),
                CompletedYear    = TotalOrderGrandTotals(completedYearOrders),
                CompletedAllTime = TotalOrderGrandTotals(completedAllOrders)
            };

            return(orderTotals);
        }
예제 #28
0
        public override string ToString()
        {
            StringBuilder result = new StringBuilder();

            if (IsSetAmazonOrderId())
            {
                result.Append("Order ID: ");
                result.AppendLine(AmazonOrderId);
            }
            if (IsSetFulfillmentChannel())
            {
                result.Append("FulfillmentChannel:");
                result.AppendLine(FulfillmentChannel.ToString());
            }
            if (IsSetNumberOfItemsShipped())
            {
                result.Append("Number of Items Shipped: ");
                result.AppendLine(NumberOfItemsShipped.ToString());
            }
            if (IsSetNumberOfItemsUnshipped())
            {
                result.Append("Number of Items Not Shipped: ");
                result.AppendLine(NumberOfItemsShipped.ToString());
            }
            if (IsSetLastUpdateDate())
            {
                result.Append("Last Update Date: ");
                result.AppendLine(LastUpdateDate.ToString());
            }
            if (IsSetOrderChannel())
            {
                result.Append("Order Channel: ");
                result.AppendLine(OrderChannel);
            }
            if (IsSetOrderStatus())
            {
                result.Append("Order Status: ");
                result.AppendLine(OrderStatus.ToString());
            }
            if (IsSetOrderTotal())
            {
                result.Append("Order Total: ");
                result.AppendLine(OrderTotal.ToString());
            }
            if (IsSetPurchaseDate())
            {
                result.Append("Purchase Date: ");
                result.AppendLine(PurchaseDate.ToString());
            }
            if (IsSetSalesChannel())
            {
                result.Append("Sales Channel: ");
                result.AppendLine(SalesChannel);
            }
            if (IsSetSellerOrderId())
            {
                result.Append("Seller Order Id: ");
                result.AppendLine(SellerOrderId);
            }
            if (IsSetShipServiceLevel())
            {
                result.Append("Ship Service Level: ");
                result.AppendLine(ShipServiceLevel);
            }
            if (IsSetPaymentExecutionDetail())
            {
                result.Append("Payment Execution Detail: ");
                result.Append(PaymentExecutionDetail);
            }
            if (IsSetPaymentMethod())
            {
                result.Append("Payment Method: ");
                result.Append(PaymentMethod);
            }
            if (IsSetMarketplaceId())
            {
                result.Append("Marketplace Id: ");
                result.AppendLine(MarketplaceId);
            }
            if (IsSetBuyerEmail())
            {
                result.Append("Buyer Email: ");
                result.AppendLine(BuyerEmail);
            }
            if (IsSetShipServiceLevel())
            {
                result.Append("Buyer Name: ");
                result.AppendLine(BuyerName);
            }
            if (IsSetShipmentServiceLevelCategory())
            {
                result.Append("Shipment Service Level Category: ");
                result.AppendLine(ShipmentServiceLevelCategory);
            }
            if (IsSetCbaDisplayableShippingLabel())
            {
                result.Append("CbaDisplayableShippingLabel: ");
                result.AppendLine(this.CbaDisplayableShippingLabel);
            }
            if (IsSetOrderType())
            {
                result.Append("OrderType: ");
                result.AppendLine(this.OrderType);
            }
            if (IsSetEarliestShipDate())
            {
                result.Append("EarliestShipDate: ");
                result.AppendLine(this.EarliestShipDate.ToString());
            }
            if (IsSetLatestShipDate())
            {
                result.Append("LatestShipDate: ");
                result.AppendLine(this.LatestShipDate.ToString());
            }
            return(result.ToString());
        }
예제 #29
0
        private Activity BuildImplementation()
        {
            Variable <Boolean> isFreeShipping =
                new Variable <Boolean> {
                Name = "IsFreeShipping"
            };
            Variable <Decimal> normalRate =
                new Variable <Decimal> {
                Name = "NormalRate", Default = 1.95M
            };
            Variable <Decimal> expressRate =
                new Variable <Decimal> {
                Name = "ExpressRate", Default = 3.50M
            };
            Variable <Decimal> minimum =
                new Variable <Decimal> {
                Name = "Minimum", Default = 12.95M
            };
            Variable <Decimal> freeThreshold =
                new Variable <Decimal> {
                Name = "FreeThreshold", Default = 75.00M
            };

            return(new Sequence
            {
                Variables =
                {
                    isFreeShipping, normalRate, expressRate, minimum, freeThreshold
                },

                Activities =
                {
                    new Switch <String>
                    {
                        //public InArgument(Expression<Func<ActivityContext, T>> expression);
                        Expression = new InArgument <String>(
                            ac => ShipVia.Get(ac)),
                        Cases =
                        {
                            { "normal", new If
                                    {
                                        Condition = new InArgument <Boolean>(ac =>
                                                                             OrderTotal.Get(ac) >= freeThreshold.Get(ac)),
                                        Then = new Assign <Boolean>
                                        {
                                            //public OutArgument(Expression<Func<ActivityContext, T>> expression);
                                            To = new OutArgument <Boolean>(ac =>
                                                                           isFreeShipping.Get(ac)),
                                            Value = true
                                        },
                                        Else = new Assign <Decimal>
                                        {
                                            To = new OutArgument <Decimal>(ac =>
                                                                           this.Result.Get(ac)),
                                            Value = new InArgument <Decimal>(ac =>
                                                                             Weight.Get(ac) * normalRate.Get(ac))
                                        }
                                    } },
                            { "express", new Assign <Decimal>
                                    {
                                        To = new OutArgument <Decimal>(ac =>
                                                                       this.Result.Get(ac)),
                                        Value = new InArgument <Decimal>(ac =>
                                                                         Weight.Get(ac) * expressRate.Get(ac))
                                    } }
                        }
                    },
                    new If
                    {
                        Condition = new InArgument <bool>(ac =>
                                                          Result.Get(ac) < minimum.Get(ac) &&
                                                          (!isFreeShipping.Get(ac))),
                        Then = new Assign
                        {
                            To = new OutArgument <Decimal>(ac => Result.Get(ac)),
                            Value = new InArgument <Decimal>(ac => minimum.Get(ac))
                        }
                    }
                }
            }); //new Sequence
        }
예제 #30
0
 public void AddTotal(string name, string price)
 {
     OrderTotal newTotal = new OrderTotal('?');
     totales.Add(newTotal.GenerateTotal(name, price));
 }
예제 #31
0
파일: SuposDb.cs 프로젝트: hpbaotho/supos
		static public OrderTotal GetOrderTotal( SuposDataSet.OrdersRow order)
		{
			OrderTotal result = new OrderTotal();
			if (order != null)
			{
				SuposDataSet.OrderDetailsRow[] details = (SuposDataSet.OrderDetailsRow[])order.GetChildRows( "FK_orders_OrderDetails" );
				result.TotPrice = 0;
				result.TaxAmount = 0;
				foreach( SuposDataSet.OrderDetailsRow detail in details)
				{
					result.TotPrice += detail.Price*detail.Quantity;
					result.TaxAmount += (Decimal)detail.TaxesRow.Rate * detail.Price;
				}
			}
			return result;
		}
예제 #32
0
    private void DrawDatos()
    {
        OrderTotal ordTot = new OrderTotal('?');

        foreach (string dato in datos)
        {
            if (dato.Length > maxChar)
            {
                int    currentChar  = 0;
                int    headerLenght = dato.Length;
                string aa           = ordTot.GetTotalCantidad(dato);
                string bb           = "     " + ordTot.GetTotalName(dato);
                string cc;
                if (bb != "")
                {
                    cc = aa + bb;
                }
                else
                {
                    cc = "       " + aa + bb;
                }
                while (headerLenght > maxChar)
                {
                    line = cc.Substring(currentChar, maxChar);
                    line = AlignRightText(line.Length) + line;

                    gfx.DrawString(line, printFont, Brushes.Black, leftMargin, YPosition(), new StringFormat());
                    leftMargin = 0;


                    count++;

                    currentChar  += maxChar;
                    headerLenght -= maxChar;
                }
                line = cc;
                gfx.DrawString(line.Substring(currentChar, line.Length - currentChar), printFont, Brushes.Black, leftMargin, YPosition(), new StringFormat());
                count++;
            }
            else
            {
                string aa = ordTot.GetTotalCantidad(dato);
                string bb = ordTot.GetTotalName(dato);
                string cc;
                if (bb != "")
                {
                    cc = aa + bb;
                }
                else
                {
                    cc = "       " + aa + bb;
                }
                line = cc;
                gfx.DrawString(line, printFont, Brushes.Black, leftMargin, YPosition(), new StringFormat());

                count++;
            }
        }
        leftMargin = 0;
        DrawEspacio();


        line = DottedLine();

        gfx.DrawString(line, printFont, Brushes.Black, leftMargin, YPosition(), new StringFormat());

        count++;
        DrawEspacio();
    }
예제 #33
0
            private void DrawTotales()
            {
                OrderTotal ordTot = new OrderTotal('?');

                foreach (string total in totales)
                {
                    line = ordTot.GetTotalCantidad(total);
                    line = AlignRightText(line.Length) + line;

                    gfx.DrawString(line, printFont, myBrush, leftMargin, YPosition(), new StringFormat());
                    leftMargin = 0;

                    line = "      " + ordTot.GetTotalName(total);
                    gfx.DrawString(line, printFont, myBrush, leftMargin, YPosition(), new StringFormat());
                    count++;
                }
                leftMargin = 0;
                DrawEspacio();
                DrawEspacio();
            }
예제 #34
0
        public static CreateOrderReferenceForIdResponse InvokeCreateOrderReferenceForId(IOffAmazonPaymentsService service, CreateOrderReferenceForIdRequest request)
        {
            CreateOrderReferenceForIdResponse response = null;

            try
            {
                response = service.CreateOrderReferenceForId(request);

                Console.WriteLine("Service Response");
                Console.WriteLine("=============================================================================");
                Console.WriteLine();

                Console.WriteLine("        CreateOrderReferenceForIdResponse");
                if (response.IsSetCreateOrderReferenceForIdResult())
                {
                    Console.WriteLine("            CreateOrderReferenceForIdResult");
                    CreateOrderReferenceForIdResult createOrderReferenceForIdResult = response.CreateOrderReferenceForIdResult;
                    if (createOrderReferenceForIdResult.IsSetOrderReferenceDetails())
                    {
                        Console.WriteLine("                OrderReferenceDetails");
                        OrderReferenceDetails orderReferenceDetails = createOrderReferenceForIdResult.OrderReferenceDetails;
                        if (orderReferenceDetails.IsSetAmazonOrderReferenceId())
                        {
                            Console.WriteLine("                    AmazonOrderReferenceId");
                            Console.WriteLine("                        {0}", orderReferenceDetails.AmazonOrderReferenceId);
                        }
                        if (orderReferenceDetails.IsSetBuyer())
                        {
                            Console.WriteLine("                    Buyer");
                            Buyer buyer = orderReferenceDetails.Buyer;
                            if (buyer.IsSetName())
                            {
                                Console.WriteLine("                        Name");
                                Console.WriteLine("                            {0}", buyer.Name);
                            }
                            if (buyer.IsSetEmail())
                            {
                                Console.WriteLine("                        Email");
                                Console.WriteLine("                            {0}", buyer.Email);
                            }
                            if (buyer.IsSetPhone())
                            {
                                Console.WriteLine("                        Phone");
                                Console.WriteLine("                            {0}", buyer.Phone);
                            }
                        }
                        if (orderReferenceDetails.IsSetOrderTotal())
                        {
                            Console.WriteLine("                    OrderTotal");
                            OrderTotal orderTotal = orderReferenceDetails.OrderTotal;
                            if (orderTotal.IsSetCurrencyCode())
                            {
                                Console.WriteLine("                        CurrencyCode");
                                Console.WriteLine("                            {0}", orderTotal.CurrencyCode);
                            }
                            if (orderTotal.IsSetAmount())
                            {
                                Console.WriteLine("                        Amount");
                                Console.WriteLine("                            {0}", orderTotal.Amount);
                            }
                        }
                        if (orderReferenceDetails.IsSetSellerNote())
                        {
                            Console.WriteLine("                    SellerNote");
                            Console.WriteLine("                        {0}", orderReferenceDetails.SellerNote);
                        }
                        if (orderReferenceDetails.IsSetPlatformId())
                        {
                            Console.WriteLine("                    PlatformId");
                            Console.WriteLine("                        {0}", orderReferenceDetails.PlatformId);
                        }
                        if (orderReferenceDetails.IsSetDestination())
                        {
                            Console.WriteLine("                    Destination");
                            Destination destination = orderReferenceDetails.Destination;
                            if (destination.IsSetDestinationType())
                            {
                                Console.WriteLine("                        DestinationType");
                                Console.WriteLine("                            {0}", destination.DestinationType);
                            }
                            if (destination.IsSetPhysicalDestination())
                            {
                                Console.WriteLine("                        PhysicalDestination");
                                Address physicalDestination = destination.PhysicalDestination;
                                if (physicalDestination.IsSetName())
                                {
                                    Console.WriteLine("                            Name");
                                    Console.WriteLine("                                {0}", physicalDestination.Name);
                                }
                                if (physicalDestination.IsSetAddressLine1())
                                {
                                    Console.WriteLine("                            AddressLine1");
                                    Console.WriteLine("                                {0}", physicalDestination.AddressLine1);
                                }
                                if (physicalDestination.IsSetAddressLine2())
                                {
                                    Console.WriteLine("                            AddressLine2");
                                    Console.WriteLine("                                {0}", physicalDestination.AddressLine2);
                                }
                                if (physicalDestination.IsSetAddressLine3())
                                {
                                    Console.WriteLine("                            AddressLine3");
                                    Console.WriteLine("                                {0}", physicalDestination.AddressLine3);
                                }
                                if (physicalDestination.IsSetCity())
                                {
                                    Console.WriteLine("                            City");
                                    Console.WriteLine("                                {0}", physicalDestination.City);
                                }
                                if (physicalDestination.IsSetCounty())
                                {
                                    Console.WriteLine("                            County");
                                    Console.WriteLine("                                {0}", physicalDestination.County);
                                }
                                if (physicalDestination.IsSetDistrict())
                                {
                                    Console.WriteLine("                            District");
                                    Console.WriteLine("                                {0}", physicalDestination.District);
                                }
                                if (physicalDestination.IsSetStateOrRegion())
                                {
                                    Console.WriteLine("                            StateOrRegion");
                                    Console.WriteLine("                                {0}", physicalDestination.StateOrRegion);
                                }
                                if (physicalDestination.IsSetPostalCode())
                                {
                                    Console.WriteLine("                            PostalCode");
                                    Console.WriteLine("                                {0}", physicalDestination.PostalCode);
                                }
                                if (physicalDestination.IsSetCountryCode())
                                {
                                    Console.WriteLine("                            CountryCode");
                                    Console.WriteLine("                                {0}", physicalDestination.CountryCode);
                                }
                                if (physicalDestination.IsSetPhone())
                                {
                                    Console.WriteLine("                            Phone");
                                    Console.WriteLine("                                {0}", physicalDestination.Phone);
                                }
                            }
                        }
                        if (orderReferenceDetails.IsSetBillingAddress())
                        {
                            Console.WriteLine("                    BillingAddress");
                            BillingAddress billingAddress = orderReferenceDetails.BillingAddress;
                            if (billingAddress.IsSetAddressType())
                            {
                                Console.WriteLine("                        AddressType");
                                Console.WriteLine("                            {0}", billingAddress.AddressType);
                            }
                            if (billingAddress.IsSetPhysicalAddress())
                            {
                                Console.WriteLine("                        PhysicalAddress");
                                Address physicalAddress = billingAddress.PhysicalAddress;
                                if (physicalAddress.IsSetName())
                                {
                                    Console.WriteLine("                            Name");
                                    Console.WriteLine("                                {0}", physicalAddress.Name);
                                }
                                if (physicalAddress.IsSetAddressLine1())
                                {
                                    Console.WriteLine("                            AddressLine1");
                                    Console.WriteLine("                                {0}", physicalAddress.AddressLine1);
                                }
                                if (physicalAddress.IsSetAddressLine2())
                                {
                                    Console.WriteLine("                            AddressLine2");
                                    Console.WriteLine("                                {0}", physicalAddress.AddressLine2);
                                }
                                if (physicalAddress.IsSetAddressLine3())
                                {
                                    Console.WriteLine("                            AddressLine3");
                                    Console.WriteLine("                                {0}", physicalAddress.AddressLine3);
                                }
                                if (physicalAddress.IsSetCity())
                                {
                                    Console.WriteLine("                            City");
                                    Console.WriteLine("                                {0}", physicalAddress.City);
                                }
                                if (physicalAddress.IsSetCounty())
                                {
                                    Console.WriteLine("                            County");
                                    Console.WriteLine("                                {0}", physicalAddress.County);
                                }
                                if (physicalAddress.IsSetDistrict())
                                {
                                    Console.WriteLine("                            District");
                                    Console.WriteLine("                                {0}", physicalAddress.District);
                                }
                                if (physicalAddress.IsSetStateOrRegion())
                                {
                                    Console.WriteLine("                            StateOrRegion");
                                    Console.WriteLine("                                {0}", physicalAddress.StateOrRegion);
                                }
                                if (physicalAddress.IsSetPostalCode())
                                {
                                    Console.WriteLine("                            PostalCode");
                                    Console.WriteLine("                                {0}", physicalAddress.PostalCode);
                                }
                                if (physicalAddress.IsSetCountryCode())
                                {
                                    Console.WriteLine("                            CountryCode");
                                    Console.WriteLine("                                {0}", physicalAddress.CountryCode);
                                }
                                if (physicalAddress.IsSetPhone())
                                {
                                    Console.WriteLine("                            Phone");
                                    Console.WriteLine("                                {0}", physicalAddress.Phone);
                                }
                            }
                        }
                        if (orderReferenceDetails.IsSetReleaseEnvironment())
                        {
                            Console.WriteLine("                    ReleaseEnvironment");
                            Console.WriteLine("                        {0}", orderReferenceDetails.ReleaseEnvironment);
                        }
                        if (orderReferenceDetails.IsSetSellerOrderAttributes())
                        {
                            Console.WriteLine("                    SellerOrderAttributes");
                            SellerOrderAttributes sellerOrderAttributes = orderReferenceDetails.SellerOrderAttributes;
                            if (sellerOrderAttributes.IsSetSellerOrderId())
                            {
                                Console.WriteLine("                        SellerOrderId");
                                Console.WriteLine("                            {0}", sellerOrderAttributes.SellerOrderId);
                            }
                            if (sellerOrderAttributes.IsSetStoreName())
                            {
                                Console.WriteLine("                        StoreName");
                                Console.WriteLine("                            {0}", sellerOrderAttributes.StoreName);
                            }
                            if (sellerOrderAttributes.IsSetOrderItemCategories())
                            {
                                Console.WriteLine("                        OrderItemCategories");
                                OrderItemCategories orderItemCategories   = sellerOrderAttributes.OrderItemCategories;
                                List <String>       orderItemCategoryList = orderItemCategories.OrderItemCategory;
                                foreach (String orderItemCategory in orderItemCategoryList)
                                {
                                    Console.WriteLine("                            OrderItemCategory");
                                    Console.WriteLine("                                {0}", orderItemCategory);
                                }
                            }
                            if (sellerOrderAttributes.IsSetCustomInformation())
                            {
                                Console.WriteLine("                        CustomInformation");
                                Console.WriteLine("                            {0}", sellerOrderAttributes.CustomInformation);
                            }
                        }
                        if (orderReferenceDetails.IsSetOrderReferenceStatus())
                        {
                            Console.WriteLine("                    OrderReferenceStatus");
                            OrderReferenceStatus orderReferenceStatus = orderReferenceDetails.OrderReferenceStatus;
                            if (orderReferenceStatus.IsSetState())
                            {
                                Console.WriteLine("                        State");
                                Console.WriteLine("                            {0}", orderReferenceStatus.State);
                            }
                            if (orderReferenceStatus.IsSetLastUpdateTimestamp())
                            {
                                Console.WriteLine("                        LastUpdateTimestamp");
                                Console.WriteLine("                            {0}", orderReferenceStatus.LastUpdateTimestamp);
                            }
                            if (orderReferenceStatus.IsSetReasonCode())
                            {
                                Console.WriteLine("                        ReasonCode");
                                Console.WriteLine("                            {0}", orderReferenceStatus.ReasonCode);
                            }
                            if (orderReferenceStatus.IsSetReasonDescription())
                            {
                                Console.WriteLine("                        ReasonDescription");
                                Console.WriteLine("                            {0}", orderReferenceStatus.ReasonDescription);
                            }
                        }
                        if (orderReferenceDetails.IsSetConstraints())
                        {
                            Console.WriteLine("                    Constraints");
                            Constraints       constraints    = orderReferenceDetails.Constraints;
                            List <Constraint> constraintList = constraints.Constraint;
                            foreach (Constraint constraint in constraintList)
                            {
                                Console.WriteLine("                        Constraint");
                                if (constraint.IsSetConstraintID())
                                {
                                    Console.WriteLine("                            ConstraintID");
                                    Console.WriteLine("                                {0}", constraint.ConstraintID);
                                }
                                if (constraint.IsSetDescription())
                                {
                                    Console.WriteLine("                            Description");
                                    Console.WriteLine("                                {0}", constraint.Description);
                                }
                            }
                        }
                        if (orderReferenceDetails.IsSetCreationTimestamp())
                        {
                            Console.WriteLine("                    CreationTimestamp");
                            Console.WriteLine("                        {0}", orderReferenceDetails.CreationTimestamp);
                        }
                        if (orderReferenceDetails.IsSetExpirationTimestamp())
                        {
                            Console.WriteLine("                    ExpirationTimestamp");
                            Console.WriteLine("                        {0}", orderReferenceDetails.ExpirationTimestamp);
                        }
                        if (orderReferenceDetails.IsSetParentDetails())
                        {
                            Console.WriteLine("                    ParentDetails");
                            ParentDetails parentDetails = orderReferenceDetails.ParentDetails;
                            if (parentDetails.IsSetId())
                            {
                                Console.WriteLine("                        Id");
                                Console.WriteLine("                            {0}", parentDetails.Id);
                            }
                            if (parentDetails.IsSetType())
                            {
                                Console.WriteLine("                        Type");
                                Console.WriteLine("                            {0}", parentDetails.Type);
                            }
                        }
                        if (orderReferenceDetails.IsSetIdList())
                        {
                            Console.WriteLine("                    IdList");
                            IdList        idList     = orderReferenceDetails.IdList;
                            List <String> memberList = idList.member;
                            foreach (String member in memberList)
                            {
                                Console.WriteLine("                        member");
                                Console.WriteLine("                            {0}", member);
                            }
                        }
                    }
                }
                if (response.IsSetResponseMetadata())
                {
                    Console.WriteLine("            ResponseMetadata");
                    ResponseMetadata responseMetadata = response.ResponseMetadata;
                    if (responseMetadata.IsSetRequestId())
                    {
                        Console.WriteLine("                RequestId");
                        Console.WriteLine("                    {0}", responseMetadata.RequestId);
                    }
                }
            }
            catch (OffAmazonPaymentsServiceException ex)
            {
                PrintException(ex);
            }
            return(response);
        }
 public static SetOrderReferenceDetailsResponse SetOrderReferenceDetails(OffAmazonPaymentsServicePropertyCollection propertiesCollection, 
     IOffAmazonPaymentsService service, string orderReferenceId, string orderAmount)
 {
     SetOrderReferenceDetailsRequest setOrderRequest = new SetOrderReferenceDetailsRequest();
     setOrderRequest.SellerId = propertiesCollection.MerchantID;
     setOrderRequest.AmazonOrderReferenceId = orderReferenceId;
     //setup the currency and amount as an ordertotal object
     OrderReferenceAttributes attributes = new OrderReferenceAttributes();
     OrderTotal orderTotal = new OrderTotal();
     orderTotal.Amount = orderAmount;
     orderTotal.CurrencyCode = propertiesCollection.CurrencyCode;
     attributes.OrderTotal = orderTotal;
     setOrderRequest.OrderReferenceAttributes = attributes;
     return SetOrderReferenceDetailsSample.InvokeSetOrderReferenceDetails(service, setOrderRequest);
 }