示例#1
0
        public void GetGmktDisableOrderCount()
        {
            string taId = "th3141";
            long cnt = new GEPOrderBiz().GetGmktDisableOrderCount(taId, 7);

            System.Console.WriteLine(string.Format("G마켓 주문불가상품 건수 : {0} 건", cnt));
        }
示例#2
0
        public JsonResult GetOrderList(GEPOrderSearchModel model)
        {
            if (!ModelState.IsValid)
            {
                return Json(new JQGridResult
                {
                    ErrorMessags = ModelState.Values.SelectMany(m => m.Errors)
                                                    .Select(e => e.ErrorMessage)
                                                    .ToList()
                });
            }

            MongoPagingResult<GEPOrderGridT> GridData = new GEPOrderBiz().GetGEPOrderGridData(model.Page.Value
                                                                                        , model.Rows.Value
                                                                                        , (int)model.paymentStatus
                                                                                        , (int)model.dateBase
                                                                                        , Util.GetSafeInt(model.site)
                                                                                        , (int)model.searchKind
                                                                                        , model.searchKey
                                                                                        , model.startDate.Value
                                                                                        , model.endDate.Value.AddDays(1)
                                                                                        , MemberContext.LoginID);

            JQGridResult result = new JQGridResult();
            result.total = Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(GridData.Count) / 10));
            result.page = model.Page.Value;
            result.rows = GridData.Result.ToArray();
            result.Count = GridData.Count;

            return Json(result);
        }
示例#3
0
        public void GetDisableOrders(string startDtStr, string endDtStr)
        {
            DateTime startDt = DateTime.Parse(startDtStr);
            DateTime endDt = DateTime.Parse(endDtStr);

            MongoPagingResult<GEPDisableOrderGridT> result = new GEPOrderBiz().GetDisableOrderGridData(1, 20, 0, "", startDt, endDt, "ebaykorea_ta");

            foreach (GEPDisableOrderGridT order in result.Result)
            {
                System.Console.WriteLine(order.GEPOrderNo);
            }
        }
示例#4
0
        public void InsertDisableOrders(string startDtStr, string endDtStr)
        {
            DateTime startDt = DateTime.Parse(startDtStr);
            DateTime endDt = DateTime.Parse(endDtStr);
            int page = 1;
            int rows = 100;

            MongoPagingResult<GEPOrderGridT> result = new GEPOrderBiz().GetGEPOrderGridData(page, rows, 0, 0, 0, 0, "", startDt, endDt, "ebaykorea_ta");

            for (int i = 1; i < result.Result.Count(); i += 5)
            {
                new GEPOrderBiz().InsertDisableOrder(result.Result.ElementAt(i).GEPOrderNo);
            }
        }
示例#5
0
        public void GetGEPOrderList(string startDtStr, string endDtStr)
        {
            DateTime startDt = DateTime.Parse(startDtStr);
            DateTime endDt = DateTime.Parse(endDtStr);
            int page = 1;
            int rows = 20;

            MongoPagingResult<GEPOrderGridT> result = new GEPOrderBiz().GetGEPOrderGridData(page, rows, 0, 0, 0, 0, "", startDt, endDt, "ebaykorea_ta");

            foreach (GEPOrderGridT order in result.Result)
            {
                System.Console.WriteLine(order.GEPOrderNo);
            }
        }
        public JsonResult AddToGmarketCart(BasketInputParamT reqBasketInputParam)
        {
            CartBiz cartBiz = new CartBiz();
            GEPOrderBiz gepBiz = new GEPOrderBiz();
            List<BasketInputParamT> basketInputParamList = new List<BasketInputParamT>();
            GmarketBasketAddResultT gmktBasketInputResult = new GmarketBasketAddResultT();
            gmktBasketInputResult.Result = new GEPBaseResultT();

            string optNos = string.Empty;
            long gepOrderNo = 0;

            BasketInputParamT basketInputParam = new BasketInputParamT();
            basketInputParam.CustNo = MemberContext.CustomerNo;
            basketInputParam.LoginID = MemberContext.LoginID;
            basketInputParam.ItemNo = reqBasketInputParam.ItemNo;
            basketInputParam.OrderCount = reqBasketInputParam.OrderCount;
            optNos = GetOptNo(reqBasketInputParam.ItemNo);
            basketInputParam.OptNos = optNos;
            basketInputParam.GEPOrderNo = reqBasketInputParam.GEPOrderNo;
            basketInputParam.InputWay = reqBasketInputParam.InputWay;

            basketInputParamList.Add(basketInputParam);

            gmktBasketInputResult = cartBiz.BasketInput(basketInputParamList);

            if (gmktBasketInputResult.Result.RetCode == 0)
            {
                if(long.TryParse(reqBasketInputParam.GEPOrderNo, out gepOrderNo))
                {
                    gepBiz.AddInCartFromDisableOrder(gepOrderNo);
                }
            }
            return new JsonResult
            {
                Data = new { Result = gmktBasketInputResult.Result, Data = gmktBasketInputResult.AddResultList }
            };
        }
