//选择商品分类树节点 protected void TvGoodsClassNodeClick(object sender, RadTreeNodeEventArgs e) { var classId = new Guid(e.Node.Value); if (!IsInster) { NonceGoodsClassInfo = new GoodsClassInfo(); if (classId != Guid.Empty) { var goodsClassInfo = _goodsCenterSao.GetClassDetail(classId); if (goodsClassInfo.GoodsClassFieldList == null) { goodsClassInfo.GoodsClassFieldList = new List <Guid>(); } NonceGoodsClassInfo = goodsClassInfo; if (goodsClassInfo.GoodsClassFieldList.Count > 0) { GoodsClassFieldIdList = goodsClassInfo.GoodsClassFieldList; } } } else { NonceGoodsClassInfo = new GoodsClassInfo { ClassId = Guid.NewGuid(), ParentClassId = classId, ClassName = String.Empty }; } }
public static int AddExt(GoodsClassInfo entity) { int num = GoodsClass.Add(entity); if (num > 0) { if (entity.ParentID.Equals(0)) { entity.RootID = num; entity.Depth = 1; entity.ChildCount = 0; } else { GoodsClassInfo dataById = GoodsClass.GetDataById(entity.ParentID); if (dataById != null) { entity.RootID = dataById.RootID; entity.Depth = dataById.Depth + 1; entity.ChildCount = 0; dataById.ChildCount++; GoodsClass.Update(dataById); } } entity.AutoID = num; GoodsClass.Update(entity); } return(num); }
protected void InsterItem(object sender, EventArgs e) { FieldGrid.Enabled = true; Guid parentClassId; if (TVGoodsClass.SelectedNode == null) { parentClassId = Guid.Empty; } else { RadTreeNode currentNode = TVGoodsClass.SelectedNode; parentClassId = new Guid(currentNode.Value); } NonceGoodsClassInfo = new GoodsClassInfo { ClassId = Guid.NewGuid(), ParentClassId = parentClassId, ClassName = string.Empty }; ControlPanel.Visible = false; IB_Add.Visible = true; LB_AddSpace.Visible = true; IB_Update.Visible = false; LB_UpdateSpace.Visible = false; IB_Cancel.Visible = true; DisableGoodsClassPanel(false); }
protected void lnk_Delete_Click(object sender, System.EventArgs e) { if (!base.IsAuthorizedOp(ActionType.Delete.ToString())) { base.ShowAjaxMsg(this.UpdatePanel1, "Không có thẩm quyền"); } else { int @int = WebUtils.GetInt((sender as LinkButton).CommandArgument); GoodsClassInfo dataById = SinGooCMS.BLL.GoodsClass.GetDataById(@int); if (dataById == null) { base.ShowAjaxMsg(this.UpdatePanel1, "Những thông tin này không được tìm thấy, các dữ liệu không tồn tại hoặc đã bị xóa"); } else if (SinGooCMS.BLL.GoodsClass.Delete(@int)) { this.BindData(); PageBase.log.AddEvent(base.LoginAccount.AccountName, "删除商品类目[" + dataById.ClassName + "] thành công"); base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thành công"); } else { base.ShowAjaxMsg(this.UpdatePanel1, "Thao tác thất bại"); } } }
private static void InitCate(string nick, GoodsClassInfo cinfo, TeteShopCategoryInfo ainfo) { ainfo.Cateid = cinfo.cid; ainfo.Parentid = cinfo.parent_cid; ainfo.Catename = cinfo.name; ainfo.Catepicurl = cinfo.pic_url; ainfo.Nick = Encrypt(nick); }
private void InitGuiGe(GoodsClassInfo goodsClass, ProductInfo pro) { if (goodsClass.AutoID == pro.ClassID) { System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder(); System.Collections.Generic.IList <GoodsSpecifyInfo> list = GoodsSpecify.GetList(1000, " ProID=" + pro.AutoID, "AutoID asc"); foreach (GoodsSpecifyInfo current in list) { stringBuilder.Append("<tr>"); int num = 0; string[] array = current.Specification.Split(new char[] { ',' }); for (int i = 0; i < array.Length; i++) { string text = array[i]; stringBuilder.Append(string.Concat(new string[] { "<td class='ggname' style='background:#ffa;position:relative;' onclick=\\\"createMenu(this,'", goodsClass.GeiGeSets[num].GuiGeValue, "')\\\"><span>", text, "</span><input type='hidden' name='gg_name' value='", text, "' /></td>" })); num++; } string gUID = StringUtils.GetGUID(); stringBuilder.Append(string.Concat(new object[] { "<td><input type='text' value='", current.ProductSN, "' name='gg_hh' class='input-txt' style='width:120px;' /></td><td><input type='text' value='", current.SellPrice.ToString("f2"), "' name='gg_xsj' class='input-txt' style='width:60px;' /><input type='hidden' name='gg_memberprice' id='", gUID, "'/> <a href='javascript:;' onclick=\\\"$.dialog.open('MemberPrice.aspx?Module=", base.CurrentModuleCode, "&type=guige&opid=", current.AutoID, "&price=", current.SellPrice.ToString("f2"), "&retid=", gUID, "&action=Modify',{title:'Chỉnh sửa giá thành viên',width:580,height:430},false);\\\" >giá thành viên</a></td><td><input type='text' value='", current.Stock, "' name='gg_kc' class='input-txt' style='width:60px;' /></td><td><input type='text' value='", current.AlarmNum, "' name='gg_alarmnum' class='input-txt' style='width:60px;' /></td><td><a href='javascript:;' onclick='$(this).parent().parent().remove();'>Remove</a></td>" })); stringBuilder.Append("</tr>"); } this.JsonForGuiGeInitValue = stringBuilder.ToString().Trim(); } }
static ClassInfo ConvertToClassInfo(GoodsClassInfo goodsClassInfo) { var classInfo = new ClassInfo { ClassID = goodsClassInfo.ClassId, Name = goodsClassInfo.ClassName, OrderIndex = goodsClassInfo.OrderIndex, ParentID = goodsClassInfo.ParentClassId }; return(classInfo); }
static GoodsClassInfo ConvertToMyGoodsClassInfo(ClassTreeModel classInfo) { var goodsClassInfo = new GoodsClassInfo { ClassId = classInfo.ClassID, ClassName = classInfo.ClassName, OrderIndex = classInfo.OrderIndex, ParentClassId = classInfo.ParentID, }; return(goodsClassInfo); }
protected void Page_Load(object sender, System.EventArgs e) { this.IsOnSale = WebUtils.GetQueryString("Status", "On"); this.currCate = SinGooCMS.BLL.Category.GetCacheCategoryByID(WebUtils.GetQueryInt("CateID")); this.goodsClass = SinGooCMS.BLL.GoodsClass.GetDataById(WebUtils.GetQueryInt("ClassID")); if (base.IsEdit) { this.proInit = Product.GetDataById(base.OpID); if (this.currCate == null) { this.currCate = SinGooCMS.BLL.Category.GetDataById((this.proInit == null) ? 0 : this.proInit.CateID); } if (this.goodsClass == null) { this.goodsClass = SinGooCMS.BLL.GoodsClass.GetDataById((this.proInit == null) ? 0 : this.proInit.ClassID); } } this.panelgg.Visible = (this.panelswitch.Visible = ((this.goodsClass == null) ? false : true)); if (this.currCate == null) { base.ClientScript.RegisterClientScriptBlock(base.GetType(), "alertandredirect", string.Concat(new object[] { "<script>alert('Không tìm thấy thông tin');location='Products.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View'</script>" })); } else if (base.IsEdit && this.proInit == null) { base.ClientScript.RegisterClientScriptBlock(base.GetType(), "alertandredirect", string.Concat(new object[] { "<script>alert('Thông tin sản phẩm không tìm thấy');location='Products.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View'</script>" })); } else { this.proModel = (base.IsEdit ? ProductModel.GetCacheModelById(this.proInit.ModelID) : ProductModel.GetCacheModelById(this.currCate.ModelID)); if (!base.IsPostBack) { this.BindBrand(); this.BindAreaModel(); this.BindPostageModel(); this.BindTags(); this.BindData(); } } }
static GoodsClassInfo ConvertToMyGoodsClassInfo(ClassDetail classDetail) { var goodsClassInfo = new GoodsClassInfo { ClassId = classDetail.ClassInfo.ClassID, ClassName = classDetail.ClassInfo.Name, OrderIndex = classDetail.ClassInfo.OrderIndex, ParentClassId = classDetail.ClassInfo.ParentID, GoodsClassFieldList = classDetail.ClassFieldList }; return(goodsClassInfo); }
public static int Add(GoodsClassInfo entity) { int result; if (entity == null) { result = 0; } else { result = BizBase.dbo.InsertModel <GoodsClassInfo>(entity); } return(result); }
private void InitForModify() { GoodsClassInfo dataById = SinGooCMS.BLL.GoodsClass.GetDataById(base.OpID); this.TextBox1.Text = dataById.ClassName; ListItem listItem = this.DropDownList2.Items.FindByValue(dataById.ParentID.ToString()); if (listItem != null) { listItem.Selected = true; } this.Repeater1.DataSource = dataById.GeiGeSets; this.Repeater1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { IB_Add.Visible = false; LB_AddSpace.Visible = false; IB_Update.Visible = false; LB_UpdateSpace.Visible = false; IB_Cancel.Visible = false; BindParentClass(); NonceGoodsClassInfo = new GoodsClassInfo(); GetTreeGoodsClass(); DisableGoodsClassPanel(true); } }
public static bool DeleteExt(int intPrimaryKeyIDValue) { GoodsClassInfo dataById = GoodsClass.GetDataById(intPrimaryKeyIDValue); bool result; if (dataById != null) { if (GoodsClass.Delete(intPrimaryKeyIDValue)) { BizBase.dbo.UpdateTable("update shop_GoodsClass set ChildCount=ChildCount-1 where ChildCount>0 AND AutoID=" + dataById.ParentID); } result = true; } else { result = false; } return(result); }
/// <summary> /// 新增商品分类 /// </summary> /// <param name="goodsClassInfo"></param> /// <param name="errorMessage"></param> /// <returns></returns> public bool AddClass(GoodsClassInfo goodsClassInfo, out string errorMessage) { var request = new ClassDetail { ClassInfo = ConvertToClassInfo(goodsClassInfo), ClassFieldList = goodsClassInfo.GoodsClassFieldList, }; var result = GoodsServerClient.AddClass(request); errorMessage = string.Empty; if (result == null) { errorMessage = "GMS连接异常"; } else if (!result.IsSuccess) { errorMessage = result.ErrorMsg; } return(result != null && result.IsSuccess); }
//添加商品分类 protected void Add_Click(object sender, EventArgs e) { try { GoodsClassInfo goodsClassInfo = NonceGoodsClassInfo; goodsClassInfo.GoodsClassFieldList = GoodsClassFieldIdList; string errorMessage; var result = _goodsCenterSao.AddClass(goodsClassInfo, out errorMessage); if (result) { //商品分类添加操作记录添加 var personnelInfo = CurrentSession.Personnel.Get(); WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, goodsClassInfo.ClassId, "", OperationPoint.GoodsClassManager.Add.GetBusinessInfo(), ""); if (TVGoodsClass.SelectedNode == null) { RadTreeNode addNode = CreateNode(goodsClassInfo.ClassName, false, goodsClassInfo.ClassId.ToString()); TVGoodsClass.Nodes.Add(addNode); } else { RadTreeNode currentNode = TVGoodsClass.FindNodeByValue(goodsClassInfo.ParentClassId.ToString()); RadTreeNode addNode = CreateNode(goodsClassInfo.ClassName, false, goodsClassInfo.ClassId.ToString()); currentNode.Nodes.Add(addNode); OpenTree(currentNode); BindParentClass(); } InsterItem(sender, e); } else { RAM.Alert("商品分类添加失败!操作异常!" + errorMessage); } } catch { RAM.Alert("产品分类添加失败!"); } }
protected void Delete_Click(object sender, EventArgs e) { if (TVGoodsClass.SelectedNode == null) { return; } var currentNode = TVGoodsClass.SelectedNode; var panterCurrentNode = currentNode.ParentNode; var classId = new Guid(currentNode.Value); if (classId != Guid.Empty) { try { GoodsClassInfo goodsClassInfo = _goodsCenterSao.GetClassDetail(classId); string errorMessage; var result = _goodsCenterSao.DeleteClass(classId, out errorMessage); if (result) { UnselectAllNodes(TVGoodsClass); //商品分类添加操作记录添加 var personnelInfo = CurrentSession.Personnel.Get(); WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, goodsClassInfo.ClassId, "", OperationPoint.GoodsClassManager.Delete.GetBusinessInfo(), ""); if (currentNode.Parent != null) { panterCurrentNode.Selected = true; panterCurrentNode.Nodes.Remove(currentNode); var nodeId = new Guid(panterCurrentNode.Value); GoodsClassInfo goodsClassInfo2 = nodeId == Guid.Empty ? null : _goodsCenterSao.GetClassDetail(nodeId); NonceGoodsClassInfo = goodsClassInfo2; } else { if (currentNode.Index > 0) { currentNode.TreeView.Nodes[currentNode.Index - 1].Selected = true; var id = new Guid(currentNode.TreeView.Nodes[currentNode.Index - 1].Value); GoodsClassInfo goodsClassInfo2 = id == Guid.Empty ? null : _goodsCenterSao.GetClassDetail(id); NonceGoodsClassInfo = goodsClassInfo2; } TVGoodsClass.Nodes.Remove(currentNode); } DDL_ParentClass.SelectedValue = panterCurrentNode.Value; if (panterCurrentNode.Value != Guid.Empty.ToString()) { BindParentClass(); } } else { RAM.Alert("商品分类删除失败!" + errorMessage); } } catch (Exception exp) { RAM.Alert("商品分类信息删除失败!\n\n错误提示:" + exp.Message); } } else { RAM.Alert("根节点不允许删除!"); } }
protected void Update_Click(object sender, EventArgs e) { GoodsClassInfo goodsClassInfo = NonceGoodsClassInfo; if (goodsClassInfo.ClassId != Guid.Empty) { try { if (TVGoodsClass.SelectedNode != null) { goodsClassInfo.GoodsClassFieldList = GoodsClassFieldIdList; var goodsInfoList = _goodsCenterSao.GetGoodsInfoListSimpleByClassId(goodsClassInfo.ClassId, string.Empty); var fieldList = _goodsCenterSao.GetFieldListByGoodsClassId(goodsClassInfo.ClassId).ToList(); if (goodsInfoList.Count > 0) { if (GoodsClassFieldIdList.Count != fieldList.Count) { RAM.Alert("该分类下有商品,不能更改商品分类的属性"); return; } } string errorMessage; var result = _goodsCenterSao.UpdateClass(goodsClassInfo, out errorMessage); if (result) { // 操作记录添加 var personnelInfo = CurrentSession.Personnel.Get(); WebControl.AddOperationLog(personnelInfo.PersonnelId, personnelInfo.RealName, goodsClassInfo.ClassId, "", OperationPoint.GoodsClassManager.Edit.GetBusinessInfo(), ""); RadTreeNode currentNode = TVGoodsClass.SelectedNode; RadTreeNode aimNode = TVGoodsClass.FindNodeByValue(goodsClassInfo.ParentClassId.ToString()); currentNode.Text = goodsClassInfo.ClassName; currentNode.ToolTip = goodsClassInfo.ClassName; currentNode.CssClass = "TreeNode"; if (currentNode.Parent != null) { if (goodsClassInfo.ParentClassId != new Guid(currentNode.ParentNode.Value)) { currentNode.ParentNode.Nodes.Remove(currentNode); aimNode.Nodes.Add(currentNode); OpenTree(aimNode); } } } else { RAM.Alert("商品分类更改失败!" + errorMessage); } } } catch { RAM.Alert("产品分类更改失败!"); } } else { RAM.Alert("根节点不允许更改!"); } }
public static bool Update(GoodsClassInfo entity) { return(entity != null && BizBase.dbo.UpdateModel <GoodsClassInfo>(entity)); }
public static bool UpdateExt(GoodsClassInfo entity) { return(false); }
protected void btnok_Click(object sender, System.EventArgs e) { if (base.Action.Equals(ActionType.Add.ToString()) && !base.IsAuthorizedOp(ActionType.Add.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else if (base.Action.Equals(ActionType.Modify.ToString()) && !base.IsAuthorizedOp(ActionType.Modify.ToString())) { base.ShowMsg("Không có thẩm quyền"); } else { int num = WebUtils.StringToInt(this.DropDownList2.SelectedValue); GoodsClassInfo goodsClassInfo = new GoodsClassInfo(); if (base.IsEdit) { goodsClassInfo = SinGooCMS.BLL.GoodsClass.GetDataById(base.OpID); } goodsClassInfo.ClassName = WebUtils.GetString(this.TextBox1.Text); goodsClassInfo.GuiGeCollection = WebUtils.GetFormString("hdf_guigejson"); if (string.IsNullOrEmpty(goodsClassInfo.ClassName)) { base.ShowMsg("商品类目名称不能为空!"); } else if (string.IsNullOrEmpty(goodsClassInfo.GuiGeCollection)) { base.ShowMsg("没有输入任何规格属性!"); } else if (base.IsEdit && goodsClassInfo.AutoID == num) { base.ShowMsg("上级文件夹不能是自己!"); } else { goodsClassInfo.ParentID = num; if (base.Action.Equals(ActionType.Add.ToString())) { goodsClassInfo.Sort = SinGooCMS.BLL.GoodsClass.MaxSort + 1; goodsClassInfo.Lang = base.cultureLang; goodsClassInfo.Creator = base.LoginAccount.AccountName; goodsClassInfo.AutoTimeStamp = System.DateTime.Now; if (SinGooCMS.BLL.GoodsClass.AddExt(goodsClassInfo) > 0) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "添加商品类目[" + goodsClassInfo.ClassName + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "GoodsClass.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View" })); } else { base.ShowMsg("添加失败"); } } if (base.Action.Equals(ActionType.Modify.ToString())) { if (SinGooCMS.BLL.GoodsClass.Update(goodsClassInfo)) { PageBase.log.AddEvent(base.LoginAccount.AccountName, "修改商品类目[" + goodsClassInfo.ClassName + "] thành công"); base.Response.Redirect(string.Concat(new object[] { "GoodsClass.aspx?CatalogID=", base.CurrentCatalogID, "&Module=", base.CurrentModuleCode, "&action=View" })); } else { base.ShowMsg("修改失败"); } } } } }