/// <summary> /// 获得分类品牌列表 /// </summary> /// <param name="cateId">分类id</param> /// <param name="keyword">关键词</param> /// <returns></returns> public List<BrandInfo> GetCategoryBrandListByKeyword(int cateId, string keyword) { DbParameter[] parms = { GenerateInParam("@cateid", SqlDbType.Int,4,cateId), GenerateInParam("@keyword", SqlDbType.NChar,40,keyword) }; List<BrandInfo> brandList = new List<BrandInfo>(); IDataReader reader = RDBSHelper.ExecuteReader(CommandType.StoredProcedure, string.Format("{0}getcategorybrandlistbykeyword", RDBSHelper.RDBSTablePre), parms); while (reader.Read()) { BrandInfo brandInfo = new BrandInfo(); brandInfo.BrandId = TypeHelper.ObjectToInt(reader["brandid"]); brandInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]); brandInfo.Name = reader["name"].ToString(); brandInfo.Logo = reader["logo"].ToString(); brandList.Add(brandInfo); } reader.Close(); return brandList; }
/// <summary> /// 从IDataReader创建BrandInfo /// </summary> public static BrandInfo BuildBrandFromReader(IDataReader reader) { BrandInfo brandInfo = new BrandInfo(); brandInfo.BrandId = TypeHelper.ObjectToInt(reader["brandid"]); brandInfo.DisplayOrder = TypeHelper.ObjectToInt(reader["displayorder"]); brandInfo.Name = reader["name"].ToString(); brandInfo.Logo = reader["logo"].ToString(); return brandInfo; }
public ActionResult Add(BrandModel model) { if (AdminBrands.GetBrandIdByName(model.BrandName) > 0) ModelState.AddModelError("BrandName", "名称已经存在"); if (ModelState.IsValid) { BrandInfo brandInfo = new BrandInfo() { DisplayOrder = model.DisplayOrder, Name = model.BrandName, Logo = model.Logo }; AdminBrands.CreateBrand(brandInfo); AddAdminOperateLog("添加品牌", "添加品牌,品牌为:" + model.BrandName); return PromptView("品牌添加成功"); } Load(); return View(model); }
public IEnumerable <HomeCategorySet> GetHomeCategorySets() { var homeCategorySet = new HomeCategorySet[HOME_CATEGORY_SET_COUNT]; if (Cache.Exists(CacheKeyCollection.HomeCategory)) { homeCategorySet = Core.Cache.Get <HomeCategorySet[]>(CacheKeyCollection.HomeCategory); } else { //var homeCategoryGroups = context.HomeCategoryInfo.FindAll().GroupBy(item => item.RowNumber); var cc = (from C in Context.HomeCategoryInfo .Include("CategoryInfo") where C.CategoryInfo.IsDeleted == false select C).ToList(); var homeCategoryGroups = (from C in cc group C by C.RowNumber into G select G).ToList(); foreach (var group in homeCategoryGroups) { homeCategorySet[group.Key - 1] = new HomeCategorySet() { RowNumber = group.Key, HomeCategories = group }; } var _HomeCategoryRowInfo = Context.HomeCategoryRowInfo.FindAll().ToList(); for (int i = 0; i < HOME_CATEGORY_SET_COUNT; i++) { if (homeCategorySet[i] == null) { homeCategorySet[i] = new HomeCategorySet() { RowNumber = i + 1, HomeCategories = new List <HomeCategoryInfo>() }; } var homeCategoryRows = new List <HomeCategorySet.HomeCategoryTopic>(); var categoryRowInfo = _HomeCategoryRowInfo.Where(item => item.RowId == i + 1).FirstOrDefault(); if (categoryRowInfo != null) { homeCategoryRows.Add(new HomeCategorySet.HomeCategoryTopic() { Url = categoryRowInfo.Url1, ImageUrl = categoryRowInfo.Image1 }); homeCategoryRows.Add(new HomeCategorySet.HomeCategoryTopic() { Url = categoryRowInfo.Url2, ImageUrl = categoryRowInfo.Image2 }); } homeCategorySet[i].HomeCategoryTopics = homeCategoryRows; } var brandService = ObjectContainer.Current.Resolve <IBrandService>(); for (int i = 0; i < homeCategorySet.Count(); i++) { homeCategorySet[i].HomeCategories = homeCategorySet[i].HomeCategories.Select(t => new HomeCategoryInfo() { CategoryId = t.CategoryId, Depth = t.Depth, Id = t.Id, RowNumber = t.RowNumber, CategoryInfo = new CategoryInfo() { Depth = t.CategoryInfo.Depth, Name = t.CategoryInfo.Name, RewriteName = t.CategoryInfo.RewriteName, TypeId = t.CategoryInfo.TypeId, CommisRate = t.CategoryInfo.CommisRate, DisplaySequence = t.CategoryInfo.DisplaySequence, HasChildren = t.CategoryInfo.HasChildren, Icon = t.CategoryInfo.Icon, Path = t.CategoryInfo.Path, Meta_Title = t.CategoryInfo.Meta_Title, ParentCategoryId = t.CategoryInfo.ParentCategoryId, Meta_Keywords = t.CategoryInfo.Meta_Keywords, Meta_Description = t.CategoryInfo.Meta_Description, Id = t.CategoryInfo.Id } }).ToList(); homeCategorySet[i].HomeCategoryTopics = homeCategorySet[i].HomeCategoryTopics.Select(t => new HomeCategorySet.HomeCategoryTopic() { ImageUrl = t.ImageUrl, Url = t.Url }).ToList(); const int MAX_DISPLAY_BRANDS = 8;//最多显示推荐品牌个数 //获取推荐的品牌 var singleRowBrand = brandService.GetBrandsByCategoryIds(homeCategorySet[i].HomeCategories.Where(item => item.Depth == 1).Select(item => item.CategoryId).ToArray()).Take(MAX_DISPLAY_BRANDS); BrandInfo[] brands = new BrandInfo[singleRowBrand.Count()]; for (int k = 0; k < singleRowBrand.Count(); k++) { brands[k] = new BrandInfo(); brands[k].Id = singleRowBrand.ElementAt(k).Id; brands[k].Name = singleRowBrand.ElementAt(k).Name; brands[k].Logo = singleRowBrand.ElementAt(k).Logo; } homeCategorySet[i].HomeBrand = brands; } Cache.Insert <HomeCategorySet[]>(CacheKeyCollection.HomeCategory, homeCategorySet, 5); } return(homeCategorySet); }
/// <summary> /// 更新品牌 /// </summary> /// <param name="brandInfo"></param> public void UpdateBrand(BrandInfo brandInfo) { DbParameter[] parms = { GenerateInParam("@displayorder", SqlDbType.Int,4,brandInfo.DisplayOrder), GenerateInParam("@name", SqlDbType.NChar, 20, brandInfo.Name), GenerateInParam("@logo", SqlDbType.NChar,100,brandInfo.Logo), GenerateInParam("@brandid", SqlDbType.Int, 4, brandInfo.BrandId) }; string commandText = string.Format("UPDATE [{0}brands] SET [displayorder]=@displayorder,[name]=@name,[logo]=@logo WHERE [brandid]=@brandid", RDBSHelper.RDBSTablePre); RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 创建品牌 /// </summary> /// <param name="brandInfo"></param> public void CreateBrand(BrandInfo brandInfo) { DbParameter[] parms = { GenerateInParam("@displayorder", SqlDbType.Int,4,brandInfo.DisplayOrder), GenerateInParam("@name", SqlDbType.NChar, 20, brandInfo.Name), GenerateInParam("@logo", SqlDbType.NChar,100,brandInfo.Logo) }; string commandText = string.Format("INSERT INTO [{0}brands]([displayorder],[name],[logo]) VALUES(@displayorder,@name,@logo)", RDBSHelper.RDBSTablePre); RDBSHelper.ExecuteNonQuery(CommandType.Text, commandText, parms); }
/// <summary> /// 更新品牌 /// </summary> /// <param name="brandInfo"></param> public static void UpdateBrand(BrandInfo brandInfo) { BrnShop.Data.Brands.UpdateBrand(brandInfo); BrnShop.Core.BSPCache.Remove(CacheKeys.SHOP_BRAND_INFO + brandInfo.BrandId); }
/// <summary> /// 创建品牌 /// </summary> /// <param name="brandInfo"></param> public static void CreateBrand(BrandInfo brandInfo) { BrnShop.Data.Brands.CreateBrand(brandInfo); }
public static ProductCreateResultJson ProductCreate(string accessTokenOrAppId, string keyStandard, string keyStr, BrandInfo brandInfo, int timeOut = Config.TIME_OUT) { return(ApiHandlerWapper.TryCommonApi(accessToken => { var urlFormat = string.Format(Config.ApiMpHost + "/scan/product/create?access_token={0}", accessToken.AsUrlData()); var data = new { keystandard = keyStandard, keystr = keyStr, brand_info = brandInfo }; return CommonJsonSend.Send <ProductCreateResultJson>(null, urlFormat, null, CommonJsonSendType.POST, timeOut: timeOut); }, accessTokenOrAppId)); }
/// <summary> /// 创建品牌 /// </summary> /// <param name="brandInfo"></param> public static void CreateBrand(BrandInfo brandInfo) { NStore.Data.Brands.CreateBrand(brandInfo); }
public ActionResult NewActivityCreateManage() { SWfsChannelService service = new SWfsChannelService(); #region 获取参数信息 string brandNo = Request.Form["BrandNo"].Trim(); //品牌编号 string picName = Request.Params["PicName"].Trim(); //图片名称 string pcPicture = ""; //主站图片 string pcUrl = Request.Params["NewPicFileUrlPC"].Trim(); //主站图片链接地址 string mobilePicture = ""; //移动端图片 string mobileUrl = Request.Params["NewPicFileUrlMobile"].Trim(); //移动端图片链接地址 int mobilePicType = Convert.ToInt32(Request.Params["PicType"]); //移动端图片类型 short status = Convert.ToInt16(Request.Params["Status"]); //活动图状态 DateTime startTime = Convert.ToDateTime(Request.Params["DateBegin"]); //开始时间 #endregion #region 验证图片 //网站端图片 if (null != Request.Files["NewPicFilePC"] && Request.Files["NewPicFilePC"].ContentLength > 0) { CommonService commonService = new CommonService(); Dictionary <string, string> rsPic = commonService.PostImg(Request.Files["NewPicFilePC"], "width:770,Height:320,Length:500"); if (rsPic.Keys.Contains("error")) { return(Json(new { result = "error", message = rsPic["error"] })); } if (rsPic.Keys.Contains("success")) { pcPicture = rsPic["success"]; } } //移动端图片 if (null != Request.Files["NewPicFileMobile"] && Request.Files["NewPicFileMobile"].ContentLength > 0) { CommonService commonService = new CommonService(); string imgSize = "width:0,Height:0,Length:0"; if (mobilePicType == 1) { imgSize = "width:393,Height:759,Length:0";//长图 } else if (mobilePicType == 2) { imgSize = "width:640,Height:426,Length:0";//宽图 } Dictionary <string, string> rsMobilePic = commonService.PostImg(Request.Files["NewPicFileMobile"], imgSize); if (rsMobilePic.Keys.Contains("error")) { return(Json(new { result = "error", message = rsMobilePic["error"] })); } if (rsMobilePic.Keys.Contains("success")) { mobilePicture = rsMobilePic["success"]; } } #endregion #region 验证品牌 BrandInfo brandInfo = service.GetBrandInfoById(brandNo); if (brandInfo == null) { return(Json(new { result = "error", message = "对不起,该品牌不存在,请重新选择。" })); } #endregion /*List<SWfsNewAlterPicInfo> newAlterPicList = service.GetNewAlterPicInfoByNo(brandNo, startTime.ToString("yyyy-MM-dd")); * if (newAlterPicList != null && newAlterPicList.Count() > 0) * { * return Json(new { result = "error", message = "对不起,同一个品牌在同一天不能出现两次。" }); * }*/ SWfsNewAlterPicture model = new SWfsNewAlterPicture(); model.PictureName = picName; model.Position = 0; model.BrandNo = brandNo; model.PcPictureNo = pcPicture; model.PcPictureLinkUrl = pcUrl; model.MobilePictureNo = mobilePicture; model.MobilePictureLinkUrl = mobileUrl; model.MobilePictureType = mobilePicType; model.Status = status; model.DataStatus = 0; model.BeginDate = startTime; model.DateCreate = DateTime.Now; model.OperatorUserId = PresentationHelper.GetPassport().UserName; try { service.Insert(model); return(Json(new { result = "success", message = "添加成功。" })); } catch (Exception ex) { return(Json(new { result = "error", message = ex.Message })); } }
/// <summary> /// 创建品牌 /// </summary> /// <param name="brandInfo"></param> public static void CreateBrand(BrandInfo brandInfo) { BrnShop.Core.BSPData.RDBS.CreateBrand(brandInfo); }
public ActionResult NewActivityEditManage() { SWfsChannelService service = new SWfsChannelService(); int picid = Convert.ToInt32(Request["PictureId"]); //获取活动图信息 SWfsNewAlterPicInfo model = service.GetNewAlterPicInfoById(picid); #region 获取参数信息 string brandNo = Request.Form["BrandNo"].Trim(); //品牌编号 string picName = Request.Params["PicName"].Trim(); //图片名称 string pcPicture = ""; //主站图片 string pcUrl = Request.Params["NewPicFileUrlPC"].Trim(); //主站图片链接地址 string mobilePicture = ""; //移动端图片 string mobileUrl = Request.Params["NewPicFileUrlMobile"].Trim(); //移动端图片链接地址 int mobilePicType = Convert.ToInt32(Request.Params["PicType"]); //移动端图片类型 short status = Convert.ToInt16(Request.Params["Status"]); //活动图状态 DateTime startTime = Convert.ToDateTime(Request.Params["DateBegin"]); //开始时间 #endregion #region 验证图片 //网站图片 if (Request.Files["NewPicFilePC"] == null || string.IsNullOrEmpty(Request.Files["NewPicFilePC"].FileName)) { if (!string.IsNullOrEmpty(model.PcPictureNo)) { pcPicture = Request.Params["hidPcPic"].ToString();//获取隐藏域中的值 } else { return(Json(new { result = "error", message = "请上传图片!" })); } } else { CommonService commonService = new CommonService(); Dictionary <string, string> rsPic = commonService.PostImg(Request.Files["NewPicFilePC"], "width:770,Height:320,Length:500"); if (rsPic.Keys.Contains("error")) { return(Json(new { result = "error", message = rsPic["error"] })); } if (rsPic.Keys.Contains("success")) { pcPicture = rsPic["success"]; } } //移动端图片 if (Request.Files["NewPicFileMobile"] == null || string.IsNullOrEmpty(Request.Files["NewPicFileMobile"].FileName)) { if (!string.IsNullOrEmpty(model.MobilePictureNo)) { if (Request.Params["hidMobilePicType"] == mobilePicType.ToString()) { mobilePicture = Request.Params["hidMobilePic"].ToString();//获取隐藏域中的值 } else { if (mobilePicType == 1) { return(Json(new { result = "error", message = "请上传393*759图片!" })); } else if (mobilePicType == 2) { return(Json(new { result = "error", message = "请上传640*426图片!" })); } } } else { return(Json(new { result = "error", message = "请上传图片!" })); } } else { CommonService commonService = new CommonService(); string imgSize = "width:0,Height:0,Length:0"; if (mobilePicType == 1) { imgSize = "width:393,Height:759,Length:0";//长图 } else if (mobilePicType == 2) { imgSize = "width:640,Height:426,Length:0";//宽图 } Dictionary <string, string> rsMobilePic = commonService.PostImg(Request.Files["NewPicFileMobile"], imgSize); if (rsMobilePic.Keys.Contains("error")) { return(Json(new { result = "error", message = rsMobilePic["error"] })); } if (rsMobilePic.Keys.Contains("success")) { mobilePicture = rsMobilePic["success"]; } } #endregion #region 验证品牌 BrandInfo brandInfo = service.GetBrandInfoById(brandNo); if (brandInfo == null) { return(Json(new { result = "error", message = "对不起,该品牌不存在,请重新选择。" })); } #endregion /*List<SWfsNewAlterPicInfo> newAlterPicList = service.GetNewAlterPicInfoByNo(brandNo, startTime.ToString("yyyy-MM-dd")); * if (newAlterPicList != null && newAlterPicList.Count() > 0) * { * if (model.BrandNo == brandNo && model.BeginDate == startTime) * { * } * else * { * return Json(new { result = "error", message = "对不起,同一个品牌在同一天不能出现两次。" }); * } * }*/ model.PictureName = picName; model.Position = 0; model.BrandNo = brandNo; model.PcPictureNo = pcPicture; model.PcPictureLinkUrl = pcUrl; model.MobilePictureNo = mobilePicture; model.MobilePictureLinkUrl = mobileUrl; model.MobilePictureType = mobilePicType; model.Status = status; model.BeginDate = startTime; try { service.Update(model); return(Json(new { result = "success", message = "修改成功。" })); } catch (Exception ex) { return(Json(new { result = "error", message = ex.Message })); } }
/// <summary> /// 搜索 /// </summary> public ActionResult AjaxSearch() { //搜索词 string word = WebHelper.GetQueryString("word"); //分类id int cateId = WebHelper.GetQueryInt("cateId"); //品牌id int brandId = WebHelper.GetQueryInt("brandId"); //筛选价格 int filterPrice = WebHelper.GetQueryInt("filterPrice"); //筛选属性 string filterAttr = WebHelper.GetQueryString("filterAttr"); //是否只显示有货 int onlyStock = WebHelper.GetQueryInt("onlyStock"); //排序列 int sortColumn = WebHelper.GetQueryInt("sortColumn"); //排序方向 int sortDirection = WebHelper.GetQueryInt("sortDirection"); //当前页数 int page = WebHelper.GetQueryInt("page"); if (word.Length == 0) { return(Content("")); } //筛选属性处理 List <int> attrValueIdList = new List <int>(); foreach (string attrValueId in StringHelper.SplitString(filterAttr, "-")) { int temp = TypeHelper.StringToInt(attrValueId); if (temp > 0) { attrValueIdList.Add(temp); } } //分类信息 CategoryInfo categoryInfo = null; //分类价格范围列表 string[] catePriceRangeList = null; //分类筛选属性及其值列表 List <KeyValuePair <AttributeInfo, List <AttributeValueInfo> > > cateAAndVList = null; //分类列表 List <CategoryInfo> categoryList = null; //品牌信息 BrandInfo brandInfo = null; //品牌列表 List <BrandInfo> brandList = null; //商品总数量 int totalCount = 0; //商品列表 List <StoreProductInfo> productList = null; //搜索 Searches.SearchMallProducts(20, page, word, cateId, brandId, filterPrice, attrValueIdList, onlyStock, sortColumn, sortDirection, ref categoryInfo, ref catePriceRangeList, ref cateAAndVList, ref categoryList, ref brandInfo, ref brandList, ref totalCount, ref productList); //分页对象 PageModel pageModel = new PageModel(20, page, totalCount); //视图对象 AjaxMallSearchModel model = new AjaxMallSearchModel() { PageModel = pageModel, ProductList = productList }; return(Content(JsonConvert.SerializeObject(model))); }
/// <summary> /// 搜索 /// </summary> public ActionResult Search() { //搜索词 string word = WebHelper.GetQueryString("word"); //分类id int cateId = WebHelper.GetQueryInt("cateId"); //品牌id int brandId = WebHelper.GetQueryInt("brandId"); //筛选价格 int filterPrice = WebHelper.GetQueryInt("filterPrice"); //筛选属性 string filterAttr = WebHelper.GetQueryString("filterAttr"); //是否只显示有货 int onlyStock = WebHelper.GetQueryInt("onlyStock"); //排序列 int sortColumn = WebHelper.GetQueryInt("sortColumn"); //排序方向 int sortDirection = WebHelper.GetQueryInt("sortDirection"); //当前页数 int page = WebHelper.GetQueryInt("page"); WorkContext.SearchWord = word; if (word.Length == 0) { return(PromptView(WorkContext.UrlReferrer, "请输入搜索词")); } //检查当前页数 if (page < 1) { page = 1; } //筛选属性处理 List <int> attrValueIdList = new List <int>(); foreach (string attrValueId in StringHelper.SplitString(filterAttr, "-")) { int temp = TypeHelper.StringToInt(attrValueId); if (temp > 0) { attrValueIdList.Add(temp); } } //分类信息 CategoryInfo categoryInfo = null; //分类价格范围列表 string[] catePriceRangeList = null; //分类筛选属性及其值列表 List <KeyValuePair <AttributeInfo, List <AttributeValueInfo> > > cateAAndVList = null; //分类列表 List <CategoryInfo> categoryList = null; //品牌信息 BrandInfo brandInfo = null; //品牌列表 List <BrandInfo> brandList = null; //商品总数量 int totalCount = 0; //商品列表 List <StoreProductInfo> productList = null; //搜索 Searches.SearchMallProducts(20, page, word, cateId, brandId, filterPrice, attrValueIdList, onlyStock, sortColumn, sortDirection, ref categoryInfo, ref catePriceRangeList, ref cateAAndVList, ref categoryList, ref brandInfo, ref brandList, ref totalCount, ref productList); if (productList == null) { return(PromptView(WorkContext.UrlReferrer, "您搜索的商品不存在")); } //分页对象 PageModel pageModel = new PageModel(20, page, totalCount); //视图对象 MallSearchModel model = new MallSearchModel() { Word = word, CateId = cateId, BrandId = brandId, FilterPrice = filterPrice, FilterAttr = filterAttr, OnlyStock = onlyStock, SortColumn = sortColumn, SortDirection = sortDirection, FilterAttrValueIdList = attrValueIdList, CategoryInfo = categoryInfo, CatePriceRangeList = catePriceRangeList, AAndVList = cateAAndVList, CategoryList = categoryList, BrandInfo = brandInfo, BrandList = brandList, PageModel = pageModel, ProductList = productList }; //异步保存搜索历史 Asyn.UpdateSearchHistory(WorkContext.Uid, word); return(View(model)); }
/// <summary> /// 创建品牌 /// </summary> /// <param name="brandInfo"></param> public static void CreateBrand(BrandInfo brandInfo) { NStore.Core.BMAData.RDBS.CreateBrand(brandInfo); }
/// <summary> /// Grid fill function Againest SalseOrderDetails /// </summary> public void gridFillAgainestSalseOrderDetails() { BrandBll BllBrand = new BrandBll(); //SalesOrderBll bllSalesOrder = new SalesOrderBll(); SalesOrderBll bllSalesOrder = new SalesOrderBll(); ProductInfo infoproduct = new ProductInfo(); //SalesMasterSP spSalesMaster = new SalesMasterSP(); SalesInvoiceBll BllSalesInvoice = new SalesInvoiceBll(); BrandInfo InfoBrand = new BrandInfo(); TaxInfo infoTax = new TaxInfo(); TaxBll bllTax = new TaxBll(); try { if (cmbSalesModeOrderNo.SelectedIndex > 0) { inMaxCount = 0; isValueChange = false; for (int i = 0; i < dgvSalesInvoice.RowCount - 1; i++) { if (dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value != null && dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString() != string.Empty) { lstArrOfRemove.Add(dgvSalesInvoice.Rows[i].Cells["dgvtxtSalesInvoiceSalesDetailsId"].Value.ToString()); } } dgvSalesInvoice.Rows.Clear(); isValueChange = true; List<DataTable> ListObj= bllSalesOrder.SalesInvoiceGridfillAgainestSalesOrder(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString())); cmbPricingLevel.SelectedValue = Convert.ToDecimal(ListObj[0].Rows[0]["pricingLevelId"].ToString()); cmbCurrency.SelectedValue = Convert.ToDecimal(ListObj[0].Rows[0]["exchangeRateId"].ToString()); if (ListObj[0].Rows[0]["employeeId"].ToString() != string.Empty) { strSalesManId = ListObj[0].Rows[0]["employeeId"].ToString(); cmbSalesMan.SelectedValue = strSalesManId; if (cmbSalesMan.SelectedValue == null) { salesManComboFill(); cmbSalesMan.SelectedValue = ListObj[0].Rows[0]["employeeId"].ToString(); } } cmbPricingLevel.Enabled = false; btnNewPricingLevel.Enabled = false; cmbCurrency.Enabled = false; ListObj = bllSalesOrder.SalesInvoiceGridfillAgainestSalesOrderUsingSalesDetails(Convert.ToDecimal(cmbSalesModeOrderNo.SelectedValue.ToString()), Convert.ToDecimal(decSalesInvoiceIdToEdit), DecSalesInvoiceVoucherTypeId); int inRowIndex = 0; foreach (DataRow drowDetails in ListObj[0].Rows) { dgvSalesInvoice.Rows.Add(); isValueChange = false; IsSetGridValueChange = false; dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSISalesOrderDetailsId"].Value = drowDetails["salesOrderDetailsId"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductCode"].Value = drowDetails["productCode"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBarcode"].Value = drowDetails["barcode"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceBatch"].Value = Convert.ToDecimal(drowDetails["batchId"].ToString()); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value = drowDetails["voucherNo"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value = drowDetails["invoiceNo"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value = drowDetails["voucherTypeId"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceDiscountPercentage"].Value = "0"; dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInRowIndex"].Value = drowDetails["salesOrderDetailsId"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value = drowDetails.ItemArray[2].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceUnitConversionId"].Value = drowDetails["unitConversionId"].ToString(); infoproduct = BllSalesInvoice.ProductViewByProductIdforSalesInvoice(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString()); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductName"].Value = infoproduct.ProductName; dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceMrp"].Value = infoproduct.Mrp; dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicePurchaseRate"].Value = infoproduct.PurchaseRate; dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceSalesRate"].Value = infoproduct.SalesRate; InfoBrand = BllBrand.BrandView(infoproduct.BrandId); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceBrand"].Value = InfoBrand.BrandName; infoTax = bllTax.TaxViewByProductId(Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceProductId"].Value).ToString()); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvcmbSalesInvoiceTaxName"].Value = infoTax.TaxId; isValueChange = false; dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].Value = Convert.ToDecimal(drowDetails["unitId"].ToString()); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoicembUnitName"].ReadOnly = true; dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceQty"].Value = drowDetails["Qty"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceRate"].Value = drowDetails["rate"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceAmount"].Value = drowDetails["amount"].ToString(); dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceConversionRate"].Value = drowDetails["conversionRate"].ToString(); isFromAgainest = true; gridColumnMakeEnables(); int intIndex = 0; intIndex = Convert.ToInt32(drowDetails["salesOrderDetailsId"].ToString()); if (inMaxCount < intIndex) inMaxCount = intIndex; inRowIndex++; isValueChange = true; isFromAgainest = false; GrossValueCalculation(dgvSalesInvoice.Rows.Count - 2); discountCalculation(dgvSalesInvoice.Rows.Count - 2); taxAndGridTotalAmountCalculation(dgvSalesInvoice.Rows.Count - 2); } IsSetGridValueChange = true; for (int i = inRowIndex; i < dgvSalesInvoice.Rows.Count; ++i) dgvSalesInvoice["dgvtxtSalesInvoiceInRowIndex", i].Value = GetNextinRowIndex().ToString(); SerialNoforSalesInvoice(); strVoucherNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherNo"].Value.ToString(); strInvoiceNoTostockPost = dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceInvoiceNo"].Value.ToString(); decVouchertypeIdTostockPost = Convert.ToDecimal(dgvSalesInvoice.Rows[dgvSalesInvoice.Rows.Count - 2].Cells["dgvtxtSalesInvoiceVoucherTypeId"].Value); } else { SiGridTotalAmountCalculation(); ClearGridAgainest(); } SiGridTotalAmountCalculation(); } catch (Exception ex) { MessageBox.Show("SI: 51" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 搜索商城商品 /// </summary> /// <param name="pageSize">每页数</param> /// <param name="pageNumber">当前页数</param> /// <param name="word">搜索词</param> /// <param name="cateId">分类id</param> /// <param name="brandId">品牌id</param> /// <param name="filterPrice">筛选价格</param> /// <param name="attrValueIdList">属性值id列表</param> /// <param name="onlyStock">是否只显示有货</param> /// <param name="sortColumn">排序列</param> /// <param name="sortDirection">排序方向</param> /// <param name="categoryInfo">分类信息</param> /// <param name="catePriceRangeList">分类价格范围列表</param> /// <param name="cateAAndVList">分类筛选属性及其值列表</param> /// <param name="categoryList">分类列表</param> /// <param name="brandInfo">品牌信息</param> /// <param name="brandList">品牌列表</param> /// <param name="totalCount">商品总数量</param> /// <param name="productList">商品列表</param> public void SearchProducts(int pageSize, int pageNumber, string word, int cateId, int brandId, int filterPrice, List <int> attrValueIdList, int onlyStock, int sortColumn, int sortDirection, ref CategoryInfo categoryInfo, ref string[] catePriceRangeList, ref List <KeyValuePair <AttributeInfo, List <AttributeValueInfo> > > cateAAndVList, ref List <CategoryInfo> categoryList, ref BrandInfo brandInfo, ref List <BrandInfo> brandList, ref int totalCount, ref List <PartProductInfo> productList) { //针对用户搜索词进行分词 List <string> keywordList = Analyse(word); //构建关键词查询sql string keywordSql = BuildKeywordSql(keywordList); #region 设置分类列表 categoryList = new List <CategoryInfo>(); StringBuilder commandText3 = new StringBuilder(); commandText3.AppendFormat("SELECT [cateid],[displayorder],[name],[pricerange],[parentid],[layer],[haschild],[path] FROM [{0}categories] WHERE [cateid] IN (SELECT DISTINCT [cateid] FROM [{0}products] WHERE [state]=0 AND [pid] IN (SELECT [pid] FROM [{0}productkeywords] WHERE [keyword] IN ({1})))", RDBSHelper.RDBSTablePre, keywordSql); IDataReader reader2 = RDBSHelper.ExecuteReader(CommandType.Text, commandText3.ToString()); while (reader2.Read()) { CategoryInfo info = new CategoryInfo(); info.CateId = TypeHelper.ObjectToInt(reader2["cateid"]); info.DisplayOrder = TypeHelper.ObjectToInt(reader2["displayorder"]); info.Name = reader2["name"].ToString(); info.PriceRange = reader2["pricerange"].ToString(); info.ParentId = TypeHelper.ObjectToInt(reader2["parentid"]); info.Layer = TypeHelper.ObjectToInt(reader2["layer"]); info.HasChild = TypeHelper.ObjectToInt(reader2["haschild"]); info.Path = reader2["path"].ToString(); categoryList.Add(info); } reader2.Close(); #endregion //当关联分类列表中一个分类也不存在时,认为商品也不存在,直接返回 if (categoryList.Count < 1) { return; } if (cateId > 0) { foreach (CategoryInfo info in categoryList) { if (info.CateId == cateId) { categoryInfo = info; break; } } //当筛选了分类,但是分类不在分类列表中,认为商品也不存在,直接返回 if (categoryInfo == null) { return; } } if (categoryInfo != null) { cateAAndVList = Categories.GetCategoryFilterAAndVList(categoryInfo.CateId); catePriceRangeList = StringHelper.SplitString(categoryInfo.PriceRange, "\r\n"); } #region 设置品牌列表 brandList = new List <BrandInfo>(); StringBuilder commandText4 = new StringBuilder(); commandText4.AppendFormat("SELECT [brandid],[displayorder],[name],[logo] FROM [{0}brands] WHERE [brandid] IN (SELECT DISTINCT [brandid] FROM [{0}products] WHERE [state]=0 {1} AND [pid] IN (SELECT [pid] FROM [{0}productkeywords] WHERE [keyword] IN ({2})))", RDBSHelper.RDBSTablePre, categoryInfo == null ? "" : "AND [cateid]=" + categoryInfo.CateId, keywordSql); IDataReader reader3 = RDBSHelper.ExecuteReader(CommandType.Text, commandText4.ToString()); while (reader3.Read()) { BrandInfo info = new BrandInfo(); info.BrandId = TypeHelper.ObjectToInt(reader3["brandid"]); info.DisplayOrder = TypeHelper.ObjectToInt(reader3["displayorder"]); info.Name = reader3["name"].ToString(); info.Logo = reader3["logo"].ToString(); brandList.Add(info); } reader3.Close(); #endregion //当品牌列表中一个品牌也不存在时,认为商品也不存在,直接返回 if (brandList.Count < 1) { return; } //当筛选了品牌,但是品牌不在品牌列表中,认为商品也不存在,直接返回 if (brandId > 0) { bool flag = true; foreach (BrandInfo info in brandList) { if (info.BrandId == brandId) { brandInfo = info; flag = false; break; } } if (flag) { return; } } #region 获取商品列表 StringBuilder commandText1 = new StringBuilder(); if (pageNumber == 1) { commandText1.AppendFormat("SELECT TOP {1} [p].[pid],[p].[psn],[p].[cateid],[p].[brandid],[p].[skugid],[p].[name],[p].[shopprice],[p].[marketprice],[p].[costprice],[p].[state],[p].[isbest],[p].[ishot],[p].[isnew],[p].[displayorder],[p].[weight],[p].[showimg],[p].[salecount],[p].[visitcount],[p].[reviewcount],[p].[star1],[p].[star2],[p].[star3],[p].[star4],[p].[star5],[p].[addtime] FROM [{0}products] AS [p]", RDBSHelper.RDBSTablePre, pageSize); if (onlyStock == 1) { commandText1.AppendFormat(" LEFT JOIN [{0}productstocks] AS [ps] ON [p].[pid]=[ps].[pid]", RDBSHelper.RDBSTablePre); } commandText1.AppendFormat(" LEFT JOIN [{0}productkeywords] AS [pk] ON [p].[pid]=[pk].[pid]", RDBSHelper.RDBSTablePre); commandText1.Append(" WHERE [p].[state]=0"); if (categoryInfo != null) { commandText1.AppendFormat(" AND [p].[cateid]={0}", categoryInfo.CateId); } if (brandId > 0) { commandText1.AppendFormat(" AND [p].[brandid]={0}", brandId); } if (categoryInfo != null && filterPrice > 0 && filterPrice <= catePriceRangeList.Length) { string[] priceRange = StringHelper.SplitString(catePriceRangeList[filterPrice - 1], "-"); if (priceRange.Length == 1) { commandText1.AppendFormat(" AND [p].[shopprice]>='{0}'", priceRange[0]); } else if (priceRange.Length == 2) { commandText1.AppendFormat(" AND [p].[shopprice]>='{0}' AND [p].[shopprice]<'{1}'", priceRange[0], priceRange[1]); } } if (categoryInfo != null && attrValueIdList.Count > 0 && attrValueIdList.Count <= cateAAndVList.Count) { commandText1.Append(" AND [p].[pid] IN (SELECT [pa1].[pid] FROM"); for (int i = 0; i < attrValueIdList.Count; i++) { if (i == 0) { commandText1.AppendFormat(" (SELECT [pid] FROM [{0}productattributes] WHERE [attrvalueid]={1}) AS [pa1]", RDBSHelper.RDBSTablePre, attrValueIdList[i]); } else { commandText1.AppendFormat(" INNER JOIN (SELECT [pid] FROM [{0}productattributes] WHERE [attrvalueid]={1}) AS [pa{2}] ON [pa{2}].[pid]=[pa{3}].[pid]", RDBSHelper.RDBSTablePre, attrValueIdList[i], i + 1, i); } } commandText1.Append(")"); } if (onlyStock == 1) { commandText1.Append(" AND [ps].[number]>0"); } commandText1.AppendFormat(" AND [pk].[keyword] IN ({0})", keywordSql); commandText1.Append(" ORDER BY "); switch (sortColumn) { case 0: commandText1.Append("[pk].[relevancy]"); break; case 1: commandText1.Append("[p].[salecount]"); break; case 2: commandText1.Append("[p].[shopprice]"); break; case 3: commandText1.Append("[p].[reviewcount]"); break; case 4: commandText1.Append("[p].[addtime]"); break; case 5: commandText1.Append("[p].[visitcount]"); break; default: commandText1.Append("[pk].[relevancy]"); break; } switch (sortDirection) { case 0: commandText1.Append(" DESC"); break; case 1: commandText1.Append(" ASC"); break; default: commandText1.Append(" DESC"); break; } commandText1.Append(",[p].[pid] DESC"); } else { commandText1.Append("SELECT [pid],[psn],[cateid],[brandid],[skugid],[name],[shopprice],[marketprice],[costprice],[state],[isbest],[ishot],[isnew],[displayorder],[weight],[showimg],[salecount],[visitcount],[reviewcount],[star1],[star2],[star3],[star4],[star5],[addtime] FROM"); commandText1.Append(" (SELECT ROW_NUMBER() OVER (ORDER BY "); switch (sortColumn) { case 0: commandText1.Append("[pk].[relevancy]"); break; case 1: commandText1.Append("[p].[salecount]"); break; case 2: commandText1.Append("[p].[shopprice]"); break; case 3: commandText1.Append("[p].[reviewcount]"); break; case 4: commandText1.Append("[p].[addtime]"); break; case 5: commandText1.Append("[p].[visitcount]"); break; default: commandText1.Append("[pk].[relevancy]"); break; } switch (sortDirection) { case 0: commandText1.Append(" DESC"); break; case 1: commandText1.Append(" ASC"); break; default: commandText1.Append(" DESC"); break; } commandText1.Append(",[p].[pid] DESC"); commandText1.AppendFormat(") AS [rowid],[p].[pid],[p].[psn],[p].[cateid],[p].[brandid],[p].[skugid],[p].[name],[p].[shopprice],[p].[marketprice],[p].[costprice],[p].[state],[p].[isbest],[p].[ishot],[p].[isnew],[p].[displayorder],[p].[weight],[p].[showimg],[p].[salecount],[p].[visitcount],[p].[reviewcount],[p].[star1],[p].[star2],[p].[star3],[p].[star4],[p].[star5],[p].[addtime] FROM [{0}products] AS [p]", RDBSHelper.RDBSTablePre); if (onlyStock == 1) { commandText1.AppendFormat(" LEFT JOIN [{0}productstocks] AS [ps] ON [p].[pid]=[ps].[pid]", RDBSHelper.RDBSTablePre); } commandText1.AppendFormat(" LEFT JOIN [{0}productkeywords] AS [pk] ON [p].[pid]=[pk].[pid]", RDBSHelper.RDBSTablePre); commandText1.Append(" WHERE [p].[state]=0"); if (categoryInfo != null) { commandText1.AppendFormat(" AND [p].[cateid]={0}", categoryInfo.CateId); } if (brandId > 0) { commandText1.AppendFormat(" AND [p].[brandid]={0}", brandId); } if (categoryInfo != null && filterPrice > 0 && filterPrice <= catePriceRangeList.Length) { string[] priceRange = StringHelper.SplitString(catePriceRangeList[filterPrice - 1], "-"); if (priceRange.Length == 1) { commandText1.AppendFormat(" AND [p].[shopprice]>='{0}'", priceRange[0]); } else if (priceRange.Length == 2) { commandText1.AppendFormat(" AND [p].[shopprice]>='{0}' AND [p].[shopprice]<'{1}'", priceRange[0], priceRange[1]); } } if (categoryInfo != null && attrValueIdList.Count > 0 && attrValueIdList.Count == cateAAndVList.Count) { commandText1.Append(" AND [p].[pid] IN (SELECT [pa1].[pid] FROM"); for (int i = 0; i < attrValueIdList.Count; i++) { if (i == 0) { commandText1.AppendFormat(" (SELECT [pid] FROM [{0}productattributes] WHERE [attrvalueid]={1}) AS [pa1]", RDBSHelper.RDBSTablePre, attrValueIdList[i]); } else { commandText1.AppendFormat(" INNER JOIN (SELECT [pid] FROM [{0}productattributes] WHERE [attrvalueid]={1}) AS [pa{2}] ON [pa{2}].[pid]=[pa{3}].[pid]", RDBSHelper.RDBSTablePre, attrValueIdList[i], i + 1, i); } } commandText1.Append(")"); } if (onlyStock == 1) { commandText1.Append(" AND [ps].[number]>0"); } commandText1.AppendFormat(" AND [pk].[keyword] IN ({0})", keywordSql); commandText1.Append(") AS [temp]"); commandText1.AppendFormat(" WHERE [rowid] BETWEEN {0} AND {1}", pageSize * (pageNumber - 1) + 1, pageSize * pageNumber); } productList = new List <PartProductInfo>(); IDataReader reader1 = RDBSHelper.ExecuteReader(CommandType.Text, commandText1.ToString()); while (reader1.Read()) { PartProductInfo partProductInfo = new PartProductInfo(); partProductInfo.Pid = TypeHelper.ObjectToInt(reader1["pid"]); partProductInfo.PSN = reader1["psn"].ToString(); partProductInfo.CateId = TypeHelper.ObjectToInt(reader1["cateid"]); partProductInfo.BrandId = TypeHelper.ObjectToInt(reader1["brandid"]); partProductInfo.SKUGid = TypeHelper.ObjectToInt(reader1["skugid"]); partProductInfo.Name = reader1["name"].ToString(); partProductInfo.ShopPrice = TypeHelper.ObjectToDecimal(reader1["shopprice"]); partProductInfo.MarketPrice = TypeHelper.ObjectToDecimal(reader1["marketprice"]); partProductInfo.CostPrice = TypeHelper.ObjectToDecimal(reader1["costprice"]); partProductInfo.State = TypeHelper.ObjectToInt(reader1["state"]); partProductInfo.IsBest = TypeHelper.ObjectToInt(reader1["isbest"]); partProductInfo.IsHot = TypeHelper.ObjectToInt(reader1["ishot"]); partProductInfo.IsNew = TypeHelper.ObjectToInt(reader1["isnew"]); partProductInfo.DisplayOrder = TypeHelper.ObjectToInt(reader1["displayorder"]); partProductInfo.Weight = TypeHelper.ObjectToDecimal(reader1["weight"]); partProductInfo.ShowImg = reader1["showimg"].ToString(); partProductInfo.SaleCount = TypeHelper.ObjectToInt(reader1["salecount"]); partProductInfo.VisitCount = TypeHelper.ObjectToInt(reader1["visitcount"]); partProductInfo.ReviewCount = TypeHelper.ObjectToInt(reader1["reviewcount"]); partProductInfo.Star1 = TypeHelper.ObjectToInt(reader1["star1"]); partProductInfo.Star2 = TypeHelper.ObjectToInt(reader1["star2"]); partProductInfo.Star3 = TypeHelper.ObjectToInt(reader1["star3"]); partProductInfo.Star4 = TypeHelper.ObjectToInt(reader1["star4"]); partProductInfo.Star5 = TypeHelper.ObjectToInt(reader1["star5"]); partProductInfo.AddTime = TypeHelper.ObjectToDateTime(reader1["addtime"]); productList.Add(partProductInfo); } reader1.Close(); #endregion #region 设置商品总数量 StringBuilder commandText2 = new StringBuilder(); commandText2.AppendFormat("SELECT COUNT([p].[pid]) FROM [{0}products] AS [p]", RDBSHelper.RDBSTablePre); if (onlyStock == 1) { commandText2.AppendFormat(" LEFT JOIN [{0}productstocks] AS [ps] ON [p].[pid]=[ps].[pid]", RDBSHelper.RDBSTablePre); } commandText2.AppendFormat(" LEFT JOIN [{0}productkeywords] AS [pk] ON [p].[pid]=[pk].[pid]", RDBSHelper.RDBSTablePre); commandText2.Append(" WHERE [p].[state]=0"); if (categoryInfo != null) { commandText2.AppendFormat(" AND [p].[cateid]={0}", categoryInfo.CateId); } if (brandId > 0) { commandText2.AppendFormat(" AND [p].[brandid]={0}", brandId); } if (categoryInfo != null && filterPrice > 0 && filterPrice <= catePriceRangeList.Length) { string[] priceRange = StringHelper.SplitString(catePriceRangeList[filterPrice - 1], "-"); if (priceRange.Length == 1) { commandText2.AppendFormat(" AND [p].[shopprice]>='{0}'", priceRange[0]); } else if (priceRange.Length == 2) { commandText2.AppendFormat(" AND [p].[shopprice]>='{0}' AND [p].[shopprice]<'{1}'", priceRange[0], priceRange[1]); } } if (categoryInfo != null && attrValueIdList.Count > 0 && attrValueIdList.Count <= cateAAndVList.Count) { commandText2.Append(" AND [p].[pid] IN (SELECT [pa1].[pid] FROM"); for (int i = 0; i < attrValueIdList.Count; i++) { if (i == 0) { commandText2.AppendFormat(" (SELECT [pid] FROM [{0}productattributes] WHERE [attrvalueid]={1}) AS [pa1]", RDBSHelper.RDBSTablePre, attrValueIdList[i]); } else { commandText2.AppendFormat(" INNER JOIN (SELECT [pid] FROM [{0}productattributes] WHERE [attrvalueid]={1}) AS [pa{2}] ON [pa{2}].[pid]=[pa{3}].[pid]", RDBSHelper.RDBSTablePre, attrValueIdList[i], i + 1, i); } } commandText2.Append(")"); } if (onlyStock == 1) { commandText2.Append(" AND [ps].[number]>0"); } commandText2.AppendFormat(" AND [pk].[keyword] IN ({0})", keywordSql); totalCount = TypeHelper.ObjectToInt(RDBSHelper.ExecuteScalar(CommandType.Text, commandText2.ToString())); #endregion }
public static async Task <ProductCreateResultJson> ProductCreateAsync(string accessTokenOrAppId, string keyStandard, string keyStr, BrandInfo brandInfo, int timeOut = Config.TIME_OUT) { return(await ApiHandlerWapper.TryCommonApiAsync(async accessToken => { var urlFormat = string.Format(Config.ApiMpHost + "/scan/product/create?access_token={0}", accessToken.AsUrlData()); var data = new { keystandard = keyStandard, keystr = keyStr, brand_info = brandInfo }; return await Senparc.Weixin.CommonAPIs.CommonJsonSend.SendAsync <ProductCreateResultJson>(null, urlFormat, null, CommonJsonSendType.POST, timeOut: timeOut).ConfigureAwait(false); }, accessTokenOrAppId).ConfigureAwait(false)); }
/// <summary> /// 更新品牌 /// </summary> /// <param name="brandInfo"></param> public static void UpdateBrand(BrandInfo brandInfo) { NStore.Data.Brands.UpdateBrand(brandInfo); NStore.Core.BMACache.Remove(CacheKeys.MALL_BRAND_INFO + brandInfo.BrandId); }