/// <summary> /// 绑定产品信息 /// </summary> /// <param name="id"></param> public void Bind(int id)//, int goodsInfoId) { Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(id); if (model != null && model.dr == 0 && model.IsEnabled == 1) { if (goodsInfoId == 0) { List <Hi.Model.BD_GoodsInfo> l = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and goodsid=" + id, ""); if (l.Count > 0) { this.lblCode.InnerText = l[0].BarCode.Trim(); //商品编号 this.lblInventory.InnerText = l[0].Inventory.ToString(); //商品库存. goodsInfoId = l[0].ID; } } else { Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (model2 != null) { this.lblCode.InnerText = model2.BarCode.Trim(); //商品编号 this.lblInventory.InnerText = model2.Inventory.ToString(); //商品库存. } } Hi.Model.SYS_GType model3 = new Hi.BLL.SYS_GType().GetModel(model.CategoryID); if (model3 != null) { this.lblCategory.InnerText = model3.TypeName.Trim(); //分类 } GetZiDingYi(model); //自定义字段 // this.divTitle.InnerText = model.GoodsName.Trim();//biaot // this.divTitle.InnerHtml = model.GoodsName.Trim() + SelectGoods.ProType(zhek);//商品名称 string zhek = Cuxiao(goodsInfoId.ToString()); if (!Util.IsEmpty(zhek)) { this.divTitle.InnerHtml = model.GoodsName + SelectGoods.ProType(zhek);//商品名称 } else { this.divTitle.InnerHtml = model.GoodsName; } if (model.IsLS == 1) { this.isls.Visible = true; this.lbllsprice.InnerText = "¥" + model.LSPrice.ToString("0.00"); } else { this.isls.Visible = false; } this.divMemo.InnerHtml = model.Title.Trim(); //描述 this.lblHideInfo1.InnerText = model.HideInfo1; this.lblHideInfo2.InnerText = model.HideInfo2; //描述 this.lblUnit.InnerText = model.Unit.Trim(); //计量单位 // this.lblRecommend.InnerText = model.IsRecommended == 2 ? "推荐" : "否";//是否推荐 if (model.IsRecommended == 2) { this.lblShow.InnerText = "显示"; this.lblRecommend.InnerText = "推荐"; } else if (model.IsRecommended == 1) { this.lblShow.InnerText = "显示"; this.lblRecommend.InnerText = "不推荐"; } else { this.lblShow.InnerText = "不显示"; this.lblRecommend.InnerText = "不推荐"; } if (model.Details == "") { this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>"; } else { this.DivShow.InnerHtml = model.Details; } if (!string.IsNullOrEmpty(model.Pic))//有图片 { LoginModel logUser = HttpContext.Current.Session["UserModel"] as LoginModel; string basePath = Common.GetWebConfigKey("OssImgPath") + "company/" + ((logUser != null) ? logUser.CompID.ToString() : "") + "/"; string surfix = "?x-oss-process=style/resize400"; this.imgPic.Src = basePath + model.Pic + surfix; this.imgPic2.Src = basePath + model.Pic + surfix; this.imgPic.Attributes.Add("jqimg", basePath + model.Pic); this.imgPic2.Attributes.Add("bimg", basePath + model.Pic); } else { this.imgPic.Src = "../../images/havenopicmax.gif"; //无图片 this.imgPic2.Src = "../../images/havenopicmax.gif"; //无图片 this.imgPic2.Attributes.Add("bimg", "../../images/havenopicmax.gif"); this.imgPic.Attributes.Add("jqimg", "../../images/havenopicmax.gif"); } } else { JScript.AlertMethod(this, "商品不存在或者已经被删除", JScript.IconOption.错误, "function(){location.href='GoodsInfoList.aspx';}"); return; } string html = string.Empty; List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + this.CompID + " and goodsId=" + id.ToString(), ""); if (ll.Count > 0) { int xy = 0; foreach (Hi.Model.BD_GoodsAttrs item in ll) { List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + this.CompID + " and attrsId=" + item.ID, ""); if (lll.Count > 0) { html += "<div class=\"li\"><i class=\"bt2\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</i><div class=\"fun\" style=\"display: inline;\">"; int count = 1; foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll) { //Hi.Model.BD_GoodsInfo model4 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); //if (xy == 0) //{ // html += "<a href=\"javascript:;\" class=\"" + (model4.Value1 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; //} //else if (xy == 1) //{ // html += "<a href=\"javascript:;\" class=\"" + (model4.Value2 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; //} //else if (xy == 2) //{ // html += "<a href=\"javascript:;\" class=\"" + (model4.Value3 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; //} if (count == 1) { html += "<a href=\"javascript:;\" class=\"hover\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } else { html += "<a href=\"javascript:;\" class=\"\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } count++; } html += "</div></div>"; } xy++; } } litAttrVaue.Text = html; }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDel_Click(object sender, EventArgs e) { SqlTransaction Tran = Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); try { List <int> l = new List <int>(); foreach (RepeaterItem row in this.rptAttribute.Items) { CheckBox cb = row.FindControl("CB_SelItem") as CheckBox; if (cb != null && cb.Checked) { HiddenField fld = row.FindControl("HF_Id") as HiddenField; if (fld != null) { int id = Convert.ToInt32(fld.Value); l.Add(id); Hi.Model.BD_Attribute model = new Hi.BLL.BD_Attribute().GetModel(id); if (model != null) { var lll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and AttrsName ='" + model.AttributeName + "'", ""); if (lll.Count > 0) { JScript.AlertMethod(this, "属性已被使用,不能删除", JScript.IconOption.错误); break; } model.ts = DateTime.Now; model.modifyuser = this.UserID; model.dr = 1; model.CompID = this.CompID; bool bol = new Hi.BLL.BD_Attribute().Update(model); List <Hi.Model.BD_AttributeValues> ll = new Hi.BLL.BD_AttributeValues().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and attributeid=" + id, "", Tran); if (ll.Count > 0) { foreach (Hi.Model.BD_AttributeValues item in ll) { Hi.Model.BD_AttributeValues model2 = new Hi.BLL.BD_AttributeValues().GetModel(item.ID, Tran); model2.dr = 1; model2.modifyuser = this.UserID; model2.ts = DateTime.Now; new Hi.BLL.BD_AttributeValues().Update(model2, Tran); } } } } } } Tran.Commit(); } catch (Exception ex) { if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } JScript.AlertMethod(this, "失败", JScript.IconOption.错误); return; } finally { DBUtility.SqlHelper.ConnectionClose(); } // new Hi.BLL.BD_Attribute().Updates(this.UserID.ToString(), l, this.CompID.ToString()); Bind(); }
/// <summary> /// 获取某一分类产品信息,兼容了无属性的值,分类传-1 /// </summary> /// <param name="JSon"></param> /// <returns></returns> public BD_GoodsCategory.ResultProductList GetProductsList(string JSon) { try { #region JSon取值 string userID = string.Empty; string disID = string.Empty; string categoryID = string.Empty; //分类ID string criticalProductID = string.Empty; //当前列表最临界点产品ID:初始-1 string getType = string.Empty; //方向 string rows = string.Empty; string sortType = string.Empty; string sort = string.Empty; JsonData JInfo = JsonMapper.ToObject(JSon); if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" && JInfo["CriticalProductID"].ToString() != "" && JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" && JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "") { userID = JInfo["UserID"].ToString(); disID = JInfo["ResellerID"].ToString(); categoryID = JInfo["ClassifyID"].ToString(); criticalProductID = JInfo["CriticalProductID"].ToString(); getType = JInfo["GetType"].ToString(); rows = JInfo["Rows"].ToString(); sortType = JInfo["SortType"].ToString(); sort = JInfo["Sort"].ToString(); } else { return(new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "参数异常" }); } Hi.Model.SYS_Users user = new Hi.Model.SYS_Users(); if (!new Common().IsLegitUser(int.Parse(userID), out user, 0, int.Parse(disID == "" ? "0" : disID))) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "参数异常" } } ; #endregion #region 模拟分页 string strsql = string.Empty; //搜索sql Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(int.Parse(disID)); if (dis == null || dis.dr == 1 || dis.IsEnabled == 0) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "未找到经销商" } } ; const string tabName = " [dbo].[BD_Goods]"; //表名 sortType = sortType == "2" ? "SalePrice" : "ID"; //价格排序 string strWhere = string.Empty; switch (categoryID) { case "-2": //促销列表 { List <Hi.Model.BD_Promotion> promotionList = new Hi.BLL.BD_Promotion().GetList("", " compID='" + dis.CompID + "' and ProStartTime<='" + DateTime.Now + "' and ProEndTime >='" + DateTime.Now + "' and IsEnabled=1", ""); List <Hi.Model.BD_PromotionDetail> detailList = new List <BD_PromotionDetail>(); if (promotionList != null && promotionList.Count > 0) { detailList = new Hi.BLL.BD_PromotionDetail().GetList("", " ProID in(" + string.Join(",", promotionList.Select(p => p.ID)) + ")", ""); } if (promotionList == null) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "今天无促销" } } ; if (detailList == null) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "今天无促销" } } ; var ienum = detailList.Select(p => p.GoodsID); if (ienum.Count() > 0) { strWhere += " and ID in ( " + string.Join(",", ienum) + ")"; } } break; case "-3": //收藏列表 { List <Hi.Model.BD_DisCollect> collects = new Hi.BLL.BD_DisCollect().GetList("", "disID='" + disID + "' and dr=0", ""); if (collects != null) { strWhere += " and ID not in ( -1 "; strWhere = collects.Aggregate(strWhere, (current, goods) => current + ("," + goods.GoodsID)) + ")"; } } break; default: if (categoryID != "-1") //全部 { strWhere += " and CategoryID in (" + Common.AllCategory(int.Parse(categoryID)) + ")"; } break; } //商品可售区域判断 List <Common.GoodsID> list = Common.DisEnAreaGoodsID(disID, dis.CompID.ToString()); if (list != null) { strWhere += " and ID not in ( -1 "; strWhere = list.Aggregate(strWhere, (current, goods) => current + ("," + goods.goodsID)) + ")"; } strWhere += " and ISNULL(dr,0)=0 and isoffline=1 and IsEnabled = 1 and compid=" + dis.CompID; strsql = new Common().PageSqlString(criticalProductID, "ID", tabName, sortType, sort, strWhere, getType, rows); #endregion List <Hi.Model.BD_DisCollect> Colist = Common.GetDataSource <BD_DisCollect>("", " and disID='" + disID + "' and compID='" + dis.CompID + "' and IsEnabled =1"); List <Hi.Model.BD_GoodsInfo> infoAllList = new Hi.BLL.BD_GoodsInfo().GetList("", " CompID='" + dis.CompID + "' and ISNULL(dr,0)=0 and IsEnabled=1 and isoffline=1", ""); #region 赋值 int CategoryID = 0; List <BD_GoodsCategory.Product> ProductList = new List <BD_GoodsCategory.Product>(); DataTable dsList = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql).Tables[0]; if (dsList != null) { if (dsList.Rows.Count == 0) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "未找到数据" } } ; foreach (DataRow row in dsList.Rows) { string SKUName = string.Empty; BD_GoodsCategory.Product product = new BD_GoodsCategory.Product(); product.ProductID = row["ID"].ToString(); //商品ID product.ProductName = row["GoodsName"].ToString(); SKUName += product.ProductName; product.SalePrice = decimal.Parse(row["SalePrice"].ToString()).ToString("0.00"); product.IsSale = row["IsSale"].ToString(); List <Hi.Model.BD_DisCollect> alist = Colist != null && Colist.Count > 0 ? Colist.Where(p => p.GoodsID.ToString() == product.ProductID).ToList() : null; product.IsCollect = alist != null && alist.Count > 0 ? "1" : "0"; product.Title = row["Title"].ToString(); //product.Details = row["Details"].ToString(); product.Title = row["Title"].ToString(); product.Unit = row["Unit"].ToString(); product.ClassifyID = row["CategoryID"].ToString(); CategoryID = int.Parse(row["CategoryID"].ToString()); //类别ID List <BD_GoodsCategory.Pic> Pic = new List <BD_GoodsCategory.Pic>(); #region List<Pic> Pic if (row["Pic"].ToString() != "" && row["Pic"].ToString() != "X") { BD_GoodsCategory.Pic pic = new BD_GoodsCategory.Pic(); pic.ProductID = row["ID"].ToString(); pic.IsDeafult = "1"; pic.PicUrl = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" + row["Pic"].ToString(); Pic.Add(pic); } Pic.AddRange(GetPicList(row["ID"].ToString())); #endregion product.ProductPicUrlList = Pic; List <BD_GoodsCategory.SKU> SKUList = new List <BD_GoodsCategory.SKU>(); string strID = "0"; #region 通过 商品ID和属性值ID关联表,找到属性值 List <Hi.Model.BD_GoodsInfo> goodsInfoList = infoAllList != null && infoAllList.Count > 0 ? infoAllList.Where(p => p.GoodsID.ToString() == row["ID"].ToString()).ToList() : null; foreach (Hi.Model.BD_GoodsInfo goodsInfo in goodsInfoList) { if (!Common.IsOffline(goodsInfo.ID)) { continue; } BD_GoodsCategory.SKU SKU = new BD_GoodsCategory.SKU(); //SKUID是GoodsInfoID,SKUName是GoodsName+各种属性值 SKU.SKUID = goodsInfo.ID.ToString(); SKU.ProductID = goodsInfo.GoodsID.ToString(); SKU.BarCode = goodsInfo.BarCode; //SKUName = GoodsName + ValueInfo SKU.SKUName = SKUName + " " + goodsInfo.ValueInfo; SKU.ValueInfo = goodsInfo.ValueInfo; SKU.SalePrice = goodsInfo.SalePrice.ToString("0.00"); int ProID = 0; //暂时未用到 促销ID SKU.IsPro = "0"; //默认不是促销价 decimal price = Common.GetProPrice(goodsInfo.GoodsID.ToString(), goodsInfo.ID.ToString(), goodsInfo.CompID.ToString(), out ProID); if (price == 0) { List <Hi.Model.BD_GoodsPrice> goodsPrice = new Hi.BLL.BD_GoodsPrice().GetList("", " GoodsInfoID='" + goodsInfo.ID + "' and ISNULL(dr,0)=0 and compid='" + goodsInfo.CompID + "' and IsEnabled=1", ""); SKU.TinkerPrice = goodsPrice.Count != 0 ? goodsPrice[0].TinkerPrice.ToString("0.00") : goodsInfo.TinkerPrice.ToString("0.00"); } else { SKU.IsPro = "1"; //是促销价 SKU.ProInfo = GetProInfo(ProID, goodsInfo.ID); SKU.TinkerPrice = price.ToString("0.00"); } List <BD_GoodsCategory.ProductAttValueID> ProductAttValueIDList = new List <BD_GoodsCategory.ProductAttValueID>(); List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", " GoodsID='" + goodsInfo.GoodsID + "' and ISNULL(dr,0)=0", ""); if (attrList == null) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "未找到商品属性名字" } } ; List <Hi.Model.BD_GoodsAttrs> attrValList = new Hi.BLL.BD_GoodsAttrs().GetList("*", " CompID ='" + dis.CompID + "'", ""); foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList) { strID += "," + attribute.AttrsID; string[] args = new[] { goodsInfo.ValueInfo }; string[] items = args[0].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); foreach (string item in items) { string[] strs = item.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (strs[1] == attribute.AttrsInfoName) { BD_GoodsCategory.ProductAttValueID productAttValueID = new BD_GoodsCategory.ProductAttValueID() { ProductAttributeValueID = attribute.ID.ToString()// }; ProductAttValueIDList.Add(productAttValueID); } } } SKU.ProductAttValueIDList = ProductAttValueIDList; SKUList.Add(SKU); } #endregion product.SKUList = SKUList; List <BD_GoodsCategory.ProductAttribute> ProductAttributeList = new List <BD_GoodsCategory.ProductAttribute>(); #region 通过商品类别ID和属性ID关联表,找到属性ID List <Hi.Model.BD_GoodsAttrs> val = new Hi.BLL.BD_GoodsAttrs().GetList("", " ID in (" + strID + ") and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0", ""); if (val == null) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "未找到商品属性" } } ; foreach (Hi.Model.BD_GoodsAttrs goodsAttr in val) { BD_GoodsCategory.ProductAttribute proAttr = new BD_GoodsCategory.ProductAttribute(); proAttr.ProductID = row["ID"].ToString(); proAttr.ProductAttributeID = goodsAttr.ID.ToString(); //属性ID proAttr.ProductAttributeName = goodsAttr.AttrsName; //属性名称 List <BD_GoodsCategory.ProductAttValue> ProductAttValueList = new List <BD_GoodsCategory.ProductAttValue>(); List <Hi.Model.BD_GoodsAttrsInfo> attrList = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", " AttrsID='" + goodsAttr.ID + "' and CompID='" + dis.CompID + "' and ISNULL(dr,0)=0" + " and AttrsID in (" + strID + ")", "ID"); //todo:商品属性表修改咨询商品结构 if (attrList == null) { return new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "未找到商品属性名字" } } ; foreach (Hi.Model.BD_GoodsAttrsInfo attribute in attrList) { BD_GoodsCategory.ProductAttValue productAttValue = new BD_GoodsCategory.ProductAttValue(); productAttValue.ProductID = row["ID"].ToString(); productAttValue.ProductAttributeID = goodsAttr.ID.ToString(); productAttValue.ProductAttValueID = attribute.ID.ToString(); productAttValue.ProductAttValueName = attribute.AttrsInfoName; ProductAttValueList.Add(productAttValue); } proAttr.ProductAttValueList = ProductAttValueList; ProductAttributeList.Add(proAttr); } #endregion product.ProductAttributeList = ProductAttributeList; ProductList.Add(product); } } #endregion return(new BD_GoodsCategory.ResultProductList() { Result = "T", Description = "获取成功", ClassifyID = categoryID, ProductList = ProductList }); } catch (Exception ex) { Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetResellerProductList :" + JSon); return(new BD_GoodsCategory.ResultProductList() { Result = "F", Description = "异常" }); } }
/// <summary> /// 商品信息绑定 /// </summary> public void Bind() { LoginModel logmodel = HttpContext.Current.Session["UserModel"] as LoginModel; Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(goodsId); if (model != null) { GetZiDingYi(model); mKeyword.Content = string.IsNullOrWhiteSpace(model.Title) ? model.GoodsName : model.Title; string zhek = Cuxiao(); if (!Util.IsEmpty(zhek)) { this.lblGoodsName.InnerHtml = model.GoodsName + SelectGoods.ProType(zhek); //商品名称 tiele_name = model.GoodsName; //前台title显示 if (hidGoodsInfoId.Value != null && hidGoodsInfoId.Value != "") { Hi.Model.BD_GoodsInfo godosInfomodel = new Hi.BLL.BD_GoodsInfo().GetModel(Convert.ToInt32(hidGoodsInfoId.Value)); //add by hgh 未登录,原价不可见 //if (logmodel != null) //{ if (Request["Comid"].ToString() == model.CompID.ToString()) { this.YuanPrice.InnerHtml = "<s><i>原价:</i><b class=\"red\" id=\"B1\">" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(godosInfomodel.TinkerPrice).ToString())).ToString("#,##0.00") + "</b></s>"; } else { string sysNameWhere = string.Format(" CompID={0} and Name='是否店铺开放价格'", Request["Comid"].ToInt(0)); List <Hi.Model.SYS_SysName> Sysl = new Hi.BLL.SYS_SysName().GetList("", sysNameWhere, ""); if (Sysl.Count > 0) { if (Sysl[0].Value == "1") { this.YuanPrice.InnerHtml = "<s><i>原价:</i><b class=\"red\" id=\"B1\">" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(godosInfomodel.TinkerPrice).ToString())).ToString("#,##0.00") + "</b></s>"; } } } //} } } else { this.lblGoodsName.InnerHtml = model.GoodsName; tiele_name = model.GoodsName;//前台title显示 this.YuanPrice.InnerHtml = ""; } this.lblunit.InnerText = model.Unit; this.lblGoodsTitle.InnerText = model.Title;//商品卖点 hideInfo1 = model.HideInfo1; hideInfo2 = model.HideInfo2; if (!Util.IsEmpty(model.Details.Trim())) { this.lblGoodsDetali.InnerHtml = model.Details.Replace("<pre>", "<p>").Replace("</pre>", "</p>");//商品描述 } if (!Util.IsEmpty(model.registeredCertificate.Trim())) { string url = Common.GetWebConfigKey("OssImgPath") + "UploadFile/" + model.registeredCertificate; this.lblGoodsDetali1.InnerHtml = "<img width=\"600\" src=\"" + url + "\"/>"; } //this.lblPrice.InnerText = "¥" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(model.SalePrice.ToString()).ToString())).ToString("#,##0.00"); ;//商品价格 if (model != null && !string.IsNullOrEmpty(model.Pic)) { this.imgPic.Src = Common.GetPicURL(model.Pic, "resize400", compId.ToString()); this.imgPic.Attributes.Add("jqimg", Common.GetPicURL(model.Pic, "", compId.ToString())); } else { imgPic.Src = "../images/Goods400x400.jpg";//无图片 imgPic.Attributes.Add("jqimg", "../images/Goods400x400.jpg"); } string html = string.Empty; List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and goodsId=" + goodsId.ToString(), ""); if (ll.Count > 0) { foreach (Hi.Model.BD_GoodsAttrs item in ll) { int xy = 0; List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and attrsId=" + item.ID, ""); if (lll.Count > 0) { //add by hgh if (item.AttrsName.Length > 4) { item.AttrsName = item.AttrsName.Substring(0, 4); } html += "<div class=\"li\"><div class=\"t\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</div><div class=\"n\">"; foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll) { if (goodsInfoId == 0) { html += "<a href=\"javascript:;\" class=\"" + (xy == 0 ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>"; } else { Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (model2 != null) { html += "<a href=\"javascript:;\" class=\"" + (model2.Value1 == item2.AttrsInfoName || model2.Value2 == item2.AttrsInfoName || model2.Value3 == item2.AttrsInfoName ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>"; } } xy++; } html += "</div></div>"; } } } litAttrVaue.InnerHtml = html; if (logmodel != null) { List <Hi.Model.BD_DisCollect> llll = new Hi.BLL.BD_DisCollect().GetList("", "isnull(dr,0)=0 and comPid=" + model.CompID + " and goodsId=" + goodsId + " and disId=" + logmodel.DisID, ""); if (llll.Count > 0) { ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btn .keep\").html('<i class=\"sc-icon\" style=\"background-position:0 -73px;\"></i>取消收藏\');})</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btn .keep\").html('<i class=\"sc-icon\" ></i>加入收藏\');})</script>"); } } } }
public ResultOrderList GetBriefingList(string JSon) { try { string UserID = string.Empty; string CompID = string.Empty; string criticalOrderID = string.Empty; //当前列表最临界点产品ID:初始-1 string getType = string.Empty; //方向 string rows = string.Empty; string sortType = string.Empty; string sort = string.Empty; string datetype = string.Empty; string ordertype = string.Empty; #region//JSon取值 JsonData JInfo = JsonMapper.ToObject(JSon); if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["CompID"].ToString() != "" && JInfo["CriticalOrderID"].ToString() != "" && JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" && JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "" && JInfo["DateType"].ToString() != "" && JInfo["OrderType"].ToString() != "") { UserID = JInfo["UserID"].ToString(); CompID = JInfo["CompID"].ToString(); criticalOrderID = JInfo["CriticalOrderID"].ToString(); getType = JInfo["GetType"].ToString(); rows = JInfo["Rows"].ToString(); sortType = JInfo["SortType"].ToString(); sort = JInfo["Sort"].ToString(); datetype = JInfo["DateType"].ToString(); ordertype = JInfo["OrderType"].ToString(); } else { return(new ResultOrderList() { Result = "F", Description = "参数异常" }); } #endregion //判断登录信息是否异常 Hi.Model.SYS_Users one = new Hi.Model.SYS_Users(); if (!new Common().IsLegitUser(int.Parse(UserID), out one, int.Parse(CompID == "" ? "0" : CompID))) { return new ResultOrderList() { Result = "F", Description = "登录信息异常" } } ; //判断经销商信息是否异常 Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(Convert.ToInt32(CompID)); if (comp == null || comp.dr == 1 || comp.AuditState == 0 || comp.IsEnabled == 0) { return new ResultOrderList() { Result = "F", Description = "核心企业异常" } } ; DateTime date = DateTime.Now; DateTime date_start = new DateTime(); DateTime date_end = date.AddDays(1); //string strdate_start = string.Empty; // string strdate_end = date_end.ToString("yyyy-MM-dd"); string strwhere = ""; switch (datetype) { case "0": date_start = new DateTime(date.Year, date.Month, date.Day, 0, 0, 0); //strdate_start = date_start.ToString("yyyy-MM-dd"); break; case "1": DateTime startWeek = date.AddDays(1 - Convert.ToInt32(date.DayOfWeek.ToString("d"))); date_start = new DateTime(startWeek.Year, startWeek.Month, startWeek.Day, 0, 0, 0); //strdate_start = date_start.ToString("yyyy-MM-dd"); break; case "2": date_start = new DateTime(date.Year, date.Month, 1); //strdate_start = date_start.ToString("yyyy-MM-dd"); break; default: return(new ResultOrderList() { Result = "F", Description = "时间段类型异常" }); break; } switch (ordertype) { case "0": strwhere = " and isnull(dr,0)=0 and Otype!=9 and CompID=" + comp.ID + " and OState in (2,3,4,5,7) and CreateDate>='" + date_start + "' and CreateDate<='" + date_end + "'"; break; case "1": strwhere = " and isnull(dr,0)=0 and CompID=" + comp.ID + " and CreateDate>='" + date_start + "' and CreateDate<='" + date_end + "' and ReturnState =3"; break; case "2": string sql = "SELECT distinct orderID FROM [dbo].[CompCollection_view] where OrderID not in(select ID from Dis_Order where ISNULL(dr,0)=0 and (Otype=9 or OState not in(2,3,4,5,7)) and CompID=" + comp.ID + ") and status!=3 and CompID=" + comp.ID + " and Date>='" + date_start + "' and Date<'" + date_end + "' AND vedf9=1 "; DataTable dt_pay = SqlHelper.Query(SqlHelper.LocalSqlServer, sql).Tables[0]; string where = ""; for (int i = 0; i < dt_pay.Rows.Count; i++) { if (ClsSystem.gnvl(dt_pay.Rows[i]["orderID"], "") != "") { where += ","; where += ClsSystem.gnvl(dt_pay.Rows[i]["orderID"], ""); } } where = where.Substring(1, where.Length - 1); strwhere = " and id in (" + where + ")"; break; default: return(new ResultOrderList() { Result = "F", Description = "订单类型异常" }); break; } if (sortType == "1") //价格排序 { sortType = "CreateDate"; } else if (sortType == "2") //价格排序 { sortType = "TotalAmount"; } else { sortType = "ID"; } string strsql = new Common().PageSqlString(criticalOrderID, "ID", "DIS_Order", sortType, sort, strwhere, getType, rows); if (strsql == "") { return new ResultOrderList() { Result = "F", Description = "基础数据异常" } } ; #region 赋值 List <Order> OrderList = new List <Order>(); DataSet ds = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql); if (ds.Tables.Count == 0) { return new ResultOrderList() { Result = "T", Description = "没有更多数据" } } ; DataTable orderList = ds.Tables[0]; if (orderList != null) { if (orderList.Rows.Count == 0) { return new ResultOrderList() { Result = "T", Description = "没有更多数据" } } ; foreach (DataRow row in orderList.Rows) { Order order = new Order(); Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(int.Parse(row["ID"].ToString())); if (orderModel == null || orderModel.dr == 1) { return new ResultOrderList() { Result = "F", Description = "订单异常" } } ; order.OrderID = orderModel.ID.ToString(); order.CompID = orderModel.CompID.ToString(); order.CompName = comp.CompName; order.State = Common.GetCompOrderType(orderModel.OState, orderModel.PayState, orderModel.Otype, orderModel.ReturnState); string IsEnSend, IsEnPay, IsEnReceive, IsEnReturn, IsEnAudit; Common.GetEspecialType(orderModel.OState.ToString(), orderModel.PayState.ToString(), orderModel.Otype.ToString(), orderModel.ReturnState.ToString(), out IsEnSend, out IsEnPay, out IsEnAudit, out IsEnReceive, out IsEnReturn); order.IsEnSend = IsEnSend; order.IsEnPay = IsEnPay; order.IsEnAudit = IsEnAudit; order.IsEnReceive = IsEnReceive; order.IsEnReturn = IsEnReturn; order.Otype = orderModel.Otype.ToString(); order.AddType = orderModel.AddType.ToString(); order.OState = orderModel.OState.ToString(); order.PayState = orderModel.PayState.ToString(); order.ReturnState = orderModel.ReturnState.ToString(); order.DisID = orderModel.DisID.ToString(); Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(orderModel.DisID); if (dis == null || dis.AuditState == 0 || dis.dr == 1) { return new ResultOrderList() { Result = "F", Description = "经销信息商异常" } } ; order.DisName = dis.DisName; order.DisUserID = orderModel.DisUserID.ToString(); Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(order.DisUserID)); //if (user == null || user.IsEnabled == 0 || user.dr == 1) // return new ResultOrderList() { Result = "F", Description = "经销商用户信息异常" }; //order.DisUserName = orderModel.DisUserName; if (user != null && user.IsEnabled == 1 && user.dr == 0) { order.DisUserName = user.TrueName; } else { order.DisUserName = ""; } order.AddrID = orderModel.AddrID.ToString(); order.ReceiptNo = orderModel.ReceiptNo; if (ClsSystem.gnvl(orderModel.ArriveDate, "") != "0001/1/1 0:00:00" && ClsSystem.gnvl(orderModel.ArriveDate, "") != "") { order.ArriveDate = orderModel.ArriveDate.ToString("yyyy-MM-dd"); } if (!string.IsNullOrEmpty(orderModel.AddrID.ToString())) { Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(orderModel.AddrID); if (addr != null) { order.Zip = addr.Zip; } } order.Address = orderModel.Address; order.Contact = orderModel.Principal; order.Phone = orderModel.Phone; order.TotalAmount = orderModel.AuditAmount.ToString("0.00"); order.AuditTotalAmount = orderModel.AuditAmount.ToString("0.00"); order.PayedAmount = orderModel.PayedAmount.ToString("0.00"); order.CreateUserID = orderModel.CreateUserID.ToString(); order.CreateDate = orderModel.CreateDate.ToString("yyyy-MM-dd HH:mm"); order.ReturnMoneyDate = orderModel.ReturnMoneyDate.ToString(); order.ReturnMoneyUser = orderModel.ReturnMoneyUser; order.ReturnMoneyUserId = orderModel.ReturnMoneyUserId.ToString(); List <Hi.Model.DIS_OrderOut> outList = new Hi.BLL.DIS_OrderOut().GetList("", " OrderID='" + orderModel.ID + "' and CompID='" + orderModel.CompID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", ""); if (outList.Count != 0) { Hi.Model.DIS_OrderOut orderOut = new Hi.Model.DIS_OrderOut(); foreach (Hi.Model.DIS_OrderOut Out in outList) { orderOut = Out; } order.SendID = orderOut.ID.ToString(); order.SendDate = orderOut.SendDate.ToString(); ////order.Express = orderOut.Express; ////order.ExpressNo = orderOut.ExpressNo; ////order.ExpressPerson = orderOut.ExpressPerson; ////order.ExpressTel = orderOut.ExpressTel; ////order.ExpressBao = orderOut.ExpressBao; ////order.PostFee = orderOut.PostFee.ToString("0.00"); order.ActionUser = orderOut.ActionUser; List <Hi.Model.DIS_Logistics> exlist = Common.GetExpress(orderOut.ID.ToString()); if (exlist != null) { order.SendRemark = exlist[0].Context; } order.IsAudit = orderOut.IsAudit.ToString(); order.AuditUserID = orderOut.AuditUserID.ToString(); order.AuditDate = orderOut.AuditDate.ToString(); order.AuditRemark = orderOut.AuditRemark == null ? "" : orderOut.AuditRemark.ToString(); order.SignDate = orderOut.SignDate.ToString(); order.IsSign = orderOut.IsSign.ToString(); order.SignUserId = orderOut.SignUserId.ToString(); order.SignUser = orderOut.SignUser; order.SignRemark = orderOut.SignRemark; } //todo:不知道的排序 //order.SortIndex = orderModel.SortIndex.ToString(); order.IsDel = orderModel.dr.ToString(); //明细 List <OrderDetail> orderDetail = new List <OrderDetail>(); List <Hi.Model.DIS_OrderDetail> detailList = new Hi.BLL.DIS_OrderDetail().GetList("", " OrderID='" + orderModel.ID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", ""); if (detailList == null) //|| detailList.Count==0 { return new ResultOrderList() { Result = "F", Description = "订单明细异常" } } ; List <Hi.Model.BD_GoodsAttrs> list_attrs = null; foreach (Hi.Model.DIS_OrderDetail detail in detailList) { string SKUName = string.Empty; OrderDetail ordetail = new OrderDetail(); ordetail.SKUID = detail.GoodsinfoID.ToString(); //通过GoodsInfoID找到GoodsID Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID); if (goodsInfo == null) { //if (goodsInfo == null || goodsInfo.IsEnabled == false || goodsInfo.dr == 1) return new ResultOrderList() { Result = "F", Description = "SKU信息异常" } } ; ordetail.ProductID = goodsInfo.GoodsID.ToString(); //通过GoodsID找到GoodsName Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID); if (goods == null) { //if (goods == null || goods.IsEnabled == 0 | goods.dr == 1) return new ResultOrderList() { Result = "F", Description = "商品异常" } } ; ordetail.ProductName = goods.GoodsName; SKUName += goods.GoodsName; list_attrs = new Hi.BLL.BD_GoodsAttrs().GetList("AttrsName", "GoodsID = " + goodsInfo.GoodsID + " and CompID = " + comp.ID + " and ISNULL(dr,0) = 0", ""); if (list_attrs != null && list_attrs.Count != 0) { foreach (Hi.Model.BD_GoodsAttrs attr in list_attrs) { SKUName += attr.AttrsName; } } ordetail.SKUName = SKUName; //todo:描述是什么 ordetail.ValueInfo = goodsInfo.ValueInfo; ordetail.SalePrice = detail.Price.ToString("0.00"); ordetail.TinkerPrice = detail.AuditAmount.ToString("0.00"); ordetail.Num = detail.GoodsNum.ToString("0.00"); ordetail.Remark = detail.Remark; //ordetail.IsPro = .Trim() == "0" || detail.vdef1.Trim() == "" ? "0" : "1"; //是否是促销商品 //是否是促销商品 ordetail.IsPro = ClsSystem.gnvl(detail.vdef1, "").Trim() == "0" || ClsSystem.gnvl(detail.vdef1, "").Trim() == "" ? "0" : "1"; if (ordetail.IsPro != "0") { ordetail.ProNum = detail.vdef5; if (detail.vdef1 != "" && detail.vdef1.Length > 0) { Hi.Model.BD_Promotion pro = new Hi.BLL.BD_Promotion().GetModel(Convert.ToInt32(detail.vdef1)); if (pro != null) { List <Hi.Model.BD_PromotionDetail> dList = new Hi.BLL.BD_PromotionDetail().GetList( "", " ProID=" + pro.ID + " and GoodInfoID ='" + ordetail.SKUID + "' and dr=0", ""); string info = string.Empty; if (dList != null && dList.Count > 0) { if (pro.Type == 0 && pro.ProType == 1) { info = "赠品"; } else if (pro.Type == 0 && pro.ProType == 2) { info = "商品优惠价" + dList[0].GoodsPrice.ToString("0.00"); } else if (pro.Type == 1 && pro.ProType == 3) { info = "商品数量满" + pro.Discount.ToString("0.00") + "赠" + dList[0].GoodsPrice.ToString("0.00") + dList[0].GoodsUnit; } else if (pro.Type == 1 && pro.ProType == 4) { info = "商品打折" + pro.Discount.ToString("0.00") + "%"; } } ordetail.proInfo = new PromotionInfo() { ProID = detail.vdef1, ProTitle = pro.ProTitle, ProInfos = info, Type = pro.Type.ToString(), ProTpye = pro.ProType.ToString(), Discount = pro.Discount.ToString("0.00"), ProStartTime = pro.ProStartTime.ToString("yy-MM-dd"), ProEndTime = pro.ProEndTime.ToString("yy-MM-dd") }; } } } List <Pic> Pic = new List <Pic>(); if (goods.Pic != "" && goods.Pic != "X") { Pic pic = new Pic(); pic.ProductID = goodsInfo.GoodsID.ToString(); pic.IsDeafult = "1"; pic.PicUrl = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" + goods.Pic; Pic.Add(pic); } ordetail.ProductPicUrlList = Pic; orderDetail.Add(ordetail); } order.OrderDetailList = orderDetail; OrderList.Add(order); } } else { return(new ResultOrderList() { Result = "F", Description = "没有更多数据" }); } #endregion return(new ResultOrderList() { Result = "T", Description = "获取成功", OrderList = OrderList }); } catch (Exception ex) { Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetBriefingList:" + JSon); return(new ResultOrderList() { Result = "F", Description = "参数异常" }); } }
/// <summary> /// 绑定产品信息 /// </summary> /// <param name="id"></param> public void Bind(int id, int goodsInfoId, int compId) { Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(id); if (model != null && model.dr == 0 && model.IsEnabled == 1) { Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (model2 != null) { this.lblCode.InnerText = model2.BarCode.Trim(); //商品编号 this.lblInventory.InnerText = model2.Inventory.ToString(); //库存 } Hi.Model.BD_GoodsCategory model3 = new Hi.BLL.BD_GoodsCategory().GetModel(model.CategoryID); if (model3 != null) { this.lblCategory.InnerText = model3.CategoryName.Trim(); //分类 } GetZiDingYi(model); //自定义字段 this.divTitle.InnerText = model.GoodsName.Trim(); //biaot this.divMemo.InnerHtml = model.Title.Trim(); //描述 this.lblHideInfo1.InnerText = model.HideInfo1; this.lblHideInfo2.InnerText = model.HideInfo2; //描述 this.lblUnit.InnerText = model.Unit.Trim(); //计量单位 if (model.Details == "") { this.DivShow.InnerHtml = "<p style=\"padding-top: 20px; line-height: 40px; padding-left: 20px\">暂无数据</p>"; } else { this.DivShow.InnerHtml = model.Details; } if (!string.IsNullOrEmpty(model.Pic))//有图片 { this.imgPic.Src = Common.GetPicURL(model.Pic, "resize400"); this.imgPic.Attributes.Add("jqimg", Common.GetPicURL(model.Pic)); this.imgPic2.Src = Common.GetPicURL(model.Pic, "resize400"); this.imgPic2.Attributes.Add("bimg", Common.GetPicURL(model.Pic)); } else { this.imgPic.Src = "../../images/havenopicmax.gif"; //无图片 this.imgPic2.Src = "../../images/havenopicmax.gif"; //无图片 this.imgPic2.Attributes.Add("bimg", "../../images/havenopicmax.gif"); this.imgPic.Attributes.Add("jqimg", "../../images/havenopicmax.gif"); } //add by hgh 设置商品是否首页显示 this.labText.Text = model.IsFirstShow == true ? "是" : "否"; } else { JScript.AlertMsg(this, "商品不存在或者已经被删除", "GoodsInfoList.aspx"); return; } string html = string.Empty; List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and goodsId=" + id.ToString(), ""); if (ll.Count > 0) { int xy = 0; foreach (Hi.Model.BD_GoodsAttrs item in ll) { List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + compId + " and attrsId=" + item.ID, ""); if (lll.Count > 0) { html += "<div class=\"li\"><i class=\"bt2\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</i><div class=\"fun\">"; foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll) { Hi.Model.BD_GoodsInfo model4 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (xy == 0) { html += "<a href=\"javascript:;\" class=\"" + (model4.Value1 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } else if (xy == 1) { html += "<a href=\"javascript:;\" class=\"" + (model4.Value2 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } else if (xy == 2) { html += "<a href=\"javascript:;\" class=\"" + (model4.Value3 == item2.AttrsInfoName.Trim() ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "</a>"; } } html += "</div></div>"; } xy++; } } litAttrVaue.Text = html; }
/// <summary> /// 应收应付账款订单列表 /// </summary> /// <param name="JSon"></param> /// <returns></returns> public DIS_Order.ResultOrderList GetDisAccountInfo(string JSon) { try { string strWhere = " and Ostate in (2,4,5) and PayState in (0,1)"; #region JSon取值 string userID = string.Empty; string disID = string.Empty; string criticalOrderID = string.Empty; //当前列表最临界点产品ID:初始-1 string getType = string.Empty; //方向 string rows = string.Empty; string sortType = string.Empty; string sort = string.Empty; string orderType = string.Empty;//单据类型 1:订单 2:账单 JsonData JInfo = JsonMapper.ToObject(JSon); if (JInfo.Count > 0 && JInfo["UserID"].ToString() != "" && JInfo["ResellerID"].ToString() != "" && JInfo["CriticalOrderID"].ToString() != "" && JInfo["GetType"].ToString() != "" && JInfo["Rows"].ToString() != "" && JInfo["SortType"].ToString() != "" && JInfo["Sort"].ToString() != "" && JInfo["orderType"].ToString() != "") { userID = JInfo["UserID"].ToString(); disID = JInfo["ResellerID"].ToString(); strWhere += " and DisID='" + disID + "' and ISNULL(dr,0)=0"; criticalOrderID = JInfo["CriticalOrderID"].ToString(); getType = JInfo["GetType"].ToString(); rows = JInfo["Rows"].ToString(); sortType = JInfo["SortType"].ToString(); sort = JInfo["Sort"].ToString(); orderType = JInfo["orderType"].ToString(); } else { return(new DIS_Order.ResultOrderList() { Result = "F", Description = "参数异常" }); } if (orderType == "1")//订单 { strWhere += " and ISNULL(dr,0)=0 and OState != 0 and Otype!=9"; } else//账单 { strWhere += " and ISNULL(dr,0)=0 and OState != 0 and Otype=9"; } JsonData JMsg = JInfo["Search"]; if (JMsg.Count > 0) { if (JMsg["OrderID"].ToString() != "") { strWhere += " and ReceiptNo like '" + JMsg["OrderID"].ToString() + "%'"; } if (JMsg["BeginDate"].ToString() != "") { strWhere += " and CreateDate >= '" + Convert.ToDateTime(JMsg["BeginDate"].ToString()) + "'"; } if (JMsg["EndDate"].ToString() != "") { strWhere += " and CreateDate < " + Convert.ToDateTime(JInfo["EndDate"].ToString()).AddDays(1) + "'"; } //根据出库单编号 锁定 订单ID if (JMsg["ExpressNo"].ToString() != "") { //strWhere += " and ReceiptNo like '" + JMsg["ExpressNo"].ToString() + "%'"; List <Hi.Model.DIS_OrderOut> orderOut = new Hi.BLL.DIS_OrderOut().GetList("", " ExpressNo like '%" + JMsg["ExpressNo"].ToString() + "%'", ""); if (orderOut.Count == 0) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "参数异常" } } ; strWhere += " and ID in ( 0"; strWhere = orderOut.Aggregate(strWhere, (current, aout) => current + ("," + aout.OrderID)); strWhere += " )"; } } #endregion #region 模拟分页 string tabName = " [dbo].[DIS_Order]"; //表名 string strsql = string.Empty; //搜索sql sortType = "ID"; strsql = new Common().PageSqlString(criticalOrderID, "ID", tabName, sortType, sort, strWhere, getType, rows); if (strsql == "") { return new DIS_Order.ResultOrderList() { Result = "F", Description = "基础数据异常" } } ; #endregion #region 赋值 string SKUName = string.Empty; List <DIS_Order.Order> OrderList = new List <DIS_Order.Order>(); DataSet ds = SqlHelper.Query(SqlHelper.LocalSqlServer, strsql); if (ds.Tables.Count == 0) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "没有更多数据" } } ; DataTable orderList = ds.Tables[0]; if (orderList != null) { if (orderList.Rows.Count == 0) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "没有更多数据" } } ; foreach (DataRow row in orderList.Rows) { DIS_Order.Order order = new DIS_Order.Order(); Hi.Model.DIS_Order orderModel = new Hi.BLL.DIS_Order().GetModel(int.Parse(row["ID"].ToString())); order.OrderID = orderModel.ID.ToString(); order.CompID = orderModel.CompID.ToString(); Hi.Model.BD_Company comp = new Hi.BLL.BD_Company().GetModel(orderModel.CompID); if (comp == null || comp.IsEnabled == 0 || comp.dr == 1) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "企业异常" } } ; order.CompName = comp.CompName; order.State = Common.GetDisOrderType(orderModel.OState, orderModel.PayState, orderModel.Otype, orderModel.ReturnState); order.OState = orderModel.OState.ToString(); order.AddType = orderModel.AddType.ToString(); order.Otype = orderModel.Otype.ToString(); order.PayState = orderModel.PayState.ToString(); order.ReturnState = orderModel.ReturnState.ToString(); order.DisID = orderModel.DisID.ToString(); Hi.Model.BD_Distributor dis = new Hi.BLL.BD_Distributor().GetModel(orderModel.DisID); if (dis == null || dis.IsEnabled == 0 || dis.dr == 1) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "经销信息商异常" } } ; order.DisName = dis.DisName; order.DisUserID = orderModel.DisUserID.ToString(); Hi.Model.SYS_Users user = new Hi.BLL.SYS_Users().GetModel(int.Parse(userID)); if (user == null || user.IsEnabled == 0 || user.dr == 1) { return new DIS_Order.ResultOrderList() { Result = "F", Description = "经销商用户信息异常" } } ; order.DisUserName = user.TrueName; order.AddrID = orderModel.AddrID.ToString(); order.ReceiptNo = orderModel.ReceiptNo; order.ArriveDate = orderModel.ArriveDate.ToString(); if (!string.IsNullOrEmpty(orderModel.AddrID.ToString())) { Hi.Model.BD_DisAddr addr = new Hi.BLL.BD_DisAddr().GetModel(orderModel.AddrID); if (addr != null) { order.Zip = addr.Zip; } } order.Address = orderModel.Address; order.Contact = orderModel.Principal; order.Phone = orderModel.Phone; order.TotalAmount = orderModel.TotalAmount.ToString("0.00"); order.AuditTotalAmount = orderModel.AuditAmount.ToString("0.00"); order.PayedAmount = orderModel.PayedAmount.ToString("0.00"); order.CreateUserID = orderModel.CreateUserID.ToString(); order.CreateDate = orderModel.CreateDate.ToString(); order.ReturnMoneyDate = orderModel.ReturnMoneyDate.ToString(); order.ReturnMoneyUser = orderModel.ReturnMoneyUser.ToString(); order.ReturnMoneyUserId = orderModel.ReturnMoneyUserId.ToString(); List <Hi.Model.DIS_OrderOut> outList = new Hi.BLL.DIS_OrderOut().GetList("", " OrderID='" + orderModel.ID + "' and CompID='" + orderModel.CompID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", ""); if (outList.Count != 0) { Hi.Model.DIS_OrderOut orderOut = new Hi.Model.DIS_OrderOut(); foreach (Hi.Model.DIS_OrderOut Out in outList) { orderOut = Out; } order.SendID = orderOut.ID.ToString(); order.SendDate = orderOut.SendDate.ToString(); //根据发货单取对应的物流信息 List <Hi.Model.DIS_Logistics> list_log = new Hi.BLL.DIS_Logistics().GetList("", "OrderOutID = " + orderOut.ID + " and isnull(dr,0) = 0", ""); //一个发货单只有一条物流信息,所以list_log里也只有一条数据 Hi.Model.DIS_Logistics model_log = list_log[0]; order.Express = Convert.ToString(model_log.ComPName); order.ExpressNo = Convert.ToString(model_log.LogisticsNo); //order.ExpressPerson = Convert.ToString(orderOut.ExpressPerson); //order.ExpressTel = Convert.ToString(orderOut.ExpressTel); //order.ExpressBao =Convert.ToString(orderOut.ExpressBao); order.PostFee = orderModel.PostFee.ToString("0.00"); order.ActionUser = Convert.ToString(orderOut.ActionUser); order.SendRemark = Convert.ToString(orderOut.Remark); order.IsAudit = Convert.ToString(orderOut.IsAudit); order.AuditUserID = Convert.ToString(orderOut.AuditUserID); order.AuditDate = Convert.ToString(orderOut.AuditDate); order.AuditRemark = orderOut.AuditRemark == null ? "" : orderOut.AuditRemark.ToString(); order.SignDate = Convert.ToString(orderOut.SignDate); order.IsSign = Convert.ToString(orderOut.IsSign); order.SignUserId = Convert.ToString(orderOut.SignUserId); order.SignUser = Convert.ToString(orderOut.SignUser); order.SignRemark = Convert.ToString(orderOut.SignRemark); } order.SendRemark = Convert.ToString(orderModel.Remark); //todo:不知道的排序 //order.SortIndex = orderModel.SortIndex.ToString(); order.IsDel = Convert.ToString(orderModel.dr); //明细 List <DIS_Order.OrderDetail> orderDetail = new List <DIS_Order.OrderDetail>(); List <Hi.Model.DIS_OrderDetail> detailList = new Hi.BLL.DIS_OrderDetail().GetList("", " OrderID='" + orderModel.ID + "' and DisID='" + orderModel.DisID + "' and ISNULL(dr,0)=0", ""); if (detailList == null) //|| detailList.Count==0 没有明细的单 PC可以新建 { return new DIS_Order.ResultOrderList() { Result = "F", Description = "订单明细异常" } } ; List <Hi.Model.BD_GoodsAttrs> list_attrs = null; foreach (Hi.Model.DIS_OrderDetail detail in detailList) { DIS_Order.OrderDetail ordetail = new DIS_Order.OrderDetail(); ordetail.SKUID = detail.GoodsinfoID.ToString(); //通过GoodsInfoID找到GoodsID Hi.Model.BD_GoodsInfo goodsInfo = new Hi.BLL.BD_GoodsInfo().GetModel(detail.GoodsinfoID); if (goodsInfo == null) { //if (goodsInfo == null || goodsInfo.IsEnabled == false || goodsInfo.dr == 1) return new DIS_Order.ResultOrderList() { Result = "F", Description = "SKU信息异常" } } ; ordetail.ProductID = goodsInfo.GoodsID.ToString(); //通过GoodsID找到GoodsName Hi.Model.BD_Goods goods = new Hi.BLL.BD_Goods().GetModel(goodsInfo.GoodsID); if (goods == null) { //if (goods == null || goods.IsEnabled == 0 || goods.dr == 1) return new DIS_Order.ResultOrderList() { Result = "F", Description = "商品异常" } } ; ordetail.ProductName = goods.GoodsName; SKUName += goods.GoodsName; list_attrs = new Hi.BLL.BD_GoodsAttrs().GetList("AttrsName", "GoodsID = " + goodsInfo.GoodsID + " and CompID = " + comp.ID + " and ISNULL(dr,0) = 0", ""); if (list_attrs != null && list_attrs.Count != 0) { foreach (Hi.Model.BD_GoodsAttrs attr in list_attrs) { SKUName += attr.AttrsName; } } ordetail.SKUName = SKUName; //todo:描述是什么 ordetail.ValueInfo = goodsInfo.ValueInfo; ordetail.SalePrice = detail.Price.ToString("0.00"); ordetail.TinkerPrice = detail.AuditAmount.ToString("0.00"); ordetail.Num = detail.GoodsNum.ToString("0.00"); ordetail.Remark = detail.Remark; List <DIS_Order.Pic> Pic = new List <DIS_Order.Pic>(); if (goods.Pic.ToString() != "" && goods.Pic.ToString() != "X") { DIS_Order.Pic pic = new DIS_Order.Pic(); pic.ProductID = goodsInfo.GoodsID.ToString(); pic.IsDeafult = "1"; pic.PicUrl = ConfigurationManager.AppSettings["ImgViewPath"].ToString().Trim() + "GoodsImg/" + goods.Pic; Pic.Add(pic); } ordetail.ProductPicUrlList = Pic; orderDetail.Add(ordetail); } order.OrderDetailList = orderDetail; OrderList.Add(order); } } else { return(new DIS_Order.ResultOrderList() { Result = "F", Description = "没有更多数据" }); } #endregion return(new DIS_Order.ResultOrderList() { Result = "T", Description = "获取成功", OrderList = OrderList }); } catch (Exception ex) { Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetDisAccountInfo:" + JSon); return(new DIS_Order.ResultOrderList() { Result = "F", Description = "参数异常" }); } }
/// <summary> /// 确定导入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnImport_Click(object sender, EventArgs e) { if (HttpContext.Current.Session["GoodsTable"] != null) { SqlTransaction Tran = null; SqlConnection Connection = new SqlConnection(SqlHelper.LocalSqlServer); Connection.Open(); Tran = Connection.BeginTransaction(); try { DataTable dt = HttpContext.Current.Session["GoodsTable"] as DataTable; for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["chkstr"].ToString() == "数据正确!") { Hi.Model.BD_Goods model = new Hi.Model.BD_Goods(); model.CompID = this.CompID; model.GoodsName = dt.Rows[i]["goodsname"].ToString(); model.GoodsCode = "";// dt.Rows[i]["barcode"].ToString(); ; model.CategoryID = Convert.ToInt32(dt.Rows[i]["categoryid"].ToString()); model.Unit = CheckGoodsUnit(dt.Rows[i]["unit"].ToString(), "计量单位", Tran); model.SalePrice = Convert.ToDecimal(dt.Rows[i]["price"].ToString()); //if (dt.Rows[i]["isoffline"] == null) //{ // model.IsOffline = 1; //} //else //{ model.IsOffline = dt.Rows[i]["isoffline"].ToString() == "是" || dt.Rows[i]["isoffline"].ToString() == "" ? 1 : 0; // } model.IsSale = 0; //if (dt.Rows[i]["isrecommended"] == null) //{ // model.IsRecommended = 1; //} //else //{ model.IsRecommended = dt.Rows[i]["isrecommended"].ToString() == "是" || dt.Rows[i]["isrecommended"].ToString() == "" ? 1 : 0; // } model.IsIndex = 0; model.Title = dt.Rows[i]["title"].ToString(); model.CreateUserID = this.UserID; model.CreateDate = DateTime.Now; model.IsEnabled = 1; model.modifyuser = this.UserID; model.memo = dt.Rows[i]["details"].ToString(); model.ts = DateTime.Now; int goodsId = new Hi.BLL.BD_Goods().Add(model, Tran); string[] spec = (string[])dt.Rows[i]["spec"]; if (spec.Length == 0) { Hi.Model.BD_GoodsInfo model4 = new Hi.Model.BD_GoodsInfo(); model4.CompID = this.CompID; if (dt.Rows[i]["barcode"].ToString() == "") { model4.BarCode = GoodsCode(Tran); } else { model4.BarCode = dt.Rows[i]["barcode"].ToString(); } model4.GoodsID = goodsId; if (dt.Rows[i]["inventory"].ToString() != "") { model4.Inventory = Convert.ToDecimal(dt.Rows[i]["inventory"].ToString()); } model4.IsOffline = 1; model4.ValueInfo = ""; model4.SalePrice = Convert.ToDecimal(dt.Rows[i]["price"].ToString()); model4.TinkerPrice = Convert.ToDecimal(dt.Rows[i]["price"].ToString()); model4.IsEnabled = true; model4.CreateDate = DateTime.Now; model4.CreateUserID = this.UserID; model4.ts = DateTime.Now; model4.modifyuser = this.UserID; int goodsInfoId = new Hi.BLL.BD_GoodsInfo().Add(model4, Tran); model.ID = goodsId; model.ViewInfoID = goodsInfoId; model.ts = DateTime.Now; model.modifyuser = this.UserID; new Hi.BLL.BD_Goods().Update(model, Tran); } else { List <List <string> > valueList = new List <List <string> >(); for (int v = 0; v < spec.Length; v++) { //添加商品属性数据 Hi.Model.BD_GoodsAttrs attr = new Hi.Model.BD_GoodsAttrs(); attr.GoodsID = goodsId; attr.CompID = CompID; attr.dr = 0; attr.ts = DateTime.Now; attr.modifyuser = UserID; attr.AttrsName = spec[v].Trim(); int attrid = new Hi.BLL.BD_GoodsAttrs().Add(attr, Tran); List <string> valueList2 = new List <string>(); string[] values = dt.Rows[i]["value" + (v + 1) + ""].ToString().Split(new string[] { "/" }, StringSplitOptions.RemoveEmptyEntries); foreach (string value in values) { valueList2.Add(value); //添加商品属性值明细数据 Hi.Model.BD_GoodsAttrsInfo attrinfo = new Hi.Model.BD_GoodsAttrsInfo(); attrinfo.AttrsID = attrid; attrinfo.GoodsID = goodsId; attrinfo.CompID = CompID; attrinfo.ts = DateTime.Now; attrinfo.modifyuser = UserID; attrinfo.AttrsInfoName = value.Trim(); new Hi.BLL.BD_GoodsAttrsInfo().Add(attrinfo, Tran); } valueList.Add(valueList2); } string[] valueInfos = makeValueInfo(valueList, spec); //生成商品ValueInfo int firstInfoId = 0; foreach (string valueinfo in valueInfos) { Hi.Model.BD_GoodsInfo goodsinfo = new Hi.Model.BD_GoodsInfo(); goodsinfo.IsOffline = 1; goodsinfo.ValueInfo = ""; goodsinfo.SalePrice = dt.Rows[i]["price"].ToString().ToDecimal(0); goodsinfo.TinkerPrice = dt.Rows[i]["price"].ToString().ToDecimal(0); goodsinfo.IsEnabled = true; goodsinfo.CreateDate = DateTime.Now; goodsinfo.CreateUserID = this.UserID; goodsinfo.ts = DateTime.Now; goodsinfo.modifyuser = this.UserID; goodsinfo.GoodsID = goodsId; if (dt.Rows[i]["inventory"].ToString() != "") { goodsinfo.Inventory = Convert.ToDecimal(dt.Rows[i]["inventory"].ToString()); } goodsinfo.BarCode = GoodsCode(Tran); goodsinfo.CompID = this.CompID; goodsinfo.ValueInfo = valueinfo; string[] infos = valueinfo.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries); for (int index = 0; index < infos.Length; index++) { goodsinfo.GetType().GetProperty("Value" + (index + 1) + "").SetValue(goodsinfo, infos[index].Split(new char[] { ':' })[1], null); } int goodsInfoId = new Hi.BLL.BD_GoodsInfo().Add(goodsinfo, Tran); if (firstInfoId == 0) { firstInfoId = goodsInfoId; } } model.ID = goodsId; model.ViewInfoID = firstInfoId; model.ts = DateTime.Now; model.modifyuser = this.UserID; new Hi.BLL.BD_Goods().Update(model, Tran); } } } Tran.Commit(); Response.Redirect("ImportGoods3.aspx", false); //ClientScript.RegisterStartupScript(this.GetType(), "Add", "<script>addlis(" + count + "," + count2 + ",'" + str + "');</script>"); } catch (Exception ex) { if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } HttpContext.Current.Session["GoodsTable"] = null; JScript.AlertMethod(this, "系统错误,导入商品失败!", JScript.IconOption.错误, "function(){location.href='ImportGoods.aspx'}"); } } else { JScript.AlertMethod(this, "Excel没有数据,请重新导入", JScript.IconOption.错误, "function(){location.href='ImportGoods.aspx'}"); } }
//public void Download_Click(object sender, EventArgs e) //{ // LinkButton bt = sender as LinkButton; // string fileName = bt.Attributes["fileName"]; // string filePath = Server.MapPath("../UploadFile/") + fileName; // if (File.Exists(filePath)) // { // FileInfo file = new FileInfo(filePath); // Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); //解决中文乱码 // Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(file.Name.Substring(0, file.Name.LastIndexOf("_")) + Path.GetExtension(file.Name))); //解决中文文件名乱码 // Response.AddHeader("Content-length", file.Length.ToString()); // Response.ContentType = "appliction/octet-stream"; // Response.WriteFile(file.FullName); // Response.Flush(); // Response.End(); // } // else // { // JScript.AlertMsgOne(this, "附件不存在!", JScript.IconOption.错误); // } //} /// <summary> /// 附件绑定 /// </summary> //public void DataBindLink() //{ // string goodsId = Request.QueryString["goodsId"]; // if (!string.IsNullOrWhiteSpace(goodsId)) // { // //string gid = Common.DesDecrypt(Request["goodsId"], Common.EncryptKey); // Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(Convert.ToInt32(goodsId)); // if (model != null && model.CompID == this.CompID) // { // if (!string.IsNullOrEmpty(model.registeredCertificate)) // { // LinkButton linkFile = new LinkButton(); // linkFile.Click += new EventHandler(Download_Click); // if (model.registeredCertificate.LastIndexOf("_") != -1) // { // string text = model.registeredCertificate.Substring(0, model.registeredCertificate.LastIndexOf("_")) + Path.GetExtension(model.registeredCertificate); // if (text.Length < 15) // linkFile.Text = text; // else // { // linkFile.Text = text.Substring(0, 15) + "..."; // } // linkFile.Attributes.Add("title", text); // } // else // { // string text = model.registeredCertificate.Substring(0, model.registeredCertificate.LastIndexOf("-")) + Path.GetExtension(model.registeredCertificate); // if (text.Length < 15) // linkFile.Text = text; // else // { // linkFile.Text = text.Substring(0, 15) + "..."; // } // linkFile.Attributes.Add("title", text); // } // linkFile.Style.Add("text-decoration", "underline"); // linkFile.Attributes.Add("fileName", model.registeredCertificate); // HtmlGenericControl div = new HtmlGenericControl("div"); // div.Controls.Add(linkFile); // UpFileText2.Controls.Add(div); // } // } // } //} /// <summary> /// 商品信息绑定 /// </summary> public void Bind() { Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(goodsId); if (model != null) { GetZiDingYi(model); string zhek = Cuxiao(); if (!Util.IsEmpty(zhek)) { this.lblGoodsName.InnerHtml = model.GoodsName + SelectGoods.ProType(zhek); //商品名称 tiele_name = model.GoodsName; //前台title显示 Hi.Model.BD_GoodsInfo godosInfomodel = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (this.CompID.ToString() == model.CompID.ToString()) { this.YuanPrice.InnerHtml = "<s><i>原价:</i><b class=\"red\" id=\"B1\">¥" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(godosInfomodel.TinkerPrice).ToString())).ToString("#,##0.00") + "</b></s>"; } } else { this.lblGoodsName.InnerHtml = model.GoodsName; tiele_name = model.GoodsName;//前台title显示 this.YuanPrice.InnerHtml = ""; } this.lblunit.InnerText = model.Unit; this.lblGoodsTitle.InnerText = model.Title;//商品卖点 hideInfo1 = model.HideInfo1; hideInfo2 = model.HideInfo2; if (!Util.IsEmpty(model.Details.Trim())) { this.lblGoodsDetali.InnerHtml = model.Details;//商品描述 } if (!Util.IsEmpty(model.registeredCertificate.Trim())) { string url = Common.GetWebConfigKey("OssImgPath") + "/UploadFile/" + model.registeredCertificate; this.lblGoodsDetali1.InnerHtml = "<img width=\"600\" src=\"" + url + "\"/>"; } if (model != null && !string.IsNullOrEmpty(model.Pic)) { this.imgPic.Src = Common.GetPicURL(model.Pic, "resize400"); this.imgPic.Attributes.Add("jqimg", Common.GetPicURL(model.Pic)); } //this.lblPrice.InnerText = "¥" + decimal.Parse(string.Format("{0:N2}", Convert.ToDecimal(model.SalePrice.ToString()).ToString())).ToString("#,##0.00"); ;//商品价格 string html = string.Empty; List <Hi.Model.BD_GoodsAttrs> ll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and compId=" + compID + " and goodsId=" + goodsId.ToString(), ""); if (ll.Count > 0) { foreach (Hi.Model.BD_GoodsAttrs item in ll) { int xy = 0; List <Hi.Model.BD_GoodsAttrsInfo> lll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and compId=" + compID + " and attrsId=" + item.ID, ""); if (lll.Count > 0) { html += "<div class=\"li\"><div class=\"t\" tip=\"" + item.AttrsName + "\">" + item.AttrsName + ":</div><div class=\"n\">"; foreach (Hi.Model.BD_GoodsAttrsInfo item2 in lll) { if (goodsInfoId == 0) { html += "<a href=\"javascript:;\" class=\"" + (xy == 0 ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>"; } else { Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsInfoId); if (model2 != null) { html += "<a href=\"javascript:;\" class=\"" + (model2.Value1 == item2.AttrsInfoName || model2.Value2 == item2.AttrsInfoName || model2.Value3 == item2.AttrsInfoName ? "hover" : "") + "\" tip=\"" + item2.AttrsInfoName + "\">" + item2.AttrsInfoName + "<i class=\"xz-icon\"></i></a>"; } } xy++; } html += "</div></div>"; } } } litAttrVaue.InnerHtml = html; List <Hi.Model.BD_DisCollect> llll = new Hi.BLL.BD_DisCollect().GetList("", "isnull(dr,0)=0 and comPid=" + model.CompID + " and goodsId=" + goodsId + " and disId=" + this.DisID, ""); if (llll.Count > 0) { ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btns .keep\").html('<i class=\"sc-icon\" style=\"background-position:0 -73px;\"></i>取消收藏\');})</script>"); } else { ClientScript.RegisterStartupScript(this.GetType(), "showsc", "<script>$(function(){$(\".btns .keep\").html('<i class=\"sc-icon\" ></i>加入收藏\');})</script>"); } } }
/// <summary> /// 删除GOods以及goodsinfo表 /// </summary> /// <param name="Tran"></param> private void DelGoods() { SqlTransaction Tran = DBUtility.SqlHelper.CreateStoreTranSaction(); try { foreach (RepeaterItem row in this.rptGoodsInfo.Items) { CheckBox cb = row.FindControl("CB_SelItem") as CheckBox; if (cb != null && cb.Checked) { HiddenField fld = row.FindControl("HF_Id") as HiddenField; HiddenField fld2 = row.FindControl("HF_GoodsId") as HiddenField; if (fld != null && fld2 != null) { int goodsId = Convert.ToInt32(fld2.Value); int goodsinfoId = Convert.ToInt32(fld.Value); Hi.Model.BD_GoodsInfo model2 = new Hi.BLL.BD_GoodsInfo().GetModel(goodsinfoId, Tran); if (model2 != null) { model2.ts = DateTime.Now; model2.modifyuser = this.UserID; model2.dr = 1; model2.CompID = this.CompID; bool bol = new Hi.BLL.BD_GoodsInfo().Update(model2, Tran); } List <Hi.Model.BD_GoodsInfo> ll = new Hi.BLL.BD_GoodsInfo().GetList("", "isnull(dr,0)=0 and compid=" + this.CompID + " and goodsId=" + goodsId, "", Tran); if (ll.Count == 0) { Hi.Model.BD_Goods model = new Hi.BLL.BD_Goods().GetModel(goodsId, Tran); if (model != null) { model.ts = DateTime.Now; model.modifyuser = this.UserID; model.dr = 1; model.CompID = this.CompID; bool bol = new Hi.BLL.BD_Goods().Update(model, Tran); } List <Hi.Model.BD_GoodsAttrs> lll = new Hi.BLL.BD_GoodsAttrs().GetList("", "isnull(dr,0)=0 and goodsid=" + goodsId + " and compid=" + this.CompID, "", Tran); if (lll.Count > 0) { foreach (Hi.Model.BD_GoodsAttrs item in lll) { Hi.Model.BD_GoodsAttrs attsmodel = new Hi.BLL.BD_GoodsAttrs().GetModel(item.ID); if (attsmodel != null) { attsmodel.ts = DateTime.Now; attsmodel.modifyuser = this.UserID; attsmodel.dr = 1; attsmodel.CompID = this.CompID; bool bol = new Hi.BLL.BD_GoodsAttrs().Update(attsmodel, Tran); } List <Hi.Model.BD_GoodsAttrsInfo> llll = new Hi.BLL.BD_GoodsAttrsInfo().GetList("", "isnull(dr,0)=0 and goodsid=" + goodsId + " and compid=" + this.CompID + " and attrsid=" + item.ID, "", Tran); if (llll.Count > 0) { foreach (Hi.Model.BD_GoodsAttrsInfo item2 in llll) { Hi.Model.BD_GoodsAttrsInfo attsinfomodel = new Hi.BLL.BD_GoodsAttrsInfo().GetModel(item2.ID); if (attsmodel != null) { attsinfomodel.ts = DateTime.Now; attsinfomodel.modifyuser = this.UserID; attsinfomodel.dr = 1; attsinfomodel.CompID = this.CompID; bool bol = new Hi.BLL.BD_GoodsAttrsInfo().Update(attsinfomodel, Tran); } } } } } } } } } Tran.Commit(); } catch (Exception) { if (Tran != null) { if (Tran.Connection != null) { Tran.Rollback(); } } } finally { DBUtility.SqlHelper.ConnectionClose(); } }