public void AddItems(PackageItems pkgItems) { itemNum = pkgItems.ItemNumber; itemDesc = pkgItems.Description; H = pkgItems.H; L = pkgItems.L; W = pkgItems.W; Weight += pkgItems.TotalWeight; multiItem = pkgItems.MultipleItems; signReq = (pkgItems.SignatureRequired ? "Y" : "N"); ShipMethod = pkgItems.ShipMethod; }
public void CreatePackages() { Package shipPkg = null; InitProgressBar(this, new ProgressBarEventArgs(0, prePkgObjs.Values.Count + 1)); foreach (var prePkg in prePkgObjs.Values) { IncrementProgressBar(this, new ProgressBarEventArgs()); var objOrder = orderList[prePkg.Key]; var objCustomer = custList[prePkg.CustomerKey]; XmlNode pkgNode; if (prePkg.SinglePackItems.Count > 0) { foreach (var objOrdItem in prePkg.SinglePackItems.Values) { pkgNode = xrefList.CreatePackageNode(packageID, objOrdItem.OrderInfo); // ReSharper disable PossibleNullReferenceException Logger.Log(String.Format(" Package node created, {0} - {1}", pkgNode.Attributes["ID"].Value, pkgNode.Attributes["Key"].Value), LogLevel.Debug); // ReSharper restore PossibleNullReferenceException xrefList.AddOrderNode(pkgNode, objOrdItem.OrderInfo, objOrdItem.Quantity); Logger.Log(String.Format(" Order line added, {0} - {1} - {2}", objOrdItem.OrderInfo.OrderNumber, objOrdItem.OrderInfo.OrderItemId, objOrdItem.OrderInfo.OrderId), LogLevel.Debug); var objItem = objOrdItem.Item; var shipUSMail = (objItem.ShipUSMail || objCustomer.POBox); shipPkg = new Package(packageID, objItem, objOrder, objOrdItem.OrderInfo.OrderItemId, objCustomer, (shipUSMail ? "USPS" : "UPS")); if (objItem.HasDimensions) { shipPkg.SetDimensions(objItem); } shipPkg.Weight = objItem.Weight; Add(packageID.ToString(), shipPkg); xrefList.AddPackageNode(pkgNode); Logger.Log(String.Format(" Package node added, {0}", pkgNode.Attributes["ID"].Value), LogLevel.Debug); packageID++; if (objItem.IsKit) { { for (int i = 0; i < objItem.SubItems.Count - 1; i++) { var tempItem = itemList.GetItem(objItem.SubItems[i]); var newShipPkg = new Package(packageID, shipPkg, tempItem); if (tempItem.HasDimensions) { newShipPkg.SetDimensions(tempItem); } newShipPkg.Weight = tempItem.Weight; Add(packageID.ToString(), newShipPkg); packageID++; } } } } } pkgNode = null; foreach (var multiPackList in prePkg.MultiPackItems.Values) { // ReSharper disable PossibleNullReferenceException if (multiPackList.Count > 0) { var multiItemList = new PackageItems(); foreach (var objOrdItem in multiPackList.Values) { multiItemList.AddItem(objOrdItem); if (pkgNode == null) { pkgNode = xrefList.CreatePackageNode(packageID, objOrdItem.OrderInfo); shipPkg = new Package(packageID, objOrder, objCustomer, objOrdItem.OrderInfo); Logger.Log(String.Format(" Package node created, {0} - {1}", pkgNode.Attributes["ID"].Value, pkgNode.Attributes["Key"].Value), LogLevel.Debug); } xrefList.AddOrderNode(pkgNode, objOrdItem.OrderInfo, objOrdItem.Quantity); Logger.Log(String.Format(" Order line added, {0} - {1} - {2}", objOrdItem.OrderInfo.OrderNumber, objOrdItem.OrderInfo.OrderItemId, objOrdItem.OrderInfo.OrderId), LogLevel.Debug); } multiItemList.CalcWeightAndSize(itemList); shipPkg.AddItems(multiItemList); shipPkg.SetCarrier(itemList); Add(packageID.ToString(), shipPkg); xrefList.AddPackageNode(pkgNode); Logger.Log(String.Format(" Package node added, {0}", pkgNode.Attributes["ID"].Value), LogLevel.Debug); packageID++; } pkgNode = null; // ReSharper restore PossibleNullReferenceException } } xrefList.SaveDocument(); Settings.PackageID = packageID; }