예제 #1
0
        private void grdAttributeValues_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex                = ((GridViewRow)((Control)e.CommandSource).NamingContainer).RowIndex;
            int attributeValueId        = (int)this.grdAttributeValues.DataKeys[rowIndex].Value;
            int displaySequence         = int.Parse((this.grdAttributeValues.Rows[rowIndex].FindControl("lblDisplaySequence") as Literal).Text, NumberStyles.None);
            int replaceAttributeValueId = 0;
            int replaceDisplaySequence  = 0;

            if (e.CommandName == "Fall")
            {
                if (rowIndex < (this.grdAttributeValues.Rows.Count - 1))
                {
                    replaceAttributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex + 1].Value;
                    replaceDisplaySequence  = int.Parse((this.grdAttributeValues.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as Literal).Text, NumberStyles.None);
                }
            }
            else if ((e.CommandName == "Rise") && (rowIndex > 0))
            {
                replaceAttributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex - 1].Value;
                replaceDisplaySequence  = int.Parse((this.grdAttributeValues.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as Literal).Text, NumberStyles.None);
            }
            if (replaceAttributeValueId > 0)
            {
                ProductTypeHelper.SwapAttributeValueSequence(attributeValueId, replaceAttributeValueId, displaySequence, replaceDisplaySequence);
                this.BindData();
            }
        }
예제 #2
0
        private void grdAttributeValues_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            int rowIndex         = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex;
            int attributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex].Value;
            int displaySequence  = int.Parse((this.grdAttributeValues.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
            int num = 0;
            int replaceDisplaySequence = 0;

            if (e.CommandName == "Fall")
            {
                if (rowIndex < this.grdAttributeValues.Rows.Count - 1)
                {
                    num = (int)this.grdAttributeValues.DataKeys[rowIndex + 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdAttributeValues.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            else
            {
                if (e.CommandName == "Rise" && rowIndex > 0)
                {
                    num = (int)this.grdAttributeValues.DataKeys[rowIndex - 1].Value;
                    replaceDisplaySequence = int.Parse((this.grdAttributeValues.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            if (num > 0)
            {
                ProductTypeHelper.SwapAttributeValueSequence(attributeValueId, num, displaySequence, replaceDisplaySequence);
                this.BindData();
            }
        }
예제 #3
0
        private void grdAttributeValues_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
        {
            int    rowIndex                = ((System.Web.UI.WebControls.GridViewRow)((System.Web.UI.Control)e.CommandSource).NamingContainer).RowIndex;
            int    attributeValueId        = (int)this.grdAttributeValues.DataKeys[rowIndex].Value;
            int    displaySequence         = int.Parse((this.grdAttributeValues.Rows[rowIndex].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
            string imageUrl                = e.CommandArgument.ToString();
            int    replaceAttributeValueId = 0;
            int    replaceDisplaySequence  = 0;

            if (e.CommandName == "Fall")
            {
                if (rowIndex < this.grdAttributeValues.Rows.Count - 1)
                {
                    replaceAttributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex + 1].Value;
                    replaceDisplaySequence  = int.Parse((this.grdAttributeValues.Rows[rowIndex + 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            else
            {
                if (e.CommandName == "Rise" && rowIndex > 0)
                {
                    replaceAttributeValueId = (int)this.grdAttributeValues.DataKeys[rowIndex - 1].Value;
                    replaceDisplaySequence  = int.Parse((this.grdAttributeValues.Rows[rowIndex - 1].FindControl("lblDisplaySequence") as System.Web.UI.WebControls.Literal).Text, System.Globalization.NumberStyles.None);
                }
            }
            if (e.CommandName == "dele")
            {
                if (ProductTypeHelper.DeleteAttributeValue(attributeValueId))
                {
                    StoreHelper.DeleteImage(imageUrl);
                }
                else
                {
                    this.ShowMsg("该规格下存在商品", false);
                }
            }
            if (replaceAttributeValueId > 0)
            {
                ProductTypeHelper.SwapAttributeValueSequence(attributeValueId, replaceAttributeValueId, displaySequence, replaceDisplaySequence);
            }
            this.BindData();
        }
        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;
            AttributeValueInfo attributeValueInfo = ProductTypeHelper.GetAttributeValueInfo(value2);
            int                num2               = attributeValueInfo.DisplaySequence;

            if (parameter == "Fall")
            {
                if (num2 == num)
                {
                    num++;
                }
            }
            else if (num2 == num)
            {
                num2++;
            }
            ProductTypeHelper.SwapAttributeValueSequence(value, value2, num, num2);
            base.ReturnSuccessResult(context, "", 0, true);
        }