Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private List <DTO_WebOrderItemSide> createItemSides(TreeNode inItemNode)
        {
            List <DTO_WebOrderItemSide> result = new List <DTO_WebOrderItemSide>();

            WebmateClientInterface webMate = WebmateClientInterface.Instance;

            //......................................

            TreeNode sideNode = inItemNode.FirstNode;

            while (sideNode != null)
            {
                ItemAttr sideAttr = (ItemAttr)sideNode.Tag;

                DTO_WebOrderItemSide webOrderItemSide;
                webOrderItemSide = webMate.CreateAccountOrderItemSide(1,  // Discount ID
                                                                      sideAttr.TPC,
                                                                      Convert.ToSingle(sideAttr.Qty),
                                                                      Convert.ToDecimal(sideAttr.Price));
                result.Add(webOrderItemSide);

                sideNode = sideNode.NextNode;
            }

            //......................................

            return(result);
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private List <DTO_WebOrderItem> createItems()
        {
            List <DTO_WebOrderItem> result = new List <DTO_WebOrderItem>();

            //......................................

            TreeNode itemNode = tvItems.TopNode.FirstNode;

            WebmateClientInterface webMate = WebmateClientInterface.Instance;
            DTO_WebOrderItem       webOrderItem;

            while (itemNode != null)
            {
                ItemAttr itemAttr = (ItemAttr)itemNode.Tag;

                webOrderItem = webMate.CreateAccountOrderItem(1, // Discount ID
                                                              itemAttr.TPC,
                                                              Convert.ToSingle(itemAttr.Qty),
                                                              Convert.ToDecimal(itemAttr.Price),
                                                              new List <DTO_WebOrderItemOption>(),
                                                              createItemSides(itemNode));
                result.Add(webOrderItem);

                itemNode = itemNode.NextNode;
            }

            //......................................

            return(result);
        }
Beispiel #3
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        private decimal calculateTotalPrice(TreeNode inItemNode)
        {
            decimal totalPrice = 0.0M;

            while (inItemNode != null)
            {
                ItemAttr itemAttr = (ItemAttr)inItemNode.Tag;
                totalPrice += Convert.ToInt32(itemAttr.Qty) * Convert.ToDecimal(itemAttr.Price);
                totalPrice += calculateTotalPrice(inItemNode.FirstNode);
                inItemNode  = inItemNode.NextNode;
            }

            return(totalPrice);
        }
Beispiel #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inSideNode"></param>
        /// <param name="inTPC"></param>
        /// <param name="inPrice"></param>
        /// <param name="inQty"></param>
        protected void editItemNode(
            TreeNode inItemNode,
            string inTPC,
            string inPrice,
            string inQty)
        {
            inItemNode.Text = string.Format(@"TPC:{0}  Price:{1:###.##}  Qty:{2:###.##}", inTPC, inPrice, inQty);

            ItemAttr attr = (ItemAttr)inItemNode.Tag;

            attr.TPC   = inTPC;
            attr.Price = inPrice;
            attr.Qty   = inQty;

            inItemNode.Tag = attr;
        }
Beispiel #5
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inTPC"></param>
        /// <param name="inPrice"></param>
        /// <param name="inQty"></param>
        protected void addItemSideNode(
            TreeNode inItemNode,
            string inTPC,
            string inPrice,
            string inQty)
        {
            TreeNode node = inItemNode.Nodes.Add(string.Format(@"TPC:{0}  Price:{1:###.##}  Qty:{2:###.##}", inTPC, inPrice, inQty));

            ItemAttr attr = new ItemAttr();

            attr.TPC   = inTPC;
            attr.Price = inPrice;
            attr.Qty   = inQty;

            node.Tag = attr;
        }
Beispiel #6
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="inTPC"></param>
        /// <param name="inPrice"></param>
        /// <param name="inQty"></param>
        protected void addItemNode(
            string inTPC,
            string inPrice,
            string inQty)
        {
            TreeNode node = tvItems.TopNode.Nodes.Add(string.Format(@"TPC:{0}  Price:{1}  Qty:{2}", inTPC, inPrice, inQty));

            ItemAttr attr = new ItemAttr();

            attr.TPC   = inTPC;
            attr.Price = inPrice;
            attr.Qty   = inQty;

            node.Tag = attr;

            tvItems.TopNode.Expand();
        }
Beispiel #7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        protected bool showItemForm(bool inNewItem)
        {
            TreeNode selectedNode = tvItems.SelectedNode;

            itemForm_.ItemOnly = (selectedNode == null) || (selectedNode == tvItems.TopNode);
            itemForm_.NewItem  = inNewItem;

            if (inNewItem) // Add new item / side
            {
                if (!itemForm_.ItemOnly && selectedNode.Parent == tvItems.TopNode)
                {
                    itemForm_.CheckSideAttr();
                }
                else
                {
                    itemForm_.CheckItemAttr();
                }

                return(itemForm_.ShowDialog() == System.Windows.Forms.DialogResult.OK);
            }
            else if (!itemForm_.ItemOnly)   // Edit an existing item / side
            {
                ItemAttr attr = (ItemAttr)selectedNode.Tag;

                itemForm_.TPC   = attr.TPC;
                itemForm_.Price = attr.Price;
                itemForm_.Qty   = attr.Qty;

                if (selectedNode.Parent != tvItems.TopNode)
                {
                    itemForm_.CheckSideAttr();
                }
                else
                {
                    itemForm_.CheckItemAttr();
                }

                return(itemForm_.ShowDialog() == System.Windows.Forms.DialogResult.OK);
            }

            return(false);
        }