示例#7
0
        //ASP 장바구니에서 주문 불가로 삭제하는 건들을 주문 불가 리스트에 넣기
        public GEPBaseResultT insertCartDisableOrder(string gdNos, string gdSelNos, string pId)
        {
            GEPBaseResultT disableOrderResult = new GEPBaseResultT();
            DisOrderGepOrderNoT disOrderGepOrderNo = new DisOrderGepOrderNoT();
            GEPOrderBiz gepBiz = new GEPOrderBiz();

            string[] itemNoArray = gdNos.Split('|');
            string[] gdSelNoArray = gdSelNos.Split('|');
            long gepOrderNo;
            int errCnt = 0;

            for (int i = 0, cnt = itemNoArray.Length; i < cnt; i++)
            {
                if (itemNoArray[i] != string.Empty)
                {
                    disOrderGepOrderNo = GetDisOrderGepOrderNo(pId, itemNoArray[i], gdSelNoArray[i]);
                    if (disOrderGepOrderNo != null)
                    {
                        gepOrderNo = disOrderGepOrderNo.GepOrderNo;
                        try
                        {
                            gepBiz.InsertDisableOrder(gepOrderNo);
                        }
                        catch (Exception e)
                        {
                        }
                    }
                    else
                    {
                        errCnt += 1;
                    }
                }
            }

            if (errCnt > 0)
            {
                disableOrderResult.RetCode = -1;
                disableOrderResult.RetMessage = "주문 불가 리스트 넣기 오류";
            }
            else
            {
                disableOrderResult.RetCode = 0;
                disableOrderResult.RetMessage = "주문 불가 리스트 넣기 성공";
            }
            return disableOrderResult;
        }
示例#8
0
        //장바구니 넣기 진입점 - 리스트로 파라미터 값들이 바로 넘어 왔을 때
        public GmarketBasketAddResultT BasketInput(List<BasketInputParamT> lstBasketInputParam)
        {
            GEPOrderBiz gepBiz = new GEPOrderBiz();
            BasketParamT basketParam = new BasketParamT();
            AvailableBasketInfoResultT availableBasketInfoResult = new AvailableBasketInfoResultT();
            GmarketBasketAddResultT gmktBasketInputResult = new GmarketBasketAddResultT();
            gmktBasketInputResult.Result = new GEPBaseResultT();
            GEPBaseResultT insertDBResult = new GEPBaseResultT();
            List<BasketGepOrderNoT> basketGepOrderNos = new List<BasketGepOrderNoT>();
            BasketCurrCountT basketCurrentCnt = new BasketCurrCountT();

            long conGepOrderNo;
            int inputErrorCnt = 0, orderImpossCnt = 0;
            string basketPid = CheckBasketPid(lstBasketInputParam[0].CustNo);
            int lstBasketInputParamCnt = lstBasketInputParam.Count;

            //상품은 100개 까지만 담을 수 있다.
            if (basketPid != string.Empty)
            {
                basketCurrentCnt = GetBasketCurrentCount(basketPid);
                int cartCnt = basketCurrentCnt.NationalCnt;

                if ((cartCnt + lstBasketInputParamCnt) > 100)
                {
                    gmktBasketInputResult.Result.RetCode = -10;
                    gmktBasketInputResult.Result.RetMessage = "현재 장바구니에 " + cartCnt + "건의 주문건이 있습니다.";

                    return gmktBasketInputResult;
                }
            }

            //주문 불가 상품(-970에러)인지 체크
            if (lstBasketInputParam[0].InputWay == "C")
            {
                for (int i = 0; i < lstBasketInputParamCnt; i++)
                {
                    GEPOrderInfoT gepOrderInfo = new GEPOrderInfoT();
                    GmarketBasketAddT checkOrderStatusRtn = new GmarketBasketAddT();
                    if (long.TryParse(lstBasketInputParam[i].GEPOrderNo, out conGepOrderNo))
                    {
                        gepOrderInfo = GetGEPOrderInfo(conGepOrderNo);
                    }
                    if (gepOrderInfo != null)
                    {
                        if (gepOrderInfo.GEPOrder.Status == GepOrderStatus.Conclusion && (gepOrderInfo.GMKTOrder.OrderStatus == GmktOrderStatus.None || gepOrderInfo.GMKTOrder.OrderStatus == GmktOrderStatus.ConclusionFail))
                        {
                            checkOrderStatusRtn.GepOrderNo = lstBasketInputParam[i].GEPOrderNo;
                            checkOrderStatusRtn.RetCode = "0";
                            checkOrderStatusRtn.RetMessage = "주문 가능 상태 체크 성공";
                        }
                        else
                        {
                            orderImpossCnt += 1;
                            checkOrderStatusRtn.GepOrderNo = lstBasketInputParam[i].GEPOrderNo;
                            checkOrderStatusRtn.RetCode = "970";
                            checkOrderStatusRtn.RetMessage = "상품이 주문 가능 상태가 아닙니다.";
                        }
                        gmktBasketInputResult.AddResultList.Add(checkOrderStatusRtn);
                    }
                }
                if (orderImpossCnt > 0)
                {
                    gmktBasketInputResult.Result.RetCode = -1;
                    gmktBasketInputResult.Result.RetMessage = "장바구니담기 실패";

                    return gmktBasketInputResult;
                }
                else
                {
                    gmktBasketInputResult.AddResultList.Clear();
                }
            }

            //장바구니 중복 담긴 상품인지 체크
            if (basketPid != string.Empty)
            {
                int duplicaBasketCnt = 0;
                basketGepOrderNos = GetBasketGepOrderNo(basketPid);
                for (int i = 0; i < lstBasketInputParamCnt; i++)
                {
                    GmarketBasketAddT checkDuplicaRtn = new GmarketBasketAddT();

                    BasketGepOrderNoT result = basketGepOrderNos.Find(
                        delegate(BasketGepOrderNoT gepOrderNo)
                        {
                            return gepOrderNo.GepOrderNo.ToString() == lstBasketInputParam[i].GEPOrderNo;
                        }
                    );
                    if (result != null)
                    {
                        duplicaBasketCnt += 1;
                        checkDuplicaRtn.GepOrderNo = lstBasketInputParam[i].GEPOrderNo;
                        checkDuplicaRtn.RetCode = "1001";
                        checkDuplicaRtn.RetMessage = "이미 장바구니에 담긴 상품이 있습니다.";
                    }
                    else
                    {
                        checkDuplicaRtn.GepOrderNo = lstBasketInputParam[i].GEPOrderNo;
                        checkDuplicaRtn.RetCode = "0";
                        checkDuplicaRtn.RetMessage = "중복 체크 성공";
                    }
                    gmktBasketInputResult.AddResultList.Add(checkDuplicaRtn);
                }

                if (duplicaBasketCnt > 0)
                {
                    gmktBasketInputResult.Result.RetCode = -1;
                    gmktBasketInputResult.Result.RetMessage = "장바구니담기 실패";

                    return gmktBasketInputResult;
                }
                else
                {
                    gmktBasketInputResult.AddResultList.Clear();
                }
            }

            if (lstBasketInputParam.Count > 0)
            {
                for (int itemIdx = 0; itemIdx < lstBasketInputParamCnt; itemIdx++)
                {
                    availableBasketInfoResult.Result = new GEPBaseResultT();
                    GmarketBasketAddT checkInsertableInfo = new GmarketBasketAddT();
                    basketParam = MakeBasketParam(lstBasketInputParam[itemIdx]);
                    availableBasketInfoResult = InsertableBasketInfo(basketParam);

                    checkInsertableInfo.GepOrderNo = lstBasketInputParam[itemIdx].GEPOrderNo;
                    checkInsertableInfo.RetCode = availableBasketInfoResult.Result.RetCode.ToString();
                    checkInsertableInfo.RetMessage = availableBasketInfoResult.Result.RetMessage;

                    gmktBasketInputResult.AddResultList.Add(checkInsertableInfo);

                    if (availableBasketInfoResult.Result.RetCode != 0)
                    {
                        inputErrorCnt += 1;
                        gmktBasketInputResult.Result.RetCode = -1;
                        gmktBasketInputResult.Result.RetMessage = "장바구니담기 실패";

                        if (long.TryParse(lstBasketInputParam[itemIdx].GEPOrderNo, out conGepOrderNo))
                        {
                            try
                            {
                                gepBiz.InsertDisableOrder(conGepOrderNo);
                            }
                            catch (Exception e)
                            {
                            }
                        }
                    }
                }

                if (inputErrorCnt == 0)
                {
                    gmktBasketInputResult.AddResultList.Clear();
                    for (int itemIdx = 0; itemIdx < lstBasketInputParamCnt; itemIdx++)
                    {
                        GmarketBasketAddT gmktBasketRtn = new GmarketBasketAddT();
                        basketParam = MakeBasketParam(lstBasketInputParam[itemIdx]);
                        insertDBResult = BasketInput(basketParam);

                        gmktBasketRtn.GepOrderNo = basketParam.GEPOrderNo;
                        gmktBasketRtn.RetCode = insertDBResult.RetCode.ToString();
                        gmktBasketRtn.RetMessage = insertDBResult.RetMessage;

                        if (gmktBasketRtn.RetCode != "0")
                        {
                            if (long.TryParse(lstBasketInputParam[itemIdx].GEPOrderNo, out conGepOrderNo))
                            {
                                try
                                {
                                    gepBiz.InsertDisableOrder(conGepOrderNo);
                                }
                                catch (Exception e)
                                {
                                }
                            }
                        }

                        gmktBasketInputResult.AddResultList.Add(gmktBasketRtn);
                    }
                }
            }
            return gmktBasketInputResult;
        }