Ejemplo n.º 1
0
        public HttpResponseBase SaveBaseInfo()
        {
            string json = "{success:true}";
            int transportDays = -1;///初始化
            uint product_mode = 0;
            uint brand_id = 0;
            try
            {
                string prod_name = (Request.Form["prod_name"] ?? "").Trim();
                string prod_sz = (Request.Form["prod_sz"] ?? "").Trim();
                if (!Product.CheckProdName(prod_name) || !Product.CheckProdName(prod_sz))
                {
                    json = "{success:false,msg:'" + Resources.Product.FORBIDDEN_CHARACTER + "'}";
                    this.Response.Clear();
                    this.Response.Write(json);
                    this.Response.End();
                    return this.Response;
                }
                ProductTemp pTemp = new ProductTemp();
                _productTempMgr = new ProductTempMgr(connectionString);
                _productMgr = new ProductMgr(connectionString);
                Caller _caller = (Session["caller"] as Caller);
                Product p = new Product();
             

                ///add by wwei0216w 2015/8/24
                ///根據product_mode查找供應商對應的自出,寄倉,調度欄位,如果為0則不予保存
                 brand_id = uint.Parse(Request.Form["brand_id"]?? "0");
                 product_mode = uint.Parse(Request.Form["product_mode"]??"0");///獲得product_mode
                 string msg = "寄倉";
                IVendorImplMgr _vendorMgr = new VendorMgr(connectionString);
                List<Vendor> vendorList = _vendorMgr.GetArrayDaysInfo(brand_id);
                if (vendorList.Count > 0)
                {
                    switch (product_mode)
                    {
                        case 1:
                            transportDays = vendorList.FirstOrDefault<Vendor>().self_send_days;
                            msg = "自出";
                            break;
                        case 2:
                            transportDays = vendorList.FirstOrDefault<Vendor>().stuff_ware_days;
                            msg = "寄倉";
                            break;
                        case 3:
                            msg = "調度";
                            transportDays = vendorList.FirstOrDefault<Vendor>().dispatch_days;
                            break;
                        default:
                            break;
                    }
                }

                if (transportDays == 0)
                {
                    json = "{success:false,msg:'" + msg + Resources.Product.TRANSPORT_DAYS + "'}";
                    this.Response.Clear();
                    this.Response.Write(json);
                    this.Response.End();
                    return this.Response;
                }

                //查詢product表。
                if (Request.Params["product_id"] != "")
                {
                    p.Product_Id = uint.Parse(Request.Params["product_id"]);
                    p = _productMgr.Query(p)[0];
                }


                uint product_sort = 0;
                string product_vendor_code = "";
                uint product_start = 0;
                uint product_end = 0;
                uint expect_time = 0;
                uint product_freight_set = 0;
                int tax_type = 0;
                uint combination = 0;
                string expect_msg = string.Empty;
                int show_in_deliver = 0;
                int process_type = 0;
                int product_type = 0;
                uint recommedde_jundge = 0;
                uint recommedde_expend_day = 0;
                string recommededcheckall = string.Empty;
                int purchase_in_advance = 0;
                uint purchase_in_advance_start = 0;
                uint purchase_in_advance_end = 0;
                //庫存
                if (!string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"]))
                {
                    string[] Value = Request.Params["ig_sh_InsertValue"].Split(',');
                    pTemp.Ignore_Stock = int.Parse(Value[0]);
                    pTemp.Shortage = int.Parse(Value[1]);
                    pTemp.stock_alarm = int.Parse(Value[2]);

                    if (Request.Params["product_id"] != "")
                    {
                        p.Ignore_Stock = int.Parse(Value[0]);
                        p.Shortage = int.Parse(Value[1]);
                        p.stock_alarm = int.Parse(Value[2]);
                    }
                }
                else
                {
                    //brand_id = uint.Parse(Request.Form["brand_id"]);
                    product_sort = uint.Parse(Request.Form["product_sort"]);
                    product_vendor_code = Request.Form["product_vendor_code"];
                    product_start = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_start"]).ToString());
                    product_end = uint.Parse(CommonFunction.GetPHPTime(Request.Form["product_end"]).ToString());
                    expect_time = uint.Parse(CommonFunction.GetPHPTime(Request.Form["expect_time"]).ToString());
                    product_freight_set = uint.Parse(Request.Form["product_freight_set"]);
                    tax_type = int.Parse(Request.Form["tax_type"]);
                    combination = uint.Parse(Request.Form["combination"]);
                    //product_mode = uint.Parse(Request.Params["product_mode"]);
                    expect_msg = Request.Form["expect_msg"] ?? "";
                    //商品新增欄位 add by  xiangwang0413w 2014/09/15
                    show_in_deliver = int.Parse(Request.Form["show_in_deliver"]);
                    process_type = int.Parse(Request.Form["process_type"]);
                    product_type = int.Parse(Request.Form["product_type"]);
                    //add by dongya 2015/08/26 
                    recommedde_jundge = uint.Parse(Request.Form["recommedde_jundge"]);//是否選擇了推薦商品屬性 1 表示推薦
                    recommedde_expend_day = 0;
                    if (recommedde_jundge == 1)
                    {
                        if (!string.IsNullOrEmpty(Request.Params["recommededcheckall"]))
                        {
                            recommededcheckall = Request.Params["recommededcheckall"].ToString().TrimEnd(',');//選擇的所有的月數
                        }
                        recommedde_expend_day = uint.Parse(Request.Form["recommedde_expend_day"]);
                    }
                    //add by dongya 2015/09/02 
                    purchase_in_advance = Convert.ToInt32(Request.Form["purchase_in_advance"]);
                    purchase_in_advance_start = uint.Parse(Request.Form["purchase_in_advance_start"]);
                    purchase_in_advance_end = uint.Parse(Request.Form["purchase_in_advance_end"]);
                }

             

                if (string.IsNullOrEmpty(Request.Params["product_id"]))
                {
                    pTemp.Brand_Id = brand_id;
                    pTemp.Prod_Name = prod_name;
                    pTemp.Prod_Sz = prod_sz;
                    pTemp.Product_Name = pTemp.GetProductName();

                    pTemp.Product_Sort = product_sort;
                    pTemp.Product_Vendor_Code = product_vendor_code;
                    pTemp.Product_Start = product_start;
                    pTemp.Product_End = product_end;
                    pTemp.Expect_Time = expect_time;
                    pTemp.Product_Freight_Set = product_freight_set;
                    pTemp.Product_Mode = product_mode;
                    pTemp.Tax_Type = tax_type;
                    pTemp.Combination = combination;
                    pTemp.expect_msg = expect_msg;
                    pTemp.Combo_Type = COMBO_TYPE;
                    pTemp.Create_Channel = 1;// 1:後台管理者(manage_user) edit by xiagnwang0413w 2014/08/09
                    //商品新增欄位 add by  xiangwang0413w 2014/09/15
                    pTemp.Show_In_Deliver = show_in_deliver;
                    pTemp.Process_Type = process_type;
                    pTemp.Product_Type = product_type;

                    //add by zhuoqin0830w  增加新的欄位  2015/03/17
                    pTemp.Deliver_Days = 3;
                    pTemp.Min_Purchase_Amount = 1;
                    pTemp.Safe_Stock_Amount = 1;
                    pTemp.Extra_Days = 0;
                    //add by dongya
                    pTemp.recommedde_jundge = recommedde_jundge;//推薦商品 1表示推薦 0表示不推薦
                    pTemp.months = recommededcheckall;//以1,3,這樣的形式顯示
                    pTemp.expend_day = recommedde_expend_day;
                    //add by dongya 2015/09/02 
                    pTemp.purchase_in_advance = purchase_in_advance;
                    pTemp.purchase_in_advance_start = purchase_in_advance_start;
                    pTemp.purchase_in_advance_end = purchase_in_advance_end;

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

                    //查找臨時表是否存在數據,存在:更新,不存在插入
                    pTemp.Writer_Id = _caller.user_id;
                    pTemp.Product_Status = 0;
                    if (!string.IsNullOrEmpty(Request.Form["OldProductId"]))
                    {
                        pTemp.Product_Id = Request.Form["OldProductId"];
                    }

                   

                    ProductTemp query = new ProductTemp { Writer_Id = pTemp.Writer_Id, Combo_Type = COMBO_TYPE, Product_Id = pTemp.Product_Id };
                    ProductTemp pTempList = _productTempMgr.GetProTemp(query);
                    if (pTempList == null)
                    {
                        //插入
                        int result = 0;
                        result = _productTempMgr.baseInfoSave(pTemp);
                        if (result >0)
                        {
                            json = "{success:true}";
                        }
                        else
                        {
                            json = "{success:false}";
                        }
                    }
                    else
                    {

                        //更新
                        if (!string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"]))
                        {
                            _productTempMgr.ProductTempUpdate(pTemp, "stock");
                        }
                        else
                        {
                            if (pTemp.Product_Mode != 2)
                            {
                                pTemp.Bag_Check_Money = 0;
                            }
                            else
                            {
                                pTemp.Bag_Check_Money = pTempList.Bag_Check_Money;
                            }
                            _productTempMgr.baseInfoUpdate(pTemp);
                        }

                    }
                }
                else
                {
                   
                    if (string.IsNullOrEmpty(Request.Params["ig_sh_InsertValue"]))
                    {
                        p.Brand_Id = brand_id;
                        p.Prod_Name = prod_name;
                        p.Prod_Sz = prod_sz;
                        p.Product_Name = p.GetProductName();

                        p.Product_Sort = product_sort;
                        p.Product_Vendor_Code = product_vendor_code;
                        p.Product_Start = product_start;
                        p.Product_End = product_end;
                        p.Expect_Time = expect_time;
                        p.Product_Freight_Set = product_freight_set;
                        p.Product_Mode = product_mode;
                        p.Tax_Type = tax_type;
                        p.expect_msg = expect_msg;//預留商品信息
                        p.Combination = combination;
                        //商品新增欄位 add by  xiangwang0413w 2014/09/15
                        p.Show_In_Deliver = show_in_deliver;
                        p.Process_Type = process_type;
                        p.Product_Type = product_type;

                        //add by zhuoqin0830w  增加新的欄位  2015/03/17
                        p.Deliver_Days = 3;
                        p.Min_Purchase_Amount = 1;
                        p.Safe_Stock_Amount = 1;
                        p.Extra_Days = 0;
                        p.off_grade = int.Parse(Request.Form["off-grade"]);
                        //add by dongya
                        p.recommedde_jundge = recommedde_jundge;//推薦商品 1表示推薦 0表示不推薦
                        p.months = recommededcheckall;//以1,3,這樣的形式顯示
                        p.expend_day = recommedde_expend_day;
                        //add by dongya 0410j
                        p.purchase_in_advance = purchase_in_advance;
                        p.purchase_in_advance_start = purchase_in_advance_start;
                        p.purchase_in_advance_end = purchase_in_advance_end;
                        //更新正式表
                        p.Product_Id = uint.Parse(Request.Params["product_id"]);
                        if (p.Product_Mode != 2)
                        {
                            p.Bag_Check_Money = 0;
                        }

                        #region ScheduleRelation
                        int scheduleId = int.Parse(Request.Form["schedule_id"]);
                        IScheduleRelationImplMgr _srMgr = new ScheduleRelationMgr(connectionString);
                        _srMgr.Save(new ScheduleRelation { relation_table = "product", relation_id = (int)p.Product_Id, schedule_id = scheduleId });
                        #endregion

                    }
                    _tableHistoryMgr = new TableHistoryMgr(connectionString);
                    _productMgr = new ProductMgr(connectionString);
                    _categorySetMgr = new ProductCategorySetMgr(connectionString);
                    ArrayList aList = new ArrayList();
                    aList.Add(_productMgr.Update(p));
                    aList.Add(_categorySetMgr.UpdateBrandId(new ProductCategorySet { Product_Id = p.Product_Id, Brand_Id = p.Brand_Id })); //add by wwei0216w 2015/2/24 品牌名稱變更后,product_category_set表所對應的品牌名稱也需要更新

                    _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;

                    if (_tableHistoryMgr.SaveHistory<Product>(p, batch, aList))
                    {
                        #region add by zhuoqin0830w  2015/06/25  判斷修改的商品是否是失格商品  1為失格 0為正常
                        if (!string.IsNullOrEmpty(Request.Params["product_id"]))
                        {
                            _productMgr.UpdateOff_Grade(p.Product_Id, p.off_grade);
                        }
                        #endregion
                        //add by wwei0216 2015/1/9 刪除不符合條件的物品匹配模式
                        if (!p.CheckdStoreFreight())
                        {
                            IProductDeliverySetImplMgr _productDeliverySetMgr = new ProductDeliverySetMgr(connectionString);
                            _productDeliverySetMgr.Delete(
                                new ProductDeliverySet { Freight_big_area = 1, Freight_type = 12 }, p.Product_Id);
                        }

                        #region 推薦商品屬性插入/修改recommended_product_attribute表中做記錄 add by dongya 2015/09/30 ----目前只針對單一商品
                        RecommendedProductAttributeMgr rProductAttributeMgr = new RecommendedProductAttributeMgr(connectionString);
                        RecommendedProductAttribute rPA = new RecommendedProductAttribute();
                        rPA.product_id = Convert.ToUInt32(p.Product_Id);
                        rPA.time_start = 0;
                        rPA.time_end = 0;
                        rPA.expend_day = recommedde_expend_day;
                        rPA.months = recommededcheckall;
                        rPA.combo_type = 2;//組合商品
                        //首先判斷表中是否對該product_id設置為推薦
                        int productId = Convert.ToInt32(rPA.product_id);
                        if (rProductAttributeMgr.GetMsgByProductId(productId) > 0)//如果大於0,表示推薦表中存在數據
                        {
                            if (recommedde_jundge == 1)//==1表示推薦 
                            {
                                rProductAttributeMgr.Update(rPA);
                            }
                            else if (recommedde_jundge == 0)//==0表示不推薦 
                            {
                                rProductAttributeMgr.Delete(productId);
                            }
                        }
                        else
                        {
                            if (recommedde_jundge == 1)//==1表示推薦 
                            {
                                rProductAttributeMgr.Save(rPA);
                            }
                        }
                        #endregion
                        json = "{success:true,msg:'" + Resources.Product.SAVE_SUCCESS + "'}";
                    }
                    else
                    {
                        json = "{success:false,msg:'" + Resources.Product.SAVE_FAIL + "'}";
                    }
                }
            }
            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 + "'}";
            }

            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 2
0
        public HttpResponseBase GetVendor()
        {
            _vendorMgr = new VendorMgr(mySqlConnectionString);
            List<Vendor> stores = new List<Vendor>();
            string json = string.Empty;
            try
            {
                stores = _vendorMgr.VendorQueryList(new Vendor());

                json = "{success:true,data:" + JsonConvert.SerializeObject(stores) + "}";//返回json數據

            }
            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:true,totalCount:0,data:[]}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 3
0
 public List<Parametersrc> GetValue(int keyValue)
 {
     ///獲得value值,value值一般為根據key值所得到的信息集合,例如供應商,則查詢所有供應商的信息,
     ///品牌則查詢所有品牌信息
     List<Parametersrc> listParametersrc = new List<Parametersrc>();
     try
     {
         switch (keyValue)
         { 
             case 1:
                 IVendorImplMgr _vendorMge = new VendorMgr(connectionString);
                 List<Vendor> list = _vendorMge.VendorQueryAll(new Vendor());
                 list = list.FindAll(m => m.vendor_status == 1);
                 foreach (var v in list)
                 {
                     listParametersrc.Add(new Parametersrc { ParameterCode = v.vendor_id.ToString(),parameterName = v.vendor_name_full});
                 }
                 return listParametersrc;
             default:
                 return listParametersrc;
         }
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleMgr-->GetValue" + ex.Message, ex);
     }
 }
Ejemplo n.º 4
0
        public HttpResponseBase GetUserInfo()
        {
            string json = "{success:false}";
            try
            {
                int type = 0; int related_id = 0; string urlType = string.Empty; int totalCount = 0;
                int info_id = 0; string info_type = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params["relatedID"]))
                {
                    related_id = Convert.ToInt32(Request.Params["relatedID"].ToString());//表主鍵欄位
                }
                if (!string.IsNullOrEmpty(Request.Params["type"]))
                {
                    type = Convert.ToInt32(Request.Params["type"].ToString());//secret_type,表某一模塊
                }
                if (!string.IsNullOrEmpty(Request.Params["urlType"]))//url地址
                {
                    urlType = Request.Params["urlType"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["info_id"]))
                {
                    info_id = Convert.ToInt32(Request.Params["info_id"].ToString());
                }
                if (!string.IsNullOrEmpty(Request.Params["info_type"]))
                {
                    info_type = Request.Params["info_type"].ToString();
                }
                switch (info_type)//1.會員查詢頁面2.訂單內容3.簡訊查詢4.聯絡客服列表
                {
                    case "users":
                        UsersMgr _usermgr = new UsersMgr(mySqlConnectionString);
                        Users u = new Users();
                        Users uModel = _usermgr.GetUser(new Users { user_id = Convert.ToUInt32(info_id) }).FirstOrDefault();

                        if (uModel != null)
                        {
                            if (!string.IsNullOrEmpty(uModel.user_mobile))
                            {
                                if (!CommonFunction.isMobile(uModel.user_mobile))
                                {
                                    if (uModel.user_mobile.ToString().Length == 48)
                                    {
                                        uModel.user_mobile = EncryptComputer.EncryptDecryptTextByApi(uModel.user_mobile, false);
                                        if (!CommonFunction.isMobile(uModel.user_mobile))
                                        {
                                            //異常記錄
                                            Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                                            logMessage.Content = string.Format("表名:{0},編號:{1},行動電話:{2},Message:{3}", "users", uModel.user_id, uModel.user_mobile, "行動電話解密后不滿足正則表達式");
                                            logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                                            log.Error(logMessage);
                                        }
                                    }
                                    else
                                    {
                                        //異常記錄
                                        Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                                        logMessage.Content = string.Format("表名:{0},編號:{1},行動電話:{2},Message:{3}", "users", uModel.user_id, uModel.user_mobile, "行動電話錯誤");
                                        logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                                        log.Error(logMessage);
                                    }
                                }
                            }
                        }
                        json = "{success:true,\"user_id\":\"" + uModel.user_id + "\",\"user_name\":\"" + uModel.user_name + "\",\"user_email\":\"" + uModel.user_email + "\",\"user_mobile\":\"" + uModel.user_mobile + "\",\"user_adress\":\"" + uModel.user_address + "\"}";

                        this.Response.Clear();
                        this.Response.Write(json);
                        this.Response.End();
                        return this.Response;
                    case "trial_share":
                        TrialRecordMgr _recordMgr = new TrialRecordMgr(mySqlConnectionString);
                        TrialShare tModel = _recordMgr.GetTrialShare(new TrialShare { share_id = related_id, user_id = info_id });
                        json = "{success:true,\"user_id\":\"" + tModel.user_id + "\",\"user_name\":\"" + tModel.user_name + "\"}";
                        break;
                    case "manager_user":
                        ManageUserMgr _muMgr = new ManageUserMgr(mySqlConnectionString);
                        ManageUser muModel = _muMgr.GetManageUser(new ManageUser { user_id = Convert.ToUInt32(info_id) }).FirstOrDefault();
                        json = "{success:true,\"user_id\":\"" + muModel.user_id + "\",\"user_name\":\"" + muModel.user_username + "\",\"user_email\":\"" + muModel.user_email + "\"}";
                        break;
                    case "vip_user":
                        VipUserMgr vipusersMgr = new VipUserMgr(mySqlConnectionString);
                        VipUser model = vipusersMgr.GetSingleByID(related_id);
                        json = "{success:true,\"v_id\":\"" + model.v_id + "\",\"user_id\":\"" + model.user_id + "\",\"user_email\":\"" + model.user_email + "\"}";
                        break;
                    case "edm_group_email":
                        EdmGroupEmailMgr edmgroupmailMgr = new EdmGroupEmailMgr(mySqlConnectionString);
                        EdmGroupEmailQuery egemodel = edmgroupmailMgr.GetModel(new EdmGroupEmail { email_id = Convert.ToUInt32(related_id), group_id = Convert.ToUInt32(info_id) }).FirstOrDefault();
                        json = "{success:true,\"user_id\":\"" + egemodel.email_id + "\",\"user_name\":\"" + egemodel.email_name + "\",\"user_email\":\"" + egemodel.email_address + "\"}";
                        break;
                    case "edm_test":
                        EdmTestMgr edmtestMgr = new EdmTestMgr(mySqlConnectionString);
                        EdmTestQuery etmodel = edmtestMgr.GetModel(new EdmTestQuery { email_id = Convert.ToUInt32(related_id) }).FirstOrDefault();
                        json = "{success:true,\"user_id\":\"" + etmodel.email_id + "\",\"user_name\":\"" + etmodel.test_username + "\",\"user_email\":\"" + etmodel.email_address + "\"}";

                        break;
                    case "order_master":
                        OrderMasterMgr omMgr = new OrderMasterMgr(mySqlConnectionString);
                        zMgr = new ZipMgr(mySqlConnectionString);
                        DataTable dt = omMgr.GetOrderidAndName(related_id);
                        json = "{success:true,\"order_id\":\"" + dt.Rows[0][0] + "\",\"order_name\":\"" + dt.Rows[0][1] + "\",\"order_phone\":\"" + dt.Rows[0][2] + "\",\"order_mobile\":\"" + dt.Rows[0][3] + "\",\"order_address\":\"" + zMgr.Getaddress(int.Parse(dt.Rows[0][9].ToString())) + dt.Rows[0][4] + "\",\"delivery_name\":\"" + dt.Rows[0][5] + "\",\"delivery_phone\":\"" + dt.Rows[0][6] + "\",\"delivery_mobile\":\"" + dt.Rows[0][7] + "\",\"delivery_address\":\"" + zMgr.Getaddress(int.Parse(dt.Rows[0][10].ToString())) + dt.Rows[0][8] + "\"}";
                        break;
                    case "order_master1":
                        OrderMasterMgr omMgr1 = new OrderMasterMgr(mySqlConnectionString);
                        DataTable dt1 = omMgr1.GetOrderidAndName(related_id);
                        json = "{success:true,\"order_id\":\"" + dt1.Rows[0][0] + "\",\"order_name\":\"" + dt1.Rows[0][1] + "\"}";
                        break;
                    case "order_payment_hitrust":
                        TabShowMgr OphMgr = new TabShowMgr(mySqlConnectionString);
                        DataTable store = new DataTable();
                        store = OphMgr.GetOderHitrustDT(related_id);
                        json = "{success:true,\"id\":\"" + store.Rows[0]["id"] + "\",\"pan\":\"" + store.Rows[0]["pan"] + "\",\"bankname\":\"" + store.Rows[0]["bankname"] + "\"}";
                        break;
                    case "order_payment_nccc":
                        TabShowMgr OpnMgr = new TabShowMgr(mySqlConnectionString);
                        DataTable Opn = new DataTable();
                        store = OpnMgr.GetNCCC(related_id);
                        json = "{success:true,\"nccc_id\":\"" + Opn.Rows[0]["nccc_id"] + "\",\"nccc_pan\":\"" + Opn.Rows[0]["pan"] + "\",\"nccc_bankname\":\"" + Opn.Rows[0]["bankname"] + "\"}";
                        break;
                    //case "send_mail":
                    //    SendMailMgr sendmailMgr = new SendMailMgr(mySqlConnectionString);
                    //    SendMail sendModel = sendmailMgr.GetModel(new SendMail { id = related_id });
                    //    json = "{success:true,\"sender_address\":\"" + sendModel.sender_address + "\",\"sender_name\":\"" + sendModel.sender_name + "\",\"send_type\":\"" + sendModel.send_type
                    //        + "\",\"recipient\":\"" + sendModel.recipient + "\",\"recipient_name\":\"" + sendModel.recipient_name
                    //        + "\"}";
                    //    break;
                }
                switch (type)//1.會員查詢頁面2.訂單內容3.簡訊查詢4.聯絡客服列表
                {
                    case 1:
                        if (urlType == "/Member/RecommendMember")//推薦會員中推薦者的信息
                        {
                            UserRecommendMgr _userrecommendMgr = new UserRecommendMgr(mySqlConnectionString);
                            DataTable _urdtno = _userrecommendMgr.getUserInfo(related_id);
                            if (_urdtno.Rows.Count > 0)
                            {

                                json = "{success:true,\"user_id\":\"" + "" + "\",\"user_name\":\"" + "" + "\",\"user_email\":\"" + "" + "\",\"user_adress\":\"" + "" + "\",\"ur_name\":\"" + _urdtno.Rows[0]["name"] + "\",\"ur_mail\":\"" + _urdtno.Rows[0]["mail"] + "\",\"no_ur_name\":\"" + _urdtno.Rows[0]["user_name"] + "\"}";
                            }
                        }
                        else if (urlType == "/Member/UserLoginLog")//會員登入記錄
                        {
                            UserLoginLogMgr _userloginlog = new UserLoginLogMgr(mySqlConnectionString);
                            DataTable _dtull = _userloginlog.GetUserInfo(related_id);
                            if (_dtull.Rows.Count > 0)
                            {

                                json = "{success:true,\"user_id\":\"" + _dtull.Rows[0]["user_id"] + "\",\"user_name\":\"" + _dtull.Rows[0]["user_name"] + "\",\"user_email\":\"" + _dtull.Rows[0]["user_email"] + "\",\"user_adress\":\"" + _dtull.Rows[0]["user_address"] + "\"}";
                            }
                        }
                        else
                        {
                            UsersListMgr _userMgr = new UsersListMgr(mySqlConnectionString);
                            BLL.gigade.Model.Custom.Users _user = _userMgr.getModel(related_id);
                            if (_user != null)
                            {

                                json = "{success:true,\"user_id\":\"" + _user.user_id + "\",\"user_name\":\"" + _user.user_name + "\",\"user_email\":\"" + _user.user_email + "\",\"user_adress\":\"" + _user.user_address + "\"}";
                            }
                        }
                        break;
                    case 2:
                        OrderQuestionMgr _IOrderQuesMgr = new OrderQuestionMgr(mySqlConnectionString);
                        DataTable _dtques = _IOrderQuesMgr.GetUserInfo(related_id);
                        if (_dtques.Rows.Count > 0)
                        {

                            json = "{success:true,\"user_id\":\"" + _dtques.Rows[0]["user_id"] + "\",\"user_name\":\"" + _dtques.Rows[0]["user_name"] + "\",\"user_email\":\"" + _dtques.Rows[0]["user_email"] + "\",\"user_adress\":\"" + "" + "\",\"order_id\":\"" + _dtques.Rows[0]["order_id"] + "\"}";
                        }
                        break;
                    case 3:
                        SmsMgr _ISmsMgr = new SmsMgr(mySqlConnectionString);

                        SmsQuery SmsStore = _ISmsMgr.GetSmsList(new SmsQuery { id = related_id }, out totalCount).FirstOrDefault();
                        if (SmsStore != null)
                        {

                            json = "{success:true,\"user_id\":\"" + "" + "\",\"user_name\":\"" + "" + "\",\"user_email\":\"" + "" + "\",\"user_mobile\":\"" + SmsStore.mobile + "\",\"user_adress\":\"" + "" + "\"}";
                        }
                        break;
                    case 4:
                        ContactUsQuestionMgr _ctactMgr = new ContactUsQuestionMgr(mySqlConnectionString);
                        DataTable _dt = _ctactMgr.GetUserInfo(related_id);
                        if (_dt.Rows.Count > 0)
                        {

                            json = "{success:true,\"user_id\":\"" + _dt.Rows[0]["user_id"] + "\",\"user_name\":\"" + _dt.Rows[0]["user_name"] + "\",\"user_email\":\"" + _dt.Rows[0]["user_email"] + "\",\"user_adress\":\"" + "" + "\"}";
                        }
                        break;
                    case 7://供應商詳情
                        VendorQuery _dtven = null;
                        if (urlType == "/Vendor/VendorBrandList")
                        {
                            VendorBrandSetMgr _IvendorBrandSet = new VendorBrandSetMgr(mySqlConnectionString);
                            VendorBrandSetQuery query = _IvendorBrandSet.GetModelById(related_id);
                            VendorMgr _vendorMgr = new VendorMgr(mySqlConnectionString);

                            _dtven = _vendorMgr.Query(new VendorQuery { vendor_id = query.vendor_id, IsPage = false }, ref totalCount).FirstOrDefault();
                            if (_dtven != null)
                            {
                                json = "{success:true,\"user_id\":\"" + "" + "\",\"user_name\":\"" + _dtven.vendor_name_full + "\",\"user_email\":\"" + "" + "\",\"user_phone\":\"" + "" + "\",\"user_adress\":\"" + "" + "\",\"simple_name\":\"" + _dtven.vendor_name_simple + "\"}";
                            }
                        }
                        else if (urlType == "/Vendor/VendorLoginList")
                        {
                            VendorLoginListMgr _Ivendorloginlist = new VendorLoginListMgr(mySqlConnectionString);

                            VendorLoginQuery query = _Ivendorloginlist.Query(new VendorLoginQuery { login_id = Convert.ToUInt32(related_id), IsPage = false }, out totalCount).FirstOrDefault();
                            VendorMgr _vendorMgr = new VendorMgr(mySqlConnectionString);

                            _dtven = _vendorMgr.Query(new VendorQuery { vendor_id = query.vendor_id, IsPage = false }, ref totalCount).FirstOrDefault();
                            if (_dtven != null)
                            {
                                json = "{success:true,\"user_id\":\"" + _dtven.vendor_code + "\",\"user_name\":\"" + _dtven.vendor_name_full + "\",\"user_email\":\"" + "" + "\",\"user_phone\":\"" + "" + "\",\"user_adress\":\"" + "" + "\",\"simple_name\":\"" + _dtven.vendor_name_simple + "\"}";
                            }
                        }
                        else
                        {
                            VendorMgr _vendorMgr = new VendorMgr(mySqlConnectionString);

                            _dtven = _vendorMgr.Query(new VendorQuery { vendor_id = Convert.ToUInt32(related_id), IsPage = false }, ref totalCount).FirstOrDefault();
                            if (_dtven != null)
                            {
                                json = "{success:true,\"user_id\":\"" + _dtven.vendor_code + "\",\"user_name\":\"" + _dtven.vendor_name_full + "\",\"user_email\":\"" + _dtven.vendor_email + "\",\"user_phone\":\"" + "" + "\",\"user_adress\":\"" + _dtven.vendor_company_address + "\",\"simple_name\":\"" + _dtven.vendor_name_simple + "\"}";
                            }

                        }

                        break;
                    case 9:
                        MailUserMgr _IMailUserMgr = new MailUserMgr(mySqlConnectionString);
                        DataTable _dtmu = _IMailUserMgr.GetUserInfo(related_id);
                        if (_dtmu.Rows.Count > 0)
                        {

                            json = "{success:true,\"user_id\":\"" + _dtmu.Rows[0]["user_id"] + "\",\"user_name\":\"" + _dtmu.Rows[0]["user_name"] + "\",\"user_email\":\"" + _dtmu.Rows[0]["user_email"] +  "\",\"user_adress\":\"" + _dtmu.Rows[0]["user_address"] + "\"}";                        }
                        break;
                    case 10:
                        PaperAnswerMgr _paperAnswerMgr = new PaperAnswerMgr(mySqlConnectionString);
                        PaperAnswer store = _paperAnswerMgr.GetPaperAnswerList(new PaperAnswer { answerID = related_id, IsPage = false }, out totalCount).FirstOrDefault();
                        if (store != null)
                        {
                            json = "{success:true,\"user_id\":\"" + store.userid + "\",\"user_name\":\"" + "" + "\",\"user_email\":\"" + store.userMail + "\",\"user_phone\":\"" + "" + "\",\"user_adress\":\"" + "" + "\"}";
                        }
                        break;
                    case 14://會員等級歷程
                        UserLevelLogMgr _userLevelLog = new UserLevelLogMgr(mySqlConnectionString);
                        //   UserLevelLogQuery store


                        UserLevelLogQuery levelStore = _userLevelLog.GetUserLevelLogList(new UserLevelLogQuery { user_id = Convert.ToUInt32(related_id), IsPage = false, isSecret = false }, out totalCount).FirstOrDefault();
                        if (levelStore != null)
                        {
                            json = "{success:true,\"user_id\":\"" + levelStore.user_id + "\",\"user_name\":\"" + levelStore.user_name + "\",\"user_email\":\"" + levelStore.user_email + "\"}";
                        }
                        break;
                    case 18://企業會員管理
                        _vipUserGroup = new VipUserGroupMgr(mySqlConnectionString);

                        VipUserGroupQuery vipStore = _vipUserGroup.GetVipUserGList(new VipUserGroupQuery { group_id = Convert.ToUInt32(related_id), IsPage = false, isSecret = false }, out totalCount).FirstOrDefault();
                        if (vipStore != null)
                        {
                            json = "{success:true,\"group_committe_chairman\":\"" + vipStore.group_committe_chairman + "\",\"group_committe_phone\":\"" + vipStore.group_committe_phone + "\",\"group_committe_mail\":\"" + vipStore.group_committe_mail + "\"}";
                        }
                        break;
                    case 19://商品點擊查詢
                        _IBrowseDataMgr = new BrowseDataMgr(mySqlConnectionString);
                        DataTable _dtBrowse = _IBrowseDataMgr.GetBrowseDataList(new BrowseDataQuery { id = related_id, IsPage = false, isSecret = false }, out totalCount);
                        string user_name = (_dtBrowse.Rows[0]["user_name"].ToString());
                        string user_id = (_dtBrowse.Rows[0]["user_id"].ToString());
                        json = "{success:true,\"user_name\":\"" + user_name + "\",\"user_id\":\"" + user_id + "\"}";
                        break;
                    case 22://聯合信用卡銀行卡號
                        _tabshow = new TabShowMgr(mySqlConnectionString);

                        //  OrderPaymentNcccQuery OPNQuery = new OrderPaymentNcccQuery();
                        OrderPaymentNcccQuery OPNQuery = _tabshow.GetNCCC(new OrderPaymentNcccQuery { nccc_id = (uint)related_id, IsPage = false, isSecret = false }, out totalCount).FirstOrDefault();
                        json = "{success:true,\"nccc_id\":\"" + OPNQuery.nccc_id + "\",\"nccc_pan\":\"" + OPNQuery.pan + "\",\"nccc_bankname\":\"" + OPNQuery.bankname + "\"}";
                        break;
                    case 23://退貨
                        _orderReturnStatus = new OrderReturnStatusMgr(mySqlConnectionString);

                        OrderMaster om = _orderReturnStatus.GetOrderInfo(Convert.ToUInt32(related_id));


                        json = "{success:true,\"orc_name\":\"" + om.Delivery_Name + "\",\"orc_mobile\":\"" + om.Delivery_Mobile + "\",\"orc_address\":\"" + om.Delivery_Address + "\"}";
                        break;

                }

            }
            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}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }