public List<VendorBrandSet> Query(VendorBrandSet vbs) { StringBuilder sbSql = new StringBuilder(); List<VendorBrandSet> list = new List<VendorBrandSet>(); try { sbSql.Append("select id,brand_id,class_id from vendor_brand_set where 1=1 "); if (vbs.class_id != 0) { sbSql.AppendFormat(" and class_id='{0}'", vbs.class_id); } list = _dbAccess.getDataTableForObj<VendorBrandSet>(sbSql.ToString()); } catch (Exception ex) { throw new Exception("VendorBrandSetDao-->Query-->" + ex.Message + "sql:" + sbSql.ToString(), ex); } return list; }
public List<VendorBrandSet> GetClassId(VendorBrandSet vbs) { return _vendorBrandSetDao.GetClassId(vbs); }
public List<Model.VendorBrandSet> Query(VendorBrandSet vbs) { return _vendorBrandSetDao.Query(vbs); }
public HttpResponseBase GetProductByCategorySet() { string resultStr = "{success:false}"; try { _productMgr = new ProductMgr(connectionString); ProductQuery query = new ProductQuery(); query.isjoincate = true; query.IsPage = true; query.Start = int.Parse(Request.Form["start"] ?? "0"); if (!string.IsNullOrEmpty(Request.Form["limit"])) { query.Limit = Convert.ToInt32(Request.Form["limit"].ToString()); } else { query.Limit = 500; } uint isTryUint = 0; if (uint.TryParse(Request.Params["status"].ToString(), out isTryUint)) { query.Product_Status = Convert.ToUInt32(Request.Params["status"].ToString()); } if (uint.TryParse(Request.Params["brand_id"].ToString(), out isTryUint)) { query.Brand_Id = Convert.ToUInt32(Request.Params["brand_id"].ToString()); } else { if (!string.IsNullOrEmpty(Request.Params["class_id"])) { VendorBrandSetMgr vbsMgr = new VendorBrandSetMgr(connectionString); VendorBrandSet vbs = new VendorBrandSet(); vbs.class_id = Convert.ToUInt32(Request.Form["class_id"]); List<VendorBrandSet> vbsList = vbsMgr.Query(vbs); foreach (VendorBrandSet item in vbsList) { query.brandArry += item.brand_id; query.brandArry += ","; } query.brandArry = query.brandArry.Substring(0, query.brandArry.Length - 1); } } if (!string.IsNullOrEmpty(Request.Params["keyCode"].ToString())) { string keyCode = Request.Params["keyCode"].ToString(); keyCode = keyCode.Replace(",", ","); keyCode = Regex.Replace(keyCode, @"\s+", ","); if (keyCode.Substring(keyCode.Length - 1).Equals(",")) { keyCode = keyCode.Substring(0, keyCode.Length - 1); } string[] ProductID = keyCode.Split(','); try { for (int i = 0; i < ProductID.Length; i++) { int ID = int.Parse(ProductID[i]); } query.Product_Id = 0; query.Product_Id_In = keyCode; } catch (Exception) { query.Product_Name = Request.Params["keyCode"].ToString(); } } //if (!string.IsNullOrEmpty(Request.Params["keyCode"].ToString())) //{ // if (uint.TryParse(Request.Params["keyCode"].ToString(), out isTryUint)) // { // query.Product_Id = Convert.ToUInt32(Request.Params["keyCode"].ToString()); // } // else // { // query.Product_Name = Request.Params["keyCode"].ToString(); // } //} if (string.IsNullOrEmpty(Request.Params["category_id"].ToString())) { if (uint.TryParse(Request.Params["comboFrontCage_hide"].ToString(), out isTryUint)) { query.category_id = Convert.ToUInt32(Request.Params["comboFrontCage_hide"].ToString()); } } else { if (uint.TryParse(Request.Params["category_id"].ToString(), out isTryUint)) { query.category_id = Convert.ToUInt32(Request.Params["category_id"].ToString()); } } int totalCount = 0; List<ProductDetailsCustom> prods = _productMgr.GetAllProList(query, out totalCount); resultStr = "{succes:true,totalCount:" + totalCount + ",item:" + JsonConvert.SerializeObject(prods) + "}"; } 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 = "{succes:false,totalCount:0,item:[]}"; } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public HttpResponseBase QueryProList() { string json = string.Empty; string _classid = String.Empty; PromotionsMaintainDao pmDao = new PromotionsMaintainDao(connectionString); try { QueryVerifyCondition query = new QueryVerifyCondition(); #region 查询条件填充 query.IsPage = true; query.Start = int.Parse(Request.Params["start"] ?? "0"); query.Limit = int.Parse(Request.Params["limit"] ?? "25"); if (!string.IsNullOrEmpty(Request.Params["ProCatid"]))//活動的category_id { query.cate_id = Request.Form["ProCatid"].ToString(); } if (!string.IsNullOrEmpty(Request.Params["key"]))//變動1支持商品編號的批次查詢 { query.product_name = Request.Params["key"].Replace(',', ',').Replace('|', ',').Replace(' ', ','); //在這裡product_id用,分割拼接的字符串用product_name 存放 } if (!string.IsNullOrEmpty(Request.Params["site_id"]))//支持多站台查詢 { query.site_ids = Request.Params["site_id"].ToString(); } if (!string.IsNullOrEmpty(Request.Params["comboFrontCage_hide"]))//支持類別查詢商品 { query.category_id = Convert.ToUInt32(Request.Params["comboFrontCage_hide"].ToString()); } #endregion query.combination = 1;//只顯示單一商品 int totalCount = 0; if (!string.IsNullOrEmpty(Request.Params["brand_id"]))//支持品牌查詢 { query.brand_id = uint.Parse(Request.Params["brand_id"]); } else { if (!string.IsNullOrEmpty(Request.Params["class_id"]))//支持館別查詢 { VendorBrandSetMgr vbsMgr = new VendorBrandSetMgr(connectionString); VendorBrandSet vbs = new VendorBrandSet(); vbs.class_id = Convert.ToUInt32(Request.Params["class_id"]); List<VendorBrandSet> vbsList = vbsMgr.Query(vbs); foreach (VendorBrandSet item in vbsList) { query.brand_ids += item.brand_id + ","; } query.brand_ids = query.brand_ids.TrimEnd(','); } } List<QueryandVerifyCustom> pros = pmDao.GetProList(query, out totalCount); json = "{succes:true,totalCount:" + totalCount + ",item:" + JsonConvert.SerializeObject(pros) + "}"; } 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 = "{succes:true,totalCount:0,item:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public List<VendorBrandSet> GetClassId(VendorBrandSet vbs) { StringBuilder sbSql = new StringBuilder(); sbSql.AppendFormat("select id,brand_id,class_id from vendor_brand_set where brand_id=" + vbs.brand_id + " limit 1"); return _dbAccess.getDataTableForObj<VendorBrandSet>(sbSql.ToString()); }
public HttpResponseBase GetProductByCategorySet() { string resultStr = "{success:false}"; string str = string.Empty; try { _productMgr = new ProductMgr(mySqlConnectionString); ProductQuery query = new ProductQuery(); query.isjoincate = true; query.IsPage = true; query.Start = int.Parse(Request.Form["start"] ?? "0"); if (!string.IsNullOrEmpty(Request.Form["limit"])) { query.Limit = Convert.ToInt32(Request.Form["limit"].ToString()); } else { query.Limit = 500; } uint isTryUint = 0; if (uint.TryParse(Request.Params["status"].ToString(), out isTryUint)) { query.Product_Status = Convert.ToUInt32(Request.Params["status"].ToString()); } if (uint.TryParse(Request.Params["brand_id"].ToString(), out isTryUint)) { query.Brand_Id = Convert.ToUInt32(Request.Params["brand_id"].ToString()); } else { if (!string.IsNullOrEmpty(Request.Params["class_id"])) { VendorBrandSetMgr vbsMgr = new VendorBrandSetMgr(mySqlConnectionString); VendorBrandSet vbs = new VendorBrandSet(); vbs.class_id = Convert.ToUInt32(Request.Form["class_id"]); List<VendorBrandSet> vbsList = vbsMgr.Query(vbs); foreach (VendorBrandSet item in vbsList) { query.brandArry += item.brand_id; query.brandArry += ","; } query.brandArry = query.brandArry.Substring(0, query.brandArry.Length - 1); } } if (!string.IsNullOrEmpty(Request.Params["keyCode"].ToString())) { if (uint.TryParse(Request.Params["keyCode"].ToString(), out isTryUint)) { query.Product_Id = Convert.ToUInt32(Request.Params["keyCode"].ToString()); } else { query.Product_Name = Request.Params["keyCode"].ToString(); } } if (!string.IsNullOrEmpty(Request.Params["category_id"].ToString())) { if (uint.TryParse(Request.Params["category_id"].ToString(), out isTryUint)) { //判斷是否是父節點,若是則獲取所有的category_id prodCateMgr = new ProductCategoryMgr(mySqlConnectionString); List<ProductCategory> category = prodCateMgr.QueryAll(new ProductCategory()); GetAllCategory_id(category, Convert.ToUInt32(Request.Params["category_id"].ToString()), ref str); query.categoryArry = str; } } int totalCount = 0; List<ProductDetailsCustom> prods = _productMgr.GetAllProList(query, out totalCount); resultStr = "{succes:true,totalCount:" + totalCount + ",item:" + JsonConvert.SerializeObject(prods) + "}"; } 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 = "{succes:false,totalCount:0,item:[]}"; } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
public JsonResult GetLinkUrl() { VendorBrandSet vbs = new VendorBrandSet(); WebContentTypeSetup wts = new WebContentTypeSetup(); wts.area_id = int.Parse(Request.Params["areaid"].ToString()); wts.page_id = int.Parse(Request.Params["pageid"].ToString()); wts.web_content_type = Request.Params["webcontenttype_page"].ToString(); wts.site_id = 7; var linkUrl = ""; if (wtiMgr.Query(wts) != null) { WebContentTypeSetup model = wtiMgr.Query(wts)[0]; linkUrl = model.default_link_url.ToString(); switch (model.web_content_type) { case "web_content_type1": case "web_content_type8": break; case "web_content_type2": if (Request.Params["productid"].ToString() != "" && Request.Params["productid"].ToString() != "0") { var cid = _proMgr.QueryClassId(Convert.ToInt32(Request.Params["productid"].ToString())); linkUrl += "?pid=" + Request.Params["productid"].ToString() + "&cid=" + cid; } break; case "web_content_type3": case "web_content_type5": vbs.brand_id = uint.Parse(Request.Params["brandid"].ToString()); linkUrl += "&bid=" + Request.Params["brandid"].ToString(); break; case "web_content_type4": vbs.brand_id = uint.Parse(Request.Params["brandid"].ToString()); linkUrl += "?bid=" + Request.Params["brandid"].ToString(); List<VendorBrandSet> list = vbsMgr.GetClassId(vbs); if (list.Count > 0) { linkUrl += "&cid=" + list[0].class_id.ToString() + "#readstory"; } break; case "web_content_type6": case "web_content_type7": break; default: break; } } return Json(new { success = "true", msg = linkUrl }); }