/// <summary>
 /// 删除企业的功能模块
 /// </summary>
 /// <param name="Model"></param>
 /// <returns></returns>
 public static int DelCompanyModule(CompanyModuleModel Model)
 {
     string sql = "Delete from pubdba.CompanyModule where CompanyCD=@CompanyCD and ModuleID=@ModuleID";
     SqlParameter[] parms = new SqlParameter[2];
     parms[0] = SqlHelper.GetParameter("@CompanyCD", Model.CompanyCD);
     parms[1] = SqlHelper.GetParameter("@ModuleID", Model.ModuleID);
     return SqlHelper.ExecuteTransSql(sql, parms);
 }
Esempio n. 2
0
 /// <summary>
 /// 删除企业的功能模块
 /// </summary>
 public static int DelCompanyModule(CompanyModuleModel Model)
 {
     if (Model == null) return 0;
     try
     {
         return CompanyModuleDBHelper.DelCompanyModule(Model);
     }
     catch (System.Exception ex)
     {
         throw ex;
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        string CompanyCD = Request.QueryString["CompanyCD"];
        if (CompanyCD != "")
        {
            CompanyModuleModel Model = new CompanyModuleModel();
            Model.CompanyCD = CompanyCD;
            //获取所有功能模块信息
            DataTable DataTable = CompanyModBus.GetSysModuleInfo();            
            //生成tree
            string ScriptShow = "<script type=\"text/javascript\">";
            ScriptShow += "var rows = new Object;";
            ScriptShow += "var rowsPidIndex = new Object;";
            ScriptShow += "rows={";
            ArrayList rowsPidIndex = new ArrayList();
            //显示所有功能模块信息            
            for (int i = 0; i < DataTable.Rows.Count; i++)
            {
                DataRow row = DataTable.Rows[i];
                ScriptShow += "'" + row["ModuleID"].ToString() + "' : {'id':'" + row["ModuleID"].ToString() + "', 'pid':'" + row["ParentID"].ToString() + "', 'title':'" + row["ModuleName"].ToString() + "' }";
                if (i < DataTable.Rows.Count-1)
                {
                    ScriptShow += ",";
                }
                //父节点
                if (row["ModuleType"].ToString() == "S")
                {
                    rowsPidIndex.Add(row["ModuleID"].ToString());
                }
            }
            ScriptShow += "};";
            //初始化顶级目录
            ScriptShow += "rowsPidIndex[0] = new Array(";
            ScriptShow += getChildNode("0", DataTable);
            ScriptShow += ") ; ";
            //初始化父节点
            for (int i = 0; i < rowsPidIndex.Count;i++ )
            {
                ScriptShow += "rowsPidIndex["+rowsPidIndex[i].ToString()+"] = new Array(";
                ScriptShow += getChildNode(rowsPidIndex[i].ToString(), DataTable);
                ScriptShow += ") ; ";                
            }
            ScriptShow += "</script>";
            LblScriptShow.Text = ScriptShow;

            //获取该企业的所有模块信息
            DataTable CompanyModuleInfo = CompanyModBus.GetCompanyModuleInfo(CompanyCD);
            //生成被选择项
            string checkBoxCheckedTemp = ",";
            for(int i=0;i<CompanyModuleInfo.Rows.Count;i++)
            {
                DataRow row = CompanyModuleInfo.Rows[i];
                checkBoxCheckedTemp += row["ModuleID"].ToString() + ",";
            }
            string checkBoxChecked = "";
            checkBoxChecked += "<input type='hidden' id='CompanyCD' name='CompanyCD' value='" + CompanyCD + "'>";
            checkBoxChecked += "<script>";
            checkBoxChecked += "var ctree = new treeCheckBox( 'ctree'  , rows , rowsPidIndex ); ";
            checkBoxChecked += "ctree.iconPath='../../js/dtree/images/';";
            checkBoxChecked += "ctree.useCheckBox=true;";
            checkBoxChecked += "ctree.checkBoxName='menu[]';";
            checkBoxChecked += "ctree.checkBoxChecked='"+checkBoxCheckedTemp+"';";
            checkBoxChecked += "ctree.toString( Tc );";
            checkBoxChecked += "</script>";
            LblcheckBoxChecked.Text = checkBoxChecked;
        }

    }