public void Product_AddToNew() { if (!B_ARoleAuth.AuthCheckEx(ZLEnum.Auth.shop, "product")) { return; } DataTable table = new DataTable(); M_Product proMod = proBll.GetproductByid(Mid); proMod = FillProductModel(ref table, proMod); //------------------ proMod.ProCode = B_Product.GetProCode(); proMod.AddUser = B_Admin.GetLogin().AdminName; proMod.Stock = 0; proMod.AddTime = DateTime.Now; proMod.UpdateTime = DateTime.Now; proMod.ID = 0; proMod.ID = proBll.Add(table, proMod); //------------------ IsNeedVerBak(proMod); IsHaveMaterial(proMod); IsAddStock(proMod, DataConvert.CLng(Request.Form["Stock"])); IsUserProduct(proMod, Request.Form["uprouids_old_hid"], Request.Form["uprouids_hid"]); IsHavePresent(proMod); Response.Redirect(CustomerPageAction.customPath + "Shop/ProductShow.aspx?ID=" + proMod.ID); }
public VM_Product(M_Product proMod, HttpRequest Request) { groupList = JsonConvert.SerializeObject(DBCenter.SelWithField("ZL_Group", "GroupID,GroupName")); fareDT = fareBll.Sel(); this.proMod = proMod; if (proMod.ID > 0) { this.NodeID = proMod.Nodeid; this.ModelID = proMod.ModelID; this.ProGuid = proMod.ID.ToString(); //捆绑商品 if (!string.IsNullOrEmpty(proMod.BindIDS)) { DataTable dt = proBll.SelByIDS(proMod.BindIDS, "id,Thumbnails,Proname,LinPrice"); bindList = JsonConvert.SerializeObject(dt); } //if (!string.IsNullOrEmpty(proMod.TableName)) //{ // DataTable valueDT = proBll.Getmodetable(proMod.TableName.ToString(), proMod.ItemID); // if (valueDT != null && valueDT.Rows.Count > 0) // { // modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { ValueDT = valueDT }); // } //} } else { this.NodeID = DataConvert.CLng(Request.GetParam("NodeID")); this.ModelID = DataConvert.CLng(Request.GetParam("ModelID")); this.ProGuid = System.Guid.NewGuid().ToString(); this.proMod.ProCode = B_Product.GetProCode(); //modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { Source = ModelConfig.SType.Admin }); } nodeMod = nodeBll.SelReturnModel(NodeID); }
public VM_Product(M_Product proMod, HttpRequestBase Request) { groupList = JsonConvert.SerializeObject(DBCenter.SelWithField("ZL_Group", "GroupID,GroupName")); gpriceDT = gpBll.GetGroupList(); gpriceDT.Columns.Add(new DataColumn("gprice", typeof(string))); fareDT = fareBll.Sel(); this.proMod = proMod; if (proMod.ID > 0) { this.NodeID = proMod.Nodeid; this.ModelID = proMod.ModelID; this.ProGuid = proMod.ID.ToString(); //会员组价 if (proMod.UserType == 2 && proMod.UserPrice.Contains("[") && !proMod.UserPrice.Equals("[]")) { DataTable upDT = JsonConvert.DeserializeObject <DataTable>(proMod.UserPrice); foreach (DataRow dr in upDT.Rows) { DataRow[] drs = gpriceDT.Select("GroupID='" + dr["gid"] + "'"); if (drs.Length > 0) { drs[0]["gprice"] = DataConvert.CDouble(dr["price"]).ToString("F2"); } } } //捆绑商品 if (!string.IsNullOrEmpty(proMod.BindIDS)) { DataTable dt = proBll.SelByIDS(proMod.BindIDS, "id,Thumbnails,Proname,LinPrice"); bindList = JsonConvert.SerializeObject(dt); } if (!string.IsNullOrEmpty(proMod.TableName)) { DataTable valueDT = proBll.Getmodetable(proMod.TableName.ToString(), proMod.ItemID); if (valueDT != null && valueDT.Rows.Count > 0) { modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { ValueDT = valueDT }); } } } else { this.NodeID = DataConvert.CLng(Request.QueryString["NodeID"]); this.ModelID = DataConvert.CLng(Request.QueryString["ModelID"]); this.ProGuid = System.Guid.NewGuid().ToString(); this.proMod.ProCode = B_Product.GetProCode(); modelHtml = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { Source = ModelConfig.SType.Admin }); } nodeMod = nodeBll.SelReturnModel(NodeID); }
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)); }
public void Product_AddToNew() { DataTable table = new DataTable(); M_Product srcMod = proBll.GetproductByid(Mid); srcMod = FillProductModel(ref table, srcMod); //------------------ srcMod.ProCode = B_Product.GetProCode(); srcMod.AddUser = mu.UserName; srcMod.Stock = 0; srcMod.AddTime = DateTime.Now; srcMod.UpdateTime = DateTime.Now; srcMod.ID = 0; srcMod.ID = proBll.Add(table, srcMod); //------------------ IsAddStock(srcMod, DataConvert.CLng(Request.Form["Stock"])); IsHavePresent(srcMod); function.WriteSuccessMsg("操作成功", "ProductList"); }
public IActionResult Product_AddToNew() { DataTable table = new DataTable(); M_Product srcMod = proBll.GetproductByid(Mid); srcMod = FillProductModel(ref table, srcMod); //------------------ srcMod.ProCode = B_Product.GetProCode(); srcMod.AddUser = mu.UserName; srcMod.Stock = 0; srcMod.AddTime = DateTime.Now; srcMod.UpdateTime = DateTime.Now; srcMod.ID = 0; srcMod.ID = proBll.Add(table, srcMod); //------------------ IsAddStock(srcMod, DataConvert.CLng(RequestEx["Stock"])); IsHavePresent(srcMod); return(WriteOK("操作成功", "ProductList")); }
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)); }
private string GetProCode() { return(bll.GetProCode(SiteConfig.ShopConfig.ItemRegular)); }
public void MyBind() { M_Product pinfo = null; if (ProID > 0) { pinfo = proBll.GetproductByid(ProID); NodeID = pinfo.Nodeid; } //------------------------------- M_Node nodeMod = nodeBll.SelReturnModel(NodeID); if (nodeMod.IsNull) { function.WriteErrMsg("节点[" + NodeID + "]不存在"); } string bread1 = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>", bread2 = "添加商品"; NodeName_L.Text = "<a href=\"ProductManage.aspx?NodeID=" + NodeID + "\">" + nodeMod.NodeName + "</a>"; 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(); OtherBind(pinfo);//组,运费模板 if (ProID > 0) { #region 修改 StoreID = pinfo.UserShopID > 0 ? -1 : 0; ModelID = pinfo.ModelID; AllClickNum_T.Text = pinfo.AllClickNum.ToString(); bread2 = "修改商品"; ClickType.Value = "update"; btnAdd.Visible = true; istrue_chk.Checked = pinfo.Istrue == 1 ? true : false; ProCode.Text = pinfo.ProCode; BarCode.Text = pinfo.BarCode.ToString(); Proname.Text = pinfo.Proname.ToString(); Keywords.Text = pinfo.Kayword.ToString(); ProUnit.Text = pinfo.ProUnit.ToString(); Weight.Text = pinfo.Weight.ToString(); restate_hid.Value = pinfo.GuessXML; Propeid.Text = pinfo.Propeid.ToString(); //Largesspirx.Text = pinfo.Largesspirx.ToString(); Largess.Checked = pinfo.Largess == 1 ? true : false; Recommend_T.Text = pinfo.Recommend.ToString(); //ServerPeriod.Text = pinfo.ServerPeriod.ToString(); //ServerType.SelectedValue = pinfo.ServerType.ToString(); //expRemindDP.SelectedValue = pinfo.ExpRemind.ToString(); ProClass_Hid.Value = pinfo.ProClass.ToString(); PointVal_T.Text = pinfo.PointVal.ToString(); Proinfo.Text = pinfo.Proinfo.ToString(); procontent.Value = pinfo.Procontent.ToString(); txt_Clearimg.Text = pinfo.Clearimg.ToString(); txt_Thumbnails.Text = pinfo.Thumbnails.ToString(); //Quota.Text = pinfo.Quota.ToString(); //DownQuota.Text = pinfo.DownQuota.ToString(); Stock.Text = pinfo.Stock.ToString(); SetStock_B.Visible = true; StockDown.Text = pinfo.StockDown.ToString(); function.Script(this, "SetRadVal('JisuanFs','" + pinfo.JisuanFs + "');"); Rate.Text = pinfo.Rate.ToString(); Rateset.SelectedValue = pinfo.Rateset.ToString(); Dengji.Text = pinfo.Dengji.ToString(); ShiPrice.Text = pinfo.ShiPrice.ToString(); Brand.Text = pinfo.Brand.ToString(); Producer.Text = pinfo.Producer.ToString(); LinPrice.Text = pinfo.LinPrice.ToString(); LinPrice_Purse_T.Text = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "purse").ToString("f2"); LinPrice_Sicon_T.Text = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "sicon").ToString("f2"); LinPrice_Point_T.Text = JsonHelper.GetDBVal(pinfo.LinPrice_Json, "point").ToString("f2"); FareTlp_Rad.SelectedValue = pinfo.FarePrice; ChildPro_Hid.Value = pinfo.Wholesalesinfo; //多价格 IDC_Hid.Value = pinfo.IDCPrice; Stock.ReadOnly = true; if (!string.IsNullOrEmpty(pinfo.BindIDS))//捆绑商品 { DataTable dt = proBll.SelByIDS(pinfo.BindIDS, "id,Thumbnails,Proname,LinPrice"); Bind_Hid.Value = JsonConvert.SerializeObject(dt); } if (!string.IsNullOrEmpty(pinfo.Preset)) { if (pinfo.Preset.IndexOf(",") > -1) { string[] presetarr = pinfo.Preset.Split(new string[] { "," }, StringSplitOptions.None); for (int s = 0; s < presetarr.Length; s++) { M_Promotions proinfo = promoBll.GetPromotionsByid(DataConverter.CLng(presetarr[s])); if (proinfo == null) { continue; } OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString())); } } else { M_Promotions proinfo = promoBll.GetPromotionsByid(DataConverter.CLng(pinfo.Preset)); if (proinfo != null) { OtherProject.Items.Add(new ListItem(proinfo.Promoname, proinfo.Id.ToString())); } } } if (OtherProject.Items.Count > 0) { for (int d = 0; d < OtherProject.Items.Count; d++) { OtherProject.Items[d].Selected = true; } } //填充显示会员价 switch (pinfo.UserType) { case 1: Price_Member_T.Text = DataConverter.CDouble(pinfo.UserPrice).ToString("f2"); price_member_div.Attributes["style"] = ""; break; case 2: price_group_div.Attributes["style"] = ""; break; default: break; } function.Script(this, "SetRadVal('UserPrice_Rad','" + pinfo.UserType + "');"); function.Script(this, "SetRadVal('DownQuota_Rad','" + pinfo.DownQuota + "');"); function.Script(this, "SetRadVal('Quota_Rad','" + pinfo.Quota + "');"); DownCar_T.Text = pinfo.DownCar.ToString(); BookPrice_T.Text = pinfo.BookPrice.ToString("f2"); BookDay_T.Text = pinfo.bookDay.ToString(); //Integral.Text = pinfo.Integral.ToString(); UpdateTime.Text = pinfo.UpdateTime.ToString(); AddTime.Text = pinfo.AddTime.ToString(); ModeTemplate_hid.Value = pinfo.ModeTemplate.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; Allowed.Checked = pinfo.Allowed == 1; DataTable valueDT = proBll.Getmodetable(pinfo.TableName.ToString(), pinfo.ItemID); if (valueDT != null && valueDT.Rows.Count > 0) { ModelHtml.Text = fieldBll.InputallHtml(ModelID, NodeID, new ModelConfig() { ValueDT = valueDT }); } //IntegralNum.Text = pinfo.IntegralNum.ToString(); switch (pinfo.ProjectType) { case 1: break; case 2: ProjectType2_Rad.Checked = true; ProjectPronum2.Text = pinfo.ProjectPronum.ToString(); break; case 3: ProjectType3_Rad.Checked = true; ProjectPronum3.Text = pinfo.ProjectPronum.ToString(); Productsname3.Text = pinfo.PesentNames.ToString(); HiddenField3.Value = pinfo.PesentNameid.ToString(); break; case 4: ProjectType4_Rad.Checked = true; ProjectPronum4.Text = pinfo.ProjectPronum.ToString(); break; case 5: ProjectType5_Rad.Checked = true; ProjectPronum5.Text = pinfo.ProjectPronum.ToString(); Productsname5.Text = pinfo.PesentNames.ToString(); HiddenField5.Value = pinfo.PesentNameid.ToString(); break; case 6: ProjectType6_Rad.Checked = true; ProjectMoney7.Text = pinfo.ProjectMoney.ToString(); Productsname6.Text = pinfo.PesentNames.ToString(); HiddenField6.Value = pinfo.PesentNameid.ToString(); break; case 7: ProjectType7_Rad.Checked = true; ProjectMoney7.Text = pinfo.ProjectMoney.ToString(); Productsname7.Text = pinfo.PesentNames.ToString(); HiddenField7.Value = pinfo.PesentNameid.ToString(); break; } #endregion #region 多区域价格 ProGuid = pinfo.ID.ToString(); M_Shop_RegionPrice regionMod = regionBll.SelModelByGuid(ProGuid); if (regionMod != null && !string.IsNullOrEmpty(regionMod.Info)) { function.Script(this, "region.fill(" + regionMod.Info + ");"); } #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; } Call.SetBreadCrumb(Master, "<li><a href='" + CustomerPageAction.customPath2 + "I/Main.aspx'>工作台</a></li><li><a href='ProductManage.aspx'>商城管理</a></li><li><a href='ProductManage.aspx?NodeID='>" + bread1 + "</a></li><li class='active'>" + bread2 + "</li>" + "<div class='pull-right hidden-xs'><span onclick=\"opentitle('../Content/EditNode.aspx?NodeID=" + NodeID + "','配置本节点');\" class='fa fa-cog' title='配置本节点' style='cursor:pointer;margin-left:5px;'></span></div>"); }
//保存 protected void EBtnSubmit_Click(object sender, EventArgs e) { string adminname = badmin.GetAdminLogin().AdminName; DataTable dt = fieldBll.GetModelFieldList(ModelID); DataTable gpdt = gpBll.GetGroupList(); DataTable table = new Call().GetDTFromPage(dt, Page, ViewState); M_CommonData CCate = new M_CommonData(); M_Product proMod = new M_Product(); if (ProID > 0) { proMod = proBll.GetproductByid(ProID); } CCate.Status = istrue_chk.Checked ? 99 : 0; CCate.NodeID = NodeID; CCate.ModelID = ModelID; CCate.TableName = modBll.GetModelById(ModelID).TableName; CCate.Title = Proname.Text; CCate.Inputer = adminname; CCate.PdfLink = ""; CCate.FirstNodeID = nodeBll.SelFirstNodeID(NodeID); CCate.EliteLevel = DataConverter.CLng(Dengji.SelectedValue) > 3 ? 1 : 0; CCate.InfoID = ""; CCate.SpecialID = ""; CCate.Template = ModeTemplate_hid.Value; CCate.DefaultSkins = 0; /*--------------proMod------------*/ proMod.Class = 0; proMod.Nodeid = NodeID; proMod.ModelID = ModelID; proMod.Properties = 0; proMod.Isgood = 0; proMod.MakeHtml = 0; proMod.AddUser = adminname; if (string.IsNullOrEmpty(proMod.ProCode)) { proMod.ProCode = B_Product.GetProCode(); } proMod.BarCode = BarCode.Text.Trim(); proMod.Proname = Proname.Text.Trim(); proMod.Kayword = Request.Form["tabinput"]; keyBll.AddKeyWord(proMod.Kayword, 1); proMod.ProUnit = ProUnit.Text; proMod.AllClickNum = DataConverter.CLng(Request.Form["AllClickNum"]); proMod.Weight = DataConverter.CLng(Weight.Text); proMod.ProClass = DataConverter.CLng(ProClass_Hid.Value); proMod.IDCPrice = IDC_Hid.Value; proMod.PointVal = DataConverter.CLng(PointVal_T.Text); proMod.Proinfo = Proinfo.Text; proMod.Procontent = procontent.Value; proMod.Clearimg = txt_Clearimg.Text; proMod.Thumbnails = txt_Thumbnails.Text; proMod.Producer = Producer.Text; proMod.Brand = Brand.Text; //proMod.Quota = DataConverter.CLng(Quota.Text); //proMod.DownQuota = DataConverter.CLng(DownQuota.Text); proMod.StockDown = DataConverter.CLng(StockDown.Text); proMod.JisuanFs = DataConverter.CLng(Request.Form["JisuanFs"]); proMod.Rate = DataConverter.CDouble(Rate.Text); proMod.Rateset = DataConverter.CLng(Rateset.SelectedValue); proMod.Dengji = DataConverter.CLng(Dengji.SelectedValue); proMod.ShiPrice = DataConverter.CDouble(ShiPrice.Text); proMod.LinPrice = DataConverter.CDouble(LinPrice.Text); proMod.LinPrice_Json = JsonHelper.AddVal("purse,sicon,point".Split(','), LinPrice_Purse_T.Text, LinPrice_Sicon_T.Text, LinPrice_Point_T.Text); proMod.Preset = (OtherProject.SelectedValue == null) ? "" : OtherProject.SelectedValue; //促销 //proMod.Integral = DataConverter.CLng(Integral.Text); proMod.Propeid = DataConverter.CLng(Propeid.Text); proMod.Recommend = DataConverter.CLng(Recommend_T.Text); proMod.Recommend = proMod.Recommend < 1 ? 0 : proMod.Recommend;//不允许负数 //proMod.Largesspirx = DataConverter.CLng(Largesspirx.Text); proMod.Largess = Largess.Checked?1:0; proMod.AllClickNum = DataConverter.CLng(AllClickNum_T.Text); //更新时间,若没有指定则为当前时间 proMod.UpdateTime = DataConverter.CDate(UpdateTime.Text); proMod.AddTime = DataConverter.CDate(AddTime.Text); proMod.ModeTemplate = ModeTemplate_hid.Value; proMod.FirstNodeID = CCate.FirstNodeID; proMod.bookDay = DataConverter.CLng(BookDay_T.Text); proMod.BookPrice = DataConverter.CDouble(BookPrice_T.Text); proMod.FarePrice = FareTlp_Rad.SelectedValue; proMod.UserType = DataConverter.CLng(Request.Form["UserPrice_Rad"]); proMod.Quota = DataConvert.CLng(Request.Form["Quota_Rad"]); proMod.DownQuota = DataConvert.CLng(Request.Form["DownQuota_Rad"]); switch (proMod.UserType) { case 1: proMod.UserPrice = Price_Member_T.Text.Trim(); break; case 2: proMod.UserPrice = Request.Form["Price_Group_Hid"]; break; } switch (proMod.Quota) { case 0: break; case 2: proMod.Quota_Json = Request.Form["Quota_Group_Hid"]; break; } switch (proMod.DownQuota) { case 0: break; case 2: proMod.DownQuota_Json = Request.Form["DownQuota_Group_Hid"]; break; } int ProjectTypeRad = 0; if (ProjectType2_Rad.Checked) { ProjectTypeRad = 2; } if (ProjectType3_Rad.Checked) { ProjectTypeRad = 3; } if (ProjectType4_Rad.Checked) { ProjectTypeRad = 4; } if (ProjectType5_Rad.Checked) { ProjectTypeRad = 5; } if (ProjectType6_Rad.Checked) { ProjectTypeRad = 6; } if (ProjectType7_Rad.Checked) { ProjectTypeRad = 7; } proMod.ProjectType = ProjectTypeRad; switch (proMod.ProjectType) { #region 促销 case 1: proMod.ProjectPronum = 0; proMod.ProjectMoney = 0; //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text); proMod.PesentNames = ""; proMod.PesentNameid = 0; break; case 2: proMod.ProjectPronum = DataConverter.CLng(ProjectPronum2.Text); proMod.ProjectMoney = 0; //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text); proMod.PesentNames = ""; proMod.PesentNameid = 0; break; case 3: proMod.ProjectPronum = DataConverter.CLng(ProjectPronum3.Text); proMod.ProjectMoney = 0; //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text); proMod.PesentNames = Productsname3.Text; proMod.PesentNameid = DataConverter.CLng(HiddenField3.Value); break; case 4: proMod.ProjectPronum = DataConverter.CLng(ProjectPronum4.Text); proMod.ProjectMoney = 0; //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text); proMod.PesentNames = ""; proMod.PesentNameid = 0; break; case 5: proMod.ProjectPronum = DataConverter.CLng(ProjectPronum5.Text); proMod.ProjectMoney = 0; //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text); proMod.PesentNames = Productsname5.Text; proMod.PesentNameid = DataConverter.CLng(HiddenField5.Value); break; case 6: proMod.ProjectPronum = 0; proMod.ProjectMoney = DataConverter.CDouble(ProjectMoney6.Text); //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text); proMod.PesentNames = Productsname6.Text; proMod.PesentNameid = DataConverter.CLng(HiddenField6.Value); break; case 7: proMod.ProjectPronum = 0; proMod.ProjectMoney = DataConverter.CDouble(ProjectMoney7.Text); //proMod.IntegralNum = DataConverter.CLng(IntegralNum.Text); proMod.PesentNames = Productsname7.Text; proMod.PesentNameid = DataConverter.CLng(HiddenField7.Value); break; #endregion } proMod.TableName = modBll.GetModelById(ModelID).TableName; proMod.Sales = Sales_Chk.Checked ? 1 : 2; proMod.Istrue = istrue_chk.Checked ? 1 : 0; proMod.Ishot = ishot_chk.Checked ? 1 : 0; proMod.Isnew = isnew_chk.Checked ? 1 : 0; proMod.Isbest = isbest_chk.Checked ? 1 : 0; proMod.Allowed = Allowed.Checked ? 1 : 0; proMod.GuessXML = Request.Form["GuessXML"]; proMod.Wholesalesinfo = ChildPro_Hid.Value; proMod.DownCar = DataConvert.CLng(DownCar_T.Text); //捆绑商品 if (!string.IsNullOrEmpty(Bind_Hid.Value)) { //获取绑定商品 DataTable binddt = JsonHelper.JsonToDT(Bind_Hid.Value); proMod.BindIDS = ""; foreach (DataRow dr in binddt.Rows) { proMod.BindIDS += dr["ID"] + ","; } proMod.BindIDS = proMod.BindIDS.TrimEnd(','); } else { proMod.BindIDS = ""; } string danju = proMod.UserShopID + DateTime.Now.ToString("yyyyMMddHHmmss"); if (proMod.ID < 1 || ClickType.Value.Equals("addasnew")) { proMod.Priority = 0; proMod.Nodeid = NodeID; proMod.AddTime = DateTime.Now; proMod.UpdateTime = DateTime.Now; proMod.ID = proBll.Add(table, proMod, CCate); proMod.Stock = DataConverter.CLng(Stock.Text); //多区域价格 SqlParameter[] sp = new SqlParameter[] { new SqlParameter("guid", ProGuid) }; SqlHelper.ExecuteSql("UPDATE ZL_Shop_RegionPrice SET [ProID]=" + proMod.ID + " WHERE [Guid]=@guid", sp); M_Stock stockMod = new M_Stock() { proid = proMod.ID, proname = proMod.Proname, adduser = adminname, StoreID = proMod.UserShopID, }; int proStock = DataConverter.CLng(Stock.Text); if (proStock > 0) { stockMod.proid = proMod.ID; stockMod.stocktype = 0; stockMod.Pronum = proStock; stockMod.danju = "RK" + danju; stockMod.content = "添加商品:" + proMod.Proname + "入库"; stockBll.AddStock(stockMod); } Response.Redirect("ContentShow.aspx?id=" + proMod.ID + "&ModelId=" + proMod.ModelID + "&NodeId=" + proMod.Nodeid); } else { proBll.Update(table, proMod, CCate); //int stock = proStock - DataConverter.CLng(Stock_Hid.Value); //if (stock != 0) //{ // stockMod.stocktype = stock > 0 ? 0 : 1; // stockMod.Pronum = Math.Abs(stock); // stockMod.danju = (stockMod.stocktype > 0 ? "RK" : "CK") + danju; // stockMod.content = stockMod.stocktype > 0 ? "添加商品:" + proMod.Proname + "入库" : "减少商品:" + proMod.Proname + "出库"; // stockBll.AddStock(stockMod); //} Response.Redirect("ContentShow.aspx?id=" + proMod.ID + "&ModelId=" + proMod.ModelID + "&NodeId=" + proMod.Nodeid); } }
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; } }
public void Product_Add() { int NodeID = DataConvert.CLng(Request["NodeID"]); int ModelID = DataConvert.CLng(Request["ModelID"]); string adminname = mu.UserName; DataTable dt = fieldBll.GetModelFieldList(ModelID); DataTable table; try { table = new Call().GetDTFromMVC(dt, Request); } catch (Exception e) { function.WriteErrMsg(e.Message); return; } M_CommonData CCate = new M_CommonData(); M_Product proMod = new M_Product(); if (Mid > 0) { proMod = proBll.GetproductByid(Mid); NodeID = proMod.Nodeid; ModelID = proMod.ModelID; } else { proMod.Nodeid = NodeID; proMod.ModelID = ModelID; //------------------------ CCate.NodeID = proMod.Nodeid; CCate.ModelID = proMod.ModelID; CCate.Inputer = adminname; CCate.TableName = modBll.GetModelById(ModelID).TableName; CCate.FirstNodeID = nodeBll.SelFirstNodeID(NodeID); } /*--------------proMod------------*/ proMod.Istrue = 1; proMod.Properties = 0; proMod.Class = 0; proMod.Isgood = 0; proMod.MakeHtml = 0; proMod.DownCar = 1; proMod.AddUser = adminname; if (string.IsNullOrEmpty(proMod.ProCode)) { proMod.ProCode = B_Product.GetProCode(); } proMod.BarCode = Request.Form["BarCode"]; proMod.Proname = Request.Form["Proname"]; proMod.Kayword = Request.Form["tabinput"]; keyBll.AddKeyWord(proMod.Kayword, 1); proMod.ProUnit = Request.Form["ProUnit"]; proMod.AllClickNum = DataConverter.CLng(Request.Form["AllClickNum"]); proMod.Weight = DataConverter.CLng(Request.Form["Weight"]); proMod.ProClass = DataConverter.CLng(Request.Form["ProClass_Hid"]); proMod.IDCPrice = Request.Form["IDC_Hid"]; proMod.PointVal = DataConverter.CLng(Request.Form["PointVal_T"]); proMod.Proinfo = Request.Form["Proinfo"]; proMod.Procontent = Request.Form["procontent"]; proMod.Clearimg = Request.Form["txt_Clearimg"]; proMod.Thumbnails = Request.Form["txt_Thumbnails"]; proMod.Producer = Request.Form["Producer"]; proMod.Brand = Request.Form["Brand"]; proMod.Quota = DataConverter.CLng(Request.Form["Quota"]); proMod.DownQuota = DataConverter.CLng(Request.Form["DownQuota"]); proMod.StockDown = DataConverter.CLng(Request.Form["StockDown"]); proMod.JisuanFs = DataConverter.CLng(Request.Form["JisuanFs"]); proMod.Rate = DataConverter.CDouble(Request.Form["Rate"]); proMod.Rateset = DataConverter.CLng(Request.Form["Rateset"]); proMod.Dengji = DataConverter.CLng(Request.Form["Dengji"]); proMod.ShiPrice = DataConverter.CDouble(Request.Form["ShiPrice"]); proMod.LinPrice = DataConverter.CDouble(Request.Form["LinPrice"]); proMod.LinPrice_Json = JsonHelper.AddVal("purse,sicon,point".Split(','), Request.Form["LinPrice_Purse_T"], Request.Form["LinPrice_Sicon_T"], Request.Form["LinPrice_Point_T"]); proMod.Propeid = DataConverter.CLng(Request.Form["Propeid"]); proMod.Recommend = DataConverter.CLng(Request.Form["Recommend_T"]); proMod.Recommend = proMod.Recommend < 1 ? 0 : proMod.Recommend;//不允许负数 proMod.Largesspirx = DataConverter.CLng(Request.Form["Largesspirx"]); proMod.AllClickNum = DataConverter.CLng(Request.Form["AllClickNum_T"]); //更新时间,若没有指定则为当前时间 proMod.UpdateTime = DataConverter.CDate(Request.Form["UpdateTime"]); proMod.AddTime = DataConverter.CDate(Request.Form["AddTime"]); //proMod.ModeTemplate = ModeTemplate_hid.Value; proMod.FirstNodeID = CCate.FirstNodeID; proMod.bookDay = DataConverter.CLng(Request.Form["BookDay_T"]); proMod.BookPrice = DataConverter.CDouble(Request.Form["BookPrice_T"]); proMod.FarePrice = Request.Form["FareTlp_Rad"]; proMod.UserType = DataConverter.CLng(Request.Form["UserPrice_Rad"]); //-------------------------------------- CCate.Status = 99; CCate.Title = proMod.Proname; CCate.PdfLink = ""; CCate.EliteLevel = DataConverter.CLng(Request.Form["Dengji"]) > 3 ? 1 : 0; CCate.InfoID = ""; CCate.SpecialID = ""; //CCate.Template = ModeTemplate_hid.Value; CCate.DefaultSkins = 0; switch (proMod.UserType) { case 1: proMod.UserPrice = DataConvert.CDouble(Request["Price_Member_T"]).ToString("F2"); break; case 2: DataTable updt = new DataTable(); updt.Columns.Add(new DataColumn("gid", typeof(int))); updt.Columns.Add(new DataColumn("price", typeof(double))); string[] prices = Request.Form["Price_Group_T"].Split(','); string[] gids = Request.Form["GroupID_Hid"].Split(','); for (int i = 0; i < gids.Length; i++) { DataRow dr = updt.NewRow(); dr["gid"] = Convert.ToInt32(gids[i]); dr["price"] = DataConverter.CDouble(prices[i]); updt.Rows.Add(dr); } proMod.UserPrice = JsonConvert.SerializeObject(updt); break; } proMod.TableName = modBll.GetModelById(ModelID).TableName; proMod.Sales = string.IsNullOrEmpty(Request.Form["Sales_Chk"]) ? 2 : 1; proMod.Ishot = string.IsNullOrEmpty(Request.Form["ishot_chk"]) ? 0 : 1; proMod.Isnew = string.IsNullOrEmpty(Request.Form["isnew_chk"]) ? 0 : 1; proMod.Isbest = string.IsNullOrEmpty(Request.Form["isbest_chk"]) ? 0 : 1; proMod.Allowed = string.IsNullOrEmpty(Request.Form["Allowed"]) ? 0 : 1; proMod.GuessXML = Request.Form["GuessXML"]; proMod.Wholesalesinfo = Request.Form["ChildPro_Hid"]; //捆绑商品 if (!string.IsNullOrEmpty(Request.Form["Bind_Hid"])) { //获取绑定商品 DataTable binddt = JsonHelper.JsonToDT(Request.Form["Bind_Hid"]); proMod.BindIDS = ""; foreach (DataRow dr in binddt.Rows) { proMod.BindIDS += dr["ID"] + ","; } proMod.BindIDS = proMod.BindIDS.TrimEnd(','); } else { proMod.BindIDS = ""; } string ClickType = Request.Form["ClickType"]; string danju = proMod.UserShopID + DateTime.Now.ToString("yyyyMMddHHmmss"); { //店铺专用 M_CommonData storeMod = conBll.SelMyStore_Ex(ref err); if (!string.IsNullOrEmpty(err)) { function.WriteErrMsg(err); return; } proMod.UserShopID = storeMod.GeneralID; proMod.UserID = mu.UserID; } if (proMod.ID < 1 || ClickType.Equals("addasnew")) { proMod.Priority = 0; proMod.Nodeid = NodeID; proMod.AddTime = DateTime.Now; proMod.UpdateTime = DateTime.Now; proMod.ID = proBll.Add(table, proMod, CCate); //多区域价格 SqlParameter[] sp = new SqlParameter[] { new SqlParameter("guid", Request.Form["ProGuid"]) }; SqlHelper.ExecuteSql("UPDATE ZL_Shop_RegionPrice SET [ProID]=" + proMod.ID + " WHERE [Guid]=@guid", sp); M_Stock stockMod = new M_Stock() { proid = proMod.ID, proname = proMod.Proname, adduser = adminname, StoreID = proMod.UserShopID, }; int proStock = DataConverter.CLng(Request.Form["Stock"]); if (proStock > 0) { stockMod.proid = proMod.ID; stockMod.stocktype = 0; stockMod.Pronum = proStock; stockMod.danju = "RK" + danju; stockMod.content = "添加商品:" + proMod.Proname + "入库"; stockBll.AddStock(stockMod); } } else { proBll.Update(table, proMod, CCate); } function.WriteSuccessMsg("操作成功", "ProductList"); return; }