Esempio n. 1
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            AttributeValueInfo attributeValueInfo = ProductTypeHelper.GetAttributeValueInfo(Convert.ToInt32(currentAttributeId.Value));

            if (ProductTypeHelper.GetAttribute(attributeValueInfo.AttributeId).UseAttributeImage)
            {
                if (!string.IsNullOrEmpty(txtValueDec1.Text))
                {
                    attributeValueInfo.ValueStr = Globals.HtmlEncode(txtValueDec1.Text);
                }
            }
            else if (!string.IsNullOrEmpty(txtValueStr1.Text))
            {
                attributeValueInfo.ValueStr = Globals.HtmlEncode(txtValueStr1.Text);
            }
            if (fileUpload1.HasFile)
            {
                try
                {
                    StoreHelper.DeleteImage(attributeValueInfo.ImageUrl);
                    attributeValueInfo.ImageUrl = ProductTypeHelper.UploadSKUImage(fileUpload1.PostedFile);
                }
                catch
                {
                }
            }
            if (ProductTypeHelper.UpdateSku(attributeValueInfo))
            {
                txtValueStr1.Text = string.Empty;
                txtValueDec1.Text = string.Empty;
                base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
        }
Esempio n. 2
0
        private void DoCallback()
        {
            base.Response.Clear();
            base.Response.ContentType = "text/xml";
            string a = base.Request.QueryString["action"];

            if (a == "getAttributes")
            {
                System.Collections.Generic.IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(int.Parse(base.Request.QueryString["typeId"]));
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                stringBuilder.Append("<xml><attributes>");
                foreach (AttributeInfo current in attributes)
                {
                    stringBuilder.Append("<item attributeId=\"").Append(current.AttributeId.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" attributeName=\"").Append(current.AttributeName).Append("\" typeId=\"").Append(current.TypeId.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
                }
                stringBuilder.Append("</attributes></xml>");
                base.Response.Write(stringBuilder.ToString());
            }
            if (a == "getValues")
            {
                AttributeInfo             attribute      = ProductTypeHelper.GetAttribute(int.Parse(base.Request.QueryString["attributeId"]));
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                stringBuilder2.Append("<xml><values>");
                if (attribute != null && attribute.AttributeValues.Count > 0)
                {
                    foreach (AttributeValueInfo current2 in attribute.AttributeValues)
                    {
                        stringBuilder2.Append("<item valueId=\"").Append(current2.ValueId.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" valueStr=\"").Append(current2.ValueStr).Append("\" attributeId=\"").Append(current2.AttributeId.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
                    }
                }
                stringBuilder2.Append("</values></xml>");
                base.Response.Write(stringBuilder2.ToString());
            }
            base.Response.End();
        }
Esempio n. 3
0
        private void BindData()
        {
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(attributeId);

            grdAttributeValues.DataSource = attribute.AttributeValues;
            grdAttributeValues.DataBind();
        }
Esempio n. 4
0
        private void grdAttribute_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 attributeId            = (int)this.grdAttribute.DataKeys[rowIndex].Value;
            int displaySequence        = int.Parse((this.grdAttribute.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
            int num                    = 0;
            int replaceDisplaySequence = 0;

            if (e.CommandName == "saveAttributeName")
            {
                System.Web.UI.WebControls.TextBox textBox = this.grdAttribute.Rows[rowIndex].FindControl("txtAttributeName") as System.Web.UI.WebControls.TextBox;
                AttributeInfo attribute     = ProductTypeHelper.GetAttribute(attributeId);
                string        attributeName = Globals.StripHtmlXmlTags(Globals.StripScriptTags(textBox.Text).Replace("\\", ""));
                if (string.IsNullOrEmpty(textBox.Text.Trim()) || textBox.Text.Trim().Length > 15)
                {
                    string str = string.Format("ShowMsg(\"{0}\", {1});", "属性名称限制在1-15个字符以内,不允许包含html字符和\\,系统会自动过滤", "false");
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "ServerMessageScript2", "<script language='JavaScript' defer='defer'>setTimeout(function(){" + str + "},300);</script>");
                    return;
                }
                attribute.AttributeName = attributeName;
                ProductTypeHelper.UpdateAttributeName(attribute);
                base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
            }
            if (e.CommandName == "SetYesOrNo")
            {
                AttributeInfo attribute2 = ProductTypeHelper.GetAttribute(attributeId);
                if (attribute2.IsMultiView)
                {
                    attribute2.UsageMode = AttributeUseageMode.View;
                }
                else
                {
                    attribute2.UsageMode = AttributeUseageMode.MultiView;
                }
                ProductTypeHelper.UpdateAttributeName(attribute2);
                base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
            }
            if (e.CommandName == "Fall")
            {
                if (rowIndex < this.grdAttribute.Rows.Count - 1)
                {
                    num = (int)this.grdAttribute.DataKeys[rowIndex + 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdAttribute.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            else
            {
                if (e.CommandName == "Rise" && rowIndex > 0)
                {
                    num = (int)this.grdAttribute.DataKeys[rowIndex - 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdAttribute.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            if (num > 0)
            {
                ProductTypeHelper.SwapAttributeSequence(attributeId, num, displaySequence, replaceDisplaySequence);
                this.BindAttribute();
            }
        }
        private void grdAttribute_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex               = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex;
            int attributeId            = (int)this.grdAttribute.DataKeys[rowIndex].Value;
            int displaySequence        = int.Parse((this.grdAttribute.Rows[rowIndex].FindControl("lblDisplaySequence") as Literal).Text, NumberStyles.None);
            int replaceAttributeId     = 0;
            int replaceDisplaySequence = 0;

            if (e.CommandName == "saveAttributeName")
            {
                TextBox       box       = this.grdAttribute.Rows[rowIndex].FindControl("txtAttributeName") as TextBox;
                AttributeInfo attribute = ProductTypeHelper.GetAttribute(attributeId);
                if (string.IsNullOrEmpty(box.Text.Trim()) || (box.Text.Trim().Length > 15))
                {
                    string str = string.Format("ShowMsg(\"{0}\", {1});", "属性名称限制在1-15个字符以内", "false");
                    this.Page.ClientScript.RegisterStartupScript(base.GetType(), "ServerMessageScript2", "<script language='JavaScript' defer='defer'>setTimeout(function(){" + str + "},300);</script>");
                    return;
                }
                attribute.AttributeName = Globals.HtmlEncode(box.Text);
                ProductTypeHelper.UpdateAttributeName(attribute);
                base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
            if (e.CommandName == "SetYesOrNo")
            {
                AttributeInfo info2 = ProductTypeHelper.GetAttribute(attributeId);
                if (info2.IsMultiView)
                {
                    info2.UsageMode = AttributeUseageMode.View;
                }
                else
                {
                    info2.UsageMode = AttributeUseageMode.MultiView;
                }
                ProductTypeHelper.UpdateAttributeName(info2);
                base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
            if (e.CommandName == "Fall")
            {
                if (rowIndex < (this.grdAttribute.Rows.Count - 1))
                {
                    replaceAttributeId     = (int)this.grdAttribute.DataKeys[rowIndex + 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdAttribute.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as Literal).Text, NumberStyles.None);
                }
            }
            else if ((e.CommandName == "Rise") && (rowIndex > 0))
            {
                replaceAttributeId     = (int)this.grdAttribute.DataKeys[rowIndex - 1].Value;
                replaceDisplaySequence = int.Parse((this.grdAttribute.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as Literal).Text, NumberStyles.None);
            }
            if (replaceAttributeId > 0)
            {
                ProductTypeHelper.SwapAttributeSequence(attributeId, replaceAttributeId, displaySequence, replaceDisplaySequence);
                this.BindAttribute();
            }
        }
        private DataGridViewModel <AttributeValueInfo> GetDataList(int attributeId)
        {
            DataGridViewModel <AttributeValueInfo> dataGridViewModel = new DataGridViewModel <AttributeValueInfo>();
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(attributeId);

            dataGridViewModel.rows  = attribute.AttributeValues.ToList();
            dataGridViewModel.total = dataGridViewModel.rows.Count;
            foreach (AttributeValueInfo row in dataGridViewModel.rows)
            {
            }
            return(dataGridViewModel);
        }
Esempio n. 7
0
        private void Delete(HttpContext context)
        {
            int           value     = base.GetIntParam(context, "ids", false).Value;
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(value);

            if (ProductTypeHelper.DeleteAttribute(value))
            {
                base.ReturnSuccessResult(context, "删除成功!", 0, true);
                return;
            }
            throw new HidistroAshxException("有商品在使用此规格,无法删除,不允许包含脚本标签和\\\\(反斜杠),系统会自动过滤");
        }
Esempio n. 8
0
        private void EditSku(HttpContext context)
        {
            int  value  = base.GetIntParam(context, "attributeId", false).Value;
            bool value2 = base.GetBoolParam(context, "UseAttributeImage", false).Value;
            int  value3 = base.GetIntParam(context, "typeId", false).Value;

            if (value < 1)
            {
                throw new HidistroAshxException("请选择要修改的规格,或刷新页面重试!");
            }
            int num = ProductTypeHelper.HasSetUseImg(value3);

            if (num > 0 && (num != value & value2))
            {
                throw new HidistroAshxException("已有其他规格可上传图片,最多只有一个规格允许上传商品规格图!");
            }
            string        parameter = base.GetParameter(context, "SkuName", false);
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(value);

            if (attribute == null)
            {
                throw new HidistroAshxException("规格不存在,请刷新页面重试!");
            }
            string text = Globals.StripHtmlXmlTags(Globals.StripScriptTags(parameter)).Replace("\\", "").Trim();

            if (string.IsNullOrEmpty(text) || text.Length > 30)
            {
                throw new HidistroAshxException("规格名称限制在1-30个字符以内,不允许包含脚本标签、HTML标签和\\\\(反斜杠),系统会自动过滤!");
            }
            IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(attribute.TypeId);

            foreach (AttributeInfo item in attributes)
            {
                if (item.AttributeName.Trim() == text && item.AttributeId != value)
                {
                    throw new HidistroAshxException("同一个类型中不能存相同的规格/属性名称!");
                }
            }
            attribute.AttributeName     = text;
            attribute.UsageMode         = AttributeUseageMode.Choose;
            attribute.UseAttributeImage = value2;
            if (ProductTypeHelper.UpdateAttributeName(attribute))
            {
                base.ReturnSuccessResult(context, "修改成功!", 0, true);
                return;
            }
            throw new HidistroAshxException(" 修改规格错误!");
        }
Esempio n. 9
0
        private void grdSKU_RowDeleting(object source, System.Web.UI.WebControls.GridViewDeleteEventArgs e)
        {
            int           num       = (int)this.grdSKU.DataKeys[e.RowIndex].Value;
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(num);

            if (ProductTypeHelper.DeleteAttribute(num))
            {
                foreach (AttributeValueInfo current in attribute.AttributeValues)
                {
                    StoreHelper.DeleteImage(current.ImageUrl);
                }
                base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
                return;
            }
            this.BindAttribute();
            string str = string.Format("ShowMsg(\"{0}\", {1});", "有商品在使用此规格,无法删除", "false");

            this.Page.ClientScript.RegisterStartupScript(base.GetType(), "ServerMessageScript2", "<script language='JavaScript' defer='defer'>setTimeout(function(){" + str + "},300);</script>");
        }
Esempio n. 10
0
        private void EditName(HttpContext context)
        {
            int value = base.GetIntParam(context, "id", false).Value;

            if (value < 1)
            {
                throw new HidistroAshxException("错误的参数!");
            }
            string parameter = base.GetParameter(context, "name", true);

            if (string.IsNullOrWhiteSpace(parameter))
            {
                throw new HidistroAshxException("错误的参数!");
            }
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(value);

            if (attribute == null)
            {
                throw new HidistroAshxException("错误的参数!");
            }
            parameter = Globals.StripHtmlXmlTags(Globals.StripScriptTags(parameter)).Replace("\\", "").Trim();
            if (string.IsNullOrEmpty(parameter) || parameter.Length > 30)
            {
                throw new HidistroAshxException("属性名称限制在1-15个字符以内,不允许包含html字符和\\\\(反斜杠),系统会自动过滤");
            }
            IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(attribute.TypeId);

            foreach (AttributeInfo item in attributes)
            {
                if (item.AttributeName.Trim() == parameter && item.AttributeId != value)
                {
                    throw new HidistroAshxException("同一个类型中不能存相同的规格/属性名称!");
                }
            }
            attribute.AttributeName = parameter;
            if (ProductTypeHelper.UpdateAttributeName(attribute))
            {
                base.ReturnSuccessResult(context, "修改成功!", 0, true);
                return;
            }
            throw new HidistroAshxException(" 操作失败!");
        }
Esempio n. 11
0
        /// <summary>
        /// 行删除
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void grdSKU_RowDeleting(object source, GridViewDeleteEventArgs e)
        {
            int           attributeId = (int)grdSKU.DataKeys[e.RowIndex].Value;
            AttributeInfo attribute   = ProductTypeHelper.GetAttribute(attributeId);

            if (ProductTypeHelper.DeleteAttribute(attributeId))
            {
                foreach (AttributeValueInfo info2 in attribute.AttributeValues)
                {
                    StoreHelper.DeleteImage(info2.ImageUrl);
                }
                base.Response.Redirect(HttpContext.Current.Request.Url.ToString(), true);
            }
            else
            {
                BindAttribute();
                string str = string.Format("ShowMsg(\"{0}\", {1});", "有商品在使用此规格,无法删除", "false");
                Page.ClientScript.RegisterStartupScript(base.GetType(), "ServerMessageScript2", "<script language='JavaScript' defer='defer'>setTimeout(function(){" + str + "},300);</script>");
            }
        }
Esempio n. 12
0
        private void DoCallback()
        {
            base.Response.Clear();
            base.Response.ContentType = "text/xml";
            string str = base.Request.QueryString["action"];

            if (str != null)
            {
                if (!(str == "getAttributes"))
                {
                    if (str == "getValues")
                    {
                        AttributeInfo attribute = ProductTypeHelper.GetAttribute(int.Parse(base.Request.QueryString["attributeId"]));
                        StringBuilder builder2  = new StringBuilder();
                        builder2.Append("<xml><values>");
                        if ((attribute != null) && (attribute.AttributeValues.Count > 0))
                        {
                            foreach (AttributeValueInfo info3 in attribute.AttributeValues)
                            {
                                builder2.Append("<item valueId=\"").Append(info3.ValueId.ToString(CultureInfo.InvariantCulture)).Append("\" valueStr=\"").Append(info3.ValueStr).Append("\" attributeId=\"").Append(info3.AttributeId.ToString(CultureInfo.InvariantCulture)).Append("\" />");
                            }
                        }
                        builder2.Append("</values></xml>");
                        base.Response.Write(builder2.ToString());
                    }
                }
                else
                {
                    IList <AttributeInfo> attributes = ProductTypeHelper.GetAttributes(int.Parse(base.Request.QueryString["typeId"]));
                    StringBuilder         builder    = new StringBuilder();
                    builder.Append("<xml><attributes>");
                    foreach (AttributeInfo info in attributes)
                    {
                        builder.Append("<item attributeId=\"").Append(info.AttributeId.ToString(CultureInfo.InvariantCulture)).Append("\" attributeName=\"").Append(info.AttributeName).Append("\" typeId=\"").Append(info.TypeId.ToString(CultureInfo.InvariantCulture)).Append("\" />");
                    }
                    builder.Append("</attributes></xml>");
                    base.Response.Write(builder.ToString());
                }
            }
            base.Response.End();
        }
Esempio n. 13
0
        private void IsMulti(HttpContext context)
        {
            int           value     = base.GetIntParam(context, "id", false).Value;
            int           value2    = base.GetIntParam(context, "typeid", false).Value;
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(value);

            if (attribute.IsMultiView)
            {
                attribute.UsageMode = AttributeUseageMode.View;
            }
            else
            {
                attribute.UsageMode = AttributeUseageMode.MultiView;
            }
            if (ProductTypeHelper.UpdateAttributeName(attribute))
            {
                base.ReturnSuccessResult(context, "操作成功", 0, true);
                return;
            }
            throw new HidistroAshxException("操作失败");
        }
Esempio n. 14
0
        private void SetOrder(HttpContext context)
        {
            string        parameter = base.GetParameter(context, "Type", false);
            int           num       = base.GetIntParam(context, "DisplaySequence", false).Value;
            int           value     = base.GetIntParam(context, "AttributeId", false).Value;
            int           value2    = base.GetIntParam(context, "replaceAttributeId", false).Value;
            AttributeInfo attribute = ProductTypeHelper.GetAttribute(value2);
            int           num2      = attribute.DisplaySequence;

            if (parameter == "Fall")
            {
                if (num2 == num)
                {
                    num++;
                }
            }
            else if (num2 == num)
            {
                num2++;
            }
            ProductTypeHelper.SwapAttributeSequence(value, value2, num, num2);
            base.ReturnSuccessResult(context, "", 0, true);
        }
        private void LoadProduct(ProductInfo product, Dictionary <int, IList <int> > attrs)
        {
            this.dropProductTypes.SelectedValue = product.TypeId;
            this.dropProductLines.SelectedValue = new int?(product.LineId);
            this.hdlineId.Value = product.LineId.ToString();
            this.dropBrandCategories.SelectedValue = product.BrandId;
            this.txtDisplaySequence.Text           = product.DisplaySequence.ToString();
            this.txtProductName.Text = Globals.HtmlDecode(product.ProductName);
            this.txtProductCode.Text = product.ProductCode;
            this.txtUnit.Text        = product.Unit;
            if (product.MarketPrice.HasValue)
            {
                this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2");
            }
            this.txtShortDescription.Text = product.ShortDescription;
            this.fckDescription.Text      = product.Description;
            this.txtTitle.Text            = product.Title;
            this.txtMetaDescription.Text  = product.MetaDescription;
            this.txtMetaKeywords.Text     = product.MetaKeywords;
            this.txtLowestSalePrice.Text  = product.LowestSalePrice.ToString("F2");
            this.chkPenetration.Checked   = product.PenetrationStatus == PenetrationStatus.Already;
            if (product.SaleStatus == ProductSaleStatus.OnSale)
            {
                this.radOnSales.Checked = true;
            }
            else if (product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.radUnSales.Checked = true;
            }
            else
            {
                this.radInStock.Checked = true;
            }
            this.uploader1.UploadedImageUrl = product.ImageUrl1;
            this.uploader2.UploadedImageUrl = product.ImageUrl2;
            this.uploader3.UploadedImageUrl = product.ImageUrl3;
            this.uploader4.UploadedImageUrl = product.ImageUrl4;
            this.uploader5.UploadedImageUrl = product.ImageUrl5;
            if ((attrs != null) && (attrs.Count > 0))
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("<xml><attributes>");
                foreach (int num in attrs.Keys)
                {
                    builder.Append("<item attributeId=\"").Append(num.ToString(CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(num).UsageMode).ToString()).Append("\" >");
                    foreach (int num2 in attrs[num])
                    {
                        builder.Append("<attValue valueId=\"").Append(num2.ToString(CultureInfo.InvariantCulture)).Append("\" />");
                    }
                    builder.Append("</item>");
                }
                builder.Append("</attributes></xml>");
                this.txtAttributes.Text = builder.ToString();
            }
            this.chkSkuEnabled.Checked = product.HasSKU;
            if (product.HasSKU)
            {
                StringBuilder builder2 = new StringBuilder();
                builder2.Append("<xml><productSkus>");
                foreach (string str in product.Skus.Keys)
                {
                    SKUItem item = product.Skus[str];
                    string  str2 = ("<item skuCode=\"" + item.SKU + "\" salePrice=\"" + item.SalePrice.ToString("F2") + "\" costPrice=\"" + ((item.CostPrice > 0M) ? item.CostPrice.ToString("F2") : "") + "\" purchasePrice=\"" + item.PurchasePrice.ToString("F2") + "\" qty=\"" + item.Stock.ToString(CultureInfo.InvariantCulture) + "\" alertQty=\"" + item.AlertStock.ToString(CultureInfo.InvariantCulture) + "\" weight=\"" + ((item.Weight > 0M) ? item.Weight.ToString("F2") : "") + "\">") + "<skuFields>";
                    foreach (int num3 in item.SkuItems.Keys)
                    {
                        string[] strArray2 = new string[] { "<sku attributeId=\"", num3.ToString(CultureInfo.InvariantCulture), "\" valueId=\"", item.SkuItems[num3].ToString(CultureInfo.InvariantCulture), "\" />" };
                        string   str3      = string.Concat(strArray2);
                        str2 = str2 + str3;
                    }
                    str2 = str2 + "</skuFields>";
                    if (item.MemberPrices.Count > 0)
                    {
                        str2 = str2 + "<memberPrices>";
                        foreach (int num4 in item.MemberPrices.Keys)
                        {
                            decimal num20 = item.MemberPrices[num4];
                            str2 = str2 + string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", num4.ToString(CultureInfo.InvariantCulture), num20.ToString("F2"));
                        }
                        str2 = str2 + "</memberPrices>";
                    }
                    if (item.DistributorPrices.Count > 0)
                    {
                        str2 = str2 + "<distributorPrices>";
                        foreach (int num5 in item.DistributorPrices.Keys)
                        {
                            decimal num21 = item.DistributorPrices[num5];
                            str2 = str2 + string.Format("<distributorGrande id=\"{0}\" price=\"{1}\" />", num5.ToString(CultureInfo.InvariantCulture), num21.ToString("F2"));
                        }
                        str2 = str2 + "</distributorPrices>";
                    }
                    str2 = str2 + "</item>";
                    builder2.Append(str2);
                }
                builder2.Append("</productSkus></xml>");
                this.txtSkus.Text = builder2.ToString();
            }
            SKUItem defaultSku = product.DefaultSku;

            this.txtSku.Text           = product.SKU;
            this.txtSalePrice.Text     = defaultSku.SalePrice.ToString("F2");
            this.txtCostPrice.Text     = (defaultSku.CostPrice > 0M) ? defaultSku.CostPrice.ToString("F2") : "";
            this.txtPurchasePrice.Text = defaultSku.PurchasePrice.ToString("F2");
            this.txtStock.Text         = defaultSku.Stock.ToString(CultureInfo.InvariantCulture);
            this.txtAlertStock.Text    = defaultSku.AlertStock.ToString(CultureInfo.InvariantCulture);
            this.txtWeight.Text        = (defaultSku.Weight > 0M) ? defaultSku.Weight.ToString("F2") : "";
            if (defaultSku.MemberPrices.Count > 0)
            {
                this.txtMemberPrices.Text = "<xml><gradePrices>";
                foreach (int num6 in defaultSku.MemberPrices.Keys)
                {
                    decimal num28 = defaultSku.MemberPrices[num6];
                    this.txtMemberPrices.Text = this.txtMemberPrices.Text + string.Format("<grande id=\"{0}\" price=\"{1}\" />", num6.ToString(CultureInfo.InvariantCulture), num28.ToString("F2"));
                }
                this.txtMemberPrices.Text = this.txtMemberPrices.Text + "</gradePrices></xml>";
            }
            if (defaultSku.DistributorPrices.Count > 0)
            {
                this.txtDistributorPrices.Text = "<xml><gradePrices>";
                foreach (int num7 in defaultSku.DistributorPrices.Keys)
                {
                    decimal num29 = defaultSku.DistributorPrices[num7];
                    this.txtDistributorPrices.Text = this.txtDistributorPrices.Text + string.Format("<grande id=\"{0}\" price=\"{1}\" />", num7.ToString(CultureInfo.InvariantCulture), num29.ToString("F2"));
                }
                this.txtDistributorPrices.Text = this.txtDistributorPrices.Text + "</gradePrices></xml>";
            }
        }
Esempio n. 16
0
		private void LoadProduct(ProductInfo product, System.Collections.Generic.Dictionary<int, System.Collections.Generic.IList<int>> attrs)
		{
			this.dropProductTypes.SelectedValue = product.TypeId;
			this.dropProductLines.SelectedValue = new int?(product.LineId);
			this.hdlineId.Value = product.LineId.ToString();
			this.dropBrandCategories.SelectedValue = product.BrandId;
			this.txtDisplaySequence.Text = product.DisplaySequence.ToString();
			this.txtProductName.Text = Globals.HtmlDecode(product.ProductName);
			this.txtProductCode.Text = product.ProductCode;
			this.txtUnit.Text = product.Unit;
			if (product.MarketPrice.HasValue)
			{
				this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2");
			}
			this.txtShortDescription.Text = product.ShortDescription;
            this.fckDescription.Text = product.Description;
			this.txtTitle.Text = product.Title;
			this.txtMetaDescription.Text = product.MetaDescription;
			this.txtMetaKeywords.Text = product.MetaKeywords;
			this.txtLowestSalePrice.Text = product.LowestSalePrice.ToString("F2");
			this.chkPenetration.Checked = (product.PenetrationStatus == PenetrationStatus.Already);
			if (product.SaleStatus == ProductSaleStatus.OnSale)
			{
				this.radOnSales.Checked = true;
			}
			else
			{
				if (product.SaleStatus == ProductSaleStatus.UnSale)
				{
					this.radUnSales.Checked = true;
				}
				else
				{
					this.radInStock.Checked = true;
				}
			}
			this.uploader1.UploadedImageUrl = product.ImageUrl1;
			this.uploader2.UploadedImageUrl = product.ImageUrl2;
			this.uploader3.UploadedImageUrl = product.ImageUrl3;
			this.uploader4.UploadedImageUrl = product.ImageUrl4;
			this.uploader5.UploadedImageUrl = product.ImageUrl5;
			if (attrs != null && attrs.Count > 0)
			{
				System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
				stringBuilder.Append("<xml><attributes>");
				foreach (int current in attrs.Keys)
				{
					stringBuilder.Append("<item attributeId=\"").Append(current.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(current).UsageMode).ToString()).Append("\" >");
					foreach (int current2 in attrs[current])
					{
						stringBuilder.Append("<attValue valueId=\"").Append(current2.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
					}
					stringBuilder.Append("</item>");
				}
				stringBuilder.Append("</attributes></xml>");
				this.txtAttributes.Text = stringBuilder.ToString();
			}
			this.chkSkuEnabled.Checked = product.HasSKU;
			if (product.HasSKU)
			{
				System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
				stringBuilder2.Append("<xml><productSkus>");
				foreach (string current3 in product.Skus.Keys)
				{
					SKUItem sKUItem = product.Skus[current3];
					string text = string.Concat(new string[]
					{
						"<item skuCode=\"",
						sKUItem.SKU,
						"\" salePrice=\"",
						sKUItem.SalePrice.ToString("F2"),
						"\" costPrice=\"",
						(sKUItem.CostPrice > 0m) ? sKUItem.CostPrice.ToString("F2") : "",
						"\" purchasePrice=\"",
						sKUItem.PurchasePrice.ToString("F2"),
						"\" qty=\"",
						sKUItem.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture),
						"\" alertQty=\"",
						sKUItem.AlertStock.ToString(System.Globalization.CultureInfo.InvariantCulture),
						"\" weight=\"",
						(sKUItem.Weight > 0m) ? sKUItem.Weight.ToString(System.Globalization.CultureInfo.InvariantCulture).Replace(".0000", ".00") : "",
						"\">"
					});
					text += "<skuFields>";
					foreach (int current4 in sKUItem.SkuItems.Keys)
					{
						string str = string.Concat(new string[]
						{
							"<sku attributeId=\"",
							current4.ToString(System.Globalization.CultureInfo.InvariantCulture),
							"\" valueId=\"",
							sKUItem.SkuItems[current4].ToString(System.Globalization.CultureInfo.InvariantCulture),
							"\" />"
						});
						text += str;
					}
					text += "</skuFields>";
					if (sKUItem.MemberPrices.Count > 0)
					{
						text += "<memberPrices>";
						foreach (int current5 in sKUItem.MemberPrices.Keys)
						{
							text += string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", current5.ToString(System.Globalization.CultureInfo.InvariantCulture), sKUItem.MemberPrices[current5].ToString("F2"));
						}
						text += "</memberPrices>";
					}
					if (sKUItem.DistributorPrices.Count > 0)
					{
						text += "<distributorPrices>";
						foreach (int current6 in sKUItem.DistributorPrices.Keys)
						{
							text += string.Format("<distributorGrande id=\"{0}\" price=\"{1}\" />", current6.ToString(System.Globalization.CultureInfo.InvariantCulture), sKUItem.DistributorPrices[current6].ToString("F2"));
						}
						text += "</distributorPrices>";
					}
					text += "</item>";
					stringBuilder2.Append(text);
				}
				stringBuilder2.Append("</productSkus></xml>");
				this.txtSkus.Text = stringBuilder2.ToString();
			}
			SKUItem defaultSku = product.DefaultSku;
			this.txtSku.Text = product.SKU;
			this.txtSalePrice.Text = defaultSku.SalePrice.ToString("F2");
			this.txtCostPrice.Text = ((defaultSku.CostPrice > 0m) ? defaultSku.CostPrice.ToString("F2") : "");
			this.txtPurchasePrice.Text = defaultSku.PurchasePrice.ToString("F2");
			this.txtStock.Text = defaultSku.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture);
			this.txtAlertStock.Text = defaultSku.AlertStock.ToString(System.Globalization.CultureInfo.InvariantCulture);
			this.txtWeight.Text = ((defaultSku.Weight > 0m) ? defaultSku.Weight.ToString(System.Globalization.CultureInfo.InvariantCulture).Replace(".0000", ".00") : "");
			if (defaultSku.MemberPrices.Count > 0)
			{
				this.txtMemberPrices.Text = "<xml><gradePrices>";
				foreach (int current7 in defaultSku.MemberPrices.Keys)
				{
					TrimTextBox expr_87B = this.txtMemberPrices;
					expr_87B.Text += string.Format("<grande id=\"{0}\" price=\"{1}\" />", current7.ToString(System.Globalization.CultureInfo.InvariantCulture), defaultSku.MemberPrices[current7].ToString("F2"));
				}
				TrimTextBox expr_8DC = this.txtMemberPrices;
				expr_8DC.Text += "</gradePrices></xml>";
			}
			if (defaultSku.DistributorPrices.Count > 0)
			{
				this.txtDistributorPrices.Text = "<xml><gradePrices>";
				foreach (int current8 in defaultSku.DistributorPrices.Keys)
				{
					TrimTextBox expr_938 = this.txtDistributorPrices;
					expr_938.Text += string.Format("<grande id=\"{0}\" price=\"{1}\" />", current8.ToString(System.Globalization.CultureInfo.InvariantCulture), defaultSku.DistributorPrices[current8].ToString("F2"));
				}
				TrimTextBox expr_999 = this.txtDistributorPrices;
				expr_999.Text += "</gradePrices></xml>";
			}
		}
Esempio n. 17
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. 18
0
        private string GetProductCSVForHishop(string imagePath, System.Collections.Generic.List <ExportToLocal.ProductDetail> list)
        {
            System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
            string format = "\r\n-1\t\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t\"{4}\"\t\"{5}\"\t\"{6}\"\t\"{7}\"\t\"{8}\"\t\"{9}\"\t\"{10}\"\t\"{11}\"\t\"{12}\"\t\"{13}\"\t\"{14}\"\t\"{15}\"\t\"{16}\"\t\"{17}\"\t{18}\t\"{19}\"\t\"{20}\"\t\"{21}\"\t\"{22}\"\t\"{23}\"\t\"{24}\"\t\"{25}\"\t\"{26}\"";

            stringBuilder.Append("\"id\"\t\"所属分类\"\t\"商品类型\"\t\"商品名称\"\t\"商家编码\"\t\"简单描述\"\t\"计量单位\"\t");
            stringBuilder.Append("\"详细描述\"\t\"详细页标题\"\t\"详细页描述\"\t\"详细页搜索关键字\"\t\"销售状态\"\t");
            stringBuilder.Append("\"图片\"\t\"图片2\"\t\"图片3\"\t\"图片4\"\t\"图片5\"\t");
            stringBuilder.Append("\"市场价\"\t\"品牌\"\t\"是否有规格\"\t");
            stringBuilder.Append("\"规格属性\"\t\"货号\"\t\"重量\"\t\"库存\"\t成本价\"\t\"一口价\"\t");
            stringBuilder.Append("\"商品属性\"\t\"商品标签\"");
            foreach (ExportToLocal.ProductDetail current in list)
            {
                string text = "{" + System.Guid.NewGuid().ToString() + "}.htm";
                string path = System.IO.Path.Combine(imagePath, text);
                using (System.IO.StreamWriter streamWriter = new System.IO.StreamWriter(path, false, System.Text.Encoding.GetEncoding("gb2312")))
                {
                    if (!string.IsNullOrEmpty(current.pi.Description))
                    {
                        string description = current.pi.Description;
                        streamWriter.Write(description);
                    }
                }
                string text2;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl1) && !current.pi.ImageUrl1.StartsWith("http://"))
                {
                    text2 = current.pi.ImageUrl1;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text2)))
                    {
                        System.IO.FileInfo fileInfo = new System.IO.FileInfo(base.Server.MapPath("~" + text2));
                        text2 = fileInfo.Name.ToLower();
                        fileInfo.CopyTo(System.IO.Path.Combine(imagePath, text2), true);
                    }
                }
                else
                {
                    text2 = "";
                }
                string text3;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl2) && !current.pi.ImageUrl2.StartsWith("http://"))
                {
                    text3 = current.pi.ImageUrl2;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text3)))
                    {
                        System.IO.FileInfo fileInfo2 = new System.IO.FileInfo(base.Server.MapPath("~" + text3));
                        text3 = fileInfo2.Name.ToLower();
                        fileInfo2.CopyTo(System.IO.Path.Combine(imagePath, text3), true);
                    }
                }
                else
                {
                    text3 = "";
                }
                string text4;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl3) && !current.pi.ImageUrl3.StartsWith("http://"))
                {
                    text4 = current.pi.ImageUrl3;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text4)))
                    {
                        System.IO.FileInfo fileInfo3 = new System.IO.FileInfo(base.Server.MapPath("~" + text4));
                        text4 = fileInfo3.Name.ToLower();
                        fileInfo3.CopyTo(System.IO.Path.Combine(imagePath, text4), true);
                    }
                }
                else
                {
                    text4 = "";
                }
                string text5;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl4) && !current.pi.ImageUrl4.StartsWith("http://"))
                {
                    text5 = current.pi.ImageUrl4;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text5)))
                    {
                        System.IO.FileInfo fileInfo4 = new System.IO.FileInfo(base.Server.MapPath("~" + text5));
                        text5 = fileInfo4.Name.ToLower();
                        fileInfo4.CopyTo(System.IO.Path.Combine(imagePath, text5), true);
                    }
                }
                else
                {
                    text5 = "";
                }
                string text6;
                if (!string.IsNullOrEmpty(current.pi.ImageUrl5) && !current.pi.ImageUrl5.StartsWith("http://"))
                {
                    text6 = current.pi.ImageUrl5;
                    if (System.IO.File.Exists(base.Server.MapPath("~" + text6)))
                    {
                        System.IO.FileInfo fileInfo5 = new System.IO.FileInfo(base.Server.MapPath("~" + text6));
                        text6 = fileInfo5.Name.ToLower();
                        fileInfo5.CopyTo(System.IO.Path.Combine(imagePath, text6), true);
                    }
                }
                else
                {
                    text6 = "";
                }
                string text7     = "";
                string text8     = "";
                string text9     = "";
                string text10    = "";
                string text11    = "";
                string text12    = "";
                string text13    = "";
                string text14    = "";
                string text15    = "";
                string arg_43B_0 = current.pi.SkuId;
                foreach (SKUItem current2 in current.pi.Skus.Values)
                {
                    text8  = text8 + current2.SKU + ";";
                    text9  = text9 + ((this.ConvertNull(current2.Weight) == "") ? "0" : this.ConvertNull(current2.Weight)) + ";";
                    text10 = text10 + current2.Stock + ";";
                    text11 = text11 + ((this.ConvertNull(current2.CostPrice) == "") ? "0" : this.ConvertNull(current2.CostPrice)) + ";";
                    text12 = text12 + current2.SalePrice + ";";
                }
                if (text11 == "")
                {
                    text11 = "0";
                }
                if (text10 == "")
                {
                    text10 = "0";
                }
                if (!this.chkExportImages.Checked)
                {
                    text3 = (text2 = (text4 = (text5 = (text6 = ""))));
                }
                if (current.pi.TypeId.HasValue)
                {
                    int arg_5C7_0 = current.pi.TypeId.Value;
                    foreach (System.Collections.Generic.KeyValuePair <int, System.Collections.Generic.IList <int> > current3 in current.attrs)
                    {
                        string attributeName = ProductTypeHelper.GetAttribute(current3.Key).AttributeName;
                        foreach (int current4 in current3.Value)
                        {
                            string valueStr = ProductTypeHelper.GetAttributeValueInfo(current4).ValueStr;
                            string text16   = text13;
                            text13 = string.Concat(new string[]
                            {
                                text16,
                                attributeName,
                                ":",
                                valueStr,
                                ","
                            });
                        }
                    }
                    System.Data.DataTable tags = CatalogHelper.GetTags();
                    foreach (int current5 in current.tagIds)
                    {
                        foreach (System.Data.DataRow dataRow in tags.Rows)
                        {
                            if (dataRow["TagId"].Equals(current5))
                            {
                                text14 = text14 + dataRow["TagName"] + ",";
                                break;
                            }
                        }
                    }
                }
                switch (current.pi.SaleStatus)
                {
                case ProductSaleStatus.OnSale:
                    text15 = "出售中";
                    break;

                case ProductSaleStatus.UnSale:
                    text15 = "下架区";
                    break;

                case ProductSaleStatus.OnStock:
                    text15 = "仓库中";
                    break;
                }
                bool hasSKU = current.pi.HasSKU;
                if (hasSKU)
                {
                    foreach (SKUItem current6 in current.pi.Skus.Values)
                    {
                        foreach (System.Collections.Generic.KeyValuePair <int, int> current7 in current6.SkuItems)
                        {
                            string attributeName2 = ProductTypeHelper.GetAttribute(current7.Key).AttributeName;
                            foreach (AttributeValueInfo current8 in ProductTypeHelper.GetAttribute(current7.Key).AttributeValues)
                            {
                                if (current8.ValueId.Equals(current7.Value))
                                {
                                    string valueStr2 = current8.ValueStr;
                                    text7 = text7 + attributeName2 + ":" + valueStr2;
                                    break;
                                }
                            }
                            text7 += ",";
                        }
                        text7 = text7.Trim(new char[]
                        {
                            ','
                        }) + ";";
                    }
                }
                string       obj      = "";
                CategoryInfo category = CatalogHelper.GetCategory(current.pi.CategoryId);
                if (category != null)
                {
                    obj = category.Name;
                }
                string obj2 = "";
                if (current.pi.TypeId.HasValue)
                {
                    obj2 = ProductTypeHelper.GetProductType(current.pi.TypeId.Value).TypeName;
                }
                string obj3 = "";
                if (current.pi.BrandId.HasValue)
                {
                    obj3 = CatalogHelper.GetBrandCategory(current.pi.BrandId.Value).BrandName;
                }
                stringBuilder.AppendFormat(format, new object[]
                {
                    this.ConvertNull(obj),
                    this.ConvertNull(obj2),
                    current.pi.ProductName,
                    this.ConvertNull(current.pi.ProductCode),
                    this.ConvertNull(current.pi.ShortDescription),
                    this.ConvertNull(current.pi.Unit),
                    text,
                    this.ConvertNull(current.pi.Title),
                    this.ConvertNull(current.pi.MetaDescription),
                    this.ConvertNull(current.pi.MetaKeywords),
                    text15,
                    text2,
                    text3,
                    text4,
                    text5,
                    text6,
                    this.ConvertNull(current.pi.MarketPrice),
                    this.ConvertNull(obj3),
                    hasSKU ? "1" : "0",
                    text7.Trim(new char[]
                    {
                        ';'
                    }),
                    text8.Trim(new char[]
                    {
                        ';'
                    }),
                    text9.Trim(new char[]
                    {
                        ';'
                    }),
                    text10.Trim(new char[]
                    {
                        ';'
                    }),
                    text11.Trim(new char[]
                    {
                        ';'
                    }),
                    text12.Trim(new char[]
                    {
                        ';'
                    }),
                    text13.Trim(new char[]
                    {
                        ','
                    }),
                    text14.Trim(new char[]
                    {
                        ','
                    })
                });
            }
            return(stringBuilder.ToString());
        }
