コード例 #1
0
ファイル: Test.cs プロジェクト: BGCX262/zxerp2013-svn-to-git
        private void button1_Click(object sender, EventArgs e)
        {
            ZX.Controls.TreeViewC TV = new ZX.Controls.TreeViewC();
            TV.SetTreeViewTag(this.treeView1);

            DataTable DT = TV.SaveToDataTable(this.treeView1, "FBH", "GNBH", "GNMC");
            DT.TableName = "SYS_FUNCTION";
            if (DT.Rows.Count > 0)
            {
                DataColumn DC1 = new DataColumn("WJMC");
                DC1.MaxLength = 100;
                DataColumn DC2 = new DataColumn("MMKJ");
                DC1.MaxLength = 200;
                DataColumn DC3 = new DataColumn("WJICO");
                DC1.MaxLength = 500;
                DataColumn DC4 = new DataColumn("HELPPATH");
                DC1.MaxLength = 200;
                DT.Columns.AddRange(new DataColumn[] { DC1, DC2, DC3, DC4 });
                for (int i = 0; i < DT.Rows.Count; i++)
                {
                    //文本字串格式
                    //功能菜单名称$功能程序集文件名$功能命名空间加类名$功能图标$功能帮助
                    string[] SplitStr = DT.Rows[i]["GNMC"].ToString().Split('$');
                    DT.Rows[i]["GNMC"] = SplitStr[0];
                    DT.Rows[i]["WJMC"] = SplitStr[1];
                    DT.Rows[i]["MMKJ"] = SplitStr[2];
                    DT.Rows[i]["WJICO"] = SplitStr[3];
                    DT.Rows[i]["HELPPATH"] = SplitStr[4];
                }
                DT.AcceptChanges();

                if (SystemClass.AdoNetOperation.DataTableInputDataBase(SystemClass.ConnectString.GetConnectionString(), DT, "SYS_FUNCTION", false) == true)
                {
                    ZX.Class.Log.WriteLog.Write("ZXSystem.Function.FunManage", "SaveFunctionNode", "保存功能列表到数据库成功", ZX.Class.Log.NormalLogType.InfoLog);
                }
                else
                {
                    SystemClass.MessageBoxShow.ShowMessage("保存功能列表到数据库失败!");
                    ZX.Class.Log.WriteLog.Write("ZXSystem.Function.FunManage", "SaveFunctionNode", "保存功能列表到数据库失败", ZX.Class.Log.NormalLogType.WarnLog);
                }
            }
        }