Ejemplo n.º 1
0
        public FileInfo SaveCostcoConfirm(ConfirmMessageBatch confirmBatch, IAppSettingsService appSettings)
        {
            string saveFilePath = Path.Combine(appSettings.Costco.Dir.Decrypt.Confirms.Path, confirmBatch.FileName);

            confirmBatch.ValidateXml();
            confirmBatch.SaveFile(saveFilePath);

            return(new FileInfo(saveFilePath));
        }
Ejemplo n.º 2
0
        public HubConfBatch(string fileName, ConfirmMessageBatch confirmBatch)
            : this()
        {
            FileName = Path.GetFileName(fileName);
            Confirms = (from c in confirmBatch.hubConfirm
                        select new HubConfirm
                        {
                            PartnerTrxId = c.partnerTrxID,
                            PartnerTrxDt = c.partnerTrxDate,
                            PoNumber = c.poNumber,
                            VendorsInvoiceNumber = (c.trxData != null) ? c.trxData.vendorsInvoiceNumber : null,

                            Packages = (c.packageDetail != null)
                                        ? (from p in c.packageDetail
                                           select new HubConfPackage
                                           {
                                               ID = p.packageDetailID,
                                               ShipDate = p.shipDate,
                                               ServiceLevel1 = p.serviceLevel1,
                                               TrackingNumber = p.trackingNumber,
                                               Weight = (p.shippingWeight != null) ? p.shippingWeight.Text.FirstOrDefault() : null
                                           }).ToList()
                                            : null,

                            Actions = (c.hubAction != null)
                                        ? (from a in c.hubAction
                                           select new HubConfAction
                                           {
                                               Shipment = (a.action == action.v_ship),
                                               ActionCode = a.actionCode,
                                               MerchantLineNumber = a.merchantLineNumber,
                                               TrxVendorSKU = a.trxVendorSKU,
                                               TrxMerchantSKU = a.trxMerchantSKU,
                                               TrxQty = a.trxQty,
                                               PackageIDs = (a.packageDetailLink != null) ? (from l in a.packageDetailLink select l.packageDetailID).ToArray() : null
                                           }).ToList()
                                        : null
                        }).ToList();
        }
Ejemplo n.º 3
0
 public hubConfirm(ConfirmMessageBatch confMessageBatch)
     : this()
 {
     confirmMessageBatch = confMessageBatch;
     participatingParty = MakeParticipatingParty();
 }
Ejemplo n.º 4
0
        public FileInfo SaveCostcoConfirm(ConfirmMessageBatch confirmBatch, IAppSettingsService appSettings)
        {
            string saveFilePath = Path.Combine(appSettings.Costco.Dir.Decrypt.Confirms.Path, confirmBatch.FileName);
            confirmBatch.ValidateXml();
            confirmBatch.SaveFile(saveFilePath);

            return new FileInfo(saveFilePath);
        }
Ejemplo n.º 5
0
        public static ConfirmMessageBatch ConfBatchFromJObj(string fileName, JObject jsonBatch)
        {
            string poNumber;
            string vendorsInvoiceNumber;
            string partnerTrxId;
            string partnerTrxDt;

            hubConfirm newHubConfirm;

            string packageID;
            string shipDate;
            string serviceLevel1;
            string trackingNumber;
            string weight;

            packageDetail newackageDetail;

            bool shipment;
            string merchantLineNumber;
            string actionCode;
            string trxVendorSKU;
            string trxMerchantSKU;
            string trxQty;
            string[] pkgIDs;

            hubAction newHubAction;

            ConfirmMessageBatch confirmBatch = new ConfirmMessageBatch();
            confirmBatch.CostcoSetup();
            confirmBatch.FileName = fileName;

            var confirms = from c in jsonBatch["Confirms"]
                           select c;
            foreach (var c in confirms)
            {
                poNumber = (string)c["PoNumber"];
                partnerTrxId = (string)c["PartnerTrxId"];
                partnerTrxDt = (string)c["PartnerTrxDt"];
                vendorsInvoiceNumber = (string)c["VendorsInvoiceNumber"];

                newHubConfirm = confirmBatch.AddHubConfirm(partnerTrxId, partnerTrxDt, poNumber, vendorsInvoiceNumber);

                var packages = from p in c["Packages"]
                               select p;
                foreach (var p in packages)
                {
                    packageID = (string)p["ID"];
                    shipDate = (string)p["ShipDate"];
                    serviceLevel1 = (string)p["ServiceLevel1"];
                    trackingNumber = (string)p["TrackingNumber"];
                    weight = (string)p["Weight"];

                    newackageDetail = newHubConfirm.AddPackageDetail(packageID, shipDate, serviceLevel1, trackingNumber, weight);
                }

                var actions = from a in c["Actions"]
                              select a;
                foreach (var a in actions)
                {
                    shipment = (bool)a["Shipment"];
                    merchantLineNumber = (string)a["MerchantLineNumber"];
                    actionCode = (string)a["ActionCode"];
                    trxVendorSKU = (string)a["TrxVendorSKU"];
                    trxMerchantSKU = (string)a["TrxMerchantSKU"];
                    trxQty = (string)a["TrxQty"];

                    pkgIDs = (from i in a["PackageIDs"]
                              select (string)i).ToArray();

                    if (shipment)
                    {
                        newHubAction = newHubConfirm.AddHubActionShip(merchantLineNumber, trxVendorSKU, trxMerchantSKU, trxQty,
                            pkgIDs);
                    }
                    else
                    {
                        newHubAction = newHubConfirm.AddHubActionCancel(actionCode, merchantLineNumber, trxVendorSKU, trxMerchantSKU, trxQty);
                    }
                }

            }

            return confirmBatch;
        }
Ejemplo n.º 6
0
        public ConfirmMessageBatch CostcoMessageBatchConfirm(string fileName, IAppSettingsService appSettings)
        {
            string filePath = Path.Combine(appSettings.Costco.Dir.Decrypt.Confirms.Path, fileName);

            return(ConfirmMessageBatch.Deserialize(filePath));
        }
Ejemplo n.º 7
0
 public hubConfirm(ConfirmMessageBatch confMessageBatch)
     : this()
 {
     confirmMessageBatch = confMessageBatch;
     participatingParty  = MakeParticipatingParty();
 }