public int Insert(M_Content_VerBak model) { if (string.IsNullOrEmpty(model.Flow)) { model.Flow = model.GeneralID + DateTime.Now.ToString("yyyyMMddHHmmss") + function.GetRandomString(4, 2); } return(DBCenter.Insert(model)); }
private void IsNeedVerBak(M_Product proMod) { if (!string.IsNullOrEmpty(Request.Form["verbak_chk"])) { M_Content_VerBak verMod = new M_Content_VerBak(); DataTable valueDT = proBll.GetContent(proMod.TableName, proMod.ItemID); verMod.GeneralID = proMod.ID; verMod.ContentBak = JsonConvert.SerializeObject(proMod); verMod.TableBak = JsonConvert.SerializeObject(valueDT); verMod.Title = proMod.Proname; verMod.Inputer = adminMod.AdminName; verMod.ZType = "product"; verBll.Insert(verMod); } }
//进行版本备份 private void IsNeedVerBak(M_CommonData conMod) { if (!string.IsNullOrEmpty(Request.Form["verbak_chk"])) { M_Content_VerBak verMod = new M_Content_VerBak(); DataTable valueDT = contentBll.GetContent(conMod); verMod.GeneralID = conMod.GeneralID; verMod.ContentBak = JsonConvert.SerializeObject(conMod); verMod.TableBak = JsonConvert.SerializeObject(valueDT); verMod.Title = conMod.Title; verMod.Inputer = adminMod.AdminName; verMod.ZType = "content"; verBll.Insert(verMod); } }
public ActionResult EditContent() { int Mid = Convert.ToInt32(Request.QueryString["GeneralID"]); int VerID = DataConvert.CLng(Request.QueryString["Ver"]); VM_Content vm = new VM_Content(); if (VerID > 0) { M_Content_VerBak verMod = verBll.SelReturnModel(VerID); vm.conMod = JsonConvert.DeserializeObject <M_CommonData>(verMod.ContentBak); if (vm.conMod.GeneralID != Mid) { function.WriteErrMsg("加载的版本与内容不匹配"); return(null); } vm.ValueDT = JsonConvert.DeserializeObject <DataTable>(verMod.TableBak); } else { vm.conMod = contentBll.SelReturnModel(Mid); vm.ValueDT = contentBll.GetContent(vm.conMod); } vm.fieldDT = fieldBll.SelByModelID(vm.conMod.ModelID, true); vm.nodeMod = nodeBll.SelReturnModel(vm.conMod.NodeID); if (!B_NodeRole.CheckNodeAuth(adminMod, vm.nodeMod.NodeID, "addto")) { function.WriteErrMsg("你无权修改该内容"); return(null); } vm.modelMod = modelBll.SelReturnModel(vm.conMod.ModelID); if (!string.IsNullOrEmpty(vm.conMod.SpecialID)) { vm.SpecialDT = spbll.SelByIDS(vm.conMod.SpecialID); if (vm.SpecialDT == null) { vm.SpecialDT = new DataTable(); } } DataTable ddlDT = proBll.SelByNodeID2(vm.NodeID); ViewBag.ddlDT = ddlDT; //M_Content_ScheTask exaTask = scheBll.GetModel(vm.conMod.BidType); //if (exaTask != null) { vm.ExamineTime = exaTask.ExecuteTime; } //M_Content_ScheTask expTask = scheBll.GetModel(vm.conMod.IsBid); //if (expTask != null) { vm.ExpiredTime = expTask.ExecuteTime; } //--------------- return(View("AddContent", vm)); }
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 bool UpdateByID(M_Content_VerBak model) { return(DBCenter.UpdateByID(model, model.ID)); }