/// <summary>
        /// GEP코드 생성내역 데이터
        /// </summary>
        public JsonResult GetGepOptionHistoryData(string itemNo)
        {
            int page_no = int.Parse(Request.Form["page"]);
            int page_size = int.Parse(Request.Form["rows"]);

            MongoPagingResult<GepItemsData> list = new GmarketItemBiz().GetGEPItemOptionHistory(itemNo, page_no, page_size);

            var result = new
            {
                total = Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(list.Count) / page_size)),
                page = page_no,
                rows = (from e in list.Result
                        select new
                        {
                            GepId = e._id.ToString(),
                            SelectionName = Util.GetSafeString(e.src_info.sel_name),
                            SelectionStockQty = Util.GetSafeString(e.src_info.sel_qty),
                            SelectionPrice = Util.GetSafeString(e.src_info.sel_price),
                            TotalPrice = Util.GetSafeString(e.src_info.price + Util.GetSafeInt(e.src_info.sel_price)),
                            GepInsertDate = e.rdate.ToString(),
                            GepInsertTA = e.ta,
                            OptNo = e.src_info.sel_no == null ? "" : GmktUtil.GetOptionNoString(e.src_info.sel_no.RawValues, "_")

                        }).ToArray()
            };

            return Json(result);
        }
Exemple #2
0
        /// <summary>
        /// 필수선택 임시저장
        /// </summary>
        public void SetTempGEPItems(List<GepItemsData> selections, string ta_id)
        {
            List<GepItemsData> resultGEPItems = new List<GepItemsData>(); // 최종저장할 GepItemsData

            foreach (GepItemsData sel in selections)
            {
                if (sel.src_info.sel_qty <= 0) continue; // 품절일 때 선택저장불가

                string gd_no = sel.src_info.no;
                string gd_img = sel.img;

                // 필터링으로부터 상품만들기
                SourceItemInfoT info = new GmarketItemBiz().GetSourceItem(ta_id, gd_no);
                string Desc = new GmarketItemBiz().GetSourceItemDescription(gd_no);

                // 본 상품이 해외배송 불가, 판매자 미동의 상품인 경우 선택저장불가
                if (info.OverseasDeliveryYn.ToUpper() == "N" || info.AgreeYn.ToUpper() == "N") continue;

                // eBay VeRO 체크 - 한 상품에 대한 임시저장이므로 첫번째 항목에서 걸리면 전체를 중지하고 throw하면 된다.
                string matchKeyword = null;
                bool isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.Name, out matchKeyword);
                if (isLimit == true)
                {
                    throw new ValidationException("상품명에 입력된 [" + matchKeyword + "] 단어는 eBay VeRO 정책에 적합하지 않습니다. 작업을 중지합니다.");
                }
                if (string.IsNullOrWhiteSpace(info.EngName) == false)
                {
                    isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.EngName, out matchKeyword);
                    if (isLimit == true)
                    {
                        throw new ValidationException("영문상품명에 입력된 [" + matchKeyword + "] 단어는 eBay VeRO 정책에 적합하지 않습니다. 작업을 중지합니다.");
                    }
                }

                GepItemsData resultGEPItem = new GepItemsData();
                resultGEPItem._id = GetNextGEPItemID();
                resultGEPItem.stat = "S1"; // resultGEPItemStatusEnum.StanBy;
                resultGEPItem.img = gd_img;
                resultGEPItem.src_site = "GMKT";
                resultGEPItem.src_info = new src_info();
                resultGEPItem.src_info.no = gd_no;
                resultGEPItem.src_info.name = info.Name;
                resultGEPItem.src_info.eng_name = info.EngName;
                resultGEPItem.src_info.seller = new seller();
                resultGEPItem.src_info.seller.no = info.SellerNo;
                resultGEPItem.src_info.seller.sid = info.SellerID;
                resultGEPItem.src_info.seller.name = info.SellerName;
                resultGEPItem.src_info.seller.tel = info.SellerTel;
                resultGEPItem.src_info.seller.cell = info.SellerCell;
                resultGEPItem.src_info.seller.email = info.SellerEmail;
                resultGEPItem.src_info.lcategory = new lcategory();
                resultGEPItem.src_info.lcategory.cid = info.LCategoryCode;
                resultGEPItem.src_info.lcategory.name = info.LCategoryName;
                resultGEPItem.src_info.mcategory = new mcategory();
                resultGEPItem.src_info.mcategory.cid = info.MCategoryCode;
                resultGEPItem.src_info.mcategory.name = info.MCategoryName;
                resultGEPItem.src_info.scategory = new scategory();
                resultGEPItem.src_info.scategory.cid = info.SCategoryCode;
                resultGEPItem.src_info.scategory.name = info.SCategoryName;
                resultGEPItem.src_info.desc = Desc;
                resultGEPItem.src_info.price = Util.GetSafeInt(info.SellPrice);
                resultGEPItem.src_info.settle_price = Util.GetSafeInt(info.CostPrice);
                resultGEPItem.src_info.qty = info.StockQty;
                resultGEPItem.src_info.weight = Util.GetSafeInt(info.Weight);
                resultGEPItem.src_info.dc = Util.GetSafeInt(info.SellerDiscountPrice);
                resultGEPItem.src_info.origin = info.Origin;
                resultGEPItem.src_info.dlv = new dlv();
                resultGEPItem.src_info.dlv.dlv_gr_no = info.DeliveryGroupNo;
                resultGEPItem.src_info.dlv.dlv_gr_nm = info.DeliveryGroupName;
                resultGEPItem.src_info.dlv.bs_money = Util.GetSafeInt(info.BasisMoney);
                resultGEPItem.src_info.dlv.dlv_fee = Util.GetSafeInt(info.DeliveryFee);
                resultGEPItem.src_info.dlv.who_fee = info.WhoFee;
                resultGEPItem.src_info.dlv.bs_weight = Util.GetSafeInt(info.BasisWeight);
                resultGEPItem.src_info.dlv.bs_amt = Util.GetSafeInt(info.BasisAmount);
                resultGEPItem.src_info.dlv.bs_type = info.BasisType;
                resultGEPItem.src_info.dlv.dlv_fee_yn = info.DeliveryFeeYn;
                resultGEPItem.src_info.dlv.dlv_fee_cond = info.DeliveryFeeCondition;
                // 필수선택 정보 들어감
                resultGEPItem.src_info.sel_no = sel.src_info.sel_no;
                resultGEPItem.src_info.sel_name = sel.src_info.sel_name;
                resultGEPItem.src_info.sel_price = sel.src_info.sel_price;
                resultGEPItem.src_info.sel_qty = sel.src_info.sel_qty;
                // 필수선택 정보 들어감
                resultGEPItem.src_info.overseas_sold_cnt = info.OverseasSoldCount;
                resultGEPItem.src_info.total_price = Util.GetSafeInt(info.SellPrice + info.DeliveryFee - info.SellerDiscountPrice);
                resultGEPItem.ver_code = "";
                resultGEPItem.trans = new List<trans>();
                resultGEPItem.is_exp = false;
                resultGEPItem.rdate = DateTime.Now;
                resultGEPItem.udate = DateTime.Now;
                resultGEPItem.ta = ta_id;
                resultGEPItem.total_exp_count = 0;
                resultGEPItem.latest_exp_date = DateTime.Now;
                resultGEPItem.exp_ta = "";

                resultGEPItems.Add(resultGEPItem);
            }

            // Batch Insert (임시저장은 히스토리를 남기지 않음)
            new GmarketItemDac().InsertGEPItem(resultGEPItems);
        }