Esempio n. 19
0
        private void LoadProduct(ProductInfo product, System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > attrs)
        {
            this.dropProductTypes.SelectedValue = product.TypeId;
            if (CustomConfigHelper.Instance.BrandShow)
            {
                if (!string.IsNullOrEmpty(product.BrandId))
                {
                    foreach (System.Web.UI.WebControls.ListItem item in this.BrandCategories.Items)
                    {
                        if (product.BrandId.Contains(item.Value))
                        {
                            item.Selected = true;
                        }
                    }
                }
            }
            else
            {
                int?firstBrandId = null;
                if (!string.IsNullOrEmpty(product.BrandId))
                {
                    firstBrandId = int.Parse(product.BrandId.Trim().Trim(',').Split(',')[0]);
                }
                this.dropBrandCategories.SelectedValue = firstBrandId;
            }

            this.txtDisplaySequence.Text = product.DisplaySequence.ToString();
            this.txtProductName.Text     = Globals.HtmlDecode(product.ProductName);
            this.txtProductCode.Text     = product.ProductCode;
            this.txtUnit.Text            = product.Unit;
            this.DDLRange.SelectedIndex  = product.Range;
            this.showCounts.Text         = product.ShowSaleCounts.ToString();
            if (product.MarketPrice.HasValue)
            {
                this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2");
            }
            this.txtShortDescription.Text = product.ShortDescription;
            this.fckDescription.Text      = product.Description;
            if (product.SaleStatus == ProductSaleStatus.OnSale)
            {
                this.radOnSales.Checked = true;
            }
            else
            {
                if (product.SaleStatus == ProductSaleStatus.UnSale)
                {
                    this.radUnSales.Checked = true;
                }
                else
                {
                    this.radInStock.Checked = true;
                }
            }
            this.ChkisfreeShipping.Checked = product.IsfreeShipping;

            string[]           imageUrl1          = new string[] { product.ImageUrl1, ",", product.ImageUrl2, ",", product.ImageUrl3, ",", product.ImageUrl4, ",", product.ImageUrl5 };
            string             str4               = string.Concat(imageUrl1);
            ProductFlashUpload productFlashUpload = this.ucFlashUpload1;
            string             str5               = str4.Replace(",,", ",").Replace(",,", ",");

            char[] chrArray = new char[] { ',' };
            productFlashUpload.Value = str5.Trim(chrArray);

            if (attrs != null && attrs.Count > 0)
            {
                System.Text.StringBuilder builder = new System.Text.StringBuilder();
                builder.Append("<xml><attributes>");
                foreach (int num in attrs.Keys)
                {
                    builder.Append("<item attributeId=\"").Append(num.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(num).UsageMode).ToString()).Append("\" >");
                    foreach (int num2 in attrs[num])
                    {
                        builder.Append("<attValue valueId=\"").Append(num2.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
                    }
                    builder.Append("</item>");
                }
                builder.Append("</attributes></xml>");
                this.txtAttributes.Text = builder.ToString();
            }
            this.chkSkuEnabled.Checked = product.HasSKU;
            if (product.HasSKU)
            {
                System.Text.StringBuilder builder2 = new System.Text.StringBuilder();
                builder2.Append("<xml><productSkus>");
                foreach (string str in product.Skus.Keys)
                {
                    SKUItem item = product.Skus[str];
                    string  str2 = string.Concat(new string[]
                    {
                        "<item skuCode=\"",
                        item.SKU,
                        "\" salePrice=\"",
                        item.SalePrice.ToString("F2"),
                        "\" costPrice=\"",
                        (item.CostPrice > 0m) ? item.CostPrice.ToString("F2") : "",
                        "\" qty=\"",
                        item.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture),
                        "\" weight=\"",
                        (item.Weight > 0m) ? item.Weight.ToString("F2") : "",
                        "\"><skuFields>"
                    });
                    foreach (int num3 in item.SkuItems.Keys)
                    {
                        string[] strArray2 = new string[]
                        {
                            "<sku attributeId=\"",
                            num3.ToString(System.Globalization.CultureInfo.InvariantCulture),
                            "\" valueId=\"",
                            item.SkuItems[num3].ToString(System.Globalization.CultureInfo.InvariantCulture),
                            "\" />"
                        };
                        string str3 = string.Concat(strArray2);
                        str2 += str3;
                    }
                    str2 += "</skuFields>";
                    if (item.MemberPrices.Count > 0)
                    {
                        str2 += "<memberPrices>";
                        foreach (int num4 in item.MemberPrices.Keys)
                        {
                            decimal num5 = item.MemberPrices[num4];
                            str2 += string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", num4.ToString(System.Globalization.CultureInfo.InvariantCulture), num5.ToString("F2"));
                        }
                        str2 += "</memberPrices>";
                    }
                    str2 += "</item>";
                    builder2.Append(str2);
                }
                builder2.Append("</productSkus></xml>");
                this.txtSkus.Text = builder2.ToString();
            }
            SKUItem defaultSku = product.DefaultSku;

            this.txtSku.Text       = product.SKU;
            this.txtSalePrice.Text = defaultSku.SalePrice.ToString("F2");
            this.txtCostPrice.Text = ((defaultSku.CostPrice > 0m) ? defaultSku.CostPrice.ToString("F2") : "");
            this.txtStock.Text     = defaultSku.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture);
            this.txtWeight.Text    = ((defaultSku.Weight > 0m) ? defaultSku.Weight.ToString("F2") : "");
            if (defaultSku.MemberPrices.Count > 0)
            {
                this.txtMemberPrices.Text = "<xml><gradePrices>";
                foreach (int num6 in defaultSku.MemberPrices.Keys)
                {
                    decimal num7 = defaultSku.MemberPrices[num6];
                    this.txtMemberPrices.Text = this.txtMemberPrices.Text + string.Format("<grande id=\"{0}\" price=\"{1}\" />", num6.ToString(System.Globalization.CultureInfo.InvariantCulture), num7.ToString("F2"));
                }
                this.txtMemberPrices.Text = this.txtMemberPrices.Text + "</gradePrices></xml>";
            }
        }
