Example #1
0
        //옵션체크(옵션설정값자체)
        public SelectOptionInfoResultT OptionVerification(BasketParamT reqBasketParam)
        {
            SelectOptionInfoResultT selOptResult = new SelectOptionInfoResultT();
            selOptResult.Result = new GEPBaseResultT();

            List<SelectOptionInfoT> lstSelOptInfo = new List<SelectOptionInfoT>();
            List<SelectOptionParamT> lstSelOptParam = new List<SelectOptionParamT>();

            string strMsg = String.Empty;
            int errorCnt = 0;

            if (reqBasketParam.OptSelYn == "Y" || reqBasketParam.OptAddYn == "Y") //옵션이 있을 때
            {
                string[] arrOptNo = reqBasketParam.OptNos.Split(PaymentConstant.ForthDelimiter.ToCharArray());
                lstSelOptInfo = GetSelectOptionInfo(reqBasketParam.GoodsCode, reqBasketParam.AddInfoType);

                if (lstSelOptInfo != null)
                {
                    if (lstSelOptInfo.Count > 0)
                    {
                        string strOptValidationchk = "N"; //N:변동없음
                        string strInventoryYn = String.Empty;
                        if (arrOptNo.Length > 0)
                        {
                            for (int j = 0, arrOptNoLenth = arrOptNo.Length; j < arrOptNoLenth; j++)
                            {
                                for (int i = 0, lstSelOptInfoCnt = lstSelOptInfo.Count; i < lstSelOptInfoCnt; i++)
                                {
                                    if (lstSelOptInfo[i].OptNo.ToString() == arrOptNo[j])
                                    {
                                        //옵션 Validation Check - 재고 수량 체크
                                        if (lstSelOptInfo[i].OptStat == "N")
                                        {
                                            strOptValidationchk = "O"; //옵션품절
                                            continue;
                                        }

                                        if (lstSelOptInfo[i].InfoType == "S")
                                        {
                                            strInventoryYn = reqBasketParam.OptSelInventoryYn;
                                        }
                                        else if (lstSelOptInfo[i].InfoType == "P")
                                        {
                                            strInventoryYn = reqBasketParam.OptAddInventoryYn;
                                        }

                                        if (strInventoryYn == "Y")
                                        {
                                            if (int.Parse(reqBasketParam.OrderCnt) > lstSelOptInfo[i].InventoryCnt)
                                            {
                                                strOptValidationchk = "I"; //재고부족
                                                continue;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                    strOptValidationchk = "F";

                                    if (strOptValidationchk != "N" && strOptValidationchk != "F")
                                    {
                                        strMsg = strMsg + "대상 : " + lstSelOptInfo[i].OptNm + "-" + lstSelOptInfo[i].OptValue;
                                        if (lstSelOptInfo[i].OptPrice > 0)
                                        {
                                            strMsg = strMsg + "(+" + lstSelOptInfo[i].OptPrice + "):";
                                        }
                                        else if (lstSelOptInfo[i].OptPrice < 0)
                                        {
                                            strMsg = strMsg + "(-" + lstSelOptInfo[i].OptPrice + "):";
                                        }
                                        if (strOptValidationchk == "O")
                                        {
                                            strMsg = strMsg + "선택상품품절\n";
                                        }
                                        else if (strOptValidationchk == "I")
                                        {
                                            strMsg = strMsg + "재고부족\n";
                                        }
                                        errorCnt = errorCnt + 1;
                                    }
                                    else
                                    {
                                        //gep_cart_option_info 에 데이터 넣기
                                        SelectOptionParamT optParam = new SelectOptionParamT();
                                        optParam.Pid = reqBasketParam.Pbid;
                                        optParam.CustNo = reqBasketParam.CustNo;
                                        optParam.ItemNo = reqBasketParam.GoodsCode;
                                        optParam.GdSelNo = reqBasketParam.GdSelNo;
                                        optParam.OptNm = lstSelOptInfo[i].OptNm;
                                        optParam.OptValue = lstSelOptInfo[i].OptValue;
                                        optParam.InfoType = lstSelOptInfo[i].InfoType;
                                        optParam.SelItemPrice = (Int32)lstSelOptInfo[i].OptPrice;
                                        optParam.OrderCnts = int.Parse(reqBasketParam.OrderCnt);
                                        optParam.OptNo = lstSelOptInfo[i].OptNo;
                                        optParam.OptOrderCnt = optParam.OrderCnts;
                                        optParam.OrderGubun = "N";
                                        optParam.VersionChgDt = lstSelOptInfo[i].VersionChgDt;
                                        optParam.OrderIdx = reqBasketParam.OrderIdx;

                                        lstSelOptParam.Add(optParam);
                                    }
                                }
                            }
                        }
                        else
                        {
                            errorCnt = 1002;
                        }
                    }
                    else
                    {
                        errorCnt = 1001;
                    }
                }
                else
                {
                    errorCnt = 1000;
                }
            }
            selOptResult.Result.RetCode = errorCnt;
            if (errorCnt > 999)
            {
                strMsg = "옵션 정보가 올바르지 않습니다.";
            }
            selOptResult.Result.RetMessage = strMsg;
            if (selOptResult.Result.RetCode == 0)
            {
                selOptResult.OptionInfoList.AddRange(lstSelOptParam);
            }
            return selOptResult;
        }
Example #2
0
 public SelectOptionSetResultT SetSelectOption(SelectOptionParamT seloptParam)
 {
     return new CartDac().SetSelectOption(seloptParam);
 }
Example #3
0
 public SelectOptionSetResultT SetSelectOption(SelectOptionParamT selOptParam)
 {
     return (SelectOptionSetResultT)new DacHelper(DbHelper, "tiger_write").SelectSingleEntity(
         typeof(SelectOptionSetResultT),
         GEPMappingCache.GetDataMappings("SelectOptionSetResultT"),
         CommandType.StoredProcedure,
         "dbo.up_gmkt_front_gep_sel_opt_info_insert",
         SqlParameterHelper.CreateParameter("@pid", selOptParam.Pid, SqlDbType.VarChar),
         SqlParameterHelper.CreateParameter("@cust_no", selOptParam.CustNo, SqlDbType.VarChar),
         SqlParameterHelper.CreateParameter("@gd_no", selOptParam.ItemNo, SqlDbType.VarChar),
         SqlParameterHelper.CreateParameter("@gd_sel_no", selOptParam.GdSelNo, SqlDbType.VarChar),
         SqlParameterHelper.CreateParameter("@opt_nm", selOptParam.OptNm, SqlDbType.VarChar),
         SqlParameterHelper.CreateParameter("@opt_value", selOptParam.OptValue, SqlDbType.VarChar),
         SqlParameterHelper.CreateParameter("@info_type", selOptParam.InfoType, SqlDbType.Char),
         SqlParameterHelper.CreateParameter("@sel_item_price", selOptParam.SelItemPrice, SqlDbType.Int),
         SqlParameterHelper.CreateParameter("@order_cnts", selOptParam.OrderCnts, SqlDbType.Int),
         SqlParameterHelper.CreateParameter("@opt_no", selOptParam.OptNo, SqlDbType.BigInt),
         SqlParameterHelper.CreateParameter("@opt_order_cnt", selOptParam.OptOrderCnt, SqlDbType.Int),
         SqlParameterHelper.CreateParameter("@order_gubun", selOptParam.OrderGubun, SqlDbType.Char),
         SqlParameterHelper.CreateParameter("@version_chg_dt", selOptParam.VersionChgDt, SqlDbType.VarChar),
         SqlParameterHelper.CreateParameter("@order_idx", selOptParam.OrderIdx, SqlDbType.BigInt)
         );
 }