Пример #1
0
    protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        M_UserInfo mu         = buser.GetLogin();
        M_Product  product    = new M_Product();
        M_Product  productPre = new M_Product();
        int        proID      = DataConverter.CLng(e.CommandArgument);

        switch (e.CommandName.ToLower())
        {
        case "upmove":
            product    = bll.GetproductByid(proID);
            productPre = bll.GetNearID(NodeID, product.OrderID, 1, mu.UserID);
            if (productPre.OrderID != 0)
            {
                int CurrOrder = product.OrderID;
                product.OrderID    = productPre.OrderID;
                productPre.OrderID = CurrOrder;
                bll.UpdateOrder(product);
                bll.UpdateOrder(productPre);
            }
            break;

        case "downmove":
            product    = bll.GetproductByid(proID);
            productPre = bll.GetNearID(NodeID, product.OrderID, 0, mu.UserID);
            if (productPre != null)
            {
                int CurrOrder = product.OrderID;
                product.OrderID    = productPre.OrderID;
                productPre.OrderID = CurrOrder;
                bll.UpdateOrder(product);
                bll.UpdateOrder(productPre);
            }
            break;

        case "del1":
            bll.DeleteByID(proID, bll.GetproductByid(proID));
            break;

        default:
            break;
        }
        MyBind();
    }
        protected void Egv_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            M_Product product    = new M_Product();
            M_Product productPre = new M_Product();

            switch (e.CommandName.ToLower())
            {
            case "upmove":
                product    = bll.GetproductByid(Convert.ToInt32(e.CommandArgument.ToString()));
                productPre = bll.GetNearID(NodeID, product.OrderID, 1);               //int NodeID, int CurrentID, int UporDown
                if (productPre.OrderID != 0)
                {
                    int CurrOrder = product.OrderID;
                    product.OrderID    = productPre.OrderID;
                    productPre.OrderID = CurrOrder;
                    bll.UpdateOrder(product);
                    bll.UpdateOrder(productPre);
                }
                break;

            case "downmove":
                product    = bll.GetproductByid(Convert.ToInt32(e.CommandArgument.ToString()));
                productPre = bll.GetNearID(NodeID, product.OrderID, 0);
                if (productPre.ID != 0)
                {
                    int CurrOrder = product.OrderID;
                    product.OrderID    = productPre.OrderID;
                    productPre.OrderID = CurrOrder;
                    bll.UpdateOrder(product);
                    bll.UpdateOrder(productPre);
                }
                break;

            case "del1":
                int  pid   = DataConverter.CLng(e.CommandArgument.ToString());
                bool delok = bll.DeleteByID(pid, bll.GetproductByid(pid));
                break;

            default:
                break;
            }
            MyBind();
        }