Esempio n. 20
0
        private void LoadProduct(ProductInfo product, System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > attrs)
        {
            this.dropProductTypes.SelectedValue    = product.TypeId;
            this.dropBrandCategories.SelectedValue = product.BrandId;
            bool isSetCommission = product.IsSetCommission;

            if (isSetCommission)
            {
                this.cbIsSetCommission.Checked   = false;
                this.txtFirstCommission.Enabled  = true;
                this.txtSecondCommission.Enabled = true;
                this.txtThirdCommission.Enabled  = true;
                this.txtFirstCommission.Text     = product.FirstCommission.ToString("F2");
                this.txtSecondCommission.Text    = product.SecondCommission.ToString("F2");
                this.txtThirdCommission.Text     = product.ThirdCommission.ToString("F2");
            }
            else
            {
                CategoryInfo category = CatalogHelper.GetCategory(this.categoryid);
                if (category != null)
                {
                    this.txtFirstCommission.Text  = category.FirstCommission;
                    this.txtSecondCommission.Text = category.SecondCommission;
                    this.txtThirdCommission.Text  = category.ThirdCommission;
                }
            }
            this.txtDisplaySequence.Text  = product.DisplaySequence.ToString();
            this.txtProductName.Text      = Globals.HtmlDecode(product.ProductName);
            this.txtProductShortName.Text = Globals.HtmlDecode(product.ProductShortName);
            this.txtProductCode.Text      = product.ProductCode;
            this.txtUnit.Text             = product.Unit;
            if (product.MarketPrice.HasValue)
            {
                this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2");
            }
            this.txtShortDescription.Text = product.ShortDescription;
            this.fckDescription.Text      = product.Description;
            if (product.SaleStatus == ProductSaleStatus.OnSale)
            {
                this.radOnSales.Checked = true;
            }
            else if (product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.radUnSales.Checked = true;
            }
            else
            {
                this.radInStock.Checked = true;
            }
            this.ChkisfreeShipping.Checked = product.IsfreeShipping;
            string text = string.Concat(new string[]
            {
                product.ImageUrl1,
                ",",
                product.ImageUrl2,
                ",",
                product.ImageUrl3,
                ",",
                product.ImageUrl4,
                ",",
                product.ImageUrl5
            });

            this.ucFlashUpload1.Value = text.Replace(",,", ",").Replace(",,", ",").Trim(new char[]
            {
                ','
            });
            if (attrs != null && attrs.Count > 0)
            {
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                stringBuilder.Append("<xml><attributes>");
                foreach (int current in attrs.Keys)
                {
                    stringBuilder.Append("<item attributeId=\"").Append(current.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(current).UsageMode).ToString()).Append("\" >");
                    foreach (int current2 in attrs[current])
                    {
                        stringBuilder.Append("<attValue valueId=\"").Append(current2.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
                    }
                    stringBuilder.Append("</item>");
                }
                stringBuilder.Append("</attributes></xml>");
                this.txtAttributes.Text = stringBuilder.ToString();
            }
            if (product.HasSKU && product.Skus.Keys.Count > 0)
            {
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                stringBuilder2.Append("<xml><productSkus>");
                foreach (string current3 in product.Skus.Keys)
                {
                    SKUItem sKUItem = product.Skus[current3];
                    string  text2   = string.Concat(new string[]
                    {
                        "<item skuCode=\"",
                        sKUItem.SKU,
                        "\" salePrice=\"",
                        sKUItem.SalePrice.ToString("F2"),
                        "\" costPrice=\"",
                        (sKUItem.CostPrice > 0m) ? sKUItem.CostPrice.ToString("F2") : "",
                        "\" qty=\"",
                        sKUItem.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture),
                        "\" weight=\"",
                        (sKUItem.Weight > 0m) ? sKUItem.Weight.ToString("F2") : "",
                        "\">"
                    });
                    text2 += "<skuFields>";
                    foreach (int current4 in sKUItem.SkuItems.Keys)
                    {
                        string str = string.Concat(new string[]
                        {
                            "<sku attributeId=\"",
                            current4.ToString(System.Globalization.CultureInfo.InvariantCulture),
                            "\" valueId=\"",
                            sKUItem.SkuItems[current4].ToString(System.Globalization.CultureInfo.InvariantCulture),
                            "\" />"
                        });
                        text2 += str;
                    }
                    text2 += "</skuFields>";
                    if (sKUItem.MemberPrices.Count > 0)
                    {
                        text2 += "<memberPrices>";
                        foreach (int current5 in sKUItem.MemberPrices.Keys)
                        {
                            text2 += string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", current5.ToString(System.Globalization.CultureInfo.InvariantCulture), sKUItem.MemberPrices[current5].ToString("F2"));
                        }
                        text2 += "</memberPrices>";
                    }
                    text2 += "</item>";
                    stringBuilder2.Append(text2);
                }
                stringBuilder2.Append("</productSkus></xml>");
                this.txtSkus.Text = stringBuilder2.ToString();
            }
            else
            {
                product.HasSKU = false;
            }
            SKUItem defaultSku = product.DefaultSku;

            this.txtSku.Text       = product.SKU;
            this.txtSalePrice.Text = defaultSku.SalePrice.ToString("F2");
            this.txtCostPrice.Text = ((defaultSku.CostPrice > 0m) ? defaultSku.CostPrice.ToString("F2") : "");
            this.txtStock.Text     = ProductHelper.GetProductSumStock(product.ProductId).ToString();
            this.txtWeight.Text    = ((defaultSku.Weight > 0m) ? defaultSku.Weight.ToString("F2") : "");
            if (defaultSku.MemberPrices.Count > 0)
            {
                this.txtMemberPrices.Text = "<xml><gradePrices>";
                foreach (int current6 in defaultSku.MemberPrices.Keys)
                {
                    TrimTextBox expr_7F8 = this.txtMemberPrices;
                    expr_7F8.Text += string.Format("<grande id=\"{0}\" price=\"{1}\" />", current6.ToString(System.Globalization.CultureInfo.InvariantCulture), defaultSku.MemberPrices[current6].ToString("F2"));
                }
                TrimTextBox expr_859 = this.txtMemberPrices;
                expr_859.Text += "</gradePrices></xml>";
            }
            this.chkSkuEnabled.Checked    = product.HasSKU;
            this.rbtIsSetTemplate.Checked = (product.FreightTemplateId > 0);
            this.txtShowSaleCounts.Text   = product.ShowSaleCounts.ToString();
            this.txtCubicMeter.Text       = product.CubicMeter.ToString("F2");
            this.txtFreightWeight.Text    = product.FreightWeight.ToString("F2");
            this.FreightTemplateDownList1.SelectedValue = product.FreightTemplateId;
        }
