public HttpResponseBase IsSameChildVendor()
 {
     string result = string.Empty;
     try
     {
         List<ProductComboCustom> combos;
         if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
         {
             int parentId = int.Parse(Request.Params["ProductId"]);
             _combMgr = new ProductComboMgr(connectionString);
             combos = _combMgr.combQuery(new ProductComboCustom { Parent_Id = parentId });
         }
         else
         {
             Caller _caller = (Session["caller"] as Caller);
             _combTempMgr = new ProductComboTempMgr(connectionString);
             ProductComboCustom query = new ProductComboCustom { Writer_Id = _caller.user_id };
             //複製商品時
             if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
             {
                 query.Parent_Id = int.Parse(Request.Form["OldProductId"]);
             }
             combos = _combTempMgr.combQuery(query);
         }
         List<uint> brandIds = combos.GroupBy(m => m.brand_id).Select(m => m.Key).ToList();
         if (brandIds.Count == 1)
         {
             result = "{success:true,same:true}";
         }
         else
         {
             _vendorBrandMgr = new VendorBrandMgr(connectionString);
             List<uint> vendorIds = new List<uint>();
             VendorBrand vendorBrand;
             foreach (var id in brandIds)
             {
                 vendorBrand = _vendorBrandMgr.GetProductBrand(new VendorBrand { Brand_Id = id });
                 if (vendorBrand != null && !vendorIds.Contains(vendorBrand.Vendor_Id))
                 {
                     vendorIds.Add(vendorBrand.Vendor_Id);
                 }
             }
             result = "{success:true,same:" + (vendorIds.Count == 1).ToString().ToLower() + "}";
         }
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
         result = "{success:true,same:false}";
     }
     this.Response.Clear();
     this.Response.Write(result);
     this.Response.End();
     return this.Response;
 }
        public string ComboPriceSave()
        {
            string json = "{success:true}";
            if (!PriceMaster.CheckProdName(Request.Form["product_name"]))
            {
                return "{success:false,msg:'" + Resources.Product.FORBIDDEN_CHARACTER + "'}";
            }
            ProductTemp pTemp = new ProductTemp();
            List<PriceMasterTemp> pMasterListT = new List<PriceMasterTemp>();
            List<PriceMaster> pMasterList = new List<PriceMaster>();

            List<List<ItemPrice>> ItemPList = new List<List<ItemPrice>>();
            PriceMasterTemp pMasterTemp = new PriceMasterTemp();


            if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
            {
                pTemp.Product_Id = Request.Form["OldProductId"];
                pMasterTemp.product_id = Request.Form["OldProductId"];
            }
            string paramValue = Request.Params["paramValue"];
            #region 參數
            int writer_id = (Session["caller"] as Caller).user_id;
            string product_name = PriceMaster.Product_Name_FM(Request.Params["product_name"]);
            string price_type = Request.Params["price_type"];
            string product_price_list = Request.Params["product_price_list"];
            string default_bonus_percent = Request.Params["default_bonus_percent"];
            string price = Request.Params["price"];
            string cost = Request.Params["cost"];
            string max_price = Request.Params["max_price"];
            string bonus_percent = Request.Params["bonus_percent"];
            string event_price = Request.Params["event_price"];
            string event_cost = Request.Params["event_cost"];
            string max_event_price = Request.Params["max_event_price"];
            string event_start = Request.Params["event_start"];
            string event_end = Request.Params["event_end"];
            string site_id = Request.Params["site_id"];
            string user_level = Request.Params["user_level"];
            string user_mail = Request.Params["user_mail"];
            string bag_check_money = Request.Params["bag_check_money"] == "" ? "0" : Request.Params["bag_check_money"];
            string accumulated_bonus = Request.Params["accumulated_bonus"];
            string bonus_percent_start = Request.Params["bonus_percent_start"];
            string bonus_percent_end = Request.Params["bonus_percent_end"];
            string same_price = Request.Params["same_price"];
            string show_listprice = Request.Params["show_listprice"];
            string valid_start = Request.Params["valid_start"];
            string valid_end = Request.Params["valid_end"];

            #endregion
            List<MakePriceCustom> PriceStore = new List<MakePriceCustom>();
            if (price_type == "2")//各自定價
            {
                JavaScriptSerializer jss = new JavaScriptSerializer();
                string priceStr = Request.Params["priceStr"];
                PriceStore = jss.Deserialize<List<MakePriceCustom>>(priceStr);
            }

            if (!string.IsNullOrEmpty(Request.Params["product_id"]))
            {
                #region 正式表操作
                List<PriceMaster> pMList = new List<PriceMaster>();

                //插入price_master
                _priceMasterMgr = new PriceMasterMgr(connectionString);
                _priceMasterTsMgr = new PriceMasterTsMgr(connectionString);
                PriceMaster pMaster = new PriceMaster();

                //查詢price_master
                if (!string.IsNullOrEmpty(Request.Params["price_master_id"]))
                {
                    pMaster = _priceMasterMgr.Query(new PriceMaster { price_master_id = uint.Parse(Request.Params["price_master_id"]) }).FirstOrDefault();
                }

                pMaster.product_id = uint.Parse(Request.Params["product_id"]);
                pMaster.child_id = int.Parse(Request.Params["product_id"]);
                pMaster.site_id = uint.Parse(site_id);


                uint userId = 0;
                if (!string.IsNullOrEmpty(Request.Form["user_mail"]))
                {
                    _usersMgr = new UsersMgr(connectionString);
                    System.Data.DataTable dt_User = _usersMgr.Query(Request.Form["user_mail"]);
                    if (dt_User != null && dt_User.Rows.Count > 0)
                    {
                        userId = Convert.ToUInt32(dt_User.Rows[0]["user_id"]);
                    }
                }
                if (userId != 0)
                {
                    pMaster.user_id = userId;
                }
                if (user_level != "")
                {
                    pMaster.user_level = uint.Parse(user_level);
                }
                pMaster.product_name = product_name;
                pMaster.bonus_percent = float.Parse(bonus_percent);
                pMaster.cost = int.Parse(cost);
                pMaster.price = int.Parse(price);
                pMaster.max_price = int.Parse(max_price);
                pMaster.max_event_price = int.Parse(max_event_price);
                pMaster.default_bonus_percent = float.Parse(default_bonus_percent);
                pMaster.event_price = int.Parse(event_price);
                pMaster.event_cost = int.Parse(event_cost);
                pMaster.same_price = int.Parse(same_price);
                pMaster.price_status = 2;//申請審核
                pMaster.accumulated_bonus = uint.Parse(accumulated_bonus);

                #region 時間 活動時間
                if (event_start != "")
                {
                    pMaster.event_start = Convert.ToUInt32(CommonFunction.GetPHPTime(event_start));
                }
                if (event_end != "")
                {
                    pMaster.event_end = Convert.ToUInt32(CommonFunction.GetPHPTime(event_end));
                }
                if (bonus_percent_start != "")
                {
                    pMaster.bonus_percent_start = Convert.ToUInt32(CommonFunction.GetPHPTime(bonus_percent_start));
                }
                if (bonus_percent_end != "")
                {
                    pMaster.bonus_percent_end = Convert.ToUInt32(CommonFunction.GetPHPTime(bonus_percent_end));
                }
                if (!string.IsNullOrEmpty(valid_start))
                {
                    pMaster.valid_start = Convert.ToInt32(CommonFunction.GetPHPTime(valid_start));
                }
                if (!string.IsNullOrEmpty(valid_end))
                {
                    pMaster.valid_end = Convert.ToInt32(CommonFunction.GetPHPTime(valid_end));
                }


                #endregion

                _functionMgr = new FunctionMgr(connectionString);
                string function = Request.Params["function"] ?? "";
                Function fun = _functionMgr.QueryFunction(function, "/ProductCombo");
                int functionid = fun == null ? 0 : fun.RowId;
                HistoryBatch batch = new HistoryBatch { functionid = functionid };
                batch.batchno = Request.Params["batch"] ?? "";
                batch.kuser = (Session["caller"] as Caller).user_email;

                List<ItemPrice> update = new List<ItemPrice>();
                if (price_type == "2")  //各自定價
                {
                    CreateList(PriceStore, pMaster, null, same_price, ItemPList, pMasterListT, pMasterList, update);
                }
                pMasterList.Add(pMaster);

                try
                {
                    //價格修改 申請審核
                    PriceUpdateApply priceUpdateApply = new PriceUpdateApply();
                    priceUpdateApply.apply_user = Convert.ToUInt32((Session["caller"] as Caller).user_id);

                    //價格審核記錄
                    PriceUpdateApplyHistory applyHistroy = new PriceUpdateApplyHistory();
                    applyHistroy.user_id = Convert.ToInt32(priceUpdateApply.apply_user);
                    applyHistroy.price_status = 1;
                    //applyHistroy.type = 3;
                    applyHistroy.type = 1;//edit by wwei0216w 所作操作為 1:申請審核的操作 

                    _priceUpdateApplyMgr = new PriceUpdateApplyMgr(connectionString);
                    _priceUpdateApplyHistoryMgr = new PriceUpdateApplyHistoryMgr(connectionString);
                    _tableHistoryMgr = new TableHistoryMgr(connectionString);

                    ArrayList excuteSql = new ArrayList();
                    if (!string.IsNullOrEmpty(Request.Params["price_master_id"]))
                    {
                        #region 修改

                        priceUpdateApply.price_master_id = pMaster.price_master_id;
                        PriceMaster priceMster = _priceMasterMgr.QueryPMaster(new PriceMaster()
                        {
                            site_id = uint.Parse(site_id),
                            user_level = uint.Parse(user_level == "" ? "0" : user_level),
                            user_id = userId,
                            product_id = uint.Parse(Request.Params["product_id"]),
                            price_master_id = uint.Parse(Request.Params["price_master_id"])
                        });

                        //更新price_master
                        if (priceMster != null)
                        {
                            json = "{success:true,msg:'" + Resources.Product.SITE_EXIST + "'}";
                        }
                        else
                        {
                            int apply_id = _priceUpdateApplyMgr.Save(priceUpdateApply);
                            if (apply_id != -1)
                            {
                                bool flag = false;
                                foreach (var item in pMasterList)
                                {
                                    item.apply_id = (uint)apply_id;
                                    excuteSql = new ArrayList();
                                    if (item == pMaster)
                                    {
                                        pMaster.apply_id = Convert.ToUInt32(apply_id);
                                        applyHistroy.apply_id = apply_id;
                                        excuteSql.Add(_priceUpdateApplyHistoryMgr.SaveSql(applyHistroy));
                                    }
                                    //excuteSql.Add(_priceMasterMgr.Update(item));
                                    excuteSql.Add(_priceMasterTsMgr.UpdateTs(item));//edit by xiangwang0413w 2014/07/16 將數據更新到pirce_master_ts表
                                    flag = _tableHistoryMgr.SaveHistory<PriceMaster>(item, batch, excuteSql);
                                }
                                if (flag)
                                {
                                    //更新item_price
                                    //_itemPriceMgr = new ItemPriceMgr("");
                                    _itemPriceTsMgr = new ItemPriceTsMgr(connectionString);
                                    foreach (var iPrice in update)
                                    {
                                        iPrice.apply_id = (uint)apply_id;
                                        excuteSql = new ArrayList();
                                        //excuteSql.Add(_itemPriceMgr.Update(iPrice));
                                        excuteSql.Add(_itemPriceTsMgr.UpdateTs(iPrice));//edit by xiangwang0413w 2014/07/17 將數據更新到pirce_master_ts表
                                        if (!_tableHistoryMgr.SaveHistory<ItemPrice>(iPrice, batch, excuteSql))
                                        {
                                            json = "{success:true,msg:'" + Resources.Product.EDIT_FAIL + "'}";
                                        }
                                    }
                                    json = "{success:true,msg:'" + Resources.Product.EDIT_SUCCESS + "'}";
                                }
                                else
                                {
                                    json = "{success:true,msg:'" + Resources.Product.EDIT_FAIL + "'}";
                                }
                            }
                            else
                            {
                                json = "{success:true,msg:'" + Resources.Product.EDIT_FAIL + "'}";
                            }
                        }
                        #endregion
                    }
                    else
                    {
                        #region 新增

                        string msg = string.Empty;

                        int status = 0;

                        List<ItemPrice> iprice = (ItemPList == null || ItemPList.Count == 0) ? null : ItemPList[pMasterList.IndexOf(pMaster)];
                        int priceMasterId = _priceMasterMgr.Save(pMaster, iprice, null, ref msg);
                        if (priceMasterId != -1)
                        {
                            priceUpdateApply.price_master_id = Convert.ToUInt32(priceMasterId);
                            int apply_id = _priceUpdateApplyMgr.Save(priceUpdateApply);

                            if (apply_id != -1)
                            {
                                pMaster = _priceMasterMgr.Query(new PriceMaster { price_master_id = Convert.ToUInt32(priceMasterId) }).FirstOrDefault();
                                pMaster.apply_id = Convert.ToUInt32(apply_id);
                                excuteSql.Add(_priceMasterMgr.Update(pMaster));
                                excuteSql.Add(_priceMasterTsMgr.UpdateTs(pMaster)); //edit by xiangwang0413w 2014/07/22 更新price_master_ts表後同時更新price_master_ts表,以便價格審核

                                foreach (var item in pMasterList.FindAll(m => m.product_id != m.child_id))
                                {
                                    iprice = (ItemPList == null || ItemPList.Count == 0) ? null : ItemPList[pMasterList.IndexOf(item)];
                                    priceMasterId = _priceMasterMgr.Save(item, iprice, null, ref msg);
                                    pMaster = _priceMasterMgr.Query(new PriceMaster { price_master_id = Convert.ToUInt32(priceMasterId) }).FirstOrDefault();

                                    if (priceMasterId != -1)
                                    {
                                        priceUpdateApply.price_master_id = Convert.ToUInt32(priceMasterId);
                                        pMaster = _priceMasterMgr.Query(new PriceMaster { price_master_id = Convert.ToUInt32(priceMasterId) }).FirstOrDefault();
                                        pMaster.apply_id = Convert.ToUInt32(apply_id);
                                        excuteSql.Add(_priceMasterMgr.Update(pMaster));
                                        excuteSql.Add(_priceMasterTsMgr.UpdateTs(pMaster)); //edit by xiangwang0413w 2014/07/22 更新price_master_ts表後同時更新price_master_ts表,以便價格審核
                                    }
                                    else { status = 2; }
                                }
                            }
                            else { status = 3; }
                        }
                        else { status = 3; }

                        excuteSql.Add(_priceUpdateApplyHistoryMgr.SaveSql(applyHistroy));
                        _tableHistoryMgr = new TableHistoryMgr(connectionString);
                        if (_tableHistoryMgr.SaveHistory<PriceMaster>(pMaster, batch, excuteSql))
                        {
                            status = 1;
                        }
                        else { status = 2; }

                        //foreach (var item in pMasterList)
                        //{
                        //    List<ItemPrice> iprice = (ItemPList == null || ItemPList.Count == 0) ? null : ItemPList[pMasterList.IndexOf(item)];
                        //    int priceMasterId = _priceMasterMgr.Save(item, iprice, null, ref msg);
                        //    if (apply_id != -1)
                        //    {
                        //        pMaster = _priceMasterMgr.Query(new PriceMaster { price_master_id = Convert.ToUInt32(priceMasterId) }).FirstOrDefault();
                        //    }

                        //    if (priceMasterId != -1)
                        //    {
                        //        if (item != pMaster) { status = 1; continue; }
                        //        priceUpdateApply.price_master_id = Convert.ToUInt32(priceMasterId);
                        //        int apply_id = _priceUpdateApplyMgr.Save(priceUpdateApply);
                        //        if (apply_id != -1)
                        //        {
                        //            pMaster = _priceMasterMgr.Query(new PriceMaster { price_master_id = Convert.ToUInt32(priceMasterId) }).FirstOrDefault();
                        //            pMaster.apply_id = Convert.ToUInt32(apply_id);
                        //            applyHistroy.apply_id = apply_id;

                        //            excuteSql.Add(_priceMasterMgr.Update(pMaster));
                        //            excuteSql.Add(_priceMasterTsMgr.UpdateTs(pMaster)); //edit by xiangwang0413w 2014/07/22 更新price_master_ts表後同時更新price_master_ts表,以便價格審核
                        //            excuteSql.Add(_priceUpdateApplyHistoryMgr.SaveSql(applyHistroy));
                        //            _tableHistoryMgr = new TableHistoryMgr(connectionString);
                        //            if (_tableHistoryMgr.SaveHistory<PriceMaster>(pMaster, batch, excuteSql))
                        //            {
                        //                status = 1;
                        //            }
                        //            else { status = 2; }
                        //        }
                        //        else { status = 2; }
                        //    }
                        //    else { status = 3; }
                        //}

                        if (status == 1)
                        {
                            json = "{success:true,msg:'" + Resources.Product.ADD_SUCCESS + "'}";
                        }
                        else if (status == 2)
                        {
                            json = "{success:false,msg:'" + Resources.Product.SAVE_FAIL + "'}";
                        }
                        else
                        {
                            json = "{success:false,msg:'" + msg + "'}";
                        }

                        #endregion
                    }
                }
                catch (Exception ex)
                {
                    Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                    logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                    logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                    log.Error(logMessage);
                    json = "{success:false,msg:'" + Resources.Product.SAVE_FAIL + "'}";
                }
                #endregion
            }
            else
            {
                #region 新增至臨時表
                try
                {
                    _productTempMgr = new ProductTempMgr(connectionString);
                    _pMasterTempMgr = new PriceMasterTempMgr(connectionString);

                    //product_temp
                    pTemp.Product_Price_List = uint.Parse(product_price_list);
                    pTemp.Writer_Id = writer_id;
                    pTemp.Combo_Type = COMBO_TYPE;
                    pTemp.Price_type = int.Parse(price_type);
                    pTemp.Bag_Check_Money = uint.Parse(bag_check_money);
                    pTemp.show_listprice = uint.Parse(show_listprice);
                    pTemp.Bonus_Percent = float.Parse(bonus_percent);
                    pTemp.Default_Bonus_Percent = float.Parse(default_bonus_percent);

                    //Price_Master
                    pMasterTemp.product_name = product_name; ;
                    pMasterTemp.default_bonus_percent = float.Parse(default_bonus_percent);
                    pMasterTemp.writer_Id = writer_id;
                    pMasterTemp.combo_type = COMBO_TYPE;
                    //默認站臺1:吉甲地,(按統一價格比例拆分)會員等級1:普通會員
                    pMasterTemp.site_id = 1;
                    pMasterTemp.user_level = 1;
                    pMasterTemp.same_price = int.Parse(same_price);
                    pMasterTemp.accumulated_bonus = uint.Parse(accumulated_bonus);
                    pMasterTemp.bonus_percent = float.Parse(bonus_percent);
                    pMasterTemp.price = int.Parse(price);
                    pMasterTemp.cost = int.Parse(cost);
                    pMasterTemp.max_price = int.Parse(max_price);
                    pMasterTemp.max_event_price = int.Parse(max_event_price);
                    pMasterTemp.event_price = int.Parse(event_price);
                    pMasterTemp.event_cost = int.Parse(event_cost);
                    #region 時間 活動時間
                    if (event_start != "")
                    {
                        pMasterTemp.event_start = Convert.ToUInt32(CommonFunction.GetPHPTime(event_start));
                    }
                    if (event_end != "")
                    {
                        pMasterTemp.event_end = Convert.ToUInt32(CommonFunction.GetPHPTime(event_end));
                    }
                    if (bonus_percent_start != "")
                    {
                        pMasterTemp.bonus_percent_start = Convert.ToUInt32(CommonFunction.GetPHPTime(bonus_percent_start));
                        pTemp.Bonus_Percent_Start = Convert.ToUInt32(CommonFunction.GetPHPTime(bonus_percent_start));
                    }
                    if (bonus_percent_end != "")
                    {
                        pMasterTemp.bonus_percent_end = Convert.ToUInt32(CommonFunction.GetPHPTime(bonus_percent_end));
                        pTemp.Bonus_Percent_End = Convert.ToUInt32(CommonFunction.GetPHPTime(bonus_percent_end));
                    }
                    if (!string.IsNullOrEmpty(valid_start))
                    {
                        pMasterTemp.valid_start = Convert.ToInt32(CommonFunction.GetPHPTime(valid_start));
                    }
                    if (!string.IsNullOrEmpty(valid_end))
                    {
                        pMasterTemp.valid_end = Convert.ToInt32(CommonFunction.GetPHPTime(valid_end));
                    }

                    #endregion

                    pMasterTemp.price_status = 1;

                    _productItemMgr = new ProductItemMgr(connectionString);

                    string oldProductId = "0";
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        oldProductId = Request.Form["OldProductId"];
                    }

                    List<ItemPrice> update = new List<ItemPrice>();

                    if (price_type == "2")
                    {
                        _combTempMgr = new ProductComboTempMgr(connectionString);
                        List<ProductComboCustom> combResultList = _combTempMgr.priceComboQuery(new ProductComboCustom { Writer_Id = writer_id, Parent_Id = int.Parse(oldProductId.ToString()) });
                        bool match = true;
                        if (combResultList.Count() > 0)
                        {
                            int countBySearchPile = combResultList.GroupBy(m => m.Pile_Id).Count();      //庫中原有價格數據
                            int countByStorePile = PriceStore.GroupBy(m => m.Pile_Id).Count();           //頁面store數據
                            //判斷群組數量是否相同
                            if (countBySearchPile == countByStorePile)
                            {
                                for (int i = 1; i <= countBySearchPile; i++)
                                {
                                    //組合類型為固定或任選時pile_id為0;
                                    var tempSearch = combResultList.Where(m => m.Pile_Id == (combResultList[0].Pile_Id == 0 ? 0 : i)).ToList().GroupBy(m => m.Child_Id).ToList();
                                    var tempPrice = PriceStore.Where(m => m.Pile_Id == (combResultList[0].Pile_Id == 0 ? 0 : i)).ToList().GroupBy(m => m.Child_Id).ToList();
                                    //判斷當前組中子商品的數量是否相同
                                    if (tempSearch.Count() == tempPrice.Count())
                                    {
                                        foreach (var item in tempPrice)
                                        {
                                            if (tempSearch.Where(m => m.Key == item.Key.ToString()).ToList().Count() <= 0)//edit 2014/09/24
                                            {
                                                match = false;
                                                break;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        match = false;
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                match = false;
                            }
                        }
                        else
                        {
                            match = false;
                        }

                        if (!match)
                        {
                            _combTempMgr = new ProductComboTempMgr(connectionString);

                            _combTempMgr.comboPriceDelete(new ProductComboTemp { Writer_Id = writer_id, Combo_Type = COMBO_TYPE, Parent_Id = oldProductId });

                            PriceStore.ForEach(rec => rec.price_master_id = 0);

                        }

                        CreateList(PriceStore, null, pMasterTemp, same_price, ItemPList, pMasterListT, pMasterList, update);
                    }

                    pMasterListT.Add(pMasterTemp);

                    //如果原價格為複製價格,則需刪除原複製價格並將child_id設為oldProductId
                    if (oldProductId != "0")
                    {
                        pMasterListT.ForEach(m =>
                        {
                            if (m.child_id == "0")
                            {
                                m.child_id = oldProductId;
                            }
                        });
                    }

                    //查詢                 

                    PriceMasterProductCustom queryReust = _pMasterTempMgr.Query(new PriceMasterTemp() { writer_Id = writer_id, child_id = oldProductId, product_id = oldProductId, combo_type = COMBO_TYPE });
                    //檢查價格類型是否有變動,如果有則刪除原有價格數據
                    if (queryReust != null)
                    {
                        if (!price_type.Equals(queryReust.price_type.ToString()))
                        {
                            _combTempMgr = new ProductComboTempMgr(connectionString);
                            _combTempMgr.comboPriceDelete(new ProductComboTemp { Writer_Id = writer_id, Combo_Type = COMBO_TYPE, Parent_Id = oldProductId.ToString() });
                            queryReust = null;
                        }
                    }

                    if (queryReust == null)//插入
                    {
                        if (price_type == "1")
                        {
                            _pMasterTempMgr.Save(pMasterListT, null, null);
                        }
                        else
                        {
                            _pMasterTempMgr.Save(pMasterListT, ItemPList, null);
                        }
                    }
                    else//更新
                    {
                        if (price_type == "1")
                        {
                            _pMasterTempMgr.Update(pMasterListT, null);
                        }
                        else
                        {
                            _pMasterTempMgr.Update(pMasterListT, update);
                        }
                    }
                    _productTempMgr.PriceBonusInfoSave(pTemp);

                }
                catch (Exception ex)
                {
                    Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                    logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                    logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                    log.Error(logMessage);
                    json = "{success:false,msg:'" + Resources.Product.SAVE_FAIL + "'}";
                }
                #endregion
            }
            return json;
        }
        public HttpResponseBase comboPriceTempDelete()
        {
            resultStr = "{success:false}";
            try
            {
                Caller _caller = (Session["caller"] as Caller);
                _combTempMgr = new ProductComboTempMgr(connectionString);
                ProductComboTemp delete = new ProductComboTemp { Writer_Id = _caller.user_id, Combo_Type = COMBO_TYPE };
                //複製商品時
                if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                {
                    delete.Parent_Id = Request.Form["OldProductId"];
                }
                _combTempMgr.comboPriceDelete(delete);
                resultStr = "{success:true}";
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
        public string groupNameQuery()
        {
            string json = string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    List<ProductCombo> resultList = null;
                    _combMgr = new ProductComboMgr(connectionString);
                    resultList = _combMgr.groupNumQuery(new ProductCombo { Parent_Id = int.Parse(Request.Params["ProductId"]) });
                    json = JsonConvert.SerializeObject(resultList);

                }
                else
                {
                    List<ProductComboTemp> resultList = null;
                    Caller _caller = (Session["caller"] as Caller);
                    _combTempMgr = new ProductComboTempMgr(connectionString);
                    ProductComboTemp query = new ProductComboTemp { Writer_Id = _caller.user_id };
                    //複製商品時
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        query.Parent_Id = Request.Form["OldProductId"];
                    }
                    resultList = _combTempMgr.groupNumQuery(query);
                    json = JsonConvert.SerializeObject(resultList);
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            return json;
        }
        public HttpResponseBase combSpecSave()
        {
            resultStr = "{success:false}";
            try
            {
                Caller _caller = (Session["caller"] as Caller);
                string result = Request.Params["resultStr"];
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    #region 正式表
                    //組合商品之規格目前不支持修改
                    #endregion
                }
                else
                {
                    #region 臨時表
                    _combTempMgr = new ProductComboTempMgr(connectionString);
                    List<ProductComboTemp> comList = JsonConvert.DeserializeObject<List<ProductComboTemp>>(result);
                    string parent_id = "0";
                    //複製商品時
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        parent_id = Request.Form["OldProductId"];
                    }
                    foreach (ProductComboTemp item in comList)
                    {
                        item.Writer_Id = _caller.user_id;
                        item.Parent_Id = parent_id;
                    }

                    if (_combTempMgr.Save(comList))
                    {
                        resultStr = "{success:true}";
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
        public HttpResponseBase combSpecQuery()
        {
            string json = "{success:false}";
            try
            {
                int pileId = 0;
                int.TryParse(Request.Params["pileId"] ?? "0", out pileId);
                uint parentId = 0;

                BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"];
                int writer_id = Convert.ToInt32(vendorModel.vendor_id);
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    if (uint.TryParse(Request.Params["ProductId"].ToString(), out parentId))
                    {
                        _combMgr = new ProductComboMgr(connectionString);
                        json = "{success:true,data:" + JsonConvert.SerializeObject(_combMgr.combQuery(new ProductComboCustom { Parent_Id = int.Parse(Request.Params["ProductId"]), Pile_Id = pileId })) + "}";

                    }
                    else
                    {
                        _combTempMgr = new ProductComboTempMgr(connectionString);
                        ProductComboCustomVendor query = new ProductComboCustomVendor { Writer_Id = writer_id, Pile_Id = pileId, create_channel = 2, temp_status = 12, Parent_Id = Request.Params["ProductId"] };
                        json = "{success:true,data:" + JsonConvert.SerializeObject(_combTempMgr.combQueryByVendor(query)) + "}";
                    }
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            Response.Clear();
            Response.Write(json);
            Response.End();
            return this.Response;
        }
        public HttpResponseBase GetMakePrice()
        {
            resultStr = "{success:false}";
            try
            {
                int pileId = 0;
                int.TryParse(Request.Params["pileId"] ?? "0", out pileId);
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    _combMgr = new ProductComboMgr(connectionString);
                    ProductComboCustom query = new ProductComboCustom { Parent_Id = int.Parse(Request.Params["ProductId"]), Pile_Id = pileId };
                    //複製商品時
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        query.Parent_Id = int.Parse(Request.Form["OldProductId"]);
                    }
                    resultStr = "{success:true,same:" + JsonConvert.SerializeObject(_combMgr.combNoPriceQuery(query)) + ",different:" + JsonConvert.SerializeObject(_combMgr.differentNoPriceSpecQuery(query)) + "}";
                }
                else
                {
                    Caller _caller = (Session["caller"] as Caller);
                    _combTempMgr = new ProductComboTempMgr(connectionString);
                    ProductComboCustom query = new ProductComboCustom { Writer_Id = _caller.user_id, Pile_Id = pileId };
                    //複製商品時
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        query.Parent_Id = int.Parse(Request.Form["OldProductId"]);
                    }
                    resultStr = "{success:true,same:" + JsonConvert.SerializeObject(_combTempMgr.comboPriceQuery(query)) + ",different:" + JsonConvert.SerializeObject(_combTempMgr.differentSpecQuery(query)) + "}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
        public HttpResponseBase combSpecTempDelete()
        {
            string resultStr = "{success:false}";
            try
            {
                _combTempMgr = new ProductComboTempMgr(connectionString);
                BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"];
                int write_Id = Convert.ToInt32(vendorModel.vendor_id);
                ProductComboTemp delete = new ProductComboTemp { Writer_Id = write_Id, Combo_Type = COMBO_TYPE };
                if (!string.IsNullOrEmpty(Request.Form["ProductId"]))
                {
                    delete.Parent_Id = Request.Form["ProductId"].ToString();
                }
                //複製商品時
                //if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                //{
                //    delete.Parent_Id = Request.Form["OldProductId"].ToString();
                //}

                _combTempMgr.DeleteByVendor(delete);
                resultStr = "{success:true}";
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
        public HttpResponseBase combSpecSave()
        {
            string resultStr = "{success:false}";
            try
            {
                BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"];
                int writer_id = Convert.ToInt32(vendorModel.vendor_id);

                string result = Request.Params["resultStr"];

                _combTempMgr = new ProductComboTempMgr(connectionString);
                List<ProductComboTemp> comList = JsonConvert.DeserializeObject<List<ProductComboTemp>>(result);
                string parent_id = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    parent_id = Request.Params["ProductId"];
                }

                //複製商品時
                //if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                //{
                //    parent_id = Request.Form["OldProductId"];
                //}
                foreach (ProductComboTemp item in comList)
                {
                    item.Writer_Id = writer_id;
                    item.Parent_Id = parent_id;
                }

                if (_combTempMgr.SaveByVendor(comList))
                {
                    resultStr = "{success:true}";
                }

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            Response.Clear();
            Response.Write(resultStr);
            Response.End();
            return this.Response;
        }
        public string ComboPriceSave()
        {
            string json = "{success:true,msg:'" + Resources.VendorProduct.SAVE_SUCCESS + "'}";
            #region 參數

            BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"];
            int writer_id = Convert.ToInt32(vendorModel.vendor_id);

            string product_name = Request.Params["product_name"];
            string price_type = Request.Params["price_type"];
            string product_price_list = Request.Params["product_price_list"];
            string price = Request.Params["price"];
            string cost = Request.Params["cost"];
            string max_price = Request.Params["max_price"];
            string event_price = Request.Params["event_price"];
            string event_cost = Request.Params["event_cost"];
            string max_event_price = Request.Params["max_event_price"];
            string event_start = Request.Params["event_start"];
            string event_end = Request.Params["event_end"];
            string bag_check_money = Request.Params["bag_check_money"] == "" ? "0" : Request.Params["bag_check_money"];
            string same_price = Request.Params["same_price"];
            string show_listprice = Request.Params["show_listprice"];
            string valid_start = Request.Params["valid_start"];
            string valid_end = Request.Params["valid_end"];

            #endregion

            string Vendor_productId = string.Empty;
            if (!string.IsNullOrEmpty(Request.Params["product_id"]))
            {
                Vendor_productId = Request.Params["product_id"];
            }
            //if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
            //{
            //    Vendor_productId = Request.Params["OldProductId"];
            //}

            ProductTemp pTemp = new ProductTemp();
            List<PriceMasterTemp> pMasterListT = new List<PriceMasterTemp>();

            List<List<ItemPrice>> ItemPList = new List<List<ItemPrice>>();
            PriceMasterTemp pMasterTemp = new PriceMasterTemp();

            #region 臨時表數據修改
            try
            {
                #region product_temp
                //product_temp
                pTemp.Product_Id = Vendor_productId;
                pTemp.Product_Price_List = uint.Parse(product_price_list);
                pTemp.Writer_Id = writer_id;
                pTemp.Combo_Type = COMBO_TYPE;
                pTemp.Price_type = int.Parse(price_type);
                pTemp.Bag_Check_Money = uint.Parse(bag_check_money);
                pTemp.show_listprice = uint.Parse(show_listprice);
                pTemp.Create_Channel = 2;

                #endregion

                #region Price_Master
                //Price_Master
                pMasterTemp.product_id = Vendor_productId;
                pMasterTemp.product_name = product_name;
                pMasterTemp.writer_Id = writer_id;
                pMasterTemp.combo_type = COMBO_TYPE;
                //默認站臺1:吉甲地,(按統一價格比例拆分)會員等級1:普通會員
                pMasterTemp.site_id = 1;
                pMasterTemp.user_level = 1;
                pMasterTemp.same_price = int.Parse(same_price);
                pMasterTemp.price = int.Parse(price);
                pMasterTemp.cost = int.Parse(cost);
                pMasterTemp.max_price = int.Parse(max_price);
                pMasterTemp.max_event_price = int.Parse(max_event_price);
                pMasterTemp.event_price = int.Parse(event_price);
                pMasterTemp.event_cost = int.Parse(event_cost);
                #endregion

                #region 時間 活動時間
                if (event_start != "")
                {
                    pMasterTemp.event_start = Convert.ToUInt32(CommonFunction.GetPHPTime(event_start));
                }
                if (event_end != "")
                {
                    pMasterTemp.event_end = Convert.ToUInt32(CommonFunction.GetPHPTime(event_end));
                }
                if (!string.IsNullOrEmpty(valid_start))
                {
                    pMasterTemp.valid_start = Convert.ToInt32(CommonFunction.GetPHPTime(valid_start));
                }
                if (!string.IsNullOrEmpty(valid_end))
                {
                    pMasterTemp.valid_end = Convert.ToInt32(CommonFunction.GetPHPTime(valid_end));
                }

                #endregion

                pMasterTemp.price_status = 1;

                pMasterListT.Add(pMasterTemp);

                //如果原價格為複製價格,則需刪除原複製價格並將child_id設為oldProductId
                if (!string.IsNullOrEmpty(Vendor_productId))
                {
                    pMasterListT.ForEach(m =>
                    {
                        if (string.IsNullOrEmpty(m.child_id) || m.child_id == "0")
                        {
                            m.child_id = Vendor_productId.ToString();
                        }
                    });
                }

                //查詢                 
                _pMasterTempMgr = new PriceMasterTempMgr(connectionString);
                PriceMasterProductCustomTemp queryReust = _pMasterTempMgr.QueryByVendor(new PriceMasterTemp() { writer_Id = writer_id, child_id = Vendor_productId.ToString(), product_id = Vendor_productId, combo_type = COMBO_TYPE });
                //檢查價格類型是否有變動,如果有則刪除原有價格數據
                if (queryReust != null)
                {
                    if (!price_type.Equals(queryReust.price_type.ToString()))
                    {
                        _combTempMgr = new ProductComboTempMgr(connectionString);
                        _combTempMgr.comboPriceDeleteByVendor(new ProductComboTemp { Writer_Id = writer_id, Combo_Type = COMBO_TYPE, Parent_Id = Vendor_productId });
                        queryReust = null;
                    }
                }

                if (queryReust == null)//插入
                {
                    if (price_type == "1")
                    {
                        _pMasterTempMgr.SaveByVendor(pMasterListT, null, null);
                    }
                }
                else//更新
                {
                    if (price_type == "1")
                    {
                        _pMasterTempMgr.UpdateByVendor(pMasterListT, null);
                    }
                }
                _productTempMgr = new ProductTempMgr(connectionString);
                _productTempMgr.PriceBonusInfoSaveByVendor(pTemp);

            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{success:false,msg:'" + Resources.VendorProduct.SAVE_FAIL + "'}";
            }
            #endregion

            return json;

        }
        public string groupNameQuery()
        {
            string json = string.Empty;
            try
            {
                BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"];
                string ParentId = string.Empty;
                uint pid = 0;
                if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
                {
                    if (uint.TryParse(Request.Params["ProductId"].ToString(), out pid))
                    {
                        List<ProductCombo> resultList = null;
                        _combMgr = new ProductComboMgr(connectionString);
                        resultList = _combMgr.groupNumQuery(new ProductCombo { Parent_Id = int.Parse(Request.Params["ProductId"]) });
                        json = JsonConvert.SerializeObject(resultList);
                    }
                    else
                    {
                        ParentId = Request.Params["ProductId"];
                        List<ProductComboTemp> resultList = null;
                        int writer_id = Convert.ToInt32(vendorModel.vendor_id);
                        _combTempMgr = new ProductComboTempMgr(connectionString);
                        ProductComboTemp query = new ProductComboTemp { Writer_Id = writer_id, Parent_Id = ParentId };
                        resultList = _combTempMgr.groupNumQueryByVendor(query);
                        json = JsonConvert.SerializeObject(resultList);
                    }
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }

            return json;
        }
        public string ChildStatus(string productid)
        {
            string json = string.Empty;
            string msg = string.Empty;

            try
            {
                bool result = true;

                _pctMgr = new ProductComboTempMgr(connectionString);
                List<ProductTemp> childpro = _pctMgr.QueryChildStatusVendor(new ProductComboTemp { Parent_Id = productid });
                if (childpro.Count != 1)
                {
                    foreach (var item in childpro)
                    {
                        if (item.Product_Id != childpro[0].Product_Id)
                        {
                            if (item.Product_Status != 2 && item.Product_Status != 5 && item.Product_Status != 6)
                            {
                                result = false;
                                msg += "<br/>子商品" + item.Product_Id + "狀態必須是審核通過/上架/下架狀態;";
                                // break;
                            }
                            if (item.Product_Mode != childpro[0].Product_Mode)
                            {//判斷運費
                                result = false;
                                msg += "<br/>子商品" + item.Product_Id + "出貨方式必須與子商品出貨方式一致;";
                                //break;
                            }
                            switch (childpro[0].Product_Freight_Set)
                            {
                                case 1:
                                case 3:
                                    if (item.Product_Freight_Set != 1 && item.Product_Freight_Set != 3)
                                    {
                                        result = false;
                                        msg += "<br/>子商品" + item.Product_Id + "運送方式必須符合父商品運送方式;";
                                        break;
                                    }
                                    break;
                                case 2:
                                case 4:
                                    if (item.Product_Freight_Set != 2 && item.Product_Freight_Set != 4)
                                    {
                                        result = false;
                                        msg += "<br/>子商品" + item.Product_Id + "運送方式必須符合父商品運送方式;";
                                        break;
                                    }
                                    break;
                                case 5:
                                case 6:
                                    if (item.Product_Freight_Set != 5 && item.Product_Freight_Set != 6)
                                    {
                                        result = false;
                                        msg += "<br/>子商品" + item.Product_Id + "運送方式必須符合父商品運送方式;";
                                        break;
                                    }
                                    break;
                                default: result = false; break;
                            }
                        }

                    }
                    if (!result)
                    {
                        json += "編號為" + productid + "組合商品子商品狀態錯誤:" + msg;
                    }
                }
                else
                {
                    json += "編號為" + productid + "子商品錯誤;";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
            }
            return json;
        }
 public HttpResponseBase combSpecQuery()
 {
     string json = "{success:true}";
     try
     {
         int pileId = 0;
         int.TryParse(Request.Params["pileId"] ?? "0", out pileId);
         string parentId = string.Empty;
         _combTempMgr = new ProductComboTempMgr(connectionString);
         if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
         {
             parentId = Request.Params["ProductId"];
         }
         ProductComboCustomVendor query = new ProductComboCustomVendor { Pile_Id = pileId, create_channel = 2, temp_status = 12, Parent_Id = parentId };
         json = "{success:true,data:" + JsonConvert.SerializeObject(_combTempMgr.combQueryByVendor(query)) + "}";
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
     }
     Response.Clear();
     Response.Write(json);
     Response.End();
     return this.Response;
 }
 public string groupNameQuery()
 {
     string json = string.Empty;
     try
     {
         string ParentId = string.Empty;
         if (!string.IsNullOrEmpty(Request.Params["ProductId"]))
         {
             ParentId = Request.Params["ProductId"];
         }
         List<ProductComboTemp> resultList = null;
         _combTempMgr = new ProductComboTempMgr(connectionString);
         ProductComboTemp query = new ProductComboTemp();
         query.Parent_Id = ParentId;
         resultList = _combTempMgr.groupNumQueryByVendor(query);
         json = JsonConvert.SerializeObject(resultList);
     }
     catch (Exception ex)
     {
         Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
         logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
         logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
         log.Error(logMessage);
     }
     return json;
 }