public ActionResult AddProduct() { VM_Product vm = new VM_Product(); if (Mid < 1) { if (ModelID < 1) { function.WriteErrMsg("没有指定要添加内容的模型ID!"); return(null); } if (NodeID < 1) { function.WriteErrMsg("没有指定要添加内容的栏目节点ID!"); return(null); } vm.proMod = new M_Product() { Stock = 10, Rateset = 1, Dengji = 3 }; vm.NodeID = NodeID; vm.ModelID = ModelID; vm.proMod.ProCode = B_Product.GetProCode(); } else { vm.proMod = proBll.GetproductByid(Mid); vm.NodeID = vm.proMod.Nodeid; vm.ModelID = vm.proMod.ModelID; vm.ValueDT = proBll.GetContent(vm.proMod.TableName, vm.proMod.ItemID); if (!string.IsNullOrEmpty(vm.proMod.BindIDS))//捆绑商品 { DataTable dt = proBll.SelByIDS(vm.proMod.BindIDS, "id,Thumbnails,Proname,LinPrice"); vm.bindList = JsonConvert.SerializeObject(dt); } #region 特选商品 { string where = string.Format("(ProIDS LIKE '%,{0},%' OR ProIDS LIKE '{0},%' OR ProIDS LIKE '%,{0}')", vm.proMod.ID.ToString()); DataTable dt = DBCenter.SelWithField("ZL_User_BindPro", "UserID", where); string uids = StrHelper.GetIDSFromDT(dt, "UserID"); ViewBag.prouids = uids; } #endregion } //------------------------------------------------------------------------------------------------ vm.nodeMod = nodeBll.SelReturnModel(vm.NodeID); if (vm.nodeMod.IsNull) { function.WriteErrMsg("节点[" + NodeID + "]不存在"); return(null); } return(View(vm)); }
protected void Page_Load(object sender, EventArgs e) { ExHelper.CheckUserAuth("manage"); M_UserInfo mu = buser.GetLogin(); proMod = proBll.GetproductByid(Mid); nodeMod = nodeBll.SelReturnModel(proMod.Nodeid); if (mu.SiteID != proMod.UserShopID) { function.WriteErrMsg("你无权管理该商品"); } DataTable dr = proBll.GetContent(proMod.TableName.ToString(), proMod.ItemID); this.ModelHtml.Text = this.bfield.InputallHtml(proMod.ModelID, proMod.Nodeid, new ModelConfig() { ValueDT = dr, Mode = ModelConfig.SMode.PreView }); }
public ActionResult AddProduct() { VM_Product vm = new VM_Product(); if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.shop, "product")) { return(null); } if (Mid < 1) { if (ModelID < 1) { function.WriteErrMsg("没有指定要添加内容的模型ID!"); return(null); } if (NodeID < 1) { function.WriteErrMsg("没有指定要添加内容的栏目节点ID!"); return(null); } vm.proMod = new M_Product() { Stock = 10, Rateset = 1, Dengji = 3 }; vm.NodeID = NodeID; vm.ModelID = ModelID; vm.proMod.ProCode = B_Product.GetProCode(); vm.ProGuid = Guid.NewGuid().ToString(); } else { int VerID = DataConvert.CLng(Request.QueryString["Ver"]); if (VerID > 0) { M_Content_VerBak verMod = verBll.SelReturnModel(VerID); vm.proMod = JsonConvert.DeserializeObject <M_Product>(verMod.ContentBak); if (vm.proMod.ID != Mid) { function.WriteErrMsg("加载的版本与商品不匹配"); return(null); } vm.ValueDT = JsonConvert.DeserializeObject <DataTable>(verMod.TableBak); } else { vm.proMod = proBll.GetproductByid(Mid); vm.ValueDT = proBll.GetContent(vm.proMod.TableName, vm.proMod.ItemID); } vm.ProGuid = vm.proMod.ID.ToString(); if (vm.proMod.Class == 2) { Response.Redirect(CustomerPageAction.customPath + "Shop/Arrive/SuitProAdd.aspx?ID=" + vm.proMod.ID); } vm.NodeID = vm.proMod.Nodeid; vm.ModelID = vm.proMod.ModelID; if (!string.IsNullOrEmpty(vm.proMod.BindIDS))//捆绑商品 { DataTable dt = proBll.SelByIDS(vm.proMod.BindIDS, "id,Thumbnails,Proname,LinPrice"); vm.bindList = JsonConvert.SerializeObject(dt); } //多区域价格 vm.regionMod = regionBll.SelModelByGuid(vm.ProGuid); if (vm.regionMod == null) { vm.regionMod = new M_Shop_RegionPrice(); } #region 特选商品 { string where = string.Format("(ProIDS LIKE '%,{0},%' OR ProIDS LIKE '{0},%' OR ProIDS LIKE '%,{0}')", vm.proMod.ID.ToString()); DataTable dt = DBCenter.SelWithField("ZL_User_BindPro", "UserID", where); string uids = StrHelper.GetIDSFromDT(dt, "UserID"); ViewBag.prouids = uids; } #endregion } //------------------------------------------------------------------------------------------------ vm.nodeMod = nodeBll.SelReturnModel(vm.NodeID); if (vm.nodeMod.IsNull) { function.WriteErrMsg("节点[" + vm.NodeID + "]不存在"); return(null); } return(View(vm)); }
public void MyBind() { M_Product pinfo = null; if (ProID > 0) { proMod = pinfo = proBll.GetproductByid(ProID); NodeID = pinfo.Nodeid; } //------------------------------- M_Node nodeMod = nodeBll.SelReturnModel(NodeID); if (nodeMod.IsNull) { function.WriteErrMsg("节点[" + NodeID + "]不存在"); } Node_RPT.DataSource = ExHelper.Store_NodeSel(); Node_RPT.DataBind(); function.ScriptRad(this, "node_rad", NodeID.ToString()); UpdateTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); AddTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); ProCode.Text = B_Product.GetProCode(); if (ProID > 0) { #region 修改 ModelID = pinfo.ModelID; AllClickNum_T.Text = pinfo.AllClickNum.ToString(); ClickType.Value = "update"; btnAdd.Visible = true; istrue_chk.Checked = pinfo.Istrue == 1 ? true : false; ProCode.Text = pinfo.ProCode; BarCode.Text = pinfo.BarCode; Proname.Text = pinfo.Proname; ProUnit.Text = pinfo.ProUnit; Recommend_T.Text = pinfo.Recommend.ToString(); Proinfo.Text = pinfo.Proinfo; procontent.Value = pinfo.Procontent; //txt_Clearimg.Text = pinfo.Clearimg; //txt_Thumbnails.Text = pinfo.Thumbnails; //Quota.Text = pinfo.Quota.ToString(); //DownQuota.Text = pinfo.DownQuota.ToString(); ShiPrice.Text = pinfo.ShiPrice.ToString(); LinPrice.Text = pinfo.LinPrice.ToString(); UpdateTime.Text = pinfo.UpdateTime.ToString(); AddTime.Text = pinfo.AddTime.ToString(); isnew_chk.Checked = pinfo.Isnew == 1;//是否新品,热,等 ishot_chk.Checked = pinfo.Ishot == 1; isbest_chk.Checked = pinfo.Isbest == 1; Sales_Chk.Checked = pinfo.Sales == 1; DataTable valueDT = proBll.GetContent(pinfo.TableName.ToString(), pinfo.ItemID); if (valueDT != null && valueDT.Rows.Count > 0) { ModelHtml.Text = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { ValueDT = valueDT }); } #endregion } else { isnew_chk.Checked = true; Sales_Chk.Checked = true; ModelHtml.Text = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { Source = ModelConfig.SType.Admin }); btnAdd.Visible = false; } }
void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { pinfo = bll.GetproductByid(Mid); M_Node nodeMod = bnode.SelReturnModel(pinfo.Nodeid); M_Product preMod = bll.GetNearID(pinfo.Nodeid, pinfo.ID, 0); M_Product nextMod = bll.GetNearID(pinfo.Nodeid, pinfo.ID, 1); M_CommonData storeMod = conBll.Store_SelModel(pinfo.UserShopID); if (preMod != null) { PrePro_Btn.Attributes.Remove("disabled"); PrePro_Btn.CommandArgument = preMod.ID.ToString(); } if (nextMod != null) { NextPro_Btn.Attributes.Remove("disabled"); NextPro_Btn.CommandArgument = nextMod.ID.ToString(); } lblCountHits.Text = pinfo.AllClickNum.ToString(); this.nodename.Text = "<a href=\"ProductManage.aspx?NodeID=" + nodeMod.NodeID + "\">" + nodeMod.NodeName + "</a>"; AddUser_L.Text = pinfo.AddUser; StoreName.Text = storeMod == null ? "" : storeMod.Title; ProCode.Text = pinfo.ProCode; BarCode.Text = pinfo.BarCode; Proname.Text = pinfo.Proname; Kayword.Text = pinfo.Kayword; ProUnit.Text = pinfo.ProUnit; Rateset1.Text = pinfo.Rateset.ToString(); lblpoint.Text = pinfo.PointVal.ToString(); Weight.Text = pinfo.Weight.ToString(); this.Largess1.Text = pinfo.Largess == 1 ? "是" : "否"; this.txtRecommend.Text = pinfo.Recommend.ToString(); if (!string.IsNullOrEmpty(pinfo.IDCPrice)) { ProExtend_L.Text = JsonConvert.SerializeObject(idcBll.P_GetValid(pinfo.IDCPrice)); } ProClass1.Text = pinfo.ProClass == 1 ? "正常销售" : "特价处理"; Proinfo.Text = pinfo.Proinfo.ToString(); Procontent.Text = pinfo.Procontent.ToString(); Clearimg.Text = ComRE.Img_NoPic(function.GetImgUrl(pinfo.Clearimg)); Thumbnails.Text = ComRE.Img_NoPic(function.GetImgUrl(pinfo.Thumbnails)); DownQuota.Text = pinfo.DownQuota.ToString(); Quota.Text = pinfo.Quota.ToString(); Stock.Text = pinfo.Stock.ToString(); StockDown.Text = pinfo.StockDown.ToString(); Rate.Text = pinfo.Rate.ToString(); if (pinfo.Dengji == 1) { Dengji1.Text = "★"; } if (pinfo.Dengji == 2) { Dengji1.Text = "★★"; } if (pinfo.Dengji == 3) { Dengji1.Text = "★★★"; } if (pinfo.Dengji == 4) { Dengji1.Text = "★★★★"; } if (pinfo.Dengji == 5) { Dengji1.Text = "★★★★★"; } ShiPrice.Text = pinfo.ShiPrice.ToString(); Brand.Text = pinfo.Brand.ToString(); Producer.Text = pinfo.Producer.ToString(); LinPrice.Text = pinfo.LinPrice.ToString(); BookPrice_L.Text = pinfo.BookPrice == 0?"未开启" : pinfo.BookPrice.ToString("f2"); Wholesaleone1.Text = pinfo.Wholesaleone == 1 ? "是" : "否"; if (pinfo.Istrue == 1) { this.istrue1.Text = "审核通过"; } else { this.istrue1.Text = "审核未通过"; } Stock.Enabled = false; UpdateTime.Text = pinfo.UpdateTime.ToString(); ModeTemplate.Text = pinfo.ModeTemplate.ToString(); if (pinfo.Isnew == 1) { this.istrue1.Text += " 新品"; } if (pinfo.Ishot == 1) { this.istrue1.Text += " 热销"; } if (pinfo.Isbest == 1) { this.istrue1.Text += " 精品"; } if (pinfo.Sales == 1) { Sales1.Text = "销售中"; } if (pinfo.Sales != 1) { Sales1.Text = "停销状态"; } if (pinfo.Allowed == 1) { Allowed.Text = "缺货时允许购买"; } if (pinfo.Allowed != 1) { Allowed.Text = "缺货时不允许购买"; } DataTable dr = bll.GetContent(pinfo.TableName.ToString(), DataConverter.CLng(pinfo.ItemID)); this.ModelHtml.Text = this.bfield.InputallHtml(pinfo.ModelID, pinfo.Nodeid, new ModelConfig() { ValueDT = dr, Mode = ModelConfig.SMode.PreView }); PointVal_L.Text = pinfo.PointVal.ToString(); BindUserPrice(pinfo); Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "Main.aspx'>工作台</a></li><li><a href='ProductManage.aspx'>商城管理</a></li><li><a href='ProductManage.aspx'>商品管理</a></li><li><a href=\"ProductManage.aspx?NodeID=" + nodeMod.NodeID + "\">" + nodeMod.NodeName + "</a></li><li class='active'>预览商品</li>" + "<div class='pull-right hidden-xs'><span onclick=\"opentitle('../Content/Node/EditNode.aspx?NodeID=" + pinfo.Nodeid + "','配置本节点');\" class='fa fa-cog' title='配置本节点' style='cursor:pointer;margin-left:5px;'></span></div>"); } }