コード例 #1
0
ファイル: eBayOrderBiz.cs プロジェクト: tomochandv/Test
        public eBayResultT insertCancel(eBayCancelT ebayCancelT)
        {
            eBayResultT resultT = null;

            try
            {
                eBayOrderInfoT ebayOrderInfoT = GeteBayOrderInfo(ebayCancelT.Order.TransactionId, ebayCancelT.Order.ItemId);

                if (ebayOrderInfoT == null)
                {
                    throw new GEPBizException(-1002, string.Format("eBay TransactionID : {0} , ItemID : {1} 주문이 없습니다.", ebayCancelT.Order.TransactionId, ebayCancelT.Order.ItemId));
                }

                eBayCancelT existCancleT = GeteBayCancelInfo(ebayCancelT.Order.TransactionId, ebayCancelT.Order.ItemId);

                if (existCancleT != null)
                {
                    // 취소/반품 진행 상태 변경
                    resultT = new eBayResultT();
                    resultT.RetCode = RetCodeEnum.True;
                    resultT.RetMessage = "Update : " + ebayCancelT.ToString();

                    IMongoQuery query = Query.And(Query.EQ("Order.TransactionId", ebayCancelT.Order.TransactionId), Query.EQ("Order.ItemId", ebayCancelT.Order.ItemId));
                    IMongoUpdate update = Update.Set("Status", BsonValue.Create(EnumHelper.GetDBCode(ebayCancelT.Status).ToString()))
                                                .Set("DisputeModifiedTime", BsonValue.Create(ebayCancelT.DisputeModifiedTime))
                                                .Set("UpdateDt", BsonValue.Create(DateTime.Now))
                                                .SetWrapped<eBayResultT>("ReturnMsg", resultT);

                    new eBayOrderDac().UpdateeBayCancel(query, update);

                    if (ebayOrderInfoT.Order.PaymentStatus == EBayPaymentStatusEnum.Paid)
                    {
                        // gep_cancle_list 취소/반품 진행 상태 변경
                        new GEPOrderBiz().UpdateGEPCancelStatus(ebayCancelT.Order.TransactionId.ToString(), ebayCancelT.Order.ItemId.ToString(), ebayCancelT.Status, ebayCancelT.DisputeModifiedTime.Value);
                    }
                }
                else
                {
                    // 취소/반품 최초 등록
                    ebayCancelT.Order = ebayOrderInfoT.Order;
                    ebayCancelT.Item = ebayOrderInfoT.Item;
                    ebayCancelT.CreateDt = DateTime.Now;

                    ebayCancelT.ReturnMsg = new eBayResultT();
                    ebayCancelT.ReturnMsg.RetCode = RetCodeEnum.True;
                    ebayCancelT.ReturnMsg.RetMessage = "Update : " + ebayCancelT.ToString();

                    resultT = ebayCancelT.ReturnMsg;

                    new eBayOrderDac().InserteBayCancel(ebayCancelT);

                    //eBay_order_list 에 취소/반품 상태 변경
                    IMongoQuery query = Query.And(Query.EQ("Order.TransactionId", ebayCancelT.Order.TransactionId), Query.EQ("Order.ItemId", ebayCancelT.Order.ItemId));
                    IMongoUpdate update = Update.Set("Status", BsonValue.Create(EnumHelper.GetDBCode(GepOrderStatus.Cancel).ToString()))
                                                .Set("UpdateDt", BsonValue.Create(DateTime.Now));

                    new eBayOrderDac().UpdateBayOrderInfo(query, update);

                    if (ebayOrderInfoT.Order.PaymentStatus == EBayPaymentStatusEnum.Paid)
                    {
                        // 결제 완료 상태일 경우
                        // GEP_ORDER에 취소/반품 상태 변경
                        new GEPOrderBiz().UpdateGEPOrderStatus(ebayCancelT.Order.TransactionId.ToString(), ebayCancelT.Order.ItemId.ToString(), GepOrderStatus.Cancel);

                        // GEP_CANCEL에 취소/반품 추가
                        GEPOrderInfoT gepOrderInfoT = new GEPOrderBiz().GetGEPOrderInfo(ebayCancelT.Order.TransactionId.ToString(), ebayCancelT.Order.ItemId.ToString());
                        GEPCancelInfoT gepCancelInfoT = new GEPCancelInfoT();
                        gepCancelInfoT.ExportSite = GetExportSiteInfo();
                        gepCancelInfoT.ExportSiteCancel = ebayCancelT;
                        gepCancelInfoT.GEPCancel = ConvertToGEPCancel(ebayCancelT);
                        gepCancelInfoT.GEPOrder = gepOrderInfoT.GEPOrder;
                        gepCancelInfoT.GEPOrderNo = gepOrderInfoT.GEPOrderNo;
                        gepCancelInfoT.GMKTOrder = gepOrderInfoT.GMKTOrder;
                        gepCancelInfoT.Item = gepOrderInfoT.Item;
                        gepCancelInfoT.TaId = gepOrderInfoT.TaId;
                        gepCancelInfoT.CreateDt = DateTime.Now;

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

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

                new eBayOrderDac().InserteBayHistory(history);
            }

            return resultT;
        }
コード例 #2
0
ファイル: GEPOrderDac.cs プロジェクト: tomochandv/Test
 internal void InsertGEPCancel(GEPCancelInfoT gepCancelInfoT)
 {
     new MongoDacHelper(GepMongoEnv.ConfigSection.GEP, GepMongoEnv.Database.GEP, GepMongoEnv.Collection.GEP_CANCEL)
         .Insert<GEPCancelInfoT>(gepCancelInfoT, SafeMode.True);
 }
コード例 #3
0
ファイル: GEPOrderBiz.cs プロジェクト: tomochandv/Test
 internal void InsertGEPCancel(GEPCancelInfoT gepCancelInfoT)
 {
     gepCancelInfoT.GEPCancelNo = GetNextGEPCancelNo();
     new GEPOrderDac().InsertGEPCancel(gepCancelInfoT);
 }