public ActionResult VendorProductList() { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; VendorBrand vb = new VendorBrand(); ViewBag.vendor_id = vendorModel.vendor_id; return View(); }
public string QueryClassBrand(VendorBrand brand, uint cid, int hideOffGrade = 0) { try { StringBuilder stb = new StringBuilder(); List<VendorBrand> results = _vendorBrandDao.GetClassBrandList(brand, cid, hideOffGrade); stb.Append("{"); stb.Append("success:true,item:["); stb.Append("{"); stb.AppendFormat("\"brand_id\":\"{0}\",\"brand_name\":\"{1}\"", 0, "不分"); stb.Append("}"); foreach (VendorBrand item in results) { stb.Append("{"); stb.AppendFormat("\"brand_id\":\"{0}\",\"brand_name\":\"{1}\"", item.Brand_Id, item.Brand_Name); stb.Append("}"); } stb.Append("]}"); return stb.ToString().Replace("}{", "},{"); } catch (Exception ex) { throw new Exception("VendorBrandMgr-->QueryClassBrand-->" + ex.Message, ex); } }
public List<VendorBrand> GetProductBrandList(VendorBrand brand, int hideOffGrade) { brand.Replace4MySQL(); //StringBuilder strSql = new StringBuilder("select brand_id,brand_name,vendor_id from vendor_brand where 1=1"); ///edit by wwei0216w 2015/6/30 要去掉失格供應商下的品牌 所以添加INNER JOIN vendor v ON v.vendor_id = vb.vendor_id的內聯 StringBuilder sb = new StringBuilder(); try { sb.Append(@"SELECT vb.brand_id,vb.brand_name,vb.vendor_id FROM vendor_brand vb INNER JOIN vendor v ON v.vendor_id = vb.vendor_id"); sb.Append(" WHERE 1=1 "); if (hideOffGrade == 1) { sb.Append(" and v.vendor_status != 3 "); } if (brand.Brand_Status != 0) { sb.AppendFormat(" AND vb.brand_status = {0}", brand.Brand_Status); } if (brand.Vendor_Id != 0) { sb.AppendFormat(" AND vb.vendor_id={0}", brand.Vendor_Id); } return _dbAccess.getDataTableForObj<VendorBrand>(sb.ToString()); } catch (Exception ex) { throw new Exception("VendorBrandDao-->GetProductBrandList" + ex.Message, ex); } }
public List<VendorBrand> GetProductBrandList(VendorBrand brand) { try { return _vendorBrandDao.GetProductBrandList(brand); } catch (Exception ex) { throw new Exception("VendorBrandMgr-->GetProductBrandList-->" + ex.Message, ex); } }
public string QueryBrand(int hideOffGrade = 0) { VendorBrand vb = new VendorBrand(); vbMgr = new VendorBrandMgr(connectionString); //edit by Castle //date:2014/07/18 //要求不限制 //vb.Brand_Status = 1; string json = vbMgr.QueryBrand(vb, hideOffGrade); return json; }
public VendorBrand GetProductBrand(VendorBrand query) { try { return _vendorBrandDao.GetProductBrand(query); } catch (Exception ex) { throw new Exception("VendorBrandMgr-->GetProductBrand-->" + ex.Message, ex); } }
public string QueryBrand() { VendorBrand vb = new VendorBrand(); vb.Vendor_Id = Convert.ToUInt32((Session["vendor"] as BLL.gigade.Model.Vendor).vendor_id); vbMgr = new VendorBrandMgr(connectionString); //edit by Castle //date:2014/07/18 //要求不限制 //vb.Brand_Status = 1; string json = vbMgr.QueryBrand(vb); return json; }
public VendorBrand GetProductBrand(VendorBrand query) { query.Replace4MySQL(); StringBuilder strSql = new StringBuilder("select brand_id,vendor_id,brand_name,brand_sort,brand_status,image_name,image_status,image_link_mode,image_link_url,media_report_link_url,"); strSql.Append("brand_msg,brand_msg_start_time,brand_msg_end_time,brand_createdate,brand_updatedate,brand_ipfrom,cucumber_brand,event,promotion_banner_image,resume_image,"); strSql.Append("promotion_banner_image_link,resume_image_link from vendor_brand where 1=1 "); if (query.Vendor_Id != 0) { strSql.AppendFormat(" and vendor_id={0}", query.Vendor_Id); } if (query.Brand_Id != 0) { strSql.AppendFormat(" and brand_id={0}", query.Brand_Id); } if (query.Brand_Name != "") { strSql.AppendFormat(" and brand_name='{0}'", query.Brand_Name); } return _dbAccess.getSinggleObj<VendorBrand>(strSql.ToString()); }
public string QueryBrand() { string json = string.Empty; try { BLL.gigade.Model.Vendor vendorModel=(BLL.gigade.Model.Vendor)Session["vendor"]; VendorBrand vb = new VendorBrand(); vb.Vendor_Id = vendorModel.vendor_id;//獲取該供應商下的所有品牌,暫時寫死 vbMgr = new VendorBrandMgr(connectionString); json = vbMgr.QueryBrand(vb); } 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; }
/// <summary> /// 獲取品牌故事文字列表 /// </summary> /// <param name="query">VendorBrand表對象</param> /// <param name="totalCount">查詢記錄總條數</param> /// <returns></returns> public DataTable GetVendorBrandStory(VendorBrandQuery query, out int totalCount) { query.Replace4MySQL(); StringBuilder conditionsql = new StringBuilder(); StringBuilder strSql = new StringBuilder(); StringBuilder sqlWhere = new StringBuilder(); StringBuilder count = new StringBuilder(); VendorBrand list = new VendorBrand(); DataTable store = new DataTable(); totalCount = 0; try { if (query.isExport) { conditionsql.AppendFormat(@"SELECT v.vendor_id,v.vendor_name_full, brand_id,brand_name,mu.user_username story_createname,story_createdate,mu1.user_username story_updatename,story_updatedate "); conditionsql.AppendFormat(@" FROM vendor_brand vb "); } else { conditionsql.AppendFormat(@"SELECT brand_id,brand_name,brand_status,brand_story_text,story_created,mu.user_username story_createname,story_createdate, "); conditionsql.AppendFormat(@" story_update,mu1.user_username story_updatename,story_updatedate FROM vendor_brand vb "); } strSql.AppendFormat(@" LEFT JOIN manage_user mu on mu.user_id=vb.story_created "); strSql.AppendFormat(@" LEFT JOIN manage_user mu1 on mu1.user_id=vb.story_update "); strSql.AppendFormat(@" LEFT JOIN vendor v on vb.vendor_id=v.vendor_id "); count.AppendFormat(@" SELECT count(brand_id) as totalCount from vendor_brand vb "); if (query.Vendor_Id != 0) { sqlWhere.AppendFormat(" AND vb.vendor_id={0} ", query.Vendor_Id); } if (query.Brand_Id != 0) { sqlWhere.AppendFormat(" AND vb.brand_id={0} ", query.Brand_Id); } if (query.date_start != DateTime.MinValue) { sqlWhere.AppendFormat(" and vb.story_createdate >= '{0}'", Common.CommonFunction.DateTimeToString(query.date_start)); } if (query.date_end != DateTime.MinValue) { sqlWhere.AppendFormat(" and vb.story_createdate <= '{0}'", Common.CommonFunction.DateTimeToString(query.date_end)); } if (!string.IsNullOrEmpty(query.searchContent)) { //判斷“品牌編號/品牌名稱”輸入欄是否輸入的是數字 //如果是數字就按品牌編號和品牌名稱中帶輸入內容的條件進行搜索,不是數字就按品牌名稱帶搜索內容的條件來搜索 int result = 0; //支持空格,中英文逗號隔開 string content = Regex.Replace(query.searchContent.Trim(), "(\\s+)|(,)|(\\,)", ","); string[] contents = content.Split(','); bool isSucess = int.TryParse(contents[0], out result); if (isSucess) { sqlWhere.AppendFormat(" AND vb.brand_id IN ({0}) ", content); } else { sqlWhere.AppendFormat(@" AND ( "); for (int i = 0; i < contents.Length; i++) { if (i == 0) { sqlWhere.AppendFormat(@" vb.brand_name LIKE N'%{0}%' ", contents[i]); } else { sqlWhere.AppendFormat(@" OR vb.brand_name LIKE N'%{0}%' ", contents[i]); } } sqlWhere.AppendFormat(@" )"); } } if (!string.IsNullOrEmpty(query.story_createname)) { sqlWhere.AppendFormat(" AND mu.user_username like N'%{0}%' ", query.story_createname); } //Brand_Story_Text是未編輯狀態 if (query.Brand_Story_Text == "1") { sqlWhere.AppendFormat(" AND vb.brand_story_text IS NULL"); } //Brand_Story_Text是已編輯狀態 else if (query.Brand_Story_Text == "2") { sqlWhere.AppendFormat(" AND vb.brand_story_text IS NOT NULL"); } if (query.vendorState != 0) { sqlWhere.AppendFormat(" AND v.vendor_status={0}", query.vendorState); } if (query.Brand_Status != 0) { sqlWhere.AppendFormat(" AND vb.brand_status={0}", query.Brand_Status); } if (sqlWhere.Length != 0) { strSql.Append(" WHERE "); strSql.Append(sqlWhere.ToString().TrimStart().Remove(0, 3)); } if (query.IsPage) { DataTable dt = _dbAccess.getDataTable(count.ToString() + strSql.ToString()); if (dt != null && dt.Rows.Count > 0) { totalCount = Convert.ToInt32(dt.Rows[0]["totalCount"]); } strSql.AppendFormat(" order by brand_id limit {0},{1} ", query.Start, query.Limit); } else { strSql.AppendFormat(" order by brand_id "); } store = _dbAccess.getDataTable(conditionsql.ToString() + strSql.ToString()); return store; } catch (Exception ex) { throw new Exception("VendorBrandDao-->GetVendorBrandStory-->" + ex.Message + "sql:" + conditionsql.ToString() + strSql.ToString(), ex); } }
public HttpResponseBase ISVendorProduct() { string resultStr = "{success:false}"; try { BLL.gigade.Model.Vendor vendorModel = (BLL.gigade.Model.Vendor)Session["vendor"]; int writer_id = Convert.ToInt32(vendorModel.vendor_id); VendorBrand vb = new VendorBrand(); vb.Vendor_Id = vendorModel.vendor_id;//todo:獲取該供應商下的所有品牌,暫時寫死 vbMgr = new VendorBrandMgr(connectionString); List<VendorBrand> brandList = vbMgr.GetProductBrandList(vb); uint brand = 0; if (!string.IsNullOrEmpty(Request.Form["ProductId"]))//編輯數據 { uint product_id = 0; if (uint.TryParse(Request.Form["ProductId"], out product_id)) //正式表數據 { _productMgr = new ProductMgr(connectionString); Product p = _productMgr.Query(new Product { Product_Id = product_id }).FirstOrDefault(); if (p != null) { brand = p.Brand_Id; } } else {//臨時表數據 _productTempMgr = new ProductTempMgr(connectionString); ProductTemp pTemp = _productTempMgr.GetProTempByVendor(new ProductTemp { Product_Id = Request.Form["ProductId"], Writer_Id = writer_id, Create_Channel = 2, Temp_Status = 12 }).FirstOrDefault(); if (pTemp != null) { brand = pTemp.Brand_Id; } } foreach (VendorBrand item in brandList) { if (brand == item.Brand_Id) { resultStr = "{success:true}"; 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); resultStr = "{success:false}"; } this.Response.Clear(); this.Response.Write(resultStr); this.Response.End(); return this.Response; }
/// <summary> /// 帶條件的品牌搜索 /// </summary> /// <param name="brand">品牌搜索條件</param> /// <param name="cid">根據館別搜索品牌</param> /// <param name="hideOffGrade">失格供應商下的品牌是否顯示</param> /// <returns></returns> public List<VendorBrand> GetClassBrandList(VendorBrand brand, uint cid, int hideOffGrade = 0) { brand.Replace4MySQL(); StringBuilder strSql = new StringBuilder("select vb.brand_id,vb.brand_name from vendor_brand vb "); if (cid != 0) { strSql.AppendFormat(" inner join vendor_brand_set vs on vb.brand_id=vs.brand_id and vs.class_id='{0}'", cid); } if (hideOffGrade == 1) { strSql.AppendFormat(" inner join vendor v on v.vendor_id =vb.vendor_id and v.vendor_status <> 3"); } strSql.Append(" where 1=1 "); if (brand.Brand_Status != 0) { strSql.AppendFormat(" and vb.brand_status = {0}", brand.Brand_Status); } return _dbAccess.getDataTableForObj<VendorBrand>(strSql.ToString()); }
public ActionResult PictureMaintain() { VendorBrand query = new VendorBrand(); _vendorBrand = new VendorBrandMgr(connectionString); ViewBag.BrandId = Request.Params["Brand_Id"]; query.Brand_Id = Convert.ToUInt32(Request.Params["Brand_Id"]); VendorBrand model = _vendorBrand.GetProductBrand(query); if (model != null) { ViewBag.BrandName = model.Brand_Name; //Request.Params["Brand_Name"]; } else { ViewBag.BrandName = ""; } return View(); }
public string QueryBrand() { VendorBrand vb = new VendorBrand(); vbMgr = new VendorBrandMgr(connectionString); vb.Brand_Status = 1; string json = vbMgr.QueryBrand(vb); return json; }
public HttpResponseBase GetVendorBand()/*品牌列表*/ { VendorBrand vb = new VendorBrand(); _vbrand = new VendorBrandMgr(mySqlConnectionString); List<VendorBrand> stores = new List<VendorBrand>(); string json = string.Empty; try { DataTable dt = _vbrand.GetBandList(""); for (int i = 0; i < dt.Rows.Count; i++) { vb = new VendorBrand(); vb.Brand_Id = uint.Parse(dt.Rows[i]["brand_id"].ToString()); vb.Brand_Name = dt.Rows[i]["brand_name"].ToString(); stores.Add(vb); } 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; }
/// <summary> /// 獲得品牌 /// </summary> /// <returns></returns> public HttpResponseBase GetVendorBrand() { VendorBrand vb = new VendorBrand(); List<VendorBrand> store = new List<VendorBrand>(); string json = string.Empty; try { vbMgr = new VendorBrandMgr(connectionString); if (!string.IsNullOrEmpty(Request.Params["vendor_id"])) { vb.Vendor_Id = uint.Parse(Request.Params["vendor_id"]); } store = vbMgr.GetProductBrandList(vb); json = "{success:true,data:" + JsonConvert.SerializeObject(store, 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; }
public string QueryClassBrand() { string json = string.Empty; try { uint cid = 0; VendorBrand vb = new VendorBrand(); VendorBrandMgr vbMgr = new VendorBrandMgr(connectionString); //Edit By Castle //Date:2014/07/01 //Discription:Brand_status是给前台用的后台不做限制 vb.Brand_Status = 0; //vb.Brand_Status = 1; if (!string.IsNullOrEmpty(Request.Form["topValue"])) { cid = Convert.ToUInt32(Request.Form["topValue"]); } json = vbMgr.QueryClassBrand(vb, cid); } 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; }