Esempio n. 21
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. 22
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.UpdateSku(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);
         }
     }
 }
Esempio n. 23
0
        private void LoadProduct(ProductInfo product, Dictionary <int, IList <int> > attrs)
        {
            this.dropProductTypes.SelectedValue    = product.TypeId;
            this.dropBrandCategories.SelectedValue = product.BrandId;
            if (product.IsSetCommission)
            {
                this.cbIsSetCommission.Checked   = false;
                this.txtFirstCommission.Enabled  = true;
                this.txtSecondCommission.Enabled = true;
                this.txtThirdCommission.Enabled  = true;
                this.txtFirstCommission.Text     = product.FirstCommission.ToString("F2");
                this.txtSecondCommission.Text    = product.SecondCommission.ToString("F2");
                this.txtThirdCommission.Text     = product.ThirdCommission.ToString("F2");
            }
            else
            {
                CategoryInfo category = CatalogHelper.GetCategory(this.categoryid);
                if (category != null)
                {
                    this.txtFirstCommission.Text  = category.FirstCommission;
                    this.txtSecondCommission.Text = category.SecondCommission;
                    this.txtThirdCommission.Text  = category.ThirdCommission;
                }
            }
            this.txtDisplaySequence.Text  = product.DisplaySequence.ToString();
            this.txtProductName.Text      = Globals.HtmlDecode(product.ProductName);
            this.txtProductShortName.Text = Globals.HtmlDecode(product.ProductShortName);
            this.txtProductCode.Text      = product.ProductCode;
            this.txtUnit.Text             = product.Unit;
            if (product.MarketPrice.HasValue)
            {
                this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2");
            }
            this.txtShortDescription.Text = product.ShortDescription;
            this.fckDescription.Text      = product.Description;
            if (product.SaleStatus == ProductSaleStatus.OnSale)
            {
                this.radOnSales.Checked = true;
            }
            else if (product.SaleStatus == ProductSaleStatus.UnSale)
            {
                this.radUnSales.Checked = true;
            }
            else
            {
                this.radInStock.Checked = true;
            }
            this.ChkisfreeShipping.Checked = product.IsfreeShipping;
            string str = product.ImageUrl1 + "," + product.ImageUrl2 + "," + product.ImageUrl3 + "," + product.ImageUrl4 + "," + product.ImageUrl5;

            this.ucFlashUpload1.Value = str.Replace(",,", ",").Replace(",,", ",").Trim(new char[] { ',' });
            if ((attrs != null) && (attrs.Count > 0))
            {
                StringBuilder builder = new StringBuilder();
                builder.Append("<xml><attributes>");
                foreach (int num in attrs.Keys)
                {
                    builder.Append("<item attributeId=\"").Append(num.ToString(CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(num).UsageMode).ToString()).Append("\" >");
                    foreach (int num2 in attrs[num])
                    {
                        builder.Append("<attValue valueId=\"").Append(num2.ToString(CultureInfo.InvariantCulture)).Append("\" />");
                    }
                    builder.Append("</item>");
                }
                builder.Append("</attributes></xml>");
                this.txtAttributes.Text = builder.ToString();
            }
            if (product.HasSKU && (product.Skus.Keys.Count > 0))
            {
                StringBuilder builder2 = new StringBuilder();
                builder2.Append("<xml><productSkus>");
                foreach (string str2 in product.Skus.Keys)
                {
                    SKUItem item = product.Skus[str2];
                    string  str3 = ("<item skuCode=\"" + item.SKU + "\" salePrice=\"" + item.SalePrice.ToString("F2") + "\" costPrice=\"" + ((item.CostPrice > 0M) ? item.CostPrice.ToString("F2") : "") + "\" qty=\"" + item.Stock.ToString(CultureInfo.InvariantCulture) + "\" weight=\"" + ((item.Weight > 0M) ? item.Weight.ToString("F2") : "") + "\">") + "<skuFields>";
                    foreach (int num3 in item.SkuItems.Keys)
                    {
                        string[] strArray3 = new string[] { "<sku attributeId=\"", num3.ToString(CultureInfo.InvariantCulture), "\" valueId=\"", item.SkuItems[num3].ToString(CultureInfo.InvariantCulture), "\" />" };
                        string   str4      = string.Concat(strArray3);
                        str3 = str3 + str4;
                    }
                    str3 = str3 + "</skuFields>";
                    if (item.MemberPrices.Count > 0)
                    {
                        str3 = str3 + "<memberPrices>";
                        foreach (int num4 in item.MemberPrices.Keys)
                        {
                            decimal num17 = item.MemberPrices[num4];
                            str3 = str3 + string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", num4.ToString(CultureInfo.InvariantCulture), num17.ToString("F2"));
                        }
                        str3 = str3 + "</memberPrices>";
                    }
                    str3 = str3 + "</item>";
                    builder2.Append(str3);
                }
                builder2.Append("</productSkus></xml>");
                this.txtSkus.Text = builder2.ToString();
            }
            else
            {
                product.HasSKU = false;
            }
            SKUItem defaultSku = product.DefaultSku;

            this.txtSku.Text       = product.SKU;
            this.txtSalePrice.Text = defaultSku.SalePrice.ToString("F2");
            this.txtCostPrice.Text = (defaultSku.CostPrice > 0M) ? defaultSku.CostPrice.ToString("F2") : "";
            this.txtStock.Text     = ProductHelper.GetProductSumStock(product.ProductId).ToString();
            this.txtWeight.Text    = (defaultSku.Weight > 0M) ? defaultSku.Weight.ToString("F2") : "";
            if (defaultSku.MemberPrices.Count > 0)
            {
                this.txtMemberPrices.Text = "<xml><gradePrices>";
                foreach (int num5 in defaultSku.MemberPrices.Keys)
                {
                    decimal num22 = defaultSku.MemberPrices[num5];
                    this.txtMemberPrices.Text = this.txtMemberPrices.Text + string.Format("<grande id=\"{0}\" price=\"{1}\" />", num5.ToString(CultureInfo.InvariantCulture), num22.ToString("F2"));
                }
                this.txtMemberPrices.Text = this.txtMemberPrices.Text + "</gradePrices></xml>";
            }
            this.chkSkuEnabled.Checked    = product.HasSKU;
            this.rbtIsSetTemplate.Checked = product.FreightTemplateId > 0;
            this.txtShowSaleCounts.Text   = product.ShowSaleCounts.ToString();
            this.txtCubicMeter.Text       = product.CubicMeter.ToString("F2");
            this.txtFreightWeight.Text    = product.FreightWeight.ToString("F2");
            this.FreightTemplateDownList1.SelectedValue = product.FreightTemplateId;
        }
