コード例 #1
0
ファイル: AmazonOrderUtil.cs プロジェクト: jmyd/oms
        public void GetOrderByFile(string fileName, Core.DoMain.SaleAccountType account)
        {
            CsvReader csv = new CsvReader(fileName, Encoding.Default);
            foreach (Dictionary<string, string> item in csv.ReadAllData())
            {
                OMS.Core.DoMain.OrderType order = Core.DoMain.OrderType.find("OrderExNo='" + item["order-id"] + "' and OrderForm='" + PlatformType.亚马逊.ToString() + "'").first();
                if (order != null)
                {
                    GetItem(item, order.Id.ToString());
                    continue;
                }
                order = new Core.DoMain.OrderType();
                order.OrderNo = OrderHelper.GetSequence();
                order.OrderExNo = item["order-id"];
                order.OrderForm = PlatformType.亚马逊.ToString();
                order.UserNameForm = account.UserName;
                order.ShippedStatus = "未发货";
                order.PayStatus = PayStatusType.已付款.ToString();
                order.OrderAmount = 0;
                order.OrderCurrencyCode = "USD";
                order.PayTime = wojilu.cvt.ToTime(item["purchase-date"]);
                order.AddTime = wojilu.cvt.ToTime(item["purchase-date"]);
                order.PayTime = wojilu.cvt.ToTime(item["purchase-date"]);
                order.PayTime = wojilu.cvt.ToTime(item["purchase-date"]);
                order.PayEmail = item["buyer-email"];
                order.PrintNum = 0;
                order.IsPrint = 0;
                order.BuyerCode = item["buyer-name"];
                order.BuyerId = OrderHelper.GetBuyer(order.BuyerCode, PlatformType.亚马逊).ToString();

                OMS.Core.DoMain.BuyerAddressType bat = new Core.DoMain.BuyerAddressType();
                bat.Street = item["ship-address-1"] + item["ship-address-2"] + item["ship-address-3"];
                bat.City = item["ship-city"];
                bat.StateOrProvince = item["ship-state"];
                bat.PostCode = item["ship-postal-code"];
                bat.Country = item["ship-country"];
                bat.CountryCode = item["ship-country"];
                bat.Email = item["buyer-email"];
                bat.Phone = item["buyer-phone-number"];
                bat.ContactMan = item["recipient-name"];
                bat.BuyerCode = order.BuyerCode;
                bat.BuyerId = order.BuyerId;
                OMS.Core.DoMain.BuyerAddressType bat2 = OMS.Core.DoMain.BuyerAddressType.find("ContactMan=:p1 and Street=:p2").set("p1", bat.ContactMan).set("p2", bat.Street).first();
                if (bat2 != null)
                {
                    order.AddressId = bat2.Id.ToString();
                }
                else
                {
                    bat.insert();
                    order.AddressId = bat.Id.ToString();
                }

                GetItem(item, order.Id.ToString());

            }
        }
コード例 #2
0
ファイル: EbayOrderUtil.cs プロジェクト: mccj/FOMS
        private void GetPaypalAddress(OMS.Core.DoMain.OrderType order)
        {
            if (string.IsNullOrEmpty(order.TxnId))
                return;
            foreach (IAPIProfile item in paypals)
            {
                //获得paypal地址
                com.paypal.soap.api.GetTransactionDetailsResponseType transactionDetails = AppSettingHelper.GetTransactionDetails(order.TxnId, item);
                if (transactionDetails.Ack == com.paypal.soap.api.AckCodeType.Success || transactionDetails.Ack == com.paypal.soap.api.AckCodeType.SuccessWithWarning)
                {
                    OMS.Core.DoMain.BuyerAddressType bat = new Core.DoMain.BuyerAddressType();
                    bat.Street = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.Street1 + " " + transactionDetails.PaymentTransactionDetails.PayerInfo.Address.Street2;
                    bat.City = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.CityName;
                    bat.StateOrProvince = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.StateOrProvince;
                    bat.CountryCode = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.Country.ToString();
                    bat.Country = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.CountryName;
                    bat.PostCode = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.PostalCode;
                    bat.ContactMan = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.Name;
                    bat.Email = transactionDetails.PaymentTransactionDetails.PayerInfo.Payer;
                    bat.Phone = transactionDetails.PaymentTransactionDetails.PayerInfo.ContactPhone;
                    order.PayEmail = transactionDetails.PaymentTransactionDetails.ReceiverInfo.Business;
                    order.OrderPayTax = Convert.ToDouble(transactionDetails.PaymentTransactionDetails.PaymentInfo.FeeAmount.Value);
                    order.PayCurrencyCode = transactionDetails.PaymentTransactionDetails.PaymentInfo.FeeAmount.currencyID.ToString();
                    bat.BuyerCode = order.BuyerCode;
                    bat.BuyerId = order.BuyerId;
                    order.Description = transactionDetails.PaymentTransactionDetails.PayerInfo.Address.CountryName;
                    //判断该地址是否保存在数据库中.
                    OMS.Core.DoMain.BuyerAddressType bat2 = OMS.Core.DoMain.BuyerAddressType.find("ContactMan=:p1 and Street=:p2").set("p1", bat.ContactMan).set("p2", bat.Street).first();
                    if (bat2 != null)
                    {
                        order.AddressId = bat2.Id.ToString();
                    }
                    else
                    {
                        bat.insert();
                        order.AddressId = bat.Id.ToString();
                    }

                    break;
                }
            }
        }