/// <summary> /// 属性以及属性值添加 /// </summary> /// <param name="value"></param> /// <returns></returns> public string AddAttributeValue(string value, string id, string attrName) { value = Common.NoHTML(value); attrName = Common.NoHTML(attrName); int attrId = 0; if (id == "" || id == null) { if (IsExist("attributeName", attrName, "")) { return("sxycz"); } Hi.Model.BD_Attribute l = new Hi.Model.BD_Attribute(); l.AttributeName = attrName; l.CreateDate = DateTime.Now; l.CreateUserID = this.UserID; l.ts = DateTime.Now; l.CompID = this.CompID; l.modifyuser = this.UserID; l.IsEnabled = 1; attrId = new Hi.BLL.BD_Attribute().Add(l); } else { attrId = Convert.ToInt32(id); } var num = new Hi.BLL.BD_AttributeValues().GetList("", "attributeid=" + attrId + " and attrvalue='" + value + "' and ISNULL(dr,0)=0 and Compid=" + this.CompID, ""); if (num.Count > 0) { return("ycz");//已存在 } Hi.Model.BD_AttributeValues model = new Hi.Model.BD_AttributeValues(); model.AttrValue = value; model.AttributeID = Convert.ToInt32(attrId); model.CreateDate = DateTime.Now; model.CreateUserID = this.UserID; model.ts = DateTime.Now; model.CompID = this.CompID; model.modifyuser = this.UserID; model.IsEnabled = 1; int count = new Hi.BLL.BD_AttributeValues().Add(model); if (count > 0) { return(attrId.ToString()); } else { return(""); } }
/// <summary> /// 添加属性 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnAdd_Click(object sender, EventArgs e) { try { if (bolNum(hideadd.Value)) { Hi.Model.BD_Attribute attribute = new Hi.BLL.BD_Attribute().GetModel(Convert.ToInt32(hideadd.Value)); if (IsExist("attributeName", this.txtAttributeName.Value.Trim(), hideadd.Value)) { JScript.AlertMethod(this, "属性已存在", JScript.IconOption.错误); return; } attribute.AttributeName = Common.NoHTML(this.txtAttributeName.Value.Trim()); attribute.Memo = Common.NoHTML(this.txtMemo.Value.Trim()); attribute.CreateUserID = this.UserID; attribute.ID = Convert.ToInt32(hideadd.Value); attribute.ts = DateTime.Now; attribute.CompID = this.CompID; attribute.modifyuser = this.UserID; bool k = new Hi.BLL.BD_Attribute().Update(attribute); Bind(); txtAttributeName.Value = string.Empty; txtMemo.Value = string.Empty; hideadd.Value = ""; } else { //赋值 string attributeName = Common.NoHTML(txtAttributeName.Value.Trim()); //属性名称 string memo = Common.NoHTML(txtMemo.Value.Trim()); //排序编号 if (IsExist("attributeName", attributeName, "")) { JScript.AlertMethod(this, "属性已存在", JScript.IconOption.错误); return; } Hi.Model.BD_Attribute attribute = new Hi.Model.BD_Attribute(); attribute.AttributeName = attributeName; attribute.Memo = memo; attribute.CreateUserID = this.UserID; attribute.CreateDate = DateTime.Now; attribute.CreateDate = DateTime.Now;//创建时间 attribute.ts = DateTime.Now; attribute.CompID = this.CompID; attribute.modifyuser = this.UserID; attribute.IsEnabled = 1; /*****执行*****/ int k = new Hi.BLL.BD_Attribute().Add(attribute); if (k > 0) { Bind(); txtAttributeName.Value = string.Empty; hideadd.Value = ""; } else { JScript.AlertMethod(this, "属性添加失败", JScript.IconOption.错误); return; } } } catch (Exception ex) { throw ex; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Hi.Model.BD_Attribute model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(Hi.Model.BD_Attribute model) { return(dal.Add(model)); }