Esempio n. 24
0
        private string GetProductCSVForHishop(string imagePath, List <ProductDetail> list, HttpContext context)
        {
            bool          value         = base.GetBoolParam(context, "ExportImages", true).Value;
            StringBuilder stringBuilder = new StringBuilder();
            string        text          = "\r\n-1\t\"{0}\"\t\"{1}\"\t\"{2}\"\t\"{3}\"\t\"{4}\"\t\"{5}\"\t\"{6}\"\t\"{7}\"\t\"{8}\"\t\"{9}\"\t\"{10}\"\t\"{11}\"\t\"{12}\"\t\"{13}\"\t\"{14}\"\t\"{15}\"\t\"{16}\"\t\"{17}\"\t{18}\t\"{19}\"\t\"{20}\"\t\"{21}\"\t\"{22}\"\t\"{23}\"\t\"{24}\"\t\"{25}\"\t\"{26}\"\t\"{27}\"\t\"{28}\"\t\"{29}\"\t\"{30}\"\t\"{31}\"\t\"{32}\"\t\"{33}\"";

            stringBuilder.Append("\"id\"\t\"所属分类\"\t\"商品类型\"\t\"商品名称\"\t\"商家编码\"\t\"简单描述\"\t\"计量单位\"\t");
            stringBuilder.Append("\"详细描述\"\t\"详细页标题\"\t\"详细页描述\"\t\"详细页搜索关键字\"\t\"销售状态\"\t");
            stringBuilder.Append("\"图片\"\t\"图片2\"\t\"图片3\"\t\"图片4\"\t\"图片5\"\t");
            stringBuilder.Append("\"市场价\"\t\"品牌\"\t\"是否有规格\"\t");
            stringBuilder.Append("\"规格属性\"\t\"货号\"\t\"重量\"\t\"库存\"\t成本价\"\t\"一口价\"\t");
            stringBuilder.Append("\"商品属性\"\t\"商品标签\"");
            stringBuilder.Append("\t\"商品种类\"");
            stringBuilder.Append("\t\"是否长期有效\"");
            stringBuilder.Append("\t\"有效期开始时间\"");
            stringBuilder.Append("\t\"有效期结束时间\"");
            stringBuilder.Append("\t\"是否支持退款\"");
            stringBuilder.Append("\t\"是否过期退款\"");
            stringBuilder.Append("\t\"是否生成多份\"");
            foreach (ProductDetail item in list)
            {
                string text2 = "{" + Guid.NewGuid().ToString() + "}.htm";
                string path  = Path.Combine(imagePath, text2);
                using (StreamWriter streamWriter = new StreamWriter(path, false, Encoding.GetEncoding("gb2312")))
                {
                    if (!string.IsNullOrEmpty(item.pi.Description))
                    {
                        string description = item.pi.Description;
                        streamWriter.Write(description);
                    }
                }
                string text3;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl1) && !item.pi.ImageUrl1.StartsWith("http://") && !item.pi.ImageUrl1.StartsWith("https://"))
                {
                    text3 = item.pi.ImageUrl1;
                    if (File.Exists(context.Server.MapPath("~" + text3)))
                    {
                        FileInfo fileInfo = new FileInfo(context.Server.MapPath("~" + text3));
                        text3 = fileInfo.Name.ToLower();
                        if (value)
                        {
                            fileInfo.CopyTo(Path.Combine(imagePath, text3), true);
                        }
                    }
                }
                else
                {
                    text3 = "";
                }
                string text4;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl2) && !item.pi.ImageUrl2.StartsWith("http://") && !item.pi.ImageUrl2.StartsWith("https://"))
                {
                    text4 = item.pi.ImageUrl2;
                    if (File.Exists(context.Server.MapPath("~" + text4)))
                    {
                        FileInfo fileInfo2 = new FileInfo(context.Server.MapPath("~" + text4));
                        text4 = fileInfo2.Name.ToLower();
                        if (value)
                        {
                            fileInfo2.CopyTo(Path.Combine(imagePath, text4), true);
                        }
                    }
                }
                else
                {
                    text4 = "";
                }
                string text5;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl3) && !item.pi.ImageUrl3.StartsWith("http://") && !item.pi.ImageUrl3.StartsWith("https://"))
                {
                    text5 = item.pi.ImageUrl3;
                    if (File.Exists(context.Server.MapPath("~" + text5)))
                    {
                        FileInfo fileInfo3 = new FileInfo(context.Server.MapPath("~" + text5));
                        text5 = fileInfo3.Name.ToLower();
                        if (value)
                        {
                            fileInfo3.CopyTo(Path.Combine(imagePath, text5), true);
                        }
                    }
                }
                else
                {
                    text5 = "";
                }
                string text6;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl4) && !item.pi.ImageUrl4.StartsWith("http://") && !item.pi.ImageUrl4.StartsWith("https://"))
                {
                    text6 = item.pi.ImageUrl4;
                    if (File.Exists(context.Server.MapPath("~" + text6)))
                    {
                        FileInfo fileInfo4 = new FileInfo(context.Server.MapPath("~" + text6));
                        text6 = fileInfo4.Name.ToLower();
                        if (value)
                        {
                            fileInfo4.CopyTo(Path.Combine(imagePath, text6), true);
                        }
                    }
                }
                else
                {
                    text6 = "";
                }
                string text7;
                if (!string.IsNullOrEmpty(item.pi.ImageUrl5) && !item.pi.ImageUrl5.StartsWith("http://") && !item.pi.ImageUrl5.StartsWith("https://"))
                {
                    text7 = item.pi.ImageUrl5;
                    if (File.Exists(context.Server.MapPath("~" + text7)))
                    {
                        FileInfo fileInfo5 = new FileInfo(context.Server.MapPath("~" + text7));
                        text7 = fileInfo5.Name.ToLower();
                        if (value)
                        {
                            fileInfo5.CopyTo(Path.Combine(imagePath, text7), true);
                        }
                    }
                }
                else
                {
                    text7 = "";
                }
                string text8  = "";
                string text9  = "";
                string text10 = "";
                string text11 = "";
                string text12 = "";
                string text13 = "";
                string text14 = "";
                string text15 = "";
                string text16 = "";
                string skuId  = item.pi.SkuId;
                foreach (SKUItem value4 in item.pi.Skus.Values)
                {
                    text9  = text9 + value4.SKU + ";";
                    text10 = text10 + ((this.ConvertNull(value4.Weight) == "") ? "0" : this.ConvertNull(value4.Weight)) + ";";
                    text11 = text11 + value4.Stock + ";";
                    text12 = text12 + ((this.ConvertNull(value4.CostPrice) == "") ? "0" : this.ConvertNull(value4.CostPrice)) + ";";
                    text13 = text13 + value4.SalePrice + ";";
                }
                if (text12 == "")
                {
                    text12 = "0";
                }
                if (text11 == "")
                {
                    text11 = "0";
                }
                if (!value)
                {
                    text3 = (text4 = (text5 = (text6 = (text7 = ""))));
                }
                int num;
                if (item.pi.TypeId.HasValue)
                {
                    int value2 = item.pi.TypeId.Value;
                    foreach (KeyValuePair <int, IList <int> > attr in item.attrs)
                    {
                        string attributeName = ProductTypeHelper.GetAttribute(attr.Key).AttributeName;
                        foreach (int item2 in attr.Value)
                        {
                            string valueStr = ProductTypeHelper.GetAttributeValueInfo(item2).ValueStr;
                            text14 = text14 + attributeName + ":" + valueStr + ",";
                        }
                    }
                    IList <TagInfo> tags = CatalogHelper.GetTags();
                    foreach (int tagId in item.tagIds)
                    {
                        foreach (TagInfo item3 in tags)
                        {
                            num = item3.TagID;
                            if (num.Equals(tagId))
                            {
                                text15 = text15 + item3.TagName + ",";
                                break;
                            }
                        }
                    }
                }
                switch (item.pi.SaleStatus)
                {
                case ProductSaleStatus.OnSale:
                    text16 = "出售中";
                    break;

                case ProductSaleStatus.UnSale:
                    text16 = "下架区";
                    break;

                case ProductSaleStatus.OnStock:
                    text16 = "仓库中";
                    break;
                }
                bool hasSKU = item.pi.HasSKU;
                if (hasSKU)
                {
                    foreach (SKUItem value5 in item.pi.Skus.Values)
                    {
                        foreach (KeyValuePair <int, int> skuItem in value5.SkuItems)
                        {
                            AttributeInfo attribute = ProductTypeHelper.GetAttribute(skuItem.Key);
                            if (attribute != null)
                            {
                                string attributeName2 = ProductTypeHelper.GetAttribute(skuItem.Key).AttributeName;
                                foreach (AttributeValueInfo attributeValue in ProductTypeHelper.GetAttribute(skuItem.Key).AttributeValues)
                                {
                                    num = attributeValue.ValueId;
                                    if (num.Equals(skuItem.Value))
                                    {
                                        string valueStr2 = attributeValue.ValueStr;
                                        text8 = text8 + attributeName2 + ":" + valueStr2;
                                        break;
                                    }
                                }
                            }
                            text8 += ",";
                        }
                        text8 = text8.Trim(',') + ";";
                    }
                }
                string       obj      = "";
                CategoryInfo category = CatalogHelper.GetCategory(item.pi.CategoryId);
                if (category != null)
                {
                    obj = category.Name;
                }
                string obj2 = "";
                if (item.pi.TypeId.HasValue)
                {
                    obj2 = ProductTypeHelper.GetProductType(item.pi.TypeId.Value).TypeName;
                }
                string obj3 = "";
                if (item.pi.BrandId.HasValue)
                {
                    BrandCategoryInfo brandCategory = CatalogHelper.GetBrandCategory(item.pi.BrandId.Value);
                    obj3 = ((brandCategory != null) ? brandCategory.BrandName : string.Empty);
                }
                StringBuilder stringBuilder2 = stringBuilder;
                string        format         = text;
                object[]      obj4           = new object[34]
                {
                    this.ConvertNull(obj),
                    this.ConvertNull(obj2),
                    item.pi.ProductName,
                    this.ConvertNull(item.pi.ProductCode),
                    this.ConvertNull(item.pi.ShortDescription),
                    this.ConvertNull(item.pi.Unit),
                    text2,
                    this.ConvertNull(item.pi.Title),
                    this.ConvertNull(item.pi.Meta_Description),
                    this.ConvertNull(item.pi.Meta_Keywords),
                    text16,
                    text3,
                    text4,
                    text5,
                    text6,
                    text7,
                    this.ConvertNull(item.pi.MarketPrice),
                    this.ConvertNull(obj3),
                    hasSKU ? "1" : "0",
                    text8.Trim(';'),
                    text9.Trim(';'),
                    text10.Trim(';'),
                    text11.Trim(';'),
                    text12.Trim(';'),
                    text13.Trim(';'),
                    text14.Trim(','),
                    text15.Trim(','),
                    (item.pi.ProductType == 0) ? "实物商品" : "服务类商品",
                    item.pi.IsValid ? "1" : "0",
                    null,
                    null,
                    null,
                    null,
                    null
                };
                object   obj5;
                DateTime value3;
                if (!item.pi.ValidStartDate.HasValue)
                {
                    obj5 = "";
                }
                else
                {
                    value3 = item.pi.ValidStartDate.Value;
                    obj5   = value3.ToString("yyyy-MM-dd HH:mm:ss");
                }
                obj4[29] = obj5;
                object obj6;
                if (!item.pi.ValidEndDate.HasValue)
                {
                    obj6 = "";
                }
                else
                {
                    value3 = item.pi.ValidEndDate.Value;
                    obj6   = value3.ToString("yyyy-MM-dd HH:mm:ss");
                }
                obj4[30] = obj6;
                obj4[31] = (item.pi.IsRefund ? "1" : "0");
                obj4[32] = (item.pi.IsOverRefund ? "1" : "0");
                obj4[33] = (item.pi.IsGenerateMore ? "1" : "0");
                stringBuilder2.AppendFormat(format, obj4);
            }
            return(stringBuilder.ToString());
        }