Exemple #3
0
        /// <summary>
        /// GEP로 소스상품 이관 
        /// </summary>
        public string SetGEPItems(List<GepItemsData> reqMotherItems, string ta_id)
        {
            List<string> sMsg = new List<string>(); // 생성완료 건 안내
            string fMsg = ""; // 실패 건 안내

            List<GepItemsData> resultGEPItems = new List<GepItemsData>(); // 최종저장할 GepItemsData

            // 넘어온 reqMotherItems에는 소스상품번호(src_info.no)와 이미지(img)만 값이 들어있다.
            foreach (GepItemsData motherItem in reqMotherItems)
            {
                string gd_no = motherItem.src_info.no;
                string gd_img = motherItem.img;

                // 임시저장된 필수선택 리스트(TempGEPItem)를 가져온다.
                List<GepItemsData> tmpGEPItems = new GmarketItemBiz().GetTempGEPItemList(ta_id, gd_no);

                if (tmpGEPItems != null && tmpGEPItems.Count > 0)
                {
                    foreach (GepItemsData t in tmpGEPItems)
                    {
                        t.stat = "S2";
                        new GmarketItemDac().UpdateGEPItem(t); // 상태만 S1 -> S2 바로 업데이트
                        // History
                        string sel = GmktUtil.GetOptionNoString(t.src_info.sel_no.RawValues);
                        new GmarketItemDac().SetSourceItemHistory(ta_id, gd_no, t._id, sel, t.src_info.sel_name, t.src_info.sel_price, t.src_info.sel_qty);
                    }

                    sMsg.Add(gd_no);
                }
                else
                {
                    // 필수선택이 없는 소스상품은 Insert를 위해 필터링 DB에서 나머지를 채운다.
                    SourceItemInfoT info = new GmarketItemBiz().GetSourceItem(ta_id, gd_no);
                    string Desc = new GmarketItemBiz().GetSourceItemDescription(gd_no);

                    // 본 상품이 해외배송 불가, 판매자 미동의 상품인 경우 선택저장불가
                    if (info.OverseasDeliveryYn.ToUpper() == "N" || info.AgreeYn.ToUpper() == "N")
                    {
                        if (fMsg == "") fMsg += gd_no;
                        else fMsg += ", " + gd_no;
                        continue;
                    }

                    // eBay VeRO 체크
                    string matchKeyword = null;
                    bool isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.Name, out matchKeyword);
                    if (isLimit == true)
                    {
                        if (fMsg == "") fMsg += gd_no;
                        else fMsg += ", " + gd_no;
                        continue;
                    }
                    if (string.IsNullOrWhiteSpace(info.EngName) == false)
                    {
                        isLimit = new eBayItemBiz().ContainseBayVeroKeyword(info.EngName, out matchKeyword);
                        if (isLimit == true)
                        {
                            if (fMsg == "") fMsg += gd_no;
                            else fMsg += ", " + gd_no;
                            continue;
                        }
                    }

                    GepItemsData resultGEPItem = new GepItemsData();
                    resultGEPItem._id = GetNextGEPItemID();
                    resultGEPItem.stat = "S2"; // resultGEPItemStatusEnum.Active;
                    resultGEPItem.img = gd_img;
                    resultGEPItem.src_site = "GMKT";
                    resultGEPItem.src_info = new src_info();
                    resultGEPItem.src_info.no = gd_no;
                    resultGEPItem.src_info.name = info.Name;
                    resultGEPItem.src_info.eng_name = info.EngName;
                    resultGEPItem.src_info.seller = new seller();
                    resultGEPItem.src_info.seller.no = info.SellerNo;
                    resultGEPItem.src_info.seller.sid = info.SellerID;
                    resultGEPItem.src_info.seller.name = info.SellerName;
                    resultGEPItem.src_info.seller.tel = info.SellerTel;
                    resultGEPItem.src_info.seller.cell = info.SellerCell;
                    resultGEPItem.src_info.seller.email = info.SellerEmail;
                    resultGEPItem.src_info.lcategory = new lcategory();
                    resultGEPItem.src_info.lcategory.cid = info.LCategoryCode;
                    resultGEPItem.src_info.lcategory.name = info.LCategoryName;
                    resultGEPItem.src_info.mcategory = new mcategory();
                    resultGEPItem.src_info.mcategory.cid = info.MCategoryCode;
                    resultGEPItem.src_info.mcategory.name = info.MCategoryName;
                    resultGEPItem.src_info.scategory = new scategory();
                    resultGEPItem.src_info.scategory.cid = info.SCategoryCode;
                    resultGEPItem.src_info.scategory.name = info.SCategoryName;
                    resultGEPItem.src_info.desc = Desc;
                    resultGEPItem.src_info.price = Util.GetSafeInt(info.SellPrice);
                    resultGEPItem.src_info.settle_price = Util.GetSafeInt(info.CostPrice);
                    resultGEPItem.src_info.qty = info.StockQty;
                    resultGEPItem.src_info.weight = Util.GetSafeInt(info.Weight);
                    resultGEPItem.src_info.dc = Util.GetSafeInt(info.SellerDiscountPrice);
                    resultGEPItem.src_info.origin = info.Origin;
                    resultGEPItem.src_info.dlv = new dlv();
                    resultGEPItem.src_info.dlv.dlv_gr_no = info.DeliveryGroupNo;
                    resultGEPItem.src_info.dlv.dlv_gr_nm = info.DeliveryGroupName;
                    resultGEPItem.src_info.dlv.bs_money = Util.GetSafeInt(info.BasisMoney);
                    resultGEPItem.src_info.dlv.dlv_fee = Util.GetSafeInt(info.DeliveryFee);
                    resultGEPItem.src_info.dlv.who_fee = info.WhoFee;
                    resultGEPItem.src_info.dlv.bs_weight = Util.GetSafeInt(info.BasisWeight);
                    resultGEPItem.src_info.dlv.bs_amt = Util.GetSafeInt(info.BasisAmount);
                    resultGEPItem.src_info.dlv.bs_type = info.BasisType;
                    resultGEPItem.src_info.dlv.dlv_fee_yn = info.DeliveryFeeYn;
                    resultGEPItem.src_info.dlv.dlv_fee_cond = info.DeliveryFeeCondition;
                    //resultGEPItem.src_info.sel_no
                    //resultGEPItem.src_info.sel_name
                    //resultGEPItem.src_info.sel_price
                    //resultGEPItem.src_info.sel_qty
                    resultGEPItem.src_info.overseas_sold_cnt = info.OverseasSoldCount;
                    resultGEPItem.src_info.total_price = Util.GetSafeInt(info.SellPrice + info.DeliveryFee - info.SellerDiscountPrice);
                    resultGEPItem.ver_code = "";
                    resultGEPItem.trans = new List<trans>();
                    resultGEPItem.is_exp = false;
                    resultGEPItem.rdate = DateTime.Now;
                    resultGEPItem.udate = DateTime.Now;
                    resultGEPItem.ta = ta_id;
                    resultGEPItem.total_exp_count = 0;
                    resultGEPItem.latest_exp_date = DateTime.Now;
                    resultGEPItem.exp_ta = "";

                    resultGEPItems.Add(resultGEPItem);
                }
            }

            // Batch Insert
            if (resultGEPItems.Count > 0)
            {
                new GmarketItemDac().InsertGEPItem(resultGEPItems);

                // 이관 History (Batch Insert한 건들은 필수선택이 없으므로 opt_no는 빈 값으로 넘김
                foreach (GepItemsData i in resultGEPItems)
                {
                    new GmarketItemDac().SetSourceItemHistory(ta_id, i.src_info.no, i._id, "", "", 0, 0);
                }
            }

            string resultMsg = "[작업완료]";
            if (sMsg.Count > 0)
            {
                resultMsg += "\n성공 : " + sMsg[0] + " 외 " + sMsg.Count + "건";
            }
            if (fMsg != "")
            {
                resultMsg += "\n실패 : " + fMsg;
            }

            return resultMsg;
        }
