Example #1
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();
            }
        }
Example #3
0
        private void grdSKU_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 = System.Convert.ToInt32(this.grdSKU.DataKeys[rowIndex].Value);

            if (e.CommandName == "saveSKUName")
            {
                System.Web.UI.WebControls.TextBox box = this.grdSKU.Rows[rowIndex].Cells[2].FindControl("txtSKUName") as System.Web.UI.WebControls.TextBox;
                AttributeInfo attribute = new AttributeInfo
                {
                    AttributeId = attributeId
                };
                if (string.IsNullOrEmpty(box.Text.Trim()) || box.Text.Trim().Length > 30)
                {
                    string str = string.Format("ShowMsg(\"{0}\", {1});", "规格名称限制在1-30个字符以内", "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);
                attribute.UsageMode     = AttributeUseageMode.Choose;
                ProductTypeHelper.UpdateAttributeName(attribute);
                base.Response.Redirect(System.Web.HttpContext.Current.Request.Url.ToString(), true);
            }
            int displaySequence        = int.Parse((this.grdSKU.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
            int replaceAttributeId     = 0;
            int replaceDisplaySequence = 0;

            if (e.CommandName == "Fall")
            {
                if (rowIndex < this.grdSKU.Rows.Count - 1)
                {
                    replaceAttributeId     = (int)this.grdSKU.DataKeys[rowIndex + 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdSKU.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            else
            {
                if (e.CommandName == "Rise" && rowIndex > 0)
                {
                    replaceAttributeId     = (int)this.grdSKU.DataKeys[rowIndex - 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdSKU.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            if (replaceAttributeId > 0)
            {
                ProductTypeHelper.SwapAttributeSequence(attributeId, replaceAttributeId, displaySequence, replaceDisplaySequence);
            }
            this.BindAttribute();
        }
Example #4
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);
        }