Esempio n. 25
0
        private void LoadProduct(ProductInfo product, System.Collections.Generic.Dictionary <int, System.Collections.Generic.IList <int> > attrs)
        {
            this.dropProductTypes.SelectedValue    = product.TypeId;
            this.dropTaxRate.SelectedValue         = product.TaxRateId;
            this.ddlSupplier.SelectedValue         = product.SupplierId;
            this.ddlShipping.SelectedValue         = product.TemplateId;
            this.dropBrandCategories.SelectedValue = product.BrandId;
            this.ddlImportSourceType.SelectedValue = product.ImportSourceId;
            this.txtDisplaySequence.Text           = product.DisplaySequence.ToString();
            this.txtProductName.Text    = Globals.HtmlDecode(product.ProductName);
            this.txtEnglishName.Text    = product.EnglishName;
            this.txtProductTitle.Text   = product.ProductTitle;
            this.txtsysProductName.Text = product.SysProductName;

            this.txtProductCode.Text        = product.ProductCode.Replace(product.CategoryId.ToString(), this.categoryId.ToString());
            this.txtAdminFraction.Text      = product.AdminFraction.ToString();
            this.txtFraction.Text           = product.Fraction.ToString();
            this.ddlUnit.SelectedValue      = product.UnitCode;
            this.txtManufacturer.Text       = product.Manufacturer;
            this.txtItemNo.Text             = product.ItemNo;
            this.txtBarCode.Text            = product.BarCode;
            this.txtConversionRelation.Text = product.ConversionRelation == 0 ? "1" : product.ConversionRelation.ToString();
            this.txtIngredient.Text         = product.Ingredient;
            this.Rd_Purchase.SelectedValue  = product.Purchase.ToString();
            this.txtSectionDay.Text         = product.SectionDay.ToString();
            this.txtMaxCount.Text           = product.PurchaseMaxNum.ToString();
            this.hid_Checked.Value          = product.Purchase.ToString();
            // 销售类型
            if (product.SaleType > 0)
            {
                this.dropSaleType.Text = product.SaleType.ToString();
            }

            this.dropSaleType.Enabled = false;

            if (!string.IsNullOrEmpty(product.ProductStandard))
            {
                this.txtProductStandard.Text = product.ProductStandard;
            }
            if (product.MarketPrice.HasValue)
            {
                this.txtMarketPrice.Text = product.MarketPrice.Value.ToString("F2");
            }
            if (product.ReferralDeduct.HasValue)
            {
                this.txtReferralDeduct.Text = product.ReferralDeduct.Value.ToString("F2");
            }
            if (product.SubMemberDeduct.HasValue)
            {
                this.txtSubMemberDeduct.Text = product.SubMemberDeduct.Value.ToString("F2");
            }
            if (product.SubReferralDeduct.HasValue)
            {
                this.txtSubReferralDeduct.Text = product.SubReferralDeduct.Value.ToString("F2");
            }
            this.txtShortDescription.Text      = product.ShortDescription;
            this.ChkisfreeShipping.Checked     = product.IsfreeShipping;
            this.ChkisCustomsClearance.Checked = product.IsCustomsClearance;
            this.ChkisPromotion.Checked        = product.IsPromotion;
            this.ChkisDisplayDiscount.Checked  = product.IsDisplayDiscount;

            this.fckDescription.Text        = product.Description;
            this.fckmobbileDescription.Text = product.MobblieDescription;
            this.txtTitle.Text           = product.Title;
            this.txtMetaDescription.Text = product.MetaDescription;
            this.txtMetaKeywords.Text    = product.MetaKeywords;
            this.txtBuyCardinality.Text  = product.BuyCardinality > 0 ? product.BuyCardinality.ToString() : "1";
            if (product.SaleStatus == ProductSaleStatus.OnSale)
            {
                this.radOnSales.Checked = true;
            }
            else
            {
                if (product.SaleStatus == ProductSaleStatus.UnSale)
                {
                    this.radUnSales.Checked = true;
                }
                else
                {
                    this.radInStock.Checked = true;
                }
            }
            this.uploader1.UploadedImageUrl = product.ImageUrl1;
            this.uploader2.UploadedImageUrl = product.ImageUrl2;
            this.uploader3.UploadedImageUrl = product.ImageUrl3;
            this.uploader4.UploadedImageUrl = product.ImageUrl4;
            this.uploader5.UploadedImageUrl = product.ImageUrl5;
            if (attrs != null && attrs.Count > 0)
            {
                System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
                stringBuilder.Append("<xml><attributes>");
                foreach (int current in attrs.Keys)
                {
                    stringBuilder.Append("<item attributeId=\"").Append(current.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" usageMode=\"").Append(((int)ProductTypeHelper.GetAttribute(current).UsageMode).ToString()).Append("\" >");
                    foreach (int current2 in attrs[current])
                    {
                        stringBuilder.Append("<attValue valueId=\"").Append(current2.ToString(System.Globalization.CultureInfo.InvariantCulture)).Append("\" />");
                    }
                    stringBuilder.Append("</item>");
                }
                stringBuilder.Append("</attributes></xml>");
                this.txtAttributes.Text = stringBuilder.ToString();
            }
            this.chkSkuEnabled.Checked = product.HasSKU;
            if (product.HasSKU)
            {
                System.Text.StringBuilder stringBuilder2 = new System.Text.StringBuilder();
                stringBuilder2.Append("<xml><productSkus>");
                DataTable dt = CreateTable();
                foreach (string current3 in product.Skus.Keys)
                {
                    SKUItem sKUItem = product.Skus[current3];
                    string  text    = string.Concat(new string[]
                    {
                        "<item skuCode=\"",
                        sKUItem.SKU,
                        "\" salePrice=\"",
                        sKUItem.SalePrice.ToString("F2"),
                        "\" costPrice=\"",
                        (sKUItem.CostPrice > 0m) ? sKUItem.CostPrice.ToString("F2") : "",
                        "\" qty=\"",
                        sKUItem.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture),
                        "\" factQty=\"",
                        sKUItem.FactStock.ToString(System.Globalization.CultureInfo.InvariantCulture),
                        "\" weight=\"",
                        (sKUItem.Weight > 0m) ? sKUItem.Weight.ToString("F2") : "",
                        "\" deductFee=\"",
                        (sKUItem.DeductFee > 0m) ? sKUItem.DeductFee.ToString("F2") : "",
                        "\" grossweight=\"",
                        (sKUItem.GrossWeight > 0m) ? sKUItem.GrossWeight.ToString("F2") : "",
                        "\">"
                    });
                    text += "<skuFields>";
                    //add by wangjun 2015年12月30日18:04:56 加备案编号隐藏记录
                    DataRow dr = dt.NewRow();
                    dr["SKU"] = sKUItem.SKU;
                    dr["ProductRegistrationNumber"] = sKUItem.ProductRegistrationNumber;
                    dr["LJNo"] = sKUItem.LJNo;
                    //添加WMS隐藏记录
                    dr["WMSStock"]    = sKUItem.WMSStock;
                    dr["GrossWeight"] = sKUItem.GrossWeight;
                    dr["Weight"]      = sKUItem.Weight;

                    dt.Rows.Add(dr);


                    foreach (int current4 in sKUItem.SkuItems.Keys)
                    {
                        string str = string.Concat(new string[]
                        {
                            "<sku attributeId=\"",
                            current4.ToString(System.Globalization.CultureInfo.InvariantCulture),
                            "\" valueId=\"",
                            sKUItem.SkuItems[current4].ToString(System.Globalization.CultureInfo.InvariantCulture),
                            "\" />"
                        });
                        text += str;
                    }
                    text += "</skuFields>";
                    if (sKUItem.MemberPrices.Count > 0)
                    {
                        text += "<memberPrices>";
                        foreach (int current5 in sKUItem.MemberPrices.Keys)
                        {
                            text += string.Format("<memberGrande id=\"{0}\" price=\"{1}\" />", current5.ToString(System.Globalization.CultureInfo.InvariantCulture), sKUItem.MemberPrices[current5].ToString("F2"));
                        }
                        text += "</memberPrices>";
                    }
                    text += "</item>";
                    stringBuilder2.Append(text);
                }
                ArrhidProductRegistrationNumber.Value = Newtonsoft.Json.JsonConvert.SerializeObject(dt);
                stringBuilder2.Append("</productSkus></xml>");
                this.txtSkus.Text = stringBuilder2.ToString();
            }
            SKUItem defaultSku = product.DefaultSku;

            this.txtSku.Text       = product.SKU;
            this.txtSalePrice.Text = ((defaultSku != null && defaultSku.SalePrice > 0m) ? defaultSku.SalePrice.ToString("F2") : "");
            this.txtCostPrice.Text = ((defaultSku != null && defaultSku.CostPrice > 0m) ? defaultSku.CostPrice.ToString("F2") : "");
            this.txtDeductFee.Text = ((defaultSku != null && defaultSku.DeductFee > 0m) ? defaultSku.DeductFee.ToString("F2") : "0");
            this.txtStock.Text     = defaultSku != null?defaultSku.Stock.ToString(System.Globalization.CultureInfo.InvariantCulture) : "";

            this.txtFactStock.Text = defaultSku != null?defaultSku.FactStock.ToString(System.Globalization.CultureInfo.InvariantCulture) : "";

            this.txtWeight.Text      = ((defaultSku != null && defaultSku.Weight > 0m) ? defaultSku.Weight.ToString("F2") : "");
            this.txtGrossWeight.Text = ((defaultSku != null && defaultSku.GrossWeight > 0m) ? defaultSku.GrossWeight.ToString("F2") : "");
            this.hidProductRegistrationNumber.Value = defaultSku.ProductRegistrationNumber;
            this.hidLJNo.Value = defaultSku.LJNo;
            if (defaultSku != null && defaultSku.MemberPrices.Count > 0)
            {
                this.txtMemberPrices.Text = "<xml><gradePrices>";
                foreach (int current6 in defaultSku.MemberPrices.Keys)
                {
                    TrimTextBox expr_78C = this.txtMemberPrices;
                    expr_78C.Text += string.Format("<grande id=\"{0}\" price=\"{1}\" />", current6.ToString(System.Globalization.CultureInfo.InvariantCulture), defaultSku.MemberPrices[current6].ToString("F2"));
                }
                TrimTextBox expr_7ED = this.txtMemberPrices;
                expr_7ED.Text += "</gradePrices></xml>";
            }
        }
Esempio n. 26
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();
                }
            }
        }