Exemple #4
0
        /// <summary>
        /// G마켓 상품 필수선택 정보 및 상세리스트 UI에 적합하게 조회
        /// </summary>
        public List<TempGepItemData> GetSourceItemOptionList(string gd_no, int stock_qty)
        {
            List<TempGepItemData> selections = new List<TempGepItemData>();

            SourceItemOptionInfoT info = new GmarketItemBiz().GetSourceItemOptionInfo(gd_no);
            if (info == null || info.SelectionInfoList == null || info.SelectionInfoList.Count == 0) return selections;

            if (info.DisplayType == "S")
            {
                List<SourceItemOptionRecordT> orgList = info.SelectionInfoList; // 순수하게 DB에서 가져온 원본리스트

                string[] nameArray = orgList.Select(t => t.Name).Distinct().ToArray(); // Name 추출
                List<List<SourceItemOptionRecordT>> selByName = new List<List<SourceItemOptionRecordT>>();
                int i = 0;

                // 각 Name에 대한 하위 값들을 추출
                foreach (string n in nameArray)
                {
                    var tmp = orgList.Where(t => t.Name == n).Select(t => new { OptionNo = t.OptionNo, Value = t.Value, Price = t.Price, Cnt = t.Cnt, Stat = t.Stat }).ToList();
                    List<SourceItemOptionRecordT> tmpList = new List<SourceItemOptionRecordT>();

                    foreach (var record in tmp)
                    {
                        SourceItemOptionRecordT s = new SourceItemOptionRecordT();
                        s.OptionNo = record.OptionNo;
                        s.Value = record.Value;
                        s.Price = record.Price;
                        s.Cnt = record.Cnt;
                        s.Stat = record.Stat == null ? "Y" : record.Stat;
                        tmpList.Add(s);
                    }

                    selByName.Add(tmpList);
                    i++;
                }

                // 조합형 데이터 생성
                for (int n = 0; n < selByName[0].Count; n++) // 첫번째 항목에 대한 리스트
                {
                    TempGepItemData sel = new TempGepItemData();
                    sel.sel_name = selByName[0][n].Value;
                    sel.sel_qty = info.IsSelectionInventory == false ? (Util.GetSafeString(selByName[0][n].Stat) == "N" ? 0 : stock_qty) : Util.GetSafeInt(selByName[0][n].Cnt);
                    sel.sel_price = Util.GetSafeInt(selByName[0][n].Price);
                    sel.sel_no = new BsonArray();
                    sel.sel_no.Add(selByName[0][n].OptionNo);

                    selections.Add(sel);
                }

                int mngCnt = 1;

                while (selByName.Count > mngCnt) // N번째 항목이 있다면
                {
                    List<TempGepItemData> tmpList = new List<TempGepItemData>();

                    for (int n = 0; n < selByName[mngCnt].Count; n++) // N번째 항목에 대한 리스트
                    {
                        TempGepItemData sel = new TempGepItemData();
                        sel.sel_name = selByName[mngCnt][n].Value;
                        sel.sel_qty = info.IsSelectionInventory == false ? (Util.GetSafeString(selByName[mngCnt][n].Stat) == "N" ? 0 : stock_qty) : Util.GetSafeInt(selByName[mngCnt][n].Cnt);
                        sel.sel_price = Util.GetSafeInt(selByName[mngCnt][n].Price);
                        sel.sel_no = new BsonArray();
                        sel.sel_no.Add(selByName[mngCnt][n].OptionNo);

                        for (int m = 0; m < selections.Count; m++)
                        {
                            TempGepItemData com = new TempGepItemData();
                            com.sel_name = selections[m].sel_name + " : " + sel.sel_name;
                            com.sel_qty = sel.sel_qty < selections[m].sel_qty ? sel.sel_qty : selections[m].sel_qty;
                            com.sel_price = selections[m].sel_price + sel.sel_price;
                            com.sel_no = new BsonArray();
                            com.sel_no.Add(selections[m].sel_no[0]);
                            if (mngCnt == 1) com.sel_no.Add(sel.sel_no[0]);
                            else if (mngCnt > 1) com.sel_no.Add(selections[m].sel_no[1]);
                            if (mngCnt == 2) com.sel_no.Add(sel.sel_no[0]);
                            else if (mngCnt > 2) com.sel_no.Add(selections[m].sel_no[2]);
                            if (mngCnt == 3) com.sel_no.Add(sel.sel_no[0]);
                            else if (mngCnt > 3) com.sel_no.Add(selections[m].sel_no[3]);
                            if (mngCnt == 4) com.sel_no.Add(sel.sel_no[0]);
                            else if (mngCnt > 4) com.sel_no.Add(selections[m].sel_no[4]);

                            tmpList.Add(com);
                        }
                    }

                    selections = tmpList;

                    mngCnt++;
                }
            }
            else
            {
                foreach (SourceItemOptionRecordT row in info.SelectionInfoList)
                {
                    TempGepItemData sel = new TempGepItemData();
                    sel.sel_name = row.Name + " : " + row.Value;
                    sel.sel_qty = info.IsSelectionInventory == false ? ((row.Stat != null && row.Stat == "N") ? 0 : stock_qty) : row.Cnt;
                    sel.sel_price = Util.GetSafeInt(row.Price);
                    sel.sel_no = new BsonArray();
                    sel.sel_no.Add(row.OptionNo);

                    selections.Add(sel);
                }
            }

            return selections;
        }
        /// <summary>
        /// G마켓 상품 조회 리스트 데이터
        /// </summary>
        public JsonResult GetGmarketItemListData(string lCategoryCode, string mCategoryCode, string sCategoryCode,
			string hasSelection, string hasAddition, string madeGep, string startPrice, string endPrice, string priceChgCnt, string sellerAgree,
			string startWeight, string endWeight, string startAvgDlvDuration, string endAvgDlvDuration, string overseasDelivery, 
			string dateType, string startDate, string endDate, string overseasSoldCnt, string searchType, string searchValue, string orderBy)
        {
            // Param
            int page_no = int.Parse(Request.Form["page"]);
            int page_size = int.Parse(Request.Form["rows"]);
            string sortIndex = Request.Form["sidx"];
            string sortOrder = Request.Form["sord"];
            if (string.IsNullOrEmpty(startDate) || string.IsNullOrEmpty(endDate)) dateType = "";

            // Data
            List<SourceItemInfoT> list = new GmarketItemBiz().GetSourceItemList(MemberContext.LoginID, lCategoryCode, mCategoryCode, sCategoryCode, hasSelection, hasAddition, madeGep,
                Util.GetSafeDecimal(startPrice), Util.GetSafeDecimal(endPrice), priceChgCnt, sellerAgree, Util.GetSafeDecimal(startWeight), Util.GetSafeDecimal(endWeight),
                Util.GetSafeDecimal(startAvgDlvDuration), Util.GetSafeDecimal(endAvgDlvDuration), overseasDelivery,
                dateType, Util.GetSafeDateTime(startDate), Util.GetSafeDateTime(endDate), overseasSoldCnt, searchType, searchValue, orderBy,
                page_no, page_size
                );

            // Paging
            var fData = from e in list
                        where (e.RowId > (page_no - 1) * page_size) && (e.RowId < ((page_no * page_size) + 1))
                        select new
                        {
                            Image = GmktUtil.GetGmktItemImagePath(e.No),
                            LCategoryName = e.LCategoryName,
                            MCategoryName = e.MCategoryName,
                            SCategoryName = e.SCategoryName,
                            No = e.No,
                            Name = e.Name,
                            SelectionCount = string.Format("{0}개", e.SelectionCount),
                            StockQty = e.StockQty.ToString(),
                            SellPrice = e.SellPrice.ToString(),
                            SellerDiscountPrice = Util.GetSafeString(e.SellerDiscountPrice),
                            DcPrice = (e.SellPrice - e.SellerDiscountPrice).ToString(),
                            DeliveryInfo = GmktUtil.GetDeliveryInfo(e.DeliveryFeeYn, e.DeliveryFeeCondition, e.DeliveryFee.ToString(), e.BasisMoney.ToString(), e.DeliveryGroupName),
                            Weight = e.Weight.ToString(),
                            OverseasDeliveryYn = e.OverseasDeliveryYn,
                            OverseasSoldCount = e.OverseasSoldCount.ToString(),
                            PriceChangeCount = string.Format("{0}회", e.PriceChangeCount),
                            InsertDate = e.InsertDate.ToShortDateString(),
                            UpdateDate = e.UpdateDate.ToShortDateString().Replace("0001-01-01", ""),
                            LatestSoldDate = e.LatestSoldDate.ToShortDateString().Replace("0001-01-01", ""),
                            AvgDuration = string.Format("{0}일", e.AvgDuration),
                            SellerName = e.SellerName,
                            SellerInfo = e.AgreeYn == "N" ? "" : string.Format("{0}<br />{1}", e.SellerTel, e.SellerEmail),
                            AgreeYN = e.AgreeYn,
                            LastGepRegDate = e.LastGepInsertDate.ToShortDateString().Replace("0001-01-01", ""),
                            TotalGepCnt = e.TotalGepCount.ToString(),
                            Selections = GetGmarketOptionSelectList(e.No),
                            MinishopURL = UrlConst.Instance.NEO_MINISHOP_DOMAIN_SERVER_URL + "neo_seller_collection/seller_collection_main.asp?cust_no=" + e.SellerNo
                        };

            // Sorting
            if (sortOrder == "desc")
            {
                switch (sortIndex)
                {
                    case "No":
                        fData = fData.OrderByDescending(m => m.No); break;
                    case "StockQty":
                        fData = fData.OrderByDescending(m => m.StockQty); break;
                    case "SellPrice":
                        fData = fData.OrderByDescending(m => m.SellPrice); break;
                    case "DcPrice":
                        fData = fData.OrderByDescending(m => m.DcPrice); break;
                    case "OverseasSoldCount":
                        fData = fData.OrderByDescending(m => m.OverseasSoldCount); break;
                    case "InsertDate":
                        fData = fData.OrderByDescending(m => m.InsertDate); break;
                    case "UpdateDate":
                        fData = fData.OrderByDescending(m => m.UpdateDate); break;
                    case "LatestSoldDate":
                        fData = fData.OrderByDescending(m => m.LatestSoldDate); break;
                    case "AvgDuration":
                        fData = fData.OrderByDescending(m => m.AvgDuration); break;
                    case "LastGepRegDate":
                        fData = fData.OrderByDescending(m => m.LastGepRegDate); break;
                    case "TotalGepCnt":
                        fData = fData.OrderByDescending(m => m.TotalGepCnt); break;
                }
            }
            else
            {
                switch (sortIndex)
                {
                    case "No":
                        fData = fData.OrderBy(m => m.No); break;
                    case "StockQty":
                        fData = fData.OrderBy(m => m.StockQty); break;
                    case "SellPrice":
                        fData = fData.OrderBy(m => m.SellPrice); break;
                    case "DcPrice":
                        fData = fData.OrderBy(m => m.DcPrice); break;
                    case "OverseasSoldCount":
                        fData = fData.OrderBy(m => m.OverseasSoldCount); break;
                    case "InsertDate":
                        fData = fData.OrderBy(m => m.InsertDate); break;
                    case "UpdateDate":
                        fData = fData.OrderBy(m => m.UpdateDate); break;
                    case "LatestSoldDate":
                        fData = fData.OrderBy(m => m.LatestSoldDate); break;
                    case "AvgDuration":
                        fData = fData.OrderBy(m => m.AvgDuration); break;
                    case "LastGepRegDate":
                        fData = fData.OrderBy(m => m.LastGepRegDate); break;
                    case "TotalGepCnt":
                        fData = fData.OrderBy(m => m.TotalGepCnt); break;
                }
            }

            // Result
            var result = new
            {
                totalCount = list.Count,
                total = Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(list.Count) / page_size)),
                page = page_no,
                rows = fData.ToArray()
            };

            return Json(result);
        }
        public JsonResult SetCreateGepItem(ReqData dataList)
        {
            if (dataList == null) return Json(false);
            MemberContext member = ViewBag.memberContext;

            string[] ItemNo = dataList.ArrayNo.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            string[] ItemImage = dataList.ArrayImage.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

            if (ItemNo.Length != ItemImage.Length) return Json(false);

            List<GepItemsData> reqItem = new List<GepItemsData>();

            for (int i = 0; i < ItemNo.Length; i++)
            {
                GepItemsData item = new GepItemsData();
                item.img = ItemImage[i];
                item.src_info = new src_info();
                item.src_info.no = ItemNo[i];

                reqItem.Add(item);
            }

            string msg = "";

            try
            {
                msg = new GmarketItemBiz().SetGEPItems(reqItem, member.LoginID);
            }
            catch
            {
                msg = "알 수 없는 오류로 작업에 실패하였습니다.";
            }

            var result = new
            {
                result_msg = msg
            };

            return Json(result);
        }
        /// <summary>
        /// G마켓 필수선택 기존 선택값 조회 리스트 데이터
        /// </summary>
        public List<TempGepItemData> GetGmarketOptionSelectList(string itemNo)
        {
            List<GepItemsData> list = new GmarketItemBiz().GetTempGEPItemList(MemberContext.LoginID, itemNo);

            List<TempGepItemData> reList = new List<TempGepItemData>();

            foreach (GepItemsData item in list)
            {
                TempGepItemData opt = new TempGepItemData();
                opt._id = item._id;
                opt.sel_name = item.src_info.sel_name;
                reList.Add(opt);
            }

            return reList;
        }
        /// <summary>
        /// 필수선택 리스트 데이터
        /// </summary>
        public JsonResult GetGmarketOptionInfoListData(string itemNo, string itemPrice, string StockQty)
        {
            int page_no = int.Parse(Request.Form["page"]);
            int page_size = int.Parse(Request.Form["rows"]);
            string sortIndex = Request.Form["sidx"];
            string sortOrder = Request.Form["sord"];

            List<TempGepItemData> info = new GmarketItemBiz().GetSourceItemOptionList(itemNo, Util.GetSafeInt(StockQty));

            // Paging
            var fData = from e in info
                        select new
                        {
                            SelectionName = e.sel_name.ToString(),
                            SelectionStockQty = Util.GetSafeString(Util.GetSafeInt(e.sel_qty)),
                            SelectionPrice = Util.GetSafeString(Util.GetSafeInt(e.sel_price)),
                            TotalPrice = Util.GetSafeString(Util.GetSafeInt(itemPrice) + Util.GetSafeInt(e.sel_price)),
                            OptNo = GmktUtil.GetOptionNoString(e.sel_no.RawValues, "_")

                        };

            // Sorting
            if (sortOrder == "desc")
            {
                switch (sortIndex)
                {
                    case "SelectionStockQty":
                        fData = fData.OrderByDescending(m => m.SelectionStockQty); break;
                    case "SelectionPrice":
                        fData = fData.OrderByDescending(m => m.SelectionPrice); break;
                    case "TotalPrice":
                        fData = fData.OrderByDescending(m => m.TotalPrice); break;
                }
            }
            else
            {
                switch (sortIndex)
                {
                    case "SelectionStockQty":
                        fData = fData.OrderBy(m => m.SelectionStockQty); break;
                    case "SelectionPrice":
                        fData = fData.OrderBy(m => m.SelectionPrice); break;
                    case "TotalPrice":
                        fData = fData.OrderBy(m => m.TotalPrice); break;
                }
            }

            // Result
            var result = new
            {
                total = Math.Ceiling(Convert.ToDecimal(Convert.ToDecimal(info.Count) / page_size)),
                page = page_no,
                rows = fData.ToArray()
            };

            return Json(result);
        }