Esempio n. 1
0
        public eBayResultT InserteBayOrder(eBayOrderT ebayOrderT)
        {
            eBayResultT resultT = null;

            try
            {
                long gepOrderNo = -1;

                // 결제 대기 상품은 GEP_ORDER 에 Insert 하지 않음
                if (ebayOrderT.PaymentStatus == EBayPaymentStatusEnum.Paid)
                {
                    gepOrderNo = InsertOrderInfoToGEP(ebayOrderT);
                }

                eBayOrderInfoT ebayOrderInfoT = GeteBayOrderInfo(ebayOrderT.TransactionId, ebayOrderT.ItemId);

                if (ebayOrderInfoT != null)
                {
                    //같은 주문에 대해 다시 요청 이 온 경우
                    //주문 정보 update
                    resultT = new eBayResultT();
                    resultT.RetCode = RetCodeEnum.True;
                    resultT.RetMessage = "Update : " + ebayOrderT.ToString();

                    IMongoQuery query = Query.And(Query.EQ("Order.TransactionId", ebayOrderT.TransactionId),Query.EQ("Order.ItemId",ebayOrderT.ItemId));
                    IMongoUpdate update = Update.Set("GEPOrderNo", BsonValue.Create(gepOrderNo))
                                                .SetWrapped<eBayOrderT>("Order", ebayOrderT)
                                                .Set("UpdateDt", BsonValue.Create(DateTime.Now))
                                                .SetWrapped<eBayResultT>("ReturnMsg", resultT);

                    new eBayOrderDac().UpdateBayOrderInfo(query, update);
                }
                else
                {
                    // 신규 주문 insert
                    ebayOrderInfoT = new eBayOrderInfoT();
                    ebayOrderInfoT.GEPOrderNo = gepOrderNo;
                    ebayOrderInfoT.Order = ebayOrderT;
                    ebayOrderInfoT.Item = GetOrderdItem(ebayOrderT);
                    ebayOrderInfoT.Status = GepOrderStatus.Conclusion;
                    ebayOrderInfoT.ReturnMsg = new eBayResultT();
                    ebayOrderInfoT.CreateDt  = DateTime.Now;
                    ebayOrderInfoT.ReturnMsg.RetCode = RetCodeEnum.True;
                    ebayOrderInfoT.ReturnMsg.RetMessage = "Insert : " + ebayOrderInfoT.Order.ToString();

                    new eBayOrderDac().InserteBayOrderInfo(ebayOrderInfoT);

                    resultT = ebayOrderInfoT.ReturnMsg;
                }
            }
            catch (Exception ex)
            {
                resultT = new eBayResultT();
                resultT.RetCode = RetCodeEnum.False;
                resultT.RetMessage = "Fail : " + ex.ToString();

                throw ex;
            }
            finally
            {
                eBayHistoryT history = new eBayHistoryT();
                history.ReceiveMsg = ebayOrderT;
                history.ReturnMsg = resultT;
                history.CreateDt = DateTime.Now;

                new eBayOrderDac().InserteBayHistory(history);
            }

            return resultT;
        }
Esempio n. 2
0
 internal void InserteBayOrderInfo(eBayOrderInfoT ebayOrderInfoT)
 {
     new MongoDacHelper(GepMongoEnv.ConfigSection.GEP, GepMongoEnv.Database.GEP_EBAY, GepMongoEnv.Collection.EBAY_ORDER)
         .Insert<eBayOrderInfoT>(ebayOrderInfoT, SafeMode.True);
 }