Esempio n. 1
0
        public Package(int ID, Package objPkg, Product objItem)
        {
            BaseOrder = objPkg.BaseOrder;
            CustInfo = objPkg.CustInfo;
            Carrier = objPkg.Carrier;
            PackageID = ID.ToString();
            PackageOrderNumber = objPkg.PackageOrderNumber;
            PackageSubOrderNumber = objPkg.PackageSubOrderNumber;

            itemNum = objItem.ItemNumber;
            itemDesc = objItem.Description;
            signReq = (objItem.SignatureRequired ? "Y" : "N");

            ShipMethod = objPkg.ShipMethod;
        }
Esempio n. 2
0
        public Package(int ID, Product objItem, Order objOrder, int orderItemId, Customer objCustInfo, string carrier)
        {
            BaseOrder = objOrder;
            CustInfo = objCustInfo;
            Carrier = carrier;
            PackageID = ID.ToString();
            PackageOrderNumber = objOrder.OrderNumber;
            PackageSubOrderNumber = orderItemId;

            itemNum = objItem.ItemNumber;
            itemDesc = objItem.Description;
            signReq = (objItem.SignatureRequired ? "Y" : "N");

            ShipMethod = objOrder.OrderItems[itemNum + "_" + orderItemId].OrderInfo.ShipMethod;
        }
Esempio n. 3
0
        public void AddItem(Product objItem, int quantity)
        {
            int qty;

            if (items.TryGetValue(objItem.ItemNumber, out qty))
            {
                items[objItem.ItemNumber] = qty + quantity;
            }
            else
                items.Add(objItem.ItemNumber, quantity);

            if (!SignatureRequired)
                SignatureRequired = objItem.SignatureRequired;

            totalQty += quantity;
        }
Esempio n. 4
0
        public void AddItem(Product objItem)
        {
            if (Exists(objItem.ItemNumber))
                throw new DuplicateItemException(objItem.ItemNumber);

            try
            {

                var newItem = CreateItemNode(objItem);

                matchValue = objItem.ItemNumber;
                var i = GetLastIndex();

                if (i == -1)
                {
                    root.AppendChild(newItem);
                }
                else
                {
                    var itemNum = itemNos[i];
                    currentItemNode = root.SelectSingleNode("//Item[@ItemNum='" + itemNum + "']");
                    root.InsertAfter(newItem, currentItemNode);
                }

                itemNos.Insert(i + 1, objItem.ItemNumber);

                Save(xmlFileName);

                Logger.Log(String.Format("Item '{0}' has been added to the list.", objItem.ItemNumber));
                Logger.Log(String.Format("\tValues -\n{0}", objItem.PropertyList()));

                currentItemNode = root.SelectSingleNode("//Item[@ItemNum='" + objItem.ItemNumber + "']");

            }
            catch (Exception ex)
            {
                throw new ItemMaintenanceException("Add item failed!", ex);
            }
        }
Esempio n. 5
0
        private XmlNode CreateItemNode(Product objItem)
        {
            var newItem = CreateNode(XmlNodeType.Element, "Item", null);
            var weight = CreateNode(XmlNodeType.Element, "Weight", null);
            var subItems = CreateNode(XmlNodeType.Element, "SubItems", null);

            // ReSharper disable PossibleNullReferenceException
            newItem.Attributes.Append(CreateAttributeWithValue("ItemNum", objItem.ItemNumber));
            newItem.Attributes.Append(CreateAttributeWithValue("Description", objItem.Description));
            newItem.Attributes.Append(CreateAttributeWithValue("L", objItem.L.ToString()));
            newItem.Attributes.Append(CreateAttributeWithValue("W", objItem.W.ToString()));
            newItem.Attributes.Append(CreateAttributeWithValue("H", objItem.H.ToString()));
            newItem.Attributes.Append(CreateAttributeWithValue("SinglePack", objItem.SinglePack ? "true" : "false"));
            newItem.Attributes.Append(CreateAttributeWithValue("SignReq", objItem.SignatureRequired ? "true" : "false"));
            newItem.Attributes.Append(CreateAttributeWithValue("USMail", objItem.ShipUSMail ? "true" : "false"));
            newItem.Attributes.Append(CreateAttributeWithValue("PackingException",
                                                               objItem.PackingException ? "true" : "false"));

            weight.Attributes.Append(CreateAttributeWithValue("WeightForOne", objItem.Weight.ToString()));
            weight.Attributes.Append(CreateAttributeWithValue("PackagingWeight", objItem.PackagingWeight.ToString()));

            if (objItem.IsKit)
            {
                foreach (var subItemNum in objItem.SubItems)
                {
                    var subItem = CreateNode(XmlNodeType.Element, "SubItem", null);
                    subItem.InnerText = subItemNum;
                    subItems.AppendChild(subItem);
                }
            }

            newItem.AppendChild(weight);
            newItem.AppendChild(subItems);

            return newItem;
            // ReSharper restore PossibleNullReferenceException
        }
Esempio n. 6
0
        public void UpdateItem(Product item)
        {
            // ReSharper disable PossibleNullReferenceException

            if (currentItemNode.Attributes["ItemNum"].Value != item.ItemNumber)
                GetItem(item.ItemNumber);

            try
            {

                currentItemNode.Attributes["ItemNum"].Value = item.ItemNumber;
                currentItemNode.Attributes["Description"].Value = item.Description;
                currentItemNode.Attributes["L"].Value = item.L.ToString();
                currentItemNode.Attributes["W"].Value = item.W.ToString();
                currentItemNode.Attributes["H"].Value = item.H.ToString();
                currentItemNode.Attributes["SinglePack"].Value = item.SinglePack.ToString();
                currentItemNode.Attributes["SignReq"].Value = item.SignatureRequired.ToString();
                currentItemNode.Attributes["USMail"].Value = item.ShipUSMail.ToString();
                currentItemNode.Attributes["PackingException"].Value = item.PackingException.ToString();

                var weightNode = currentItemNode.SelectSingleNode("Weight");
                weightNode.Attributes["WeightForOne"].Value = item.Weight.ToString("0.00");
                weightNode.Attributes[""].Value = item.PackagingWeight.ToString();

                var newSubItemsNode = CreateNode(XmlNodeType.Element, "SubItems", null);
                if (item.IsKit)
                {
                    foreach (var itemNumber in item.SubItems)
                    {
                        var subItem = CreateNode(XmlNodeType.Element, "SubItem", null);
                        subItem.InnerText = itemNumber;
                        newSubItemsNode.AppendChild(subItem);
                    }
                }

                var oldSubItemsNode = currentItemNode.SelectSingleNode("SubItems");
                // ReSharper disable AssignNullToNotNullAttribute
                currentItemNode.ReplaceChild(newSubItemsNode, oldSubItemsNode);
                // ReSharper restore AssignNullToNotNullAttribute

                Logger.Log(String.Format("Item '{0}' has been updated.", item.ItemNumber));
                Logger.Log(String.Format("\tUpdated values - \n{0}", item.PropertyList()));

                Save(xmlFileName);

                // ReSharper restore PossibleNullReferenceException

            }
            catch (Exception ex)
            {
                throw new ItemMaintenanceException("An unexpected exception occurred during UpdateItem.", ex);
            }
        }
Esempio n. 7
0
 public void SetDimensions(Product item)
 {
     H = item.H;
     W = item.W;
     L = item.L;
 }
Esempio n. 8
0
 public OrderItem(OrderInfo objOrdInfo,Product objItem, int quantity )
 {
     OrderInfo = objOrdInfo;
     Item = objItem;
     Quantity = quantity;
 }