Ejemplo n.º 1
0
 public PrintableOrder(PendingOrderDTO po, string prodName, string shipperName)
 {
     status        = "Pending";
     justification = "";
     this.orderId  = po.OrderID;
     this.product  = prodName;
     this.quantity = po.Quantity;
     this.date     = po.Date.ToString("dd/MM/yyy");
     this.shipper  = shipperName;
 }
Ejemplo n.º 2
0
        private async void SendRequestBtn_Click(object sender, RoutedEventArgs e)
        {
            if (checkEnteredData())
            {
                //valid request
                int      shipperId    = retrieveID(currentSelectedShipperPlaceholder.Text);
                int      quantity     = Int32.Parse(quantityInputBox.Text);
                int      productId    = retrieveID(productsListView.SelectedItem.ToString());
                DateTime selectedDate =
                    (todayCBox.IsChecked.Value) ? DateTime.Now.Date : programmedDate.Date.Value.Date;
                ProductServiceClient client =
                    new ProductServiceClient();
                int ret = await client.requestOrderAsync(loggedClientId, productId, quantity, selectedDate.Date.ToString("dd/MM/yyyy"), shipperId);

                if (ret > 0)
                {
                    //returned value is the new id
                    lblSuccess.Text       = defaultLblSuccessText.Replace("----", ret.ToString());
                    lblSuccess.Visibility = Visibility.Visible;
                    lblError.Visibility   = Visibility.Collapsed;
                    //loadOrders();
                    PendingOrderDTO po = new PendingOrderDTO();
                    po.OrderID   = ret;
                    po.ProductID = productId;
                    po.ShipperID = shipperId;
                    po.Quantity  = quantity;
                    po.Date      = selectedDate.Date;
                    po.ClientID  = loggedClientId;
                    orders.Add(new PrintableOrder(po, getProductNameById(productId), getShipperNameById(shipperId)));
                }
            }
            else
            {
                //invalid request
                lblError.Visibility = Visibility.Visible;
            }
        }
Ejemplo n.º 3
0
        public PendingOrderDTO[] GetPendingSalesOrders()
        {
            var recordset = (Recordset)DIApplication.Company.GetBusinessObject(BoObjectTypes.BoRecordset);

            PendingOrderDTO[] pendingOrders = null;

            try {
                var query = this.GetSQL("GetPendingSalesOrders");
                recordset.DoQuery(query);

                if (recordset.RecordCount > 0)
                {
                    pendingOrders = new PendingOrderDTO[recordset.RecordCount];
                    for (int i = 0; i < recordset.RecordCount; i++)
                    {
                        var pendingOrder = new PendingOrderDTO();
                        foreach (Field field in recordset.Fields)
                        {
                            pendingOrder.GetType().GetProperty(field.Name).SetValue(pendingOrder, field.Value);
                        }

                        pendingOrders[i] = pendingOrder;
                        recordset.MoveNext();
                    }
                }
            }
            catch (Exception ex) {
                HandleException(ex, "GetPendingSalesOrders");
            }
            finally {
                MemoryUtility.ReleaseComObject(recordset);
            }


            return(pendingOrders);
        }