コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string action = GetstringKey("action");

        int ID = GetIntKey("ID");

        Userinfo condition = new Userinfo();
        Userinfo v         = new Userinfo();

        if (ID == 0)
        {
            Response.Write("");
            return;
        }

        condition.ID = ID;
        Userinfo myView = TableOperate <Userinfo> .GetRowData(v, condition);

        if (myView.ID == 0)
        {
            Response.Write("");
            return;
        }

        Userinfo condition2 = new Userinfo();
        Userinfo V2         = new Userinfo();

        condition2.AddConditon(" and ID<>'" + condition.ID + "'");
        condition2.ExhibitionID = AdminMethod.ExhibitionID;
        string strOrder = string.Empty;

        condition2.OrderID = myView.OrderID;
        if (action == "up")
        {
            //向上,现在是时间越早越在上面
            condition2.AddAttach("OrderID", "<");
            strOrder = " order by OrderID  DESC"; //时间从大到小
        }
        else
        {
            condition2.AddAttach("OrderID", ">");
            strOrder = " order by OrderID ASC";
        }


        List <Userinfo> desOrderMdl = TableOperate <Userinfo> .Select(V2, condition2, 1, strOrder);

        if (desOrderMdl.Count != 1)
        {
            Response.Write("");
            return;
        }


        Userinfo conditionU = new Userinfo();

        conditionU.ID      = myView.ID;
        conditionU.OrderID = desOrderMdl[0].OrderID;
        TableOperate <Userinfo> .Update(conditionU);

        Userinfo conditionU2 = new Userinfo();

        conditionU2.ID      = desOrderMdl[0].ID;
        conditionU2.OrderID = myView.OrderID;
        TableOperate <Userinfo> .Update(conditionU2);

        Response.StatusCode = 200;
        Response.Write(conditionU2.ID);
    }