private void btnUpdate_Click(object sender, EventArgs e)
 {
     if (((txtOldValue.Text.Trim().Length > 15) || (txtOldValue.Text.Trim().IndexOf(",") != -1)) || (txtOldValue.Text.Trim().Length == 0))
     {
         ShowMsg("属性值必须小于15个字符,不能为空,并且不能包含逗号", false);
     }
     else if (ProductTypeHelper.UpdateAttributeValue(attributeId, Convert.ToInt32(hidvalueId.Value), txtOldValue.Text.Trim().Replace("+", "")))
     {
         BindData();
         ShowMsg("修改成功", true);
     }
 }
Esempio n. 2
0
 private void btnUpdate_Click(object sender, EventArgs e)
 {
     if ((this.txtOldValue.Text.Trim().Length > 15) || (this.txtOldValue.Text.Trim().Length == 0))
     {
         this.ShowMsg("属性值必须小于15个字符,不能为空", false);
     }
     else if (ProductTypeHelper.UpdateAttributeValue(this.attributeId, Convert.ToInt32(this.hidvalueId.Value), this.txtOldValue.Text.Trim().Replace("+", "")))
     {
         this.BindData();
         this.ShowMsg("修改成功", true);
     }
 }
Esempio n. 3
0
 private void btnUpdate_Click(object sender, System.EventArgs e)
 {
     if (this.txtOldValue.Text.Trim().Length <= 15 && this.txtOldValue.Text.Trim().Length != 0)
     {
         if (ProductTypeHelper.UpdateAttributeValue(this.attributeId, System.Convert.ToInt32(this.hidvalueId.Value), this.txtOldValue.Text.Trim().Replace("+", "")))
         {
             this.BindData();
             this.ShowMsg("修改成功", true);
         }
         return;
     }
     this.ShowMsg("属性值必须小于15个字符,不能为空", false);
 }
Esempio n. 4
0
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            if (this.txtOldValue.Text.Trim().Length > 15 || this.txtOldValue.Text.Trim().Length == 0)
            {
                this.ShowMsg("属性值必须小于15个字符,不能为空", false);
                return;
            }
            AttributeValueInfo attributeValueInfo = ProductTypeHelper.GetAttributeValueInfo(System.Convert.ToInt32(this.hidvalueId.Value));

            attributeValueInfo.ValueStr = this.txtOldValue.Text.Trim().Replace("+", "");
            if (ProductTypeHelper.UpdateAttributeValue(attributeValueInfo))
            {
                this.BindData();
                this.ShowMsg("修改成功", true);
            }
        }
        private void EditValue(HttpContext context)
        {
            int    value     = base.GetIntParam(context, "valueId", false).Value;
            string parameter = base.GetParameter(context, "OldValue", false);
            string text      = Globals.StripHtmlXmlTags(Globals.StripScriptTags(parameter.Trim().Replace("+", "").Replace("\\", "")));

            if (text.Length > 15 || text.Length == 0)
            {
                throw new HidistroAshxException("属性值必须小于15个字符,不能为空,且不能包含脚本标签、HTML标签、XML标签以及\\+!");
            }
            AttributeValueInfo attributeValueInfo = ProductTypeHelper.GetAttributeValueInfo(value);

            attributeValueInfo.ValueStr = text;
            if (ProductTypeHelper.UpdateAttributeValue(attributeValueInfo))
            {
                base.ReturnSuccessResult(context, "修改成功!", 0, true);
            }
        }
Esempio n. 6
0
        private void btnUpdate_Click(object sender, System.EventArgs e)
        {
            string text = Globals.StripHtmlXmlTags(Globals.StripScriptTags(this.txtOldValue.Text.Trim().Replace("+", "").Replace("\\", "")));

            if (text.Length > 15 || text.Length == 0)
            {
                this.ShowMsg("属性值必须小于15个字符,不能为空,且不能包含脚本标签、HTML标签、XML标签以及\\+", false);
                return;
            }
            AttributeValueInfo attributeValueInfo = ProductTypeHelper.GetAttributeValueInfo(System.Convert.ToInt32(this.hidvalueId.Value));

            attributeValueInfo.ValueStr = text;
            if (ProductTypeHelper.UpdateAttributeValue(attributeValueInfo))
            {
                this.BindData();
                this.ShowMsg("修改成功", true);
            }
        }
Esempio n. 7
0
        protected void btnCreateValue_Click(object sender, EventArgs e)
        {
            AttributeValueInfo         attributeValue = new AttributeValueInfo();
            IList <AttributeValueInfo> list           = new List <AttributeValueInfo>();
            int num = int.Parse(this.currentAttributeId.Value);

            attributeValue.AttributeId = num;
            if (this.Page.Request.QueryString["action"].ToString().Trim() == "add")
            {
                if (!string.IsNullOrEmpty(this.txtValueStr.Text.Trim()))
                {
                    string[] strArray = this.txtValueStr.Text.Trim().Split(new char[] { ',' });
                    for (int i = 0; i < strArray.Length; i++)
                    {
                        if (strArray[i].Trim().Length <= 100)
                        {
                            AttributeValueInfo item = new AttributeValueInfo();
                            if (strArray[i].Trim().Length > 50)
                            {
                                this.ShowMsgToTarget("属性值限制在50个字符以内", false, "parent");
                                return;
                            }
                            item.ValueStr    = Globals.HtmlEncode(strArray[i].Trim());
                            item.AttributeId = num;
                            list.Add(item);
                        }
                        else
                        {
                            this.ShowMsgToTarget("[" + strArray[i].Trim() + "]属性值超出了50个字符", false, "parent");
                            return;
                        }
                    }
                    foreach (AttributeValueInfo info3 in list)
                    {
                        ProductTypeHelper.AddAttributeValue(info3);
                    }
                    base.ClientScript.RegisterStartupScript(base.ClientScript.GetType(), "myscript", "<script>window.parent.closeModal(getParam('action'));</script>");
                    this.txtValueStr.Text = "";
                }
                if (this.fileUpload.HasFile)
                {
                    try
                    {
                        attributeValue.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
                        attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueDec.Text);
                    }
                    catch
                    {
                    }
                    if (ProductTypeHelper.AddAttributeValue(attributeValue) <= 0)
                    {
                    }
                }
            }
            else
            {
                this.valueId   = int.Parse(this.Page.Request.QueryString["valueId"]);
                attributeValue = ProductTypeHelper.GetAttributeValueInfo(this.valueId);
                if (ProductTypeHelper.GetAttribute(attributeValue.AttributeId).UseAttributeImage)
                {
                    if (!string.IsNullOrEmpty(this.txtValueDec.Text))
                    {
                        attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueDec.Text);
                    }
                }
                else if (!string.IsNullOrEmpty(this.txtValueStr.Text))
                {
                    attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueStr.Text);
                }
                if (this.fileUpload.HasFile)
                {
                    try
                    {
                        StoreHelper.DeleteImage(attributeValue.ImageUrl);
                        attributeValue.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
                    }
                    catch
                    {
                    }
                }
                ProductTypeHelper.UpdateAttributeValue(attributeValue);
                base.ClientScript.RegisterStartupScript(base.ClientScript.GetType(), "myscript", "<script>window.parent.closeModal(getParam('action'));</script>");
            }
        }
Esempio n. 8
0
        protected void btnCreateValue_Click(object sender, EventArgs e)
        {
            AttributeValueInfo         attributeValue = new AttributeValueInfo();
            IList <AttributeValueInfo> list           = new List <AttributeValueInfo>();
            int num = int.Parse(this.currentAttributeId.Value);

            attributeValue.AttributeId = num;
            string a = this.Page.Request.QueryString["action"].ToString().Trim();

            if (a == "add")
            {
                if (!string.IsNullOrEmpty(this.txtValueStr.Text.Trim()))
                {
                    string content = this.txtValueStr.Text.Trim();
                    content = Globals.StripHtmlXmlTags(Globals.StripScriptTags(content)).Replace(",", ",").Replace("\\", "")
                              .Replace("/", "");
                    string[] array = content.Split(',');
                    for (int i = 0; i < array.Length && array[i].Trim().Length <= 100; i++)
                    {
                        AttributeValueInfo attributeValueInfo = new AttributeValueInfo();
                        if (array[i].Trim().Length > 50)
                        {
                            this.ShowMsg("属性值限制在50个字符以内", false);
                            return;
                        }
                        attributeValueInfo.ValueStr    = Globals.HtmlEncode(array[i].Trim());
                        attributeValueInfo.AttributeId = num;
                        list.Add(attributeValueInfo);
                    }
                    foreach (AttributeValueInfo item in list)
                    {
                        IList <AttributeValueInfo> attributeValues = ProductTypeHelper.GetAttribute(item.AttributeId).AttributeValues;
                        if ((from c in attributeValues
                             where c.ValueStr == item.ValueStr
                             select c).Count() > 0)
                        {
                            this.ShowMsg("规格值不能重复", false);
                            return;
                        }
                        ProductTypeHelper.AddAttributeValue(item);
                    }
                    base.CloseWindow(null);
                }
            }
            else
            {
                this.valueId   = int.Parse(this.Page.Request.QueryString["valueId"]);
                attributeValue = ProductTypeHelper.GetAttributeValueInfo(this.valueId);
                AttributeInfo attribute = ProductTypeHelper.GetAttribute(attributeValue.AttributeId);
                if (!string.IsNullOrEmpty(this.txtValueStr.Text))
                {
                    attributeValue.ValueStr = Globals.StripHtmlXmlTags(Globals.StripScriptTags(this.txtValueStr.Text)).Replace(",", ",").Replace("\\", "")
                                              .Replace("/", "");
                }
                IList <AttributeValueInfo> attributeValues2 = ProductTypeHelper.GetAttribute(attributeValue.AttributeId).AttributeValues;
                if ((from c in attributeValues2
                     where c.ValueId != attributeValue.ValueId && c.ValueStr == attributeValue.ValueStr
                     select c).Count() > 0)
                {
                    this.ShowMsg("规格值不能重复", false);
                }
                else if (ProductTypeHelper.UpdateAttributeValue(attributeValue))
                {
                    base.CloseWindow(null);
                }
            }
        }
Esempio n. 9
0
        protected void btnCreateValue_Click(object sender, System.EventArgs e)
        {
            AttributeValueInfo attributeValueInfo = new AttributeValueInfo();

            System.Collections.Generic.IList <AttributeValueInfo> list = new System.Collections.Generic.List <AttributeValueInfo>();
            int num = int.Parse(this.currentAttributeId.Value);

            attributeValueInfo.AttributeId = num;
            string a = this.Page.Request.QueryString["action"].ToString().Trim();

            if (a == "add")
            {
                if (!string.IsNullOrEmpty(this.txtValueStr.Text.Trim()))
                {
                    string text = this.txtValueStr.Text.Trim();
                    text = Globals.StripHtmlXmlTags(Globals.StripScriptTags(text)).Replace(",", ",").Replace("\\", "").Replace("/", "");
                    string[] array = text.Split(new char[]
                    {
                        ','
                    });
                    int num2 = 0;
                    while (num2 < array.Length && array[num2].Trim().Length <= 100)
                    {
                        AttributeValueInfo attributeValueInfo2 = new AttributeValueInfo();
                        if (array[num2].Trim().Length > 15)
                        {
                            this.ShowMsg("属性值限制在15个字符以内", false);
                            return;
                        }
                        attributeValueInfo2.ValueStr    = Globals.HtmlEncode(array[num2].Trim());
                        attributeValueInfo2.AttributeId = num;
                        list.Add(attributeValueInfo2);
                        num2++;
                    }
                    foreach (AttributeValueInfo current in list)
                    {
                        ProductTypeHelper.AddAttributeValue(current);
                    }
                    this.CloseWindow();
                }
                if (!this.fileUpload.HasFile)
                {
                    this.ShowMsg("属性值限制在15个字符以内", false);
                    return;
                }
                try
                {
                    attributeValueInfo.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
                    attributeValueInfo.ValueStr = Globals.HtmlEncode(this.txtValueDec.Text);
                }
                catch
                {
                }
                if (ProductTypeHelper.AddAttributeValue(attributeValueInfo) > 0)
                {
                    this.CloseWindow();
                    return;
                }
            }
            else
            {
                this.valueId       = int.Parse(this.Page.Request.QueryString["valueId"]);
                attributeValueInfo = ProductTypeHelper.GetAttributeValueInfo(this.valueId);
                AttributeInfo attribute = ProductTypeHelper.GetAttribute(attributeValueInfo.AttributeId);
                if (attribute.UseAttributeImage)
                {
                    if (!string.IsNullOrEmpty(this.txtValueDec.Text))
                    {
                        attributeValueInfo.ValueStr = Globals.StripHtmlXmlTags(Globals.StripScriptTags(this.txtValueDec.Text)).Replace(",", ",").Replace("\\", "").Replace("/", "");
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(this.txtValueStr.Text))
                    {
                        attributeValueInfo.ValueStr = Globals.StripHtmlXmlTags(Globals.StripScriptTags(this.txtValueStr.Text)).Replace(",", ",").Replace("\\", "").Replace("/", "");
                    }
                }
                if (this.fileUpload.HasFile)
                {
                    try
                    {
                        StoreHelper.DeleteImage(attributeValueInfo.ImageUrl);
                        attributeValueInfo.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
                    }
                    catch
                    {
                    }
                }
                if (ProductTypeHelper.UpdateAttributeValue(attributeValueInfo))
                {
                    this.CloseWindow();
                }
            }
        }
Esempio n. 10
0
        protected void btnCreateValue_Click(object sender, EventArgs e)
        {
            AttributeValueInfo         attributeValue = new AttributeValueInfo();
            IList <AttributeValueInfo> list           = new List <AttributeValueInfo>();
            int num = int.Parse(this.currentAttributeId.Value);

            attributeValue.AttributeId = num;
            if (!(this.Page.Request.QueryString["action"].ToString().Trim() == "add"))
            {
                this.valueId   = int.Parse(this.Page.Request.QueryString["valueId"]);
                attributeValue = ProductTypeHelper.GetAttributeValueInfo(this.valueId);
                if (ProductTypeHelper.GetAttribute(attributeValue.AttributeId).UseAttributeImage)
                {
                    if (!string.IsNullOrEmpty(this.txtValueDec.Text))
                    {
                        attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueDec.Text);
                    }
                }
                else if (!string.IsNullOrEmpty(this.txtValueStr.Text))
                {
                    attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueStr.Text);
                }
                if (this.fileUpload.HasFile)
                {
                    try
                    {
                        StoreHelper.DeleteImage(attributeValue.ImageUrl);
                        attributeValue.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
                    }
                    catch
                    {
                    }
                }
                if (ProductTypeHelper.UpdateAttributeValue(attributeValue))
                {
                    this.CloseWindow();
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(this.txtValueStr.Text.Trim()))
                {
                    string[] strArray = this.txtValueStr.Text.Trim().Split(new char[] { ',' });
                    for (int i = 0; i < strArray.Length; i++)
                    {
                        if (strArray[i].Trim().Length > 100)
                        {
                            break;
                        }
                        AttributeValueInfo item = new AttributeValueInfo();
                        if (strArray[i].Trim().Length > 15)
                        {
                            this.ShowMsg("属性值限制在15个字符以内", false);
                            return;
                        }
                        item.ValueStr    = Globals.HtmlEncode(strArray[i].Trim());
                        item.AttributeId = num;
                        list.Add(item);
                    }
                    foreach (AttributeValueInfo info3 in list)
                    {
                        ProductTypeHelper.AddAttributeValue(info3);
                    }
                    this.CloseWindow();
                }
                if (this.fileUpload.HasFile)
                {
                    try
                    {
                        attributeValue.ImageUrl = ProductTypeHelper.UploadSKUImage(this.fileUpload.PostedFile);
                        attributeValue.ValueStr = Globals.HtmlEncode(this.txtValueDec.Text);
                    }
                    catch
                    {
                    }
                    if (ProductTypeHelper.AddAttributeValue(attributeValue) > 0)
                    {
                        this.CloseWindow();
                    }
                }
                else
                {
                    this.ShowMsg("属性值限制在15个字符以内", false);
                }
            }
        }