SoFunction
Updated on 2025-04-13

C# Unlimited Column Grading Program Code Sharing Good Things Page 2/3


C# unlimited column hierarchical program code sharing [3] Clear and sorting core code broadcast

using System;
using ;

namespace catalog
{
/// <summary>
///  A summary description of action.
/// </summary>
public class action:db
{
  private static bool[] ShowLine_={false,false,false,false,false,false,false,false,false,false};
  private static  ShowLine=new (ShowLine_);
  public action()
  {
  }

  public void deleteAllCatalog(string table)
  {
   string sql="delete from " + table;
   (sql);
  }

  public int downClass(string table,int classid)
  {
   string sql;
   sql="select * from " + table + " where classorderid"];
    rootid=(int)dr["rootid"];
    previd=(int)dr["previd"];
    nextid=(int)dr["nextid"];
    depth=(int)dr["depth"];
    parentid=(int)dr["parentid"];
    child=(int)dr["child"];
   }
   else
   {
    ();
    ();
return 1;//The column to be sorted down does not exist
   }
   ();
   ();

   if (nextid==0)
return 2;//There is no column below the column to be sorted and cannot be down
   if (nextid==0 && previd==0)
return 3;//There is only one of the columns to be sorted down, and it cannot be upgraded

   return upClass(table,nextid);
  }

#region Move the column upward
  public int upClass(string table,int classid)
  {
   string sql;
//First get the column information of the classid you want to upgrade
   sql="select * from " + table + " where classorderid"];
    rootid=(int)dr["rootid"];
    previd=(int)dr["previd"];
    nextid=(int)dr["nextid"];
    depth=(int)dr["depth"];
    parentid=(int)dr["parentid"];
    child=(int)dr["child"];
   }
   else
   {
    ();
    ();
return 1;//The column to be upgraded does not exist
   }
   ();
   ();

   if (previd==0)
return 2;//The column to be upgraded has no columns on it and cannot be promoted
   if (nextid==0 && previd==0)
return 3;//There is only one of the columns to improve the sorting level, and it cannot be upgraded

//Get the information of the above column
   sql="select * from " + table + " where classorderid"];
    rootid_=(int)dr["rootid"];
    previd_=(int)dr["previd"];
    nextid_=(int)dr["nextid"];
    depth_=(int)dr["depth"];
    parentid_=(int)dr["parentid"];
    child_=(int)dr["child"];
   }
   else
   {
    ();
    ();
return 4;//The column above the column to be upgraded does not exist and is illegally deleted
   }
   ();
   ();

//Replace the original previd=classid with previd=previd
   sql="update "+ table + " set prev where prevupdate "+ table + " set next where nextupdate "+ table + " set next,prev where class0";
   children_="0";

   if (child>0)
   { 
    children=getChildren(table,classid);
    temp=('','');
    child_num=;
   }
   if (child_>0)
   {
    children_=getChildren(table,previd);
    temp=children_.Split('','');
    child_num_=;
   }

//Processing the previous column nextid->nextid,previd->classid
   sql="update "+ table + " set next,prev where classupdate " + table + " set orderid=orderid - "+ (child_num_+1) + " where classid in ("+ (classid + "," + children) +")";
   (sql);
   sql="update " + table + " set orderid=orderid + "+ (child_num+1) + " where classid in ("+ (previd + "," + children_) +")";
   (sql);

   return 0;
  }
  #endregion

View original text:/book/?id=1804
Previous page123Next pageRead the full text