コード例 #1
0
 public HttpResponseBase GetProCateBanList()
 {
     string json = string.Empty;
     List<ProductCategoryBannerQuery> store = new List<ProductCategoryBannerQuery>();
     ProductCategoryBannerQuery query = new ProductCategoryBannerQuery();
     try
     {
         query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
         query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "20");
         if (!string.IsNullOrEmpty(Request.Params["banner_id"]))
         {
             query.banner_cateid = Convert.ToUInt32(Request.Params["banner_id"]);
         }
         int totalCount = 0;
         _IProductCategoryBannerMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
         store = _IProductCategoryBannerMgr.GetProCateBanList(query, out totalCount);
         IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
         //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
         timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回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:false,totalCount:0,data:[]}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
コード例 #2
0
        public HttpResponseBase GetBannerCateBrand()
        {
            string json = "{success:true}";
            _cateBrandMgr = new ProductCategoryBrandMgr(mySqlConnectionString);
            _productCategoryBannerImplMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
            _parameterMgr = new ParameterMgr(mySqlConnectionString);
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["banner_cateid"].ToString()))
                {
                    uint isTryUint = 0;
                    if (uint.TryParse(Request.Params["banner_cateid"].ToString(), out isTryUint))
                    {
                        int banner_cateid = Convert.ToInt32(Request.Params["banner_cateid"].ToString());

                        //獲取新館類別
                        uint XGCateId = _productCategoryBannerImplMgr.GetXGCate().FirstOrDefault().category_id;//獲取754
                        prodCateMgr = new ProductCategoryMgr(mySqlConnectionString);//實例化對象mgr
                        List<ProductCategory> category = prodCateMgr.QueryAll(new ProductCategory { category_display = 1 });//獲取所有的類別 包括隱藏和顯示的
                        List<ProductCategory> cateXGlist = new List<ProductCategory>();//設定對象保存新館所有類別
                        GetAllCategory_idList(category, XGCateId, ref cateXGlist);//獲取所有新館類別
                        List<Parametersrc> pali = _parameterMgr.GetElementType("banner_cate");

                        List<ProductCategoryBrand> XGCateBrandResult = new List<ProductCategoryBrand>();
                        if (pali.Count != 0)
                        {
                            if (cateXGlist != null)
                            {


                                List<ProductCategory> query = category.FindAll(p => p.category_id == banner_cateid).ToList();//判斷是否是類別專區 
                                List<ProductCategoryBrand> ProList = new List<ProductCategoryBrand>();

                                if (query.Count != 0) //新館專區類別設定
                                {
                                    ProList = _cateBrandMgr.GetSaledProduct(XGCateId, banner_cateid);//獲取所有有效商品 以及對應的品牌和館別
                                }
                                else
                                {
                                    ProList = _cateBrandMgr.GetProductByCondi(XGCateId, banner_cateid);
                                }
                                //ProList = _cateBrandMgr.GetSaledProduct(XGCateId);//獲取所有有效商品

                                foreach (ProductCategoryBrand itemcate in ProList)
                                {
                                    ProductCategory querySingle = cateXGlist.Find(p => p.category_id == itemcate.category_id);
                                    if (querySingle != null)
                                    {
                                        itemcate.category_name = querySingle.category_name;
                                        XGCateBrandResult.Add(itemcate);
                                        GetFatherCateBrand(cateXGlist, XGCateId, itemcate, ref  XGCateBrandResult);
                                    }
                                }
                                json = "{success:true,item:" + JsonConvert.SerializeObject(XGCateBrandResult, Formatting.Indented) + "}";//返回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:false,data:[]}";
            }


            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
コード例 #3
0
        public HttpResponseBase GetProductCategoryBanner(string id = "true")
        {
            List<ProductCategoryBannerQuery> categoryList = new List<ProductCategoryBannerQuery>();
            List<ProductCategoryBannerCustom> cateList = new List<ProductCategoryBannerCustom>();
            string resultStr = "";
            try
            {
                _productCategoryBannerImplMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
                ProductCategoryBannerQuery model = new ProductCategoryBannerQuery();
                categoryList = _productCategoryBannerImplMgr.QueryAll(model);
                cateList = ProductCategoryBannerCate(categoryList, 2);
                List<ProductCategorySet> resultList = new List<ProductCategorySet>();

                GetCategoryList(categoryList, ref cateList, resultList);
                resultStr = JsonConvert.SerializeObject(cateList);
            }
            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);
            }

            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return this.Response;
        }
コード例 #4
0
        public HttpResponseBase GetProductByCategorySet()
        {
            string resultStr = "{success:false,msg:0,item:[]}";
            try
            {
                _productCategoryBannerImplMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
                if (!string.IsNullOrEmpty(Request.Params["banner_cateid"].ToString()))
                {
                    uint isTryUint = 0;
                    if (uint.TryParse(Request.Params["banner_cateid"].ToString(), out isTryUint))
                    {
                        uint banner_cateid = Convert.ToUInt32(Request.Params["banner_cateid"].ToString());

                        //獲取新館類別
                        uint fatherid = _productCategoryBannerImplMgr.GetXGCate().FirstOrDefault().category_id;//獲取754
                        prodCateMgr = new ProductCategoryMgr(mySqlConnectionString);//實例化對象mgr
                        List<ProductCategory> category = prodCateMgr.QueryAll(new ProductCategory { category_display = 0 });//獲取所有的類別 包括隱藏和顯示的
                        string cateStr = string.Empty;//設定對象保存新館所有類別
                        GetAllCategory_id(category, fatherid, ref cateStr);//獲取所有新館類別

                        if (!string.IsNullOrEmpty(cateStr))//專區類別處理數據
                        {
                            DataTable dt = new DataTable();
                            List<ProductCategory> query = category.FindAll(p => p.category_id == banner_cateid).ToList();//判斷是否是類別專區 
                            if (query.Count != 0) //新館專區類別設定
                            {
                                dt = _productCategoryBannerImplMgr.isSaleProd(cateStr, banner_cateid);//獲取所有類別
                            }
                            else//不是專區的類別數據  優惠專區999998  優惠專區頁999997 優惠專區頁999996 產地直送999995
                            {
                                dt = _productCategoryBannerImplMgr.GetXGCateByBanner(cateStr, banner_cateid);
                            }

                            string cateStrs = string.Empty;//存儲所有新館類別樹狀結構數據

                            //根據新館子元素找父級元素 新館樹狀結構
                            if (dt.Rows.Count != 0)
                            {
                                bool isTrue = false;
                                string cateStrTree = string.Empty;

                                foreach (DataRow row in dt.Rows)
                                {
                                    if (Convert.ToUInt32(Convert.ToUInt32(row["category_id"])) != banner_cateid)
                                    {
                                        GetFatherCategory_id(category, ref isTrue, fatherid, Convert.ToUInt32(row["category_id"]), ref cateStrTree);
                                        if (isTrue && cateStrTree != null)
                                        {
                                            cateStrs += Convert.ToUInt32(row["category_id"]);
                                            cateStrs += ",";
                                        }
                                    }
                                }
                                cateStrs += cateStrTree;

                                if (!string.IsNullOrEmpty(cateStrs))
                                {
                                    cateStrs = cateStrs.Substring(0, cateStrs.Length - 1);
                                    List<ProductCategory> li = _productCategoryBannerImplMgr.GetProductCategoryInfo(cateStrs);
                                    IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                                    //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                                    timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                                    resultStr = "{success:true,item:" + JsonConvert.SerializeObject(li, Formatting.Indented, timeConverter) + "}";//返回json數據

                                }
                            }
                            else
                            {
                                resultStr = "{success:true,totalCount:0,item:[]}";
                            }
                        }
                    }
                }


            }
            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);
                resultStr = "{success:false,msg:0,item:[]}";
            }


            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return this.Response;
        }
コード例 #5
0
 public JsonResult UpdateState()
 {
     string json = string.Empty;
     ProductCategoryBannerQuery query = new ProductCategoryBannerQuery();
     try
     {
         if (!string.IsNullOrEmpty(Request.Params["id"]))
         {
             query.row_id = Convert.ToInt32(Request.Params["id"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["active"]))
         {
             query.status = Convert.ToInt32(Request.Params["active"]);
         }
         _IProductCategoryBannerMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
         if (_IProductCategoryBannerMgr.UpdateState(query) > 0)
         {
             return Json(new { success = "true", msg = "" });
         }
         else
         {
             return Json(new { success = "false", msg = "" });
         }
     }
     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(new { success = "false", msg = "" });
     }
 }
コード例 #6
0
 public HttpResponseBase DeleteProCateBan()
 {
     string json = string.Empty;
     _IProductCategoryBannerMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
     if (!string.IsNullOrEmpty(Request.Params["rowID"]))
     {
         try
         {
             foreach (string item in Request.Params["rowID"].Split('|'))
             {
                 if (!string.IsNullOrEmpty(item))
                 {
                     _IProductCategoryBannerMgr.DeleteProCateBan(Convert.ToInt32(item));
                 }
             }
             json = "{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);
             json = "{success:false}";
         }
     }
     else
     {
         json = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
コード例 #7
0
        /// <summary>
        /// 新增編輯類別設定信息
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase CategoryBannerSetSave()
        {
            ProductCategoryBannerQuery query = new ProductCategoryBannerQuery();
            _IProductCategoryBannerMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
            string json = string.Empty;
            string insertValues = string.Empty;
            try
            {
                if (!string.IsNullOrEmpty(Request.Params["banner_cateid"]))
                {
                    query.banner_cateid = Convert.ToUInt32(Request.Params["banner_cateid"].ToString());
                }
                if (!string.IsNullOrEmpty(Request.Params["insertValues"]))
                {
                    insertValues = Request.Params["insertValues"].ToString();
                    insertValues = Server.HtmlDecode(insertValues);
                    string[] values = insertValues.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    query.createdate = Convert.ToUInt32(CommonFunction.GetPHPTime(DateTime.Now.ToString()));
                    query.updatedate = query.createdate;
                    query.create_ipfrom = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList.FirstOrDefault().ToString();

                    if (_IProductCategoryBannerMgr.Save(values, query))
                    {
                        json = "{success:true}";
                    }
                    else
                    {
                        json = "{success:false}";
                    }

                }
                else
                {
                    bool b = _IProductCategoryBannerMgr.DeleteByCateId(query);
                    if (b)
                    {
                        json = "{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);
                json = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
コード例 #8
0
        public HttpResponseBase GetProductCatagory()
        {
            //吉甲地美安
            string resultStr = "";
            try
            {
                List<Parametersrc> Market = new List<Parametersrc>();
                _ptersrc = new ParameterMgr(mySqlConnectionString);
                Market = _ptersrc.GetAllKindType("market_category");//物流業者
               

                if (Market.Count > 0)
                {
                    ProductCategory category = new ProductCategory();
                    category.category_name = "新館";
                    List<ProductCategory> categoryStore = new List<ProductCategory>();//-------取新館的id用來獲取product_category_banner的子節點
                   // List<ProductCategory> categoryList = new List<ProductCategory>();
                    List<ProductCategoryCustom> cateList = new List<ProductCategoryCustom>();
                  
                    _procateMgr = new ProductCategoryMgr(mySqlConnectionString);
                   
                    categoryStore = _procateMgr.QueryAll(category);//
                    if (categoryStore.Count > 0)//取father_id;//在product_category表查詢新館的編號
                    {
                        category = categoryStore[0];
                    }
                    else 
                    {
                        category.category_id = 754;
                    }
                    ProductCategoryBannerQuery bannerquery = new ProductCategoryBannerQuery();//查詢裡面屬於新錧裡面美安的父元素和子元素
                    bannerquery.banner_cateid = uint.Parse(Market[0].ParameterCode);
                    bannerquery.IsPage = false;
                    _bannerMgr = new ProductCategoryBannerMgr(mySqlConnectionString);
                    List<ProductCategoryBannerQuery> bannerList = new List<ProductCategoryBannerQuery>();
                    int total = 0;
                    bannerList = _bannerMgr.GetProCateBanList(bannerquery, out total);
                   // categoryList = _procateMgr.GetProductCate(new ProductCategory { });

                    //cateList = getCate(categoryList, "2", Market[0].ParameterCode.ToString());
                    cateList = getCate(bannerList,category.category_id.ToString());
                    GetCategoryList(bannerList, ref cateList);
                   // GetCategoryList(categoryList, ref cateList);
                    resultStr = JsonConvert.SerializeObject(cateList);
                }


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

            this.Response.Clear();
            this.Response.Write(resultStr);
            this.Response.End();
            return this.Response;
        }