Example #1
0
        public ActionResult Order(eBayOrderSearchModel model)
        {
            // eBay Site, eBay 계정 정보 조회
            IEnumerable<SelectListItem> eBaySites = ViewBag.eBaySites = new CommonBiz().GetSecondSites("eBay");
            IEnumerable<SelectListItem> eBayAccounts = ViewBag.eBayAccounts = new CommonBiz().GetExportLoginIds(MemberContext.LoginID, "eBay");

            if (!ModelState.IsValid)
            {
                model.Initialize();

                if (eBaySites != null && eBaySites.Count() > 0)
                {
                    model.eBaySite = eBaySites.ElementAt(0).Value;
                }

                if (eBayAccounts != null && eBayAccounts.Count() > 0)
                {
                    model.sellerId = eBayAccounts.ElementAt(0).Value;
                }

                ModelState.Clear();
            }

            return View(model);
        }
Example #2
0
        public JsonResult GetOrderList(eBayOrderSearchModel model)
        {
            if (!ModelState.IsValid)
            {
                return Json(new JQGridResult { ErrorMessags = ModelState.Values.SelectMany(m => m.Errors)
                                                                               .Select(e => e.ErrorMessage)
                                                                               .ToList()});
            }

            List<BsonValue> eBayIds = new List<BsonValue>();

            if (model.sellerId == "All")
            {
                // TODO: (이태희) "eBay" 하드코딩?
                List<TaAccounts> taAccounts = new CommonBiz().GetTaeBayAccount(MemberContext.LoginID, "eBay");

                foreach (TaAccounts t in taAccounts)
                {
                    eBayIds.Add(BsonValue.Create(t.site_login_id));
                }
            }
            else
            {
                eBayIds.Add(BsonValue.Create(model.sellerId));
            }

            MongoPagingResult<EBayOrderGridT> GridData = new eBayOrderBiz().GetOrderGridData(model.Page.Value
                                                                                           , model.Rows.Value
                                                                                           , (int)model.paymentStatus.Value
                                                                                           , (int)model.dateBase.Value
                                                                                           , eBayIds
                                                                                           , Util.GetSafeInt(model.eBaySite)
                                                                                           , (int)model.searchKind.Value
                                                                                           , model.searchKey
                                                                                           , model.startDate.Value
                                                                                           , model.endDate.Value.AddDays(1));

            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);
        }