protected void Page_Load(object sender, EventArgs e) { int num; if ((!string.IsNullOrEmpty(Request["isCallback"]) && (Request["isCallback"] == "true")) && int.TryParse(Request["ValueId"], out num)) { if (ProductTypeHelper.DeleteAttributeValue(num)) { if (!string.IsNullOrEmpty(Request["ImageUrl"])) { StoreHelper.DeleteImage(Request["ImageUrl"]); Response.Clear(); Response.ContentType = "application/json"; Response.Write("{\"Status\":\"true\"}"); Response.End(); } else { Response.Clear(); Response.ContentType = "application/json"; Response.Write("{\"Status\":\"true\"}"); Response.End(); } } else { Response.Clear(); Response.ContentType = "application/json"; Response.Write("{\"Status\":\"false\"}"); Response.End(); } } btnFilish.Click += new EventHandler(btnFilish_Click); }
private void grdAttributeValues_RowDeleting(object source, GridViewDeleteEventArgs e) { int attributeValueId = (int)this.grdAttributeValues.DataKeys[e.RowIndex].Value; if (ProductTypeHelper.DeleteAttributeValue(attributeValueId)) { this.BindData(); } }
private void Delete(HttpContext context) { int value = base.GetIntParam(context, "ids", false).Value; if (ProductTypeHelper.DeleteAttributeValue(value)) { base.ReturnSuccessResult(context, "删除成功!", 0, true); return; } throw new HidistroAshxException("删除失败!未知错误!"); }
private void grdAttributeValues_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { int rowIndex = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex; int attributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex].Value; int displaySequence = int.Parse((this.grdAttributeValues.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None); string imageUrl = e.CommandArgument.ToString(); int replaceAttributeValueId = 0; int replaceDisplaySequence = 0; if (e.CommandName == "Fall") { if (rowIndex < this.grdAttributeValues.Rows.Count - 1) { replaceAttributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex + 1].Value; replaceDisplaySequence = int.Parse((this.grdAttributeValues.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None); } } else { if (e.CommandName == "Rise" && rowIndex > 0) { replaceAttributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex - 1].Value; replaceDisplaySequence = int.Parse((this.grdAttributeValues.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None); } } if (e.CommandName == "dele") { if (ProductTypeHelper.DeleteAttributeValue(attributeValueId)) { StoreHelper.DeleteImage(imageUrl); } else { this.ShowMsg("该规格下存在商品", false); } } if (replaceAttributeValueId > 0) { ProductTypeHelper.SwapAttributeValueSequence(attributeValueId, replaceAttributeValueId, displaySequence, replaceDisplaySequence); } this.BindData(); }
protected void Page_Load(object sender, EventArgs e) { int num; if ((!string.IsNullOrEmpty(base.Request["isCallback"]) && (base.Request["isCallback"] == "true")) && int.TryParse(base.Request["ValueId"], out num)) { if (ProductTypeHelper.DeleteAttributeValue(num)) { if (!string.IsNullOrEmpty(base.Request["ImageUrl"])) { StoreHelper.DeleteImage(base.Request["ImageUrl"]); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"true\"}"); base.Response.End(); } else { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"true\"}"); base.Response.End(); } } else { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"false\"}"); base.Response.End(); } } if (!string.IsNullOrEmpty(base.Request["isAjax"]) && (base.Request["isAjax"] == "true")) { string str = base.Request["Mode"].ToString(); string str2 = ""; string str3 = "false"; string str6 = str; if (str6 != null) { int num2; if (!(str6 == "Add")) { if (str6 == "AddSkuItemValue") { str2 = "参数缺少"; if (int.TryParse(base.Request["AttributeId"], out num2)) { string str5 = ""; str2 = "规格值名不允许为空!"; if (!string.IsNullOrEmpty(base.Request["ValueName"].ToString())) { str5 = Globals.HtmlEncode(base.Request["ValueName"].ToString().Replace("+", "").Replace(",", "")); str2 = "规格值名长度不允许超过15个字符"; if (str5.Length < 15) { AttributeValueInfo attributeValue = new AttributeValueInfo { ValueStr = str5, AttributeId = num2 }; int num4 = 0; str2 = "添加规格值失败"; num4 = ProductTypeHelper.AddAttributeValue(attributeValue); if (num4 > 0) { str2 = num4.ToString(); str3 = "true"; } } } } base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"" + str3 + "\",\"msg\":\"" + str2 + "\"}"); base.Response.End(); } } else { num2 = 0; str2 = "参数缺少"; if (int.TryParse(base.Request["AttributeId"], out num2)) { string str4 = ""; str2 = "属性名称不允许为空!"; if (!string.IsNullOrEmpty(base.Request["ValueName"].ToString())) { str4 = Globals.HtmlEncode(base.Request["ValueName"].ToString()); AttributeValueInfo info = new AttributeValueInfo { ValueStr = str4, AttributeId = num2 }; int num3 = 0; str2 = "添加属性值失败"; num3 = ProductTypeHelper.AddAttributeValue(info); if (num3 > 0) { str2 = num3.ToString(); str3 = "true"; } } } base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"" + str3 + "\",\"msg\":\"" + str2 + "\"}"); base.Response.End(); } } } this.btnFilish.Click += new EventHandler(this.btnFilish_Click); }
protected void Page_Load(object sender, System.EventArgs e) { bool flag = !string.IsNullOrEmpty(base.Request["isCallback"]) && base.Request["isCallback"] == "true"; int attributeValueId; if (flag && int.TryParse(base.Request["ValueId"], out attributeValueId)) { if (ProductTypeHelper.DeleteAttributeValue(attributeValueId)) { if (!string.IsNullOrEmpty(base.Request["ImageUrl"])) { StoreHelper.DeleteImage(base.Request["ImageUrl"]); base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"true\"}"); base.Response.End(); } else { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"true\"}"); base.Response.End(); } } else { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"false\"}"); base.Response.End(); } } if (!string.IsNullOrEmpty(base.Request["isAjax"]) && base.Request["isAjax"] == "true") { string text = base.Request["Mode"].ToString(); string text2 = "false"; string a; if ((a = text) != null) { int attributeId; string text3; if (a == "Add") { attributeId = 0; text3 = "参数缺少"; if (int.TryParse(base.Request["AttributeId"], out attributeId)) { text3 = "属性名称不允许为空!"; if (!string.IsNullOrEmpty(base.Request["ValueName"].ToString())) { string valueStr = Globals.HtmlEncode(base.Request["ValueName"].ToString()); AttributeValueInfo attributeValueInfo = new AttributeValueInfo(); attributeValueInfo.ValueStr = valueStr; attributeValueInfo.AttributeId = attributeId; text3 = "添加属性值失败"; int num = ProductTypeHelper.AddAttributeValue(attributeValueInfo); if (num > 0) { text3 = num.ToString(); text2 = "true"; } } } base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write(string.Concat(new string[] { "{\"Status\":\"", text2, "\",\"msg\":\"", text3, "\"}" })); base.Response.End(); return; } if (!(a == "AddSkuItemValue")) { return; } text3 = "参数缺少"; if (int.TryParse(base.Request["AttributeId"], out attributeId)) { text3 = "规格值名不允许为空!"; if (!string.IsNullOrEmpty(base.Request["ValueName"].ToString())) { string text4 = Globals.HtmlEncode(base.Request["ValueName"].ToString().Replace("+", "").Replace(",", "")); text3 = "规格值名长度不允许超过50个字符"; if (text4.Length < 50) { AttributeValueInfo attributeValueInfo2 = new AttributeValueInfo(); attributeValueInfo2.ValueStr = text4; attributeValueInfo2.AttributeId = attributeId; text3 = "添加规格值失败"; int num2 = ProductTypeHelper.AddAttributeValue(attributeValueInfo2); if (num2 > 0) { text3 = num2.ToString(); text2 = "true"; } } } } base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write(string.Concat(new string[] { "{\"Status\":\"", text2, "\",\"msg\":\"", text3, "\"}" })); base.Response.End(); } } }
protected void Page_Load(object sender, EventArgs e) { bool flag = !string.IsNullOrEmpty(base.Request["isCallback"]) && base.Request["isCallback"] == "true"; this.btnFilish.Click += this.btnFilish_Click; int attributeValueId = default(int); if (flag && int.TryParse(base.Request["ValueId"], out attributeValueId)) { if (ProductTypeHelper.DeleteAttributeValue(attributeValueId)) { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"true\"}"); base.Response.End(); } else { base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"false\"}"); base.Response.End(); } } if (!string.IsNullOrEmpty(base.Request["isAjax"]) && base.Request["isAjax"] == "true") { string text = base.Request["Mode"].ToString(); string text2 = ""; string text3 = "false"; string a = text; int attributeId = default(int); if (!(a == "Add")) { if (a == "AddSkuItemValue") { text2 = "参数缺少"; if (int.TryParse(base.Request["AttributeId"], out attributeId)) { string text4 = ""; text2 = "规格值名不允许为空!"; if (!string.IsNullOrEmpty(base.Request["ValueName"].ToString())) { text4 = Globals.StripHtmlXmlTags(Globals.StripScriptTags(base.Request["ValueName"].ToString().Replace("+", "").Replace(",", ""))); text2 = "规格值名长度不允许超过15个字符"; if (text4.Length < 15) { AttributeValueInfo attributeValueInfo = new AttributeValueInfo(); attributeValueInfo.ValueStr = text4; attributeValueInfo.AttributeId = attributeId; int num = 0; text2 = "添加规格值失败"; num = ProductTypeHelper.AddAttributeValue(attributeValueInfo); if (num > 0) { text2 = num.ToString(); text3 = "true"; } } } } base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"" + text3 + "\",\"msg\":\"" + text2 + "\"}"); base.Response.End(); } } else { attributeId = 0; text2 = "参数缺少"; if (int.TryParse(base.Request["AttributeId"], out attributeId)) { string text5 = ""; text2 = "属性名称不允许为空!"; if (!string.IsNullOrEmpty(base.Request["ValueName"].ToString())) { text5 = Globals.HtmlEncode(base.Request["ValueName"].ToString()); AttributeValueInfo attributeValueInfo2 = new AttributeValueInfo(); attributeValueInfo2.ValueStr = text5; attributeValueInfo2.AttributeId = attributeId; int num2 = 0; text2 = "添加属性值失败"; num2 = ProductTypeHelper.AddAttributeValue(attributeValueInfo2); if (num2 > 0) { text2 = num2.ToString(); text3 = "true"; } } } base.Response.Clear(); base.Response.ContentType = "application/json"; base.Response.Write("{\"Status\":\"" + text3 + "\",\"msg\":\"" + text2 + "\"}"); base.Response.End(); } } }