public void CreateSybaseSystemTable(IDbCommand command) { frmCreateDB cdb = new frmCreateDB(); cdb.ShowDialog(); if (cdb.DialogResult == DialogResult.OK) { string result = ""; if (cdb.x == radioType.simplified || cdb.x == radioType.typical) { #region Simplifield command.CommandText = "CREATE TABLE COLDEF" + "(" + "TABLE_NAME nvarchar(20) NOT NULL, " + "FIELD_NAME nvarchar(20) NOT NULL, " + "SEQ NUMERIC(12,0) NULL, " + "FIELD_TYPE nvarchar(20) NULL, " + "IS_KEY nvarchar(1) NOT NULL, " + "FIELD_LENGTH NUMERIC(12,0) NULL, " + "CAPTION nvarchar(40) NULL, " + "EDITMASK nvarchar(10) NULL, " + "NEEDBOX nvarchar(13) NULL, " + "CANREPORT nvarchar(1) NULL, " + "EXT_MENUID nvarchar(20) NULL, " + "FIELD_SCALE NUMERIC(12,0) NULL, " + "DD_NAME nvarchar(40) NULL, " + "DEFAULT_VALUE nvarchar(100) NULL, " + "CHECK_NULL nvarchar(1) NULL, " + "QUERYMODE nvarchar(20) NULL, " + "CAPTION1 nvarchar(40) NULL, " + "CAPTION2 nvarchar(40) NULL, " + "CAPTION3 nvarchar(40) NULL, " + "CAPTION4 nvarchar(40) NULL, " + "CAPTION5 nvarchar(40) NULL, " + "CAPTION6 nvarchar(40) NULL, " + "CAPTION7 nvarchar(40) NULL, " + "CAPTION8 nvarchar(40) NULL, " + "PRIMARY KEY(TABLE_NAME,FIELD_NAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create COLDEF table.\n\r"; } command.CommandText = "CREATE INDEX TABLENAME ON COLDEF (TABLE_NAME,FIELD_NAME)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX TABLENAME on table COLDEF .\n\r"; } command.CommandText = "CREATE TABLE SYSAUTONUM " + "(" + "AUTOID VARCHAR(20) NOT NULL, " + "FIXED VARCHAR(20) NOT NULL, " + "CURRNUM NUMERIC(10,0) NULL, " + "DESCRIPTION VARCHAR(50) NULL, " + "PRIMARY KEY (AUTOID,FIXED)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSAUTONUM table.\n\r"; } #endregion #region Typical if (cdb.x == radioType.typical) { //// Create GROUPFORMS //command.CommandText = "CREATE TABLE GROUPFORMS (" // + "GROUPID nvarchar (20) NOT NULL ," // + "PACKAGE_NAME nvarchar (50) NOT NULL ," // + "FORM_NAME nvarchar (50) NULL ," // + "PARENT_MENU nvarchar (50) NULL " // + ")"; //try //{ // command.ExecuteNonQuery(); //} //catch //{ // result += "Can not create GROUPFORMS table.\n\r"; //} // Create GROUPMENUS command.CommandText = "CREATE TABLE GROUPMENUS (" + "GROUPID varchar (20) NOT NULL ," + "MENUID nvarchar (30) NOT NULL, " + "PRIMARY KEY(GROUPID,MENUID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create GROUPMENUS table.\n\r"; } // Create USERMENUS command.CommandText = "CREATE TABLE USERMENUS (" + "USERID varchar (20) NOT NULL ," + "MENUID nvarchar (30) NOT NULL, " + "PRIMARY KEY(USERID,MENUID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create USERMENUS table.\n\r"; } // Create GROUPS command.CommandText = "CREATE TABLE GROUPS (" + "GROUPID varchar (20) NOT NULL ," + "GROUPNAME nvarchar (50) NULL ," + "DESCRIPTION nvarchar (100) NULL ," + "MSAD nvarchar (1) NULL, " + "ISROLE char(1) NULL," + "PRIMARY KEY(GROUPID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO GROUPS(GROUPID, GROUPNAME, MSAD) VALUES('00', 'EveryOne', 'N')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO GROUPS(GROUPID, GROUPNAME, MSAD) VALUES('01', 'DEPARTMENT1', 'N')"; command.ExecuteNonQuery(); } catch { result += "Can not create GROUPS table.\n\r"; } // Create MENUITEMTYPE command.CommandText = "CREATE TABLE MENUITEMTYPE (" + "ITEMTYPE nvarchar (20) NOT NULL ," + "ITEMNAME nvarchar (20) NULL, " + "DBALIAS nvarchar (50) NULL," + "PRIMARY KEY(ITEMTYPE)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO MENUITEMTYPE(ITEMTYPE, ITEMNAME) VALUES('SOLUTION1', 'DEFAULT SOLUTION')"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUITEMTYPE table.\n\r"; } // Create MENUTABLE command.CommandText = "CREATE TABLE MENUTABLE (" + "MENUID nvarchar (30) NOT NULL ," + "CAPTION nvarchar (50) NOT NULL ," + "PARENT nvarchar (20) NULL ," + "PACKAGE nvarchar (60) NULL ," + "MODULETYPE nvarchar (1) NULL ," + "ITEMPARAM nvarchar (200) NULL ," + "FORM nvarchar (32) NULL ," + "ISSHOWMODAL nvarchar (1) NULL ," + "ITEMTYPE nvarchar (20) NULL ," + "SEQ_NO nvarchar (4) NULL," + "PACKAGEDATE DateTime NULL," + "IMAGE image NULL," + "OWNER nvarchar(20) NULL," + "ISSERVER nvarchar(1) NULL," + "VERSIONNO nvarchar(20) NULL," + "CHECKOUT nvarchar(20) NULL," + "CHECKOUTDATE datetime NULL," + "CAPTION0 nvarchar(50) NULL," + "CAPTION1 nvarchar(50) NULL," + "CAPTION2 nvarchar(50) NULL," + "CAPTION3 nvarchar(50) NULL," + "CAPTION4 nvarchar(50) NULL," + "CAPTION5 nvarchar(50) NULL," + "CAPTION6 nvarchar(50) NULL," + "CAPTION7 nvarchar(50) NULL," + "IMAGEURL nvarchar(100) NULL, " + "PRIMARY KEY(MENUID)" + ") "; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO MENUTABLE(MENUID, CAPTION, ITEMTYPE, MODULETYPE) VALUES('0', 'ROOT', 'SOLUTION1', 'F')"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLE table.\n\r"; } // Create USERGROUPS command.CommandText = "CREATE TABLE USERGROUPS (" + "USERID varchar (20) NOT NULL ," + "GROUPID varchar (20) NOT NULL, " + "PRIMARY KEY(USERID,GROUPID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO USERGROUPS(USERID, GROUPID) VALUES('001', '01')"; command.ExecuteNonQuery(); } catch { result += "Can not create USERGROUPS table.\n\r"; } // Create USERS command.CommandText = "CREATE TABLE USERS (" + "USERID varchar (20) NOT NULL ," + "USERNAME nvarchar (30) NULL ," + "AGENT nvarchar (20) NULL ," + "PWD nvarchar (10) NULL ," + "CREATEDATE nvarchar (8) NULL ," + "CREATER nvarchar (20) NULL ," + "DESCRIPTION nvarchar (100) NULL ," + "EMAIL nvarchar (40) NULL ," + "LASTTIME nvarchar (8) NULL ," + "AUTOLOGIN nvarchar (1) NULL," + "LASTDATE nvarchar (8) NULL ," + "SIGNATURE nvarchar (30) NULL ," + "MSAD nvarchar (1) NULL, " + "PRIMARY KEY(USERID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO USERS(USERID, USERNAME, PWD, MSAD, AUTOLOGIN) VALUES('001', 'TEST', '', 'N','S')"; command.ExecuteNonQuery(); } catch { result += "Can not create USERS table.\n\r"; } // Create MENUTABLELOG command.CommandText = "CREATE TABLE MENUTABLELOG" + "(" + "LOGID numeric(8,0) IDENTITY," + "MENUID nvarchar(30) not null," + "PACKAGE nvarchar(20) not null," + "PACKAGEDATE DATETIME," + "LASTDATE DATETIME," + "OWNER nvarchar(20)," + "OLDVERSION IMAGE," + "OLDDATE nvarchar(20), " + "PRIMARY KEY(LOGID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLELOG table.\n\r"; } // Create MENUCHECKLOG command.CommandText = "CREATE TABLE MENUCHECKLOG" + "(" + "LOGID numeric(8,0) IDENTITY," + "ITEMTYPE nvarchar(20) not null," + "PACKAGE nvarchar(50) not null," + "PACKAGEDATE DateTime," + "FILETYPE nvarchar(10)," + "FILENAME nvarchar(60)," + "FILEDATE DateTime," + "FILECONTENT IMAGE, " + "PRIMARY KEY(LOGID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUCHECKLOG table.\n\r"; } // Create SYSEEPLOG command.CommandText = "CREATE TABLE SYSEEPLOG" + "(" + "CONNID nvarchar(20) NOT NULL," + "LOGID numeric(8,0) IDENTITY," + "LOGSTYLE nvarchar(1) NOT NULL," + "LOGDATETIME DATETIME NOT NULL," + "DOMAINID nvarchar(30) NULL," + "USERID varchar(20) NULL," + "LOGTYPE nvarchar(1) NULL," + "TITLE nvarchar(64) NULL," + "DESCRIPTION nvarchar(128) NULL," + "COMPUTERIP nvarchar(16) NULL," + "COMPUTERNAME nvarchar(64) NULL," + "EXECUTIONTIME INT NULL, " + "PRIMARY KEY(CONNID,LOGID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSEEPLOG table.\n\r"; } // Create SYSSQLLOG command.CommandText = "CREATE TABLE SYSSQLLOG(" + "LOGSTYLE nvarchar(1)," + "LOGDATETIME datetime," + "USERID varchar(20)," + "DEVELOPERID varchar(20)," + "DESCRIPTION text," + "SQLSENTENCE nvarchar(max)" + ");"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSSQLLOG table.\n\r"; } // Create SYSERRLOG command.CommandText = "CREATE TABLE SYSERRLOG" + "(" + "ERRID numeric(8,0) IDENTITY," + "USERID varchar(20), " + "MODULENAME nvarchar(30)," + "ERRMESSAGE nvarchar(255)," + "ERRSTACK text," + "ERRDESCRIP nvarchar(255)," + "ERRDATE DateTime," + "ERRSCREEN Image," + "OWNER nvarchar(20)," + "PROCESSDATE DateTime," + "PRODESCRIP nvarchar(255)," + "STATUS nvarchar(2), " + "PRIMARY KEY(ERRID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSERRLOG table.\n\r"; } command.CommandText = "CREATE TABLE SYS_LANGUAGE" + "(" + "ID numeric(8,0) IDENTITY," + "IDENTIFICATION nvarchar(80)," + "KEYS nvarchar(80)," + "EN nvarchar(80)," + "CHT nvarchar(80)," + "CHS nvarchar(80)," + "HK nvarchar(80)," + "JA nvarchar(80)," + "KO nvarchar(80)," + "LAN1 nvarchar(80)," + "LAN2 nvarchar(80)," + "PRIMARY KEY(ID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_LANGUAGE table.\n\r"; } command.CommandText = "CREATE TABLE SYS_MESSENGER" + "(" + "USERID varchar(20) NOT NULL," + "MESSAGE nvarchar(255)," + "PARAS nvarchar(255)," + "SENDTIME nvarchar(14)," + "SENDERID nvarchar(20)," + "RECTIME nvarchar(14)," + "STATUS char(1)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_MESSENGER table.\n\r"; } //CreateMenuTableControl command.CommandText = "CREATE TABLE MENUTABLECONTROL" + "(" + "MENUID varchar (30) NOT NULL, " + "CONTROLNAME Varchar (50) NOT NULL, " + "DESCRIPTION Varchar (50) NULL, " + "TYPE Varchar (20) NULL, " + "PRIMARY KEY(MENUID,CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLECONTROL table.\n\r"; } //CreateGroupMenuControl command.CommandText = "CREATE TABLE GROUPMENUCONTROL" + "(" + "GROUPID Varchar (20) NOT NULL, " + "MENUID Varchar (30) NOT NULL, " + "CONTROLNAME Varchar (50) NOT NULL, " + "TYPE Varchar (20) NULL, " + "ENABLED CHAR (1) NULL, " + "VISIBLE CHAR (1) NULL, " + "ALLOWADD CHAR (1) NULL, " + "ALLOWUPDATE CHAR (1) NULL, " + "ALLOWDELETE CHAR (1) NULL, " + "ALLOWPRINT CHAR (1) NULL, " + "PRIMARY KEY(GROUPID,MENUID,CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create GROUPMENUCONTROL table.\n\r"; } //CreateUserMenuControl command.CommandText = "CREATE TABLE USERMENUCONTROL" + "(" + "USERID Varchar (20) NOT NULL, " + "MENUID Varchar (30) NOT NULL, " + "CONTROLNAME Varchar (50) NOT NULL, " + "TYPE Varchar (20) NULL, " + "ENABLED CHAR (1) NULL, " + "VISIBLE CHAR (1) NULL, " + "ALLOWADD CHAR (1) NULL, " + "ALLOWUPDATE CHAR (1) NULL, " + "ALLOWDELETE CHAR (1) NULL, " + "ALLOWPRINT CHAR (1) NULL, " + "PRIMARY KEY(USERID,MENUID,CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create USERMENUCONTROL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REFVAL" + "(" + "REFVAL_NO Varchar(100) NOT NULL, " + "DESCRIPTION Varchar(250), " + "TABLE_NAME Varchar(100), " + "CAPTION Varchar(100), " + "DISPLAY_MEMBER Varchar(100), " + "SELECT_ALIAS Varchar(250), " + "SELECT_COMMAND Varchar(250), " + "VALUE_MEMBER Varchar(100), " + "PRIMARY KEY(REFVAL_NO) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REFVAL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REFVAL_D1" + "(" + "REFVAL_NO Varchar(30) NOT NULL, " + "FIELD_NAME Varchar(30) NOT NULL, " + "HEADER_TEXT Varchar(20), " + "WIDTH numeric(4,0), " + "PRIMARY KEY(REFVAL_NO, FIELD_NAME) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REFVAL_D1 table.\n\r"; } command.CommandText = "CREATE TABLE MENUFAVOR" + "(" + "MENUID nVarchar(30) NOT NULL, " + "CAPTION nVarchar(50) NOT NULL, " + "USERID Varchar(20) NOT NULL, " + "ITEMTYPE nVarchar(20), " + "GROUPNAME nVarChar(20), " + "PRIMARY Key (MENUID,USERID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUFAVOR table.\n\r"; } command.CommandText = "CREATE TABLE SYS_ANYQUERY" + "(" + "QUERYID Varchar(20) NOT NULL, " + "USERID Varchar(20) NOT NULL, " + "TEMPLATEID Varchar(20) NOT NULL, " + "TABLENAME Varchar(50), " + "LASTDATE datetime, " + "CONTENT text, " + "PRIMARY Key (QUERYID,USERID,TEMPLATEID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ANYQUERY table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REPORT" + "(" + "REPORTID nVarchar(50) NOT NULL, " + "FILENAME nVarchar(50) NOT NULL, " + "REPORTNAME nVarchar(50), " + "DESCRIPTION nVarchar(50), " + "FILEPATH nVarchar(50), " + "OUTPUTMODE nVarchar(20), " + "HEADERREPEAT nVarchar(5), " + "HEADERFONT image, " + "HEADERITEMS image, " + "FOOTERFONT image, " + "FOOTERITEMS image, " + "FIELDFONT image, " + "FIELDITEMS image, " + "SETTING image, " + "FORMAT image, " + "PARAMETERS image, " + "IMAGES image, " + "MAILSETTING image, " + "DATASOURCE_PROVIDER nVarchar(50)," + "DATASOURCES image," + "CLIENT_QUERY image," + "REPORT_TYPE nVarchar(1)," + "TEMPLATE_DESC nVarchar(50)," + "PRIMARY Key (REPORTID,FILENAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REPORT table.\n\r"; } command.CommandText = "CREATE TABLE SYS_PERSONAL" + "(" + "FORMNAME NVARCHAR(60) NOT NULL," + "COMPNAME NVARCHAR(30) NOT NULL," + "USERID NVARCHAR(20) NOT NULL," + "REMARK NVARCHAR(30)," + "PROPCONTENT TEXT," + "CREATEDATE DATETIME," + "PRIMARY KEY (FORMNAME,COMPNAME,USERID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_PERSONAL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_EEP_USERS" + "(" + "USERID NVARCHAR(50) NOT NULL," + "USERNAME NVARCHAR(50) NULL," + "COMPUTER NVARCHAR(50) NOT NULL," + "LOGINTIME NVARCHAR(50)," + "LASTACTIVETIME NVARCHAR(50)," + "LOGINCOUNT INT," + "PRIMARY KEY (USERID,COMPUTER)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_EEP_USERS table.\n\r"; } } #endregion } else if (cdb.x == radioType.EEP7m) { #region EEP7m command.CommandText = "Alter Table COLDEF add " + "DEFAULT_VALUE NVARCHAR(100) NULL, " + "CHECK_NULL NVARCHAR(1) NULL, " + "QUERYMODE NVARCHAR(20) NULL, " + "CAPTION1 NVARCHAR (40), " + "CAPTION2 NVARCHAR (40), " + "CAPTION3 NVARCHAR (40), " + "CAPTION4 NVARCHAR (40), " + "CAPTION5 NVARCHAR (40), " + "CAPTION6 NVARCHAR (40), " + "CAPTION7 NVARCHAR (40), " + "CAPTION8 NVARCHAR (40)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPMENUS alter column MENUID nvarchar (30)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table GROUPS add MSAD NVARCHAR (1)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPS alter column GROUPNAME nvarchar (50)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPS alter column DESCRIPTION nvarchar (200)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table MENUTABLE add " + "MODULETYPE NVARCHAR(1), " + "PACKAGEDATE DATETIME, " + "IMAGE IMAGE, " + "OWNER NVARCHAR(20), " + "ISSERVER NVARCHAR(1), " + "VERSIONNO NVARCHAR(20), " + "CHECKOUT NVARCHAR(20), " + "CHECKOUTDATE DATETIME, " + "CAPTION0 NVARCHAR(50), " + "CAPTION1 NVARCHAR(50), " + "CAPTION2 NVARCHAR(50), " + "CAPTION3 NVARCHAR(50), " + "CAPTION4 NVARCHAR(50), " + "CAPTION5 NVARCHAR(50), " + "CAPTION6 NVARCHAR(50), " + "CAPTION7 NVARCHAR(50), " + "IMAGEURL NVARCHAR(100)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table MENUTABLE alter column MENUID nvarchar(30)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table MENUTABLE alter column ITEMTYPE nvarchar(20)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table USERMENUS alter column MENUID nvarchar(30)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table USERS add " + "EMAIL NVARCHAR(40), " + "LASTTIME NVARCHAR(8), " + "AUTOLOGIN NVARCHAR(1), " + "LASTDATE NVARCHAR(8), " + "SIGNATURE NVARCHAR(30), " + "MSAD NVARCHAR(1)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } #endregion } else if (cdb.x == radioType.EEP2006m) { #region EEP2006m command.CommandText = "if exists (select * from sysobjects where id = object_id(N'[MENUFAVOR]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)" + "Alter Table MENUFAVOR ADD GROUPNAME NVARCHAR(20)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "if exists (select * from sysobjects where id = object_id(N'[SYS_ORGLEVEL]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)" + "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('0','直屬主管')"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "if exists (select * from sysobjects where id = object_id(N'[SYS_TODOLIST]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)" + "ALTER table SYS_TODOLIST ADD ATTACHMENTS nVarchar(255)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "if exists (select * from sysobjects where id = object_id(N'[SYS_TODOHIS]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)" + "ALTER table SYS_TODOHIS ADD ATTACHMENTS nVarchar(255)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } #endregion } else if (cdb.x == radioType.WorkFlow) { #region WorkFlow //GROUPS command.CommandText = "ALTER TABLE GROUPS ADD ISROLE CHAR(1) NULL"; try { command.ExecuteNonQuery(); } catch { //result += "Can not add ISROLE column to GROUPS table.\n\r"; } // SYS_ORG command.CommandText = "CREATE TABLE SYS_ORG(" + "ORG_NO nvarchar(8) NOT NULL," + "ORG_DESC nvarchar(40) NOT NULL," + "ORG_KIND nvarchar(4) NOT NULL," + "UPPER_ORG nvarchar(8) NULL," + "ORG_MAN nvarchar(20) NOT NULL," + "LEVEL_NO nvarchar(6) NOT NULL," + "ORG_TREE nvarchar(40) NULL," + "END_ORG nvarchar(4) NULL," + "ORG_FULLNAME nvarchar(254) NULL," + "PRIMARY KEY(ORG_NO)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORG(ORG_NO,ORG_DESC,ORG_KIND,ORG_MAN,LEVEL_NO) Values ('1','總公司','0','001','9')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORG table.\n\r"; } // SYS_ORGKIND command.CommandText = "CREATE TABLE SYS_ORGKIND(" + "ORG_KIND nvarchar(4) NOT NULL," + "KIND_DESC nvarchar(40) NOT NULL," + "PRIMARY KEY(ORG_KIND)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGKIND(ORG_KIND,KIND_DESC) Values ('0','公司組織')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGKIND table.\n\r"; } // SYS_ORGLEVEL command.CommandText = "CREATE TABLE SYS_ORGLEVEL(" + "LEVEL_NO nvarchar(6) NOT NULL," + "LEVEL_DESC nvarchar(40) NOT NULL," + "PRIMARY KEY(LEVEL_NO)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('0','直屬主管')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('1','主任/課長/副理')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('2','經理')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('3','副總')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('9','總經理')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGLEVEL table.\n\r"; } // SYS_ORGROLES command.CommandText = "CREATE TABLE SYS_ORGROLES(" + "ORG_NO nvarchar(8) NOT NULL," + "ROLE_ID varchar(20) NOT NULL," + "ORG_KIND nvarchar(4) NULL," + "PRIMARY KEY(ORG_NO,ROLE_ID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGROLES table.\n\r"; } command.CommandText = "CREATE INDEX ORGNO ON SYS_ORGROLES (ORG_NO, ROLE_ID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX ORGNO on table SYS_ORGROLES .\n\r"; } // SYS_ROLES_AGENT command.CommandText = "CREATE TABLE SYS_ROLES_AGENT(" + "ROLE_ID varchar(20) NOT NULL," + "AGENT nvarchar(20) NOT NULL," + "FLOW_DESC nvarchar(40) NOT NULL," + "START_DATE nvarchar(8) NOT NULL," + "START_TIME nvarchar(6) NULL," + "END_DATE nvarchar(8) NOT NULL," + "END_TIME nvarchar(6) NULL," + "PAR_AGENT nvarchar(4) NOT NULL," + "REMARK nvarchar(254) NULL," + "PRIMARY KEY(ROLE_ID,AGENT)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ROLES_AGENT table.\n\r"; } command.CommandText = "CREATE INDEX ROLEID ON SYS_ROLES_AGENT (ROLE_ID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX ROLEID on table SYS_ROLES_AGENT .\n\r"; } // SYS_TODOHIS command.CommandText = "CREATE TABLE SYS_TODOHIS(" + "LISTID nvarchar(40) NOT NULL," + "FLOW_ID nvarchar(40) NOT NULL," + "FLOW_DESC nvarchar(40) NULL," + "ROLE_ID varchar(20) NOT NULL," + "S_ROLE_ID varchar(20) NOT NULL," + "S_STEP_ID nvarchar(20) NOT NULL," + "D_STEP_ID nvarchar(20) NOT NULL," + "S_STEP_DESC nvarchar(64) NULL," + "S_USER_ID nvarchar(20) NOT NULL," + "USER_ID nvarchar(20) NOT NULL," + "USERNAME nvarchar(30) NULL," + "FORM_NAME nvarchar(30) NULL," + "WEBFORM_NAME nvarchar(50) NOT NULL," + "S_USERNAME nvarchar(30) NULL," + "NAVIGATOR_MODE nvarchar(2) NOT NULL," + "FLNAVIGATOR_MODE nvarchar(2) NOT NULL," + "PARAMETERS nvarchar(254) NULL," + "STATUS nvarchar(4) NULL," + "PROC_TIME decimal(8, 2) NOT NULL," + "EXP_TIME decimal(8, 2) NOT NULL," + "TIME_UNIT nvarchar(4) NOT NULL," + "FLOWIMPORTANT varchar(1) NOT NULL," + "FLOWURGENT varchar(1) NOT NULL," + "FORM_TABLE nvarchar(30) NULL," + "FORM_KEYS nvarchar(254) NULL," + "FORM_PRESENTATION nvarchar(254) NULL," + "REMARK nvarchar(254) NULL," + "VERSION nvarchar(2) NULL," + "VDSNAME nvarchar(40) NULL," + "SENDBACKSTEP nvarchar(2) NULL," + "LEVEL_NO nvarchar(6) NULL," + "UPDATE_DATE nvarchar(10) NULL," + "UPDATE_TIME nvarchar(8) NULL," + "FORM_PRESENT_CT nvarchar(254) NULL," + "ATTACHMENTS nvarchar(255) NULL" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_TODOHIS table.\n\r"; } command.CommandText = "CREATE INDEX LISTID ON SYS_TODOHIS (LISTID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX LISTID on table SYS_TODOHIS.\n\r"; } command.CommandText = "CREATE INDEX USERID ON SYS_TODOHIS (USER_ID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX USERID on table SYS_TODOHIS.\n\r"; } // SYS_TODOLIST command.CommandText = "CREATE TABLE SYS_TODOLIST(" + "LISTID nvarchar(40) NOT NULL," + "FLOW_ID nvarchar(40) NOT NULL," + "FLOW_DESC nvarchar(40) NULL," + "APPLICANT nvarchar(20) NOT NULL," + "S_USER_ID nvarchar(20) NOT NULL," + "S_STEP_ID nvarchar(20) NOT NULL," + "S_STEP_DESC nvarchar(64) NULL," + "D_STEP_ID nvarchar(20) NOT NULL," + "D_STEP_DESC nvarchar(64) NULL," + "EXP_TIME decimal(8, 2) NOT NULL," + "URGENT_TIME decimal(8, 2) NOT NULL," + "TIME_UNIT nvarchar(4) NOT NULL," + "USERNAME nvarchar(30) NULL," + "FORM_NAME nvarchar(30) NULL," + "NAVIGATOR_MODE nvarchar(2) NOT NULL," + "FLNAVIGATOR_MODE nvarchar(2) NOT NULL," + "PARAMETERS nvarchar(254) NULL," + "SENDTO_KIND nvarchar(4) NOT NULL," + "SENDTO_ID nvarchar(20) NOT NULL," + "FLOWIMPORTANT varchar(1) NOT NULL," + "FLOWURGENT nvarchar(1) NOT NULL," + "STATUS nvarchar(4) NULL," + "FORM_TABLE nvarchar(30) NULL," + "FORM_KEYS nvarchar(254) NULL," + "FORM_PRESENTATION nvarchar(254) NULL," + "FORM_PRESENT_CT nvarchar(254) NOT NULL," + "REMARK nvarchar(254) NULL," + "PROVIDER_NAME nvarchar(254) NULL," + "VERSION nvarchar(2) NULL," + "EMAIL_ADD nvarchar(40) NULL," + "EMAIL_STATUS varchar(1) NULL," + "VDSNAME nvarchar(40) NULL," + "SENDBACKSTEP nvarchar(2) NULL," + "LEVEL_NO nvarchar(6) NULL," + "WEBFORM_NAME nvarchar(50) NOT NULL," + "UPDATE_DATE nvarchar(10) NULL," + "UPDATE_TIME nvarchar(8) NULL," + "FLOWPATH nvarchar(100) NOT NULL," + "PLUSAPPROVE varchar(1) NOT NULL," + "PLUSROLES nvarchar(254) NOT NULL," + "MULTISTEPRETURN varchar(1) NULL," + "SENDTO_NAME nvarchar(30) NULL," + "ATTACHMENTS nvarchar(255) NULL" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_TODOLIST table.\n\r"; } command.CommandText = "CREATE INDEX LISTID ON SYS_TODOLIST (LISTID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX LISTID on table SYS_TODOLIST.\n\r"; } command.CommandText = "CREATE INDEX SENDTOID ON SYS_TODOLIST (SENDTO_ID, SENDTO_KIND)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX SENDTOID on table SYS_TODOLIST.\n\r"; } command.CommandText = "CREATE INDEX FLOWDESC ON SYS_TODOLIST (FLOW_DESC)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX FLOWDESC on table SYS_TODOLIST.\n\r"; } // SYS_FLDefinition command.CommandText = "CREATE TABLE SYS_FLDEFINITION" + "(" + "FLTYPEID nvarchar(50) NOT NULL, " + "FLTYPENAME nvarchar(200) NOT NULL, " + "FLDEFINITION text NOT NULL, " + "VERSION int NULL, " + "PRIMARY KEY(FLTYPEID) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_FLDEFINITION table.\n\r"; } // SYS_FLInstanceState command.CommandText = "CREATE TABLE SYS_FLINSTANCESTATE" + "(" + "FLINSTANCEID nvarchar(50) NOT NULL, " + "STATE image NOT NULL, " + "STATUS int NULL, " + "INFO nvarchar(200) NULL," + "PRIMARY KEY(FLINSTANCEID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_FLINSTANCESTATE table.\n\r"; } // Sys_ExtApprove command.CommandText = "CREATE TABLE SYS_EXTAPPROVE" + "(" + "APPROVEID nvarchar(50) NULL, " + "GROUPID nvarchar(50) NULL, " + "MINIMUM nvarchar(50) NULL, " + "MAXIMUM nvarchar(50) NULL," + "ROLEID nvarchar(50) NULL" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_EXTAPPROVE table.\n\r"; } #endregion } if (result != "") MessageBox.Show(result); else if (cdb.x == radioType.typical) MessageBox.Show("Create all System Tables successfully."); else if (cdb.x == radioType.simplified) MessageBox.Show("Create table COLDEF table and table SYSAUTONUM successfully."); else if (cdb.x == radioType.EEP7m) MessageBox.Show("Alter successfully."); else if (cdb.x == radioType.EEP2006m) MessageBox.Show("EEP 2006 2.1.0.1(SP2) Migration success"); else if (cdb.x == radioType.WorkFlow) MessageBox.Show("Create WorkFlow Tables successfully."); } }
public void CreateDB2SystemTable(IDbCommand command) { frmCreateDB cdb = new frmCreateDB(); cdb.ShowDialog(); if (cdb.DialogResult == DialogResult.OK) { string result = ""; if (cdb.x == radioType.simplified || cdb.x == radioType.typical) { #region Simplifield command.CommandText = "CREATE TABLE COLDEF" + "(" + "TABLE_NAME varchar(20) NOT NULL, " + "FIELD_NAME varchar(20) NOT NULL, " + "SEQ decimal(12,0), " + "FIELD_TYPE varchar(20), " + "IS_KEY varchar(1) NOT NULL, " + "FIELD_LENGTH decimal(12,0), " + "CAPTION varchar(40), " + "EDITMASK varchar(10), " + "NEEDBOX varchar(13), " + "CANREPORT varchar(1), " + "EXT_MENUID varchar(20), " + "FIELD_SCALE decimal(12,0), " + "DD_NAME varchar(40), " + "DEFAULT_VALUE varchar(100), " + "CHECK_NULL varchar(1), " + "QUERYMODE varchar(20), " + "CAPTION1 varchar(40), " + "CAPTION2 varchar(40), " + "CAPTION3 varchar(40), " + "CAPTION4 varchar(40), " + "CAPTION5 varchar(40), " + "CAPTION6 varchar(40), " + "CAPTION7 varchar(40), " + "CAPTION8 varchar(40) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create COLDEF table.\n\r"; } command.CommandText = "CREATE INDEX TABLENAME ON COLDEF (TABLE_NAME,FIELD_NAME)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX TABLENAME on table COLDEF .\n\r"; } command.CommandText = "CREATE TABLE SYSAUTONUM " + "(" + "AUTOID VARCHAR(20) NOT NULL, " + "FIXED VARCHAR(20) NOT NULL, " + "CURRNUM decimal(10,0), " + "DESCRIPTION VARCHAR(50)," + "PRIMARY KEY (AUTOID, FIXED)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSAUTONUM table.\n\r"; } #endregion #region Typical if (cdb.x == radioType.typical) { //// Create GROUPFORMS //command.CommandText = "CREATE TABLE GROUPFORMS (" // + "GROUPID nvarchar (20) NOT NULL ," // + "PACKAGE_NAME nvarchar (50) NOT NULL ," // + "FORM_NAME nvarchar (50) NULL ," // + "PARENT_MENU nvarchar (50) NULL " // + ")"; //try //{ // command.ExecuteNonQuery(); //} //catch //{ // result += "Can not create GROUPFORMS table.\n\r"; //} // Create GROUPMENUS command.CommandText = "CREATE TABLE GROUPMENUS (" + "GROUPID varchar (20) NOT NULL ," + "MENUID varchar (30) NOT NULL ," + "PRIMARY KEY (GROUPID, MENUID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create GROUPMENUS table.\n\r"; } // Create USERMENUS command.CommandText = "CREATE TABLE USERMENUS (" + "USERID varchar (20) NOT NULL ," + "MENUID varchar (30) NOT NULL " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create USERMENUS table.\n\r"; } // Create GROUPS command.CommandText = "CREATE TABLE GROUPS (" + "GROUPID varchar (20) NOT NULL ," + "GROUPNAME varchar (50)," + "DESCRIPTION varchar (100)," + "MSAD varchar (1)," + "ISROLE char(1) ," + "PRIMARY KEY (GROUPID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO GROUPS(GROUPID, GROUPNAME, MSAD) VALUES('00', 'EveryOne', 'N')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO GROUPS(GROUPID, GROUPNAME, MSAD) VALUES('01', 'DEPARTMENT1', 'N')"; command.ExecuteNonQuery(); } catch { result += "Can not create GROUPS table.\n\r"; } // Create MENUITEMTYPE command.CommandText = "CREATE TABLE MENUITEMTYPE (" + "ITEMTYPE varchar (20) NOT NULL ," + "ITEMNAME varchar (20)," + "DBALIAS varchar (50) " + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO MENUITEMTYPE(ITEMTYPE, ITEMNAME) VALUES('SOLUTION1', 'DEFAULT SOLUTION')"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUITEMTYPE table.\n\r"; } // Create MENUTABLE command.CommandText = "CREATE TABLE MENUTABLE (" + "MENUID varchar (30) NOT NULL ," + "CAPTION varchar (50) NOT NULL ," + "PARENT varchar (20) ," + "PACKAGE varchar (60)," + "MODULETYPE varchar (1)," + "ITEMPARAM varchar (200)," + "FORM varchar (32)," + "ISSHOWMODAL varchar (1)," + "ITEMTYPE varchar (20)," + "SEQ_NO varchar (4)," + "PACKAGEDATE Date," + "IMAGE GRAPHIC," + "OWNER varchar(20)," + "ISSERVER varchar(1)," + "VERSIONNO varchar(20)," + "CHECKOUT varchar(20)," + "CHECKOUTDATE date," + "CAPTION0 varchar(50)," + "CAPTION1 varchar(50)," + "CAPTION2 varchar(50)," + "CAPTION3 varchar(50)," + "CAPTION4 varchar(50)," + "CAPTION5 varchar(50)," + "CAPTION6 varchar(50)," + "CAPTION7 varchar(50)," + "IMAGEURL varchar(100), " + "PRIMARY KEY (MENUID)" + ") "; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO MENUTABLE(MENUID, CAPTION, ITEMTYPE, MODULETYPE) VALUES('0', 'ROOT', 'SOLUTION1', 'F')"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLE table.\n\r"; } // Create USERGROUPS command.CommandText = "CREATE TABLE USERGROUPS (" + "USERID varchar (20) NOT NULL ," + "GROUPID varchar (20) NOT NULL " + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO USERGROUPS(USERID, GROUPID) VALUES('001', '01')"; command.ExecuteNonQuery(); } catch { result += "Can not create USERGROUPS table.\n\r"; } // Create USERS command.CommandText = "CREATE TABLE USERS (" + "USERID varchar (20) NOT NULL ," + "USERNAME varchar (30)," + "AGENT varchar (20)," + "PWD varchar (10)," + "CREATEDATE varchar (8)," + "CREATER varchar (20)," + "DESCRIPTION varchar (100)," + "EMAIL varchar (40)," + "LASTTIME varchar (8)," + "AUTOLOGIN varchar (1)," + "LASTDATE varchar (8)," + "SIGNATURE varchar (30)," + "MSAD varchar (1) " + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO USERS(USERID, USERNAME, PWD, MSAD,AUTOLOGIN) VALUES('001', 'TEST', '', 'N','S')"; command.ExecuteNonQuery(); } catch { result += "Can not create USERS table.\n\r"; } // Create MENUTABLELOG command.CommandText = "CREATE TABLE MENUTABLELOG" + "(" + "LOGID INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1)," + "MENUID varchar(30) not null," + "PACKAGE varchar(20) not null," + "PACKAGEDATE DATE," + "LASTDATE DATE," + "OWNER varchar(20)," + "OLDVERSION BLOB," + "OLDDATE varchar(20), " + "PRIMARY KEY (LOGID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLELOG table.\n\r"; } // Create MENUCHECKLOG command.CommandText = "CREATE TABLE MENUCHECKLOG" + "(" + "LOGID INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1) ," + "ITEMTYPE varchar(20) not null," + "PACKAGE varchar(50) not null," + "PACKAGEDATE Date," + "FILETYPE varchar(10)," + "FILENAME varchar(60)," + "FILEDATE Date," + "FILECONTENT BLOB, " + "PRIMARY KEY (LOGID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUCHECKLOG table.\n\r"; } // Create SYSEEPLOG command.CommandText = "CREATE TABLE SYSEEPLOG" + "(" + "CONNID varchar(20) NOT NULL," + "LOGID INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1)," + "LOGSTYLE varchar(1) NOT NULL," + "LOGDATETIME DATE NOT NULL," + "DOMAINID varchar(30)," + "USERID varchar(20)," + "LOGTYPE varchar(1)," + "TITLE varchar(64)," + "DESCRIPTION varchar(128)," + "COMPUTERIP varchar(16)," + "COMPUTERNAME varchar(64)," + "EXECUTIONTIME integer" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSEEPLOG table.\n\r"; } // Create SYSSQLLOG command.CommandText = "CREATE TABLE SYSSQLLOG(" + "LOGSTYLE nvarchar(1)," + "LOGDATETIME Date," + "USERID varchar(20)," + "DEVELOPERID varchar(20)," + "DESCRIPTION CLOB," + "SQLSENTENCE nvarchar(max)" + ");"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSSQLLOG table.\n\r"; } // Create SYSERRLOG command.CommandText = "CREATE TABLE SYSERRLOG" + "(" + "ERRID INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1)," + "USERID varchar(20), " + "MODULENAME varchar(30)," + "ERRMESSAGE varchar(255)," + "ERRSTACK CLOB," + "ERRDESCRIP varchar(255)," + "ERRDATE Date," + "ERRSCREEN BLOB," + "OWNER varchar(20)," + "PROCESSDATE Date," + "PROCDESCRIP varchar(255)," + "STATUS varchar(2) ," + "PRIMARY KEY (ERRID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSERRLOG table.\n\r"; } command.CommandText = "CREATE TABLE SYS_LANGUAGE" + "(" + "ID INTEGER GENERATED ALWAYS AS IDENTITY (START WITH 1 INCREMENT BY 1)," + "IDENTIFICATION varchar(80)," + "KEYS varchar(80)," + "EN varchar(80)," + "CHT varchar(80)," + "CHS varchar(80)," + "HK varchar(80)," + "JA varchar(80)," + "KO varchar(80)," + "LAN1 varchar(80)," + "LAN2 varchar(80) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_LANGUAGE table.\n\r"; } command.CommandText = "CREATE TABLE SYS_MESSENGER" + "(" + "USERID varchar(20) NOT NULL," + "MESSAGE varchar(255)," + "PARAS varchar(255)," + "SENDTIME varchar(14)," + "SENDERID varchar(20)," + "RECTIME varchar(14)," + "STATUS char(1)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_MESSENGER table.\n\r"; } //CreateMenuTableControl command.CommandText = "CREATE TABLE MENUTABLECONTROL" + "(" + "MENUID varchar (30) NOT NULL, " + "CONTROLNAME Varchar (50) NOT NULL, " + "DESCRIPTION Varchar (50), " + "TYPE Varchar (20) ," + "PRIMARY KEY (MENUID,CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLECONTROL table.\n\r"; } //CreateGroupMenuControl command.CommandText = "CREATE TABLE GROUPMENUCONTROL" + "(" + "GROUPID Varchar (20) NOT NULL, " + "MENUID Varchar (30) NOT NULL, " + "CONTROLNAME Varchar (50) NOT NULL, " + "TYPE Varchar (20), " + "ENABLED CHAR (1), " + "VISIBLE CHAR (1), " + "ALLOWADD CHAR (1), " + "ALLOWUPDATE CHAR (1), " + "ALLOWDELETE CHAR (1), " + "ALLOWPRINT CHAR (1), " + "PRIMARY KEY (GROUPID, MENUID, CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create GROUPMENUCONTROL table.\n\r"; } //CreateUserMenuControl command.CommandText = "CREATE TABLE USERMENUCONTROL" + "(" + "USERID Varchar (20) NOT NULL, " + "MENUID Varchar (30) NOT NULL, " + "CONTROLNAME Varchar (50) NOT NULL, " + "TYPE Varchar (20), " + "ENABLED CHAR (1), " + "VISIBLE CHAR (1), " + "ALLOWADD CHAR (1), " + "ALLOWUPDATE CHAR (1), " + "ALLOWDELETE CHAR (1), " + "ALLOWPRINT CHAR (1) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create USERMENUCONTROL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REFVAL" + "(" + "REFVAL_NO Varchar(100) Not NULL, " + "DESCRIPTION Varchar(250), " + "TABLE_NAME Varchar(100), " + "CAPTION Varchar(100), " + "DISPLAY_MEMBER Varchar(100), " + "SELECT_ALIAS Varchar(250), " + "SELECT_COMMAND Varchar(250), " + "VALUE_MEMBER Varchar(100) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REFVAL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REFVAL_D1" + "(" + "REFVAL_NO Varchar(30) Not NULL, " + "FIELD_NAME Varchar(30) Not NULL, " + "HEADER_TEXT Varchar(20), " + "WIDTH integer " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REFVAL_D1 table.\n\r"; } command.CommandText = "CREATE TABLE MENUFAVOR" + "(" + "MENUID Varchar(30) Not NULL, " + "CAPTION Varchar(50) Not NULL, " + "USERID Varchar(20) not null, " + "ITEMTYPE Varchar(20), " + "GROUPNAME VarChar(20) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUFAVOR table.\n\r"; } command.CommandText = "CREATE TABLE SYS_ANYQUERY" + "(" + "QUERYID Varchar(20) Not NULL, " + "USERID Varchar(20) Not NULL, " + "TEMPLATEID Varchar(20), " + "TABLENAME Varchar(50), " + "LASTDATE Date, " + "CONTENT CLOB, " + "PRIMARY Key (QUERYID,USERID,TEMPLATEID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ANYQUERY table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REPORT" + "(" + "REPORTID varchar(50) Not NULL, " + "FILENAME varchar(50) Not NULL, " + "REPORTNAME varchar(255), " + "DESCRIPTION varchar(255), " + "FILEPATH varchar(255), " + "OUTPUTMODE varchar(20), " + "HEADERREPEAT varchar(5), " + "HEADERFONT BLOB, " + "HEADERITEMS BLOB, " + "FOOTERFONT BLOB, " + "FOOTERITEMS BLOB, " + "FIELDFONT BLOB, " + "FIELDITEMS BLOB, " + "SETTING BLOB, " + "FORMAT BLOB, " + "PARAMETERS BLOB, " + "IMAGES BLOB, " + "MAILSETTING BLOB, " + "DATASOURCE_PROVIDER varchar(50)," + "DATASOURCES BLOB," + "CLIENT_QUERY BLOB," + "REPORT_TYPE varchar(1)," + "TEMPLATE_DESC varchar(50)," + "PRIMARY Key (REPORTID,FILENAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REPORT table.\n\r"; } command.CommandText = "CREATE TABLE SYS_PERSONAL" + "(" + "FORMNAME varchar(60) NOT NULL," + "COMPNAME varchar(30) NOT NULL," + "USERID varchar(20) NOT NULL," + "REMARK varchar(30)," + "PROPCONTENT CLOB," + "CREATEDATE DATE," + "PRIMARY KEY (FORMNAME,COMPNAME,USERID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_PERSONAL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_EEP_USERS" + "(" + "USERID varchar(50) NOT NULL," + "USERNAME varchar(50)," + "COMPUTER varchar(50) NOT NULL," + "LOGINTIME varchar(50)," + "LASTACTIVETIME varchar(50)," + "LOGINCOUNT integer," + "PRIMARY KEY (USERID,COMPUTER)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_EEP_USERS table.\n\r"; } } #endregion } else if (cdb.x == radioType.EEP7m) { #region EEP7m command.CommandText = "Alter Table COLDEF add " + "DEFAULT_VALUE varchar(100), " + "CHECK_NULL varchar(1), " + "QUERYMODE varchar(20), " + "CAPTION1 varchar (40), " + "CAPTION2 varchar (40), " + "CAPTION3 varchar (40), " + "CAPTION4 varchar (40), " + "CAPTION5 varchar (40), " + "CAPTION6 varchar (40), " + "CAPTION7 varchar (40), " + "CAPTION8 varchar (40)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPMENUS alter column MENUID varchar (30)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table GROUPS add MSAD varchar (1)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPS alter column GROUPNAME varchar (50)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPS alter column DESCRIPTION varchar (200)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table MENUTABLE add " + "MODULETYPE varchar(1), " + "PACKAGEDATE DATE, " + "IMAGE BLOB, " + "OWNER varchar(20), " + "ISSERVER varchar(1), " + "VERSIONNO varchar(20), " + "CHECKOUT varchar(20), " + "CHECKOUTDATE DATE, " + "CAPTION0 varchar(50), " + "CAPTION1 varchar(50), " + "CAPTION2 varchar(50), " + "CAPTION3 varchar(50), " + "CAPTION4 varchar(50), " + "CAPTION5 varchar(50), " + "CAPTION6 varchar(50), " + "CAPTION7 varchar(50), " + "IMAGEURL varchar(100)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table MENUTABLE alter column MENUID varchar(30)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table MENUTABLE alter column ITEMTYPE varchar(20)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table USERMENUS alter column MENUID varchar(30)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table USERS add " + "EMAIL varchar(40), " + "LASTTIME varchar(8), " + "AUTOLOGIN varchar(1), " + "LASTDATE varchar(8), " + "SIGNATURE varchar(30), " + "MSAD varchar(1)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } #endregion } else if (cdb.x == radioType.EEP2006m) { #region EEP2006m command.CommandText = "Alter Table MENUFAVOR ADD GROUPNAME varchar(20)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('0','直屬主管')"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table SYS_TODOLIST ADD ATTACHMENTS varchar(255)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table SYS_TODOHIS ADD ATTACHMENTS varchar(255)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } #endregion } //odbc未测试 else if (cdb.x == radioType.WorkFlow) { #region WorkFlow //GROUPS command.CommandText = "ALTER TABLE GROUPS ADD ISROLE CHAR(1)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not add ISROLE column to GROUPS table.\n\r"; } // SYS_ORG command.CommandText = "CREATE TABLE SYS_ORG(" + "ORG_NO varchar(8) NOT NULL," + "ORG_DESC varchar(40) NOT NULL," + "ORG_KIND varchar(4) NOT NULL," + "UPPER_ORG varchar(8)," + "ORG_MAN varchar(20) NOT NULL," + "LEVEL_NO varchar(6) NOT NULL," + "ORG_TREE varchar(40)," + "END_ORG varchar(4)," + "ORG_FULLNAME varchar(254)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORG(ORG_NO,ORG_DESC,ORG_KIND,ORG_MAN,LEVEL_NO) Values ('1','總公司','0','001','9')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORG table.\n\r"; } // SYS_ORGKIND command.CommandText = "CREATE TABLE SYS_ORGKIND(" + "ORG_KIND varchar(4) NOT NULL," + "KIND_DESC varchar(40) NOT NULL" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGKIND(ORG_KIND,KIND_DESC) Values ('0','公司組織')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGKIND table.\n\r"; } // SYS_ORGLEVEL command.CommandText = "CREATE TABLE SYS_ORGLEVEL(" + "LEVEL_NO varchar(6) NOT NULL," + "LEVEL_DESC varchar(40) NOT NULL" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('0','直屬主管')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('1','主任/課長/副理')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('2','經理')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('3','副總')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('9','總經理')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGLEVEL table.\n\r"; } // SYS_ORGROLES command.CommandText = "CREATE TABLE SYS_ORGROLES(" + "ORG_NO varchar(8) NOT NULL," + "ROLE_ID varchar(20) NOT NULL," + "ORG_KIND varchar(4)," + "PRIMARY KEY(ORG_NO,ROLE_ID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGROLES table.\n\r"; } command.CommandText = "CREATE INDEX ORGNO ON SYS_ORGROLES (ORG_NO, ROLE_ID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX ORGNO on table SYS_ORGROLES .\n\r"; } // SYS_ROLES_AGENT command.CommandText = "CREATE TABLE SYS_ROLES_AGENT(" + "ROLE_ID varchar(20) NOT NULL," + "AGENT varchar(20) NOT NULL," + "FLOW_DESC varchar(40) NOT NULL," + "START_DATE varchar(8) NOT NULL," + "START_TIME varchar(6)," + "END_DATE varchar(8) NOT NULL," + "END_TIME varchar(6)," + "PAR_AGENT varchar(4) NOT NULL," + "REMARK varchar(254)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ROLES_AGENT table.\n\r"; } command.CommandText = "CREATE INDEX ROLEID ON SYS_ROLES_AGENT (ROLE_ID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX ROLEID on table SYS_ROLES_AGENT .\n\r"; } // SYS_TODOHIS command.CommandText = "CREATE TABLE SYS_TODOHIS(" + "LISTID varchar(40) NOT NULL," + "FLOW_ID varchar(40) NOT NULL," + "FLOW_DESC varchar(40)," + "ROLE_ID varchar(20) NOT NULL," + "S_ROLE_ID varchar(20) NOT NULL," + "S_STEP_ID varchar(20) NOT NULL," + "D_STEP_ID varchar(20) NOT NULL," + "S_STEP_DESC varchar(64)," + "S_USER_ID varchar(20) NOT NULL," + "USER_ID varchar(20) NOT NULL," + "USERNAME varchar(30)," + "FORM_NAME varchar(30)," + "WEBFORM_NAME varchar(50) NOT NULL," + "S_USERNAME varchar(30)," + "NAVIGATOR_MODE varchar(2) NOT NULL," + "FLNAVIGATOR_MODE varchar(2) NOT NULL," + "PARAMETERS varchar(254)," + "STATUS varchar(4)," + "PROC_TIME decimal(8, 2) NOT NULL," + "EXP_TIME decimal(8, 2) NOT NULL," + "TIME_UNIT varchar(4) NOT NULL," + "FLOWIMPORTANT varchar(1) NOT NULL," + "FLOWURGENT varchar(1) NOT NULL," + "FORM_TABLE varchar(30)," + "FORM_KEYS varchar(254)," + "FORM_PRESENTATION varchar(254)," + "REMARK varchar(254)," + "VERSION varchar(2)," + "VDSNAME varchar(40)," + "SENDBACKSTEP varchar(2)," + "LEVEL_NO varchar(6)," + "UPDATE_DATE varchar(10)," + "UPDATE_TIME varchar(8)," + "FORM_PRESENT_CT varchar(254)," + "ATTACHMENTS varchar(255)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_TODOHIS table.\n\r"; } command.CommandText = "CREATE INDEX LISTID ON SYS_TODOHIS (LISTID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX LISTID on table SYS_TODOHIS.\n\r"; } command.CommandText = "CREATE INDEX USERID ON SYS_TODOHIS (USER_ID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX USERID on table SYS_TODOHIS.\n\r"; } // SYS_TODOLIST command.CommandText = "CREATE TABLE SYS_TODOLIST(" + "LISTID varchar(40) NOT NULL," + "FLOW_ID varchar(40) NOT NULL," + "FLOW_DESC varchar(40)," + "APPLICANT varchar(20) NOT NULL," + "S_USER_ID varchar(20) NOT NULL," + "S_STEP_ID varchar(20) NOT NULL," + "S_STEP_DESC varchar(64)," + "D_STEP_ID varchar(20) NOT NULL," + "D_STEP_DESC varchar(64)," + "EXP_TIME decimal(8, 2) NOT NULL," + "URGENT_TIME decimal(8, 2) NOT NULL," + "TIME_UNIT varchar(4) NOT NULL," + "USERNAME varchar(30)," + "FORM_NAME varchar(30)," + "NAVIGATOR_MODE varchar(2) NOT NULL," + "FLNAVIGATOR_MODE varchar(2) NOT NULL," + "PARAMETERS varchar(254)," + "SENDTO_KIND varchar(4) NOT NULL," + "SENDTO_ID varchar(20) NOT NULL," + "FLOWIMPORTANT varchar(1) NOT NULL," + "FLOWURGENT varchar(1) NOT NULL," + "STATUS varchar(4)," + "FORM_TABLE varchar(30)," + "FORM_KEYS varchar(254)," + "FORM_PRESENTATION varchar(254)," + "FORM_PRESENT_CT varchar(254) NOT NULL," + "REMARK varchar(254)," + "PROVIDER_NAME varchar(254)," + "VERSION varchar(2)," + "EMAIL_ADD varchar(40)," + "EMAIL_STATUS varchar(1)," + "VDSNAME varchar(40)," + "SENDBACKSTEP varchar(2)," + "LEVEL_NO varchar(6)," + "WEBFORM_NAME varchar(50) NOT NULL," + "UPDATE_DATE varchar(10)," + "UPDATE_TIME varchar(8)," + "FLOWPATH varchar(100) NOT NULL," + "PLUSAPPROVE varchar(1) NOT NULL," + "PLUSROLES varchar(254) NOT NULL," + "MULTISTEPRETURN varchar(1)," + "SENDTO_NAME varchar(30)," + "ATTACHMENTS varchar(255)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_TODOLIST table.\n\r"; } command.CommandText = "CREATE INDEX LISTID ON SYS_TODOLIST (LISTID)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX LISTID on table SYS_TODOLIST.\n\r"; } command.CommandText = "CREATE INDEX SENDTOID ON SYS_TODOLIST (SENDTO_ID, SENDTO_KIND)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX SENDTOID on table SYS_TODOLIST.\n\r"; } command.CommandText = "CREATE INDEX FLOWDESC ON SYS_TODOLIST (FLOW_DESC)"; try { command.ExecuteNonQuery(); } catch { result += "Can not create INDEX FLOWDESC on table SYS_TODOLIST.\n\r"; } // SYS_FLDefinition command.CommandText = "CREATE TABLE SYS_FLDEFINITION" + "(" + "FLTYPEID varchar(50) NOT NULL, " + "FLTYPENAME varchar(200) NOT NULL, " + "FLDEFINITION CLOB NOT NULL, " + "VERSION integer, " + "PRIMARY KEY(FLTYPEID) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_FLDEFINITION table.\n\r"; } // SYS_FLInstanceState command.CommandText = "CREATE TABLE SYS_FLINSTANCESTATE" + "(" + "FLINSTANCEID varchar(50) NOT NULL, " + "STATE BLOB NOT NULL, " + "STATUS integer, " + "INFO varchar(200)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_FLINSTANCESTATE table.\n\r"; } // Sys_ExtApprove command.CommandText = "CREATE TABLE SYS_EXTAPPROVE" + "(" + "APPROVEID varchavarcharULL, " + "GROUPID varchavarcharULL, " + "MINIMUM varchavarcharULL, " + "MAXIMUM varchavarcharULL," + "ROLEID varchavarcharULL" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_EXTAPPROVE table.\n\r"; } #endregion } if (result != "") MessageBox.Show(result); else if (cdb.x == radioType.typical) MessageBox.Show("Create all System Tables successfully."); else if (cdb.x == radioType.simplified) MessageBox.Show("Create table COLDEF table and table SYSAUTONUM successfully."); else if (cdb.x == radioType.EEP7m) MessageBox.Show("Alter successfully."); else if (cdb.x == radioType.EEP2006m) MessageBox.Show("EEP 2006 2.1.0.1(SP2) Migration success"); else if (cdb.x == radioType.WorkFlow) MessageBox.Show("Create WorkFlow Tables successfully."); } }
public void CreateOracleSystemTable(IDbCommand command) { frmCreateDB cdb = new frmCreateDB(); cdb.ShowDialog(); if (cdb.DialogResult == DialogResult.OK) { string result = ""; if (cdb.x == radioType.simplified || cdb.x == radioType.typical) { #region Simplified command.CommandText = "CREATE TABLE COLDEF" + "(" + "TABLE_NAME varchar2(20) NOT NULL, " + "FIELD_NAME varchar2(20) NOT NULL, " + "SEQ NUMERIC(12,0) NULL, " + "FIELD_TYPE varchar2(20) NULL, " + "IS_KEY varchar2(1) NOT NULL, " + "FIELD_LENGTH NUMERIC(12,0) NULL, " + "CAPTION varchar2(40) NULL, " + "EDITMASK varchar2(10) NULL, " + "NEEDBOX varchar2(13) NULL, " + "CANREPORT varchar2(1) NULL, " + "EXT_MENUID varchar2(20) NULL, " + "FIELD_SCALE NUMERIC(12,0) NULL, " + "DD_NAME varchar2(40) NULL, " + "DEFAULT_VALUE varchar2(100) NULL, " + "CHECK_NULL varchar2(1) NULL, " + "QUERYMODE varchar2(20) NULL, " + "CAPTION1 varchar2(40) NULL, " + "CAPTION2 varchar2(40) NULL, " + "CAPTION3 varchar2(40) NULL, " + "CAPTION4 varchar2(40) NULL, " + "CAPTION5 varchar2(40) NULL, " + "CAPTION6 varchar2(40) NULL, " + "CAPTION7 varchar2(40) NULL, " + "CAPTION8 varchar2(40) NULL, " + "PRIMARY KEY(TABLE_NAME,FIELD_NAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create COLDEF table.\n\r"; } command.CommandText = "CREATE INDEX TABLENAME ON COLDEF(TABLE_NAME,FIELD_NAME)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX TABLENAME on table COLDEF .\n\r"; } command.CommandText = "CREATE TABLE SYSAUTONUM " + "(" + "AUTOID VARCHAR2(20) NOT NULL, " + "FIXED VARCHAR2(20) NOT NULL, " + "CURRNUM NUMERIC(10,0) NULL, " + "DESCRIPTION VARCHAR2(50) NULL, " + "PRIMARY KEY (AUTOID, FIXED)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSAUTONUM table.\n\r"; } #endregion #region Typical if (cdb.x == radioType.typical) { //// Create GROUPFORMS //command.CommandText = "CREATE TABLE GROUPFORMS (" // + "GROUPID nvarchar (20) NOT NULL ," // + "PACKAGE_NAME nvarchar (50) NOT NULL ," // + "FORM_NAME nvarchar (50) NULL ," // + "PARENT_MENU nvarchar (50) NULL " // + ")"; //try //{ // command.ExecuteNonQuery(); //} //catch //{ // result += "Can not create GROUPFORMS table.\n\r"; //} // Create GROUPMENUS command.CommandText = "CREATE TABLE GROUPMENUS (" + "GROUPID varchar2 (20) NOT NULL ," + "MENUID varchar2 (30) NOT NULL, " + "PRIMARY KEY(GROUPID,MENUID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create GROUPMENUS table.\n\r"; } // Create USERMENUS command.CommandText = "CREATE TABLE USERMENUS (" + "USERID varchar2 (20) NOT NULL ," + "MENUID varchar2 (30) NOT NULL, " + "PRIMARY KEY(USERID,MENUID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create USERMENUS table.\n\r"; } // Create GROUPS command.CommandText = "CREATE TABLE GROUPS (" + "GROUPID varchar2 (20) NOT NULL ," + "GROUPNAME varchar2 (50) NULL ," + "DESCRIPTION varchar2 (100) NULL ," + "MSAD varchar2 (1) NULL, " + "ISROLE char(1) NULL ," + "PRIMARY KEY(GROUPID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO GROUPS(GROUPID, GROUPNAME, MSAD) VALUES('00', 'EveryOne', 'N')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO GROUPS(GROUPID, GROUPNAME, MSAD) VALUES('01', 'DEPARTMENT1', 'N')"; command.ExecuteNonQuery(); } catch { result += "Can not create GROUPS table.\n\r"; } // Create MENUITEMTYPE command.CommandText = "CREATE TABLE MENUITEMTYPE (" + "ITEMTYPE varchar2 (20) NOT NULL ," + "ITEMNAME varchar2 (20) NULL, " + "DBALIAS varchar2(50) NULL, " + "PRIMARY KEY(ITEMTYPE)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO MENUITEMTYPE(ITEMTYPE, ITEMNAME) VALUES('SOLUTION1', 'DEFAULT SOLUTION')"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUITEMTYPE table.\n\r"; } // Create MENUTABLE command.CommandText = "CREATE TABLE MENUTABLE (" + "MENUID nvarchar2 (30) NOT NULL ," + "CAPTION nvarchar2 (50) NOT NULL ," + "PARENT nvarchar2 (20) NULL ," + "PACKAGE nvarchar2 (60) NULL ," + "MODULETYPE nvarchar2 (1) NULL ," + "ITEMPARAM nvarchar2 (200) NULL ," + "FORM nvarchar2 (32) NULL ," + "ISSHOWMODAL nvarchar2 (1) NULL ," + "ITEMTYPE nvarchar2 (20) NULL ," + "SEQ_NO nvarchar2 (4) NULL," + "PACKAGEDATE Date," + "ISSERVER nvarchar2(1)," + "VERSIONNO nvarchar2(20)," + "CHECKOUT nvarchar2(20)," + "CHECKOUTDATE date," + "CAPTION0 nvarchar2(50) NULL," + "CAPTION1 nvarchar2(50) NULL," + "CAPTION2 nvarchar2(50) NULL," + "CAPTION3 nvarchar2(50) NULL," + "CAPTION4 nvarchar2(50) NULL," + "CAPTION5 nvarchar2(50) NULL," + "CAPTION6 nvarchar2(50) NULL," + "CAPTION7 nvarchar2(50) NULL," + "IMAGE blob NULL," + "IMAGEURL varchar2(100) NULL, " + "OWNER varchar2(20)," + "PRIMARY KEY(MENUID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO MENUTABLE(MENUID, CAPTION, ITEMTYPE, MODULETYPE) VALUES('0', 'ROOT', 'SOLUTION1', 'F')"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLE table.\n\r"; } // Create USERGROUPS command.CommandText = "CREATE TABLE USERGROUPS (" + "USERID varchar2 (20) NOT NULL ," + "GROUPID varchar2 (20) NOT NULL, " + "PRIMARY KEY(USERID,GROUPID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO USERGROUPS(USERID, GROUPID) VALUES('001', '01')"; command.ExecuteNonQuery(); } catch { result += "Can not create USERGROUPS table.\n\r"; } // Create USERS command.CommandText = "CREATE TABLE USERS (" + "USERID varchar2 (20) NOT NULL ," + "USERNAME varchar2 (30) NULL ," + "AGENT varchar2 (20) NULL ," + "PWD varchar2 (10) NULL ," + "CREATEDATE varchar2 (8) NULL ," + "CREATER varchar2 (20) NULL ," + "DESCRIPTION varchar2 (100) NULL ," + "EMAIL varchar2 (40) NULL ," + "LASTTIME varchar2 (8) NULL ," + "AUTOLOGIN varchar2 (1)," + "LASTDATE varchar2 (8) NULL ," + "SIGNATURE varchar2 (30) NULL ," + "MSAD varchar2 (1) NULL, " + "PRIMARY KEY(USERID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO USERS(USERID, USERNAME, PWD, MSAD,AUTOLOGIN) VALUES('001', 'TEST', '', 'N','S')"; command.ExecuteNonQuery(); } catch { result += "Can not create USERS table.\n\r"; } // Create MENUTABLELOG command.CommandText = "CREATE TABLE MENUTABLELOG" + "(" + "LOGID number(10)," + "MENUID varchar2(30) not null," + "PACKAGE varchar2(20) not null," + "PACKAGEDATE DATE," + "LASTDATE DATE," + "OWNER varchar2(20)," + "OLDVERSION blob," + "OLDDATE varchar2(20), " + "PRIMARY KEY(LOGID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "CREATE SEQUENCE MENUTABLELOG_LODID_SEQ " + "START WITH 1 " + "MAXVALUE 9999999999 " + "MINVALUE 1 " + "NOCYCLE " + "NOCACHE " + "NOORDER"; command.ExecuteNonQuery(); command.CommandText = "CREATE OR REPLACE TRIGGER MENUTABLELOG_LODID" + " BEFORE INSERT" + " ON MENUTABLELOG" + " FOR EACH ROW" + " DECLARE" + " NEXT_ID NUMBER;" + " BEGIN" + " SELECT MENUTABLELOG_LODID_SEQ.NEXTVAL INTO NEXT_ID FROM dual;" + " :NEW.LOGID := NEXT_ID;" + " END;"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLELOG table.\n\r"; } // Create MENUCHECKLOG command.CommandText = "CREATE TABLE MENUCHECKLOG" + "(" + "LOGID number(10)," + "ITEMTYPE varchar2(20) not null," + "PACKAGE varchar2(50) not null," + "PACKAGEDATE Date," + "FILETYPE varchar2(10)," + "FILENAME varchar2(60)," + "FILEDATE Date," + "FILECONTENT blob, " + "PRIMARY KEY(LOGID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "CREATE SEQUENCE MENUCHECKLOG_LODID_SEQ " + "START WITH 1 " + "MAXVALUE 9999999999 " + "MINVALUE 1 " + "NOCYCLE " + "NOCACHE " + "NOORDER"; command.ExecuteNonQuery(); command.CommandText = "CREATE OR REPLACE TRIGGER MENUCHECKLOG_LODID" + " BEFORE INSERT" + " ON MENUCHECKLOG" + " FOR EACH ROW" + " DECLARE" + " NEXT_ID NUMBER;" + " BEGIN" + " SELECT MENUCHECKLOG_LODID_SEQ.NEXTVAL INTO NEXT_ID FROM dual;" + " :NEW.LOGID := NEXT_ID;" + " END;"; command.ExecuteNonQuery(); } catch { result += "Can not create MENUCHECKLOG table.\n\r"; } // Create SYSEEPLOG command.CommandText = "CREATE TABLE SYSEEPLOG" + "(" + "CONNID varchar2(20) NOT NULL," + "LOGID number(10) NOT NULL," + "LOGSTYLE varchar2(1) NOT NULL," + "LOGDATETIME DATE NOT NULL," + "DOMAINID varchar2(30) NULL," + "USERID varchar2(20) NULL," + "LOGTYPE varchar2(1) NULL," + "TITLE varchar2(64) NULL," + "DESCRIPTION LONG NULL," + "COMPUTERIP varchar2(16) NULL," + "COMPUTERNAME varchar2(64) NULL," + "EXECUTIONTIME INT NULL," + "PRIMARY KEY(CONNID,LOGID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "CREATE SEQUENCE SYSEEPLOG_LOGID_SEQ " + "START WITH 1 " + "MAXVALUE 9999999999 " + "MINVALUE 1 " + "CYCLE " + "NOCACHE " + "NOORDER"; command.ExecuteNonQuery(); command.CommandText = "CREATE OR REPLACE TRIGGER SYSEEPLOG_LOGID" + " BEFORE INSERT" + " ON SYSEEPLOG" + " FOR EACH ROW" + " DECLARE" + " NEXT_ID NUMBER;" + " BEGIN" + " SELECT SYSEEPLOG_LOGID_SEQ.NEXTVAL INTO NEXT_ID FROM dual;" + " :NEW.LOGID := NEXT_ID;" + " END;"; command.ExecuteNonQuery(); } catch { result += "Can not create SYSEEPLOG table.\n\r"; } // Create SYSSQLLOG command.CommandText = "CREATE TABLE SYSSQLLOG(" + "LOGSTYLE varchar2(1)," + "LOGDATETIME Date," + "USERID varchar2(20)," + "DEVELOPERID varchar2(20)," + "DESCRIPTION blob," + "SQLSENTENCE varchar2(max)" + ");"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYSSQLLOG table.\n\r"; } // Create SYSERRLOG command.CommandText = "CREATE TABLE SYSERRLOG" + "(" + "ERRID number(10)," + "USERID varchar2(20), " + "MODULENAME varchar2(30)," + "ERRMESSAGE varchar2(255)," + "ERRSTACK varchar2(255)," + "ERRDESCRIP varchar2(255)," + "ERRDATE Date," + "ERRSCREEN blob," + "OWNER varchar2(20)," + "PROCESSDATE Date," + "PROCDESCRIP varchar2(255)," + "STATUS varchar2(2), " + "PRIMARY KEY(ERRID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "CREATE SEQUENCE SYSERRLOG_ErrID_SEQ " + "START WITH 1 " + "MAXVALUE 9999999999 " + "MINVALUE 1 " + "NOCYCLE " + "NOCACHE " + "NOORDER"; command.ExecuteNonQuery(); command.CommandText = "CREATE OR REPLACE TRIGGER SYSERRLOG_ErrID" + " BEFORE INSERT" + " ON SYSERRLOG" + " FOR EACH ROW" + " DECLARE" + " NEXT_ID NUMBER;" + " BEGIN" + " SELECT SYSERRLOG_ErrID_SEQ.NEXTVAL INTO NEXT_ID FROM dual;" + " :NEW.ErrID := NEXT_ID;" + " END;"; command.ExecuteNonQuery(); } catch { result += "Can not create SYSERRLOG table.\n\r"; } command.CommandText = "CREATE TABLE SYS_LANGUAGE" + "(" + "ID number(10) NOT NULL," + "IDENTIFICATION varchar2(80)," + "KEYS varchar2(80)," + "EN varchar2(80)," + "CHT varchar2(80)," + "CHS varchar2(80)," + "HK varchar2(80)," + "JA varchar2(80)," + "KO varchar2(80)," + "LAN1 varchar2(80)," + "LAN2 varchar2(80), " + "PRIMARY KEY(ID)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "CREATE SEQUENCE SYS_LANGUAGE_ID_SEQ " + "START WITH 1 " + "MAXVALUE 9999999999 " + "MINVALUE 1 " + "NOCYCLE " + "NOCACHE " + "NOORDER"; command.ExecuteNonQuery(); command.CommandText = "CREATE OR REPLACE TRIGGER SYS_LANGUAGE_ID" + " BEFORE INSERT" + " ON SYS_LANGUAGE" + " FOR EACH ROW" + " DECLARE" + " NEXT_ID NUMBER;" + " BEGIN" + " SELECT SYS_LANGUAGE_ID_SEQ.NEXTVAL INTO NEXT_ID FROM dual;" + " :NEW.ID := NEXT_ID;" + " END;"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_LANGUAGE table.\n\r"; } command.CommandText = "CREATE TABLE SYS_MESSENGER" + "(" + "USERID varchar2(20) NOT NULL," + "MESSAGE varchar2(255)," + "PARAS varchar2(255)," + "SENDTIME varchar2(14)," + "SENDERID varchar2(20)," + "RECTIME varchar2(14)," + "STATUS char(1)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_MESSENGER table.\n\r"; } //CreateMenuTableControl command.CommandText = "CREATE TABLE MENUTABLECONTROL" + "(" + "MENUID varchar2 (30) NOT NULL, " + "CONTROLNAME Varchar2 (50) NOT NULL, " + "DESCRIPTION Varchar2 (50) NULL, " + "TYPE Varchar (20) NULL, " + "PRIMARY KEY(MENUID,CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUTABLECONTROL table.\n\r"; } //CreateGroupMenuControl command.CommandText = "CREATE TABLE GROUPMENUCONTROL" + "(" + "GROUPID Varchar2 (20) NOT NULL, " + "MENUID Varchar2 (30) NOT NULL, " + "CONTROLNAME Varchar2 (50) NOT NULL, " + "TYPE Varchar2 (20) NULL, " + "ENABLED CHAR (1) NULL, " + "VISIBLE CHAR (1) NULL, " + "ALLOWADD CHAR (1) NULL, " + "ALLOWUPDATE CHAR (1) NULL, " + "ALLOWDELETE CHAR (1) NULL, " + "ALLOWPRINT CHAR (1) NULL, " + "PRIMARY KEY(GROUPID,MENUID,CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create GROUPMENUCONTROL table.\n\r"; } //CreateUserMenuControl command.CommandText = "CREATE TABLE USERMENUCONTROL" + "(" + "USERID Varchar2 (20) NOT NULL, " + "MENUID Varchar2 (30) NOT NULL, " + "CONTROLNAME Varchar2 (50) NOT NULL, " + "TYPE Varchar2 (20) NULL, " + "ENABLED CHAR (1) NULL, " + "VISIBLE CHAR (1) NULL, " + "ALLOWADD CHAR (1) NULL, " + "ALLOWUPDATE CHAR (1) NULL, " + "ALLOWDELETE CHAR (1) NULL, " + "ALLOWPRINT CHAR (1) NULL, " + "PRIMARY KEY(USERID,MENUID,CONTROLNAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create USERMENUCONTROL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REFVAL" + "(" + "REFVAL_NO Varchar2(100) Not NULL, " + "DESCRIPTION Varchar2(250), " + "TABLE_NAME Varchar2(100), " + "CAPTION Varchar2(100), " + "DISPLAY_MEMBER Varchar2(100), " + "SELECT_ALIAS Varchar2(250), " + "SELECT_COMMAND Varchar2(250), " + "VALUE_MEMBER Varchar2(100), " + "CONSTRAINT PK_SYS_REFVAL PRIMARY KEY(REFVAL_NO) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REFVAL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REFVAL_D1" + "(" + "REFVAL_NO Varchar2(30) NOT NULL, " + "FIELD_NAME Varchar2(30) NOT NULL, " + "HEADER_TEXT Varchar2(20), " + "WIDTH INT, " + "CONSTRAINT PK_SYS_REFVAL_D1 PRIMARY KEY(REFVAL_NO, FIELD_NAME) " + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REFVAL table.\n\r"; } command.CommandText = "CREATE TABLE MENUFAVOR" + "(" + "MENUID Varchar2(30) NOT NULL, " + "CAPTION Varchar2(50) NOT NULL, " + "USERID Varchar2(20) NOT NULL, " + "ITEMTYPE Varchar(20), " + "GROUPNAME VarChar(20), " + "PRIMARY KEY (MENUID,USERID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create MENUFAVOR table.\n\r"; } command.CommandText = "CREATE TABLE SYS_ANYQUERY" + "(" + "QUERYID Varchar2(20) Not NULL, " + "USERID Varchar2(20) Not NULL, " + "TEMPLATEID Varchar2(20), " + "TABLENAME Varchar2(50), " + "LASTDATE date, " + "CONTENT blob, " + "PRIMARY Key (QUERYID,USERID,TEMPLATEID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ANYQUERY table.\n\r"; } command.CommandText = "CREATE TABLE SYS_REPORT" + "(" + "REPORTID nVarchar2(50) Not NULL, " + "FILENAME nVarchar2(50) Not NULL, " + "REPORTNAME nVarchar2(255), " + "DESCRIPTION nVarchar2(255), " + "FILEPATH nVarchar2(255), " + "OUTPUTMODE nVarchar2(20), " + "HEADERREPEAT nVarchar2(5), " + "HEADERFONT blob, " + "HEADERITEMS blob, " + "FOOTERFONT blob, " + "FOOTERITEMS blob, " + "FIELDFONT blob, " + "FIELDITEMS blob, " + "SETTING blob, " + "FORMAT blob, " + "PARAMETERS blob, " + "IMAGES blob, " + "MAILSETTING blob, " + "DATASOURCE_PROVIDER nVarchar2(50)," + "DATASOURCES blob," + "CLIENT_QUERY blob," + "REPORT_TYPE nVarchar2(1)," + "TEMPLATE_DESC nVarchar2(50)," + "PRIMARY Key (REPORTID,FILENAME)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_REPORT table.\n\r"; } command.CommandText = "CREATE TABLE SYS_PERSONAL" + "(" + "FORMNAME NVARCHAR2(60) NOT NULL," + "COMPNAME NVARCHAR2(30) NOT NULL," + "USERID NVARCHAR2(20) NOT NULL," + "REMARK NVARCHAR2(30)," + "PROPCONTENT LONG," + "CREATEDATE DATE," + "PRIMARY KEY (FORMNAME,COMPNAME,USERID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_PERSONAL table.\n\r"; } command.CommandText = "CREATE TABLE SYS_EEP_USERS" + "(" + "USERID NVARCHAR2(50) NOT NULL," + "USERNAME NVARCHAR2(50) NULL," + "COMPUTER NVARCHAR2(50) NOT NULL," + "LOGINTIME NVARCHAR2(50)," + "LASTACTIVETIME NVARCHAR2(50)," + "LOGINCOUNT INT," + "PRIMARY KEY (USERID,COMPUTER)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_EEP_USERS table.\n\r"; } } #endregion } else if (cdb.x == radioType.EEP7m) { #region EEP7m command.CommandText = "Alter Table COLDEF add (" + "DEFAULT_VALUE VARCHAR2(100) NULL, " + "CHECK_NULL VARCHAR2(1) NULL, " + "QUERYMODE VARCHAR2(20), " + "CAPTION1 VARCHAR2 (40), " + "CAPTION2 VARCHAR2 (40), " + "CAPTION3 VARCHAR2 (40), " + "CAPTION4 VARCHAR2 (40), " + "CAPTION5 VARCHAR2 (40), " + "CAPTION6 VARCHAR2 (40), " + "CAPTION7 VARCHAR2 (40), " + "CAPTION8 VARCHAR2 (40))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPMENUS modify (MENUID varchar2 (30))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table GROUPS add (MSAD VARCHAR2 (1))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPS modify (GROUPNAME varchar2 (50))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table GROUPS modify (DESCRIPTION varchar2 (200))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table MENUTABLE add(" + "MODULETYPE VARCHAR2(1), " + "PACKAGEDATE DATE, " + "IMAGE blob, " + "OWNER VARCHAR2(20), " + "ISSERVER VARCHAR2(1), " + "VERSIONNO VARCHAR2(20), " + "CHECKOUT VARCHAR2(20), " + "CHECKOUTDATE DATE, " + "CAPTION0 VARCHAR2(50), " + "CAPTION1 VARCHAR2(50), " + "CAPTION2 VARCHAR2(50), " + "CAPTION3 VARCHAR2(50), " + "CAPTION4 VARCHAR2(50), " + "CAPTION5 VARCHAR2(50), " + "CAPTION6 VARCHAR2(50), " + "CAPTION7 VARCHAR2(50), " + "IMAGEURL VARCHAR2(100))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table MENUTABLE modify (MENUID varchar2(30))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table MENUTABLE modify (ITEMTYPE varchar2(20))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter table USERMENUS modify (MENUID varchar2(30))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table USERS add(" + "EMAIL VARCHAR2(40), " + "LASTTIME VARCHAR2(8), " + "AUTOLOGIN VARCHAR2(1), " + "LASTDATE VARCHAR2(8), " + "SIGNATURE VARCHAR2(30), " + "MSAD VARCHAR2(1))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } #endregion } else if (cdb.x == radioType.EEP2006m) { #region EEP2006m command.CommandText = "Alter Table MENUFAVOR add (GROUPNAME VARCHAR2(20))"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('0','直屬主管')"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table SYS_TODOLIST add (ATTACHMENTS VARCHAR2(255) NULL)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } command.CommandText = "Alter Table SYS_TODOHIS add (ATTACHMENTS VARCHAR2(255) NULL)"; try { command.ExecuteNonQuery(); } catch (Exception e) { result += e.Message + "\n\r"; } #endregion } else if (cdb.x == radioType.WorkFlow) { #region WorkFlow //GROUPS command.CommandText = "ALTER TABLE GROUPS ADD ISROLE CHAR(1) NULL"; try { command.ExecuteNonQuery(); } catch { //result += "Can not add ISROLE column to GROUPS table.\n\r"; } // SYS_ORG command.CommandText = "CREATE TABLE SYS_ORG(" + "ORG_NO varchar2(8) NOT NULL," + "ORG_DESC varchar2(40) NOT NULL," + "ORG_KIND varchar2(4) NOT NULL," + "UPPER_ORG varchar2(8) NULL," + "ORG_MAN varchar2(20) NOT NULL," + "LEVEL_NO varchar2(6) NOT NULL," + "ORG_TREE varchar2(40) NULL," + "END_ORG varchar2(4) NULL," + "ORG_FULLNAME varchar2(254) NULL," + "PRIMARY KEY(ORG_NO)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORG(ORG_NO,ORG_DESC,ORG_KIND,ORG_MAN,LEVEL_NO) Values ('1','總公司','0','001','9')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORG table.\n\r"; } // SYS_ORGKIND command.CommandText = "CREATE TABLE SYS_ORGKIND(" + "ORG_KIND varchar2(4) NOT NULL," + "KIND_DESC varchar2(40) NOT NULL," + "PRIMARY KEY(ORG_KIND)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGKIND(ORG_KIND,KIND_DESC) Values ('0','公司組織')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGKIND table.\n\r"; } // SYS_ORGLEVEL command.CommandText = "CREATE TABLE SYS_ORGLEVEL(" + "LEVEL_NO varchar2(6) NOT NULL," + "LEVEL_DESC varchar2(40) NOT NULL," + "PRIMARY KEY(LEVEL_NO)" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('0','直屬主管')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('1','主任/課長/副理')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('2','經理')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('3','副總')"; command.ExecuteNonQuery(); command.CommandText = "INSERT INTO SYS_ORGLEVEL(LEVEL_NO,LEVEL_DESC) Values ('9','總經理')"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGLEVEL table.\n\r"; } // SYS_ORGROLES command.CommandText = "CREATE TABLE SYS_ORGROLES(" + "ORG_NO varchar2(8) NOT NULL," + "ROLE_ID varchar2(20) NOT NULL," + "ORG_KIND varchar2(4) NULL," + "PRIMARY KEY(ORG_NO,ROLE_ID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ORGROLES table.\n\r"; } command.CommandText = "CREATE INDEX ORGNO ON SYS_ORGROLES(ORG_NO, ROLE_ID)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX ORGNO on table SYS_ORGROLES .\n\r"; } // SYS_ROLES_AGENT command.CommandText = "CREATE TABLE SYS_ROLES_AGENT(" + "ROLE_ID varchar2(20) NULL," + "AGENT varchar2(20) NOT NULL," + "FLOW_DESC varchar2(40) NOT NULL," + "START_DATE varchar2(8) NOT NULL," + "START_TIME varchar2(6) NULL," + "END_DATE varchar2(8) NOT NULL," + "END_TIME varchar2(6) NULL," + "PAR_AGENT varchar2(4) NOT NULL," + "REMARK varchar2(254) NULL," + "PRIMARY KEY(ROLE_ID,AGENT)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_ROLES_AGENT table.\n\r"; } command.CommandText = "CREATE INDEX ROLEID ON SYS_ROLES_AGENT(ROLE_ID)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX ROLEID on table SYS_ROLES_AGENT .\n\r"; } // SYS_TODOHIS command.CommandText = "CREATE TABLE SYS_TODOHIS(" + "LISTID varchar2(40) NOT NULL," + "FLOW_ID varchar2(40) NOT NULL," + "FLOW_DESC varchar2(40) NULL," + "ROLE_ID varchar2(20) NULL," + "S_ROLE_ID varchar2(20) NULL," + "S_STEP_ID varchar2(20) NULL," + "D_STEP_ID varchar2(20) NULL," + "S_STEP_DESC varchar2(64) NULL," + "S_USER_ID varchar2(20) NULL," + "USER_ID varchar2(20) NOT NULL," + "USERNAME varchar2(30) NULL," + "FORM_NAME varchar2(30) NULL," + "WEBFORM_NAME varchar2(50) NULL," + "S_USERNAME varchar2(30) NULL," + "NAVIGATOR_MODE varchar2(2) NOT NULL," + "FLNAVIGATOR_MODE varchar2(2) NOT NULL," + "PARAMETERS varchar2(254) NULL," + "STATUS varchar2(4) NULL," + "PROC_TIME number(8, 2) NOT NULL," + "EXP_TIME number(8, 2) NOT NULL," + "TIME_UNIT varchar2(4) NOT NULL," + "FLOWIMPORTANT varchar2(1) NOT NULL," + "FLOWURGENT varchar2(1) NOT NULL," + "FORM_TABLE varchar2(30) NULL," + "FORM_KEYS varchar2(254) NULL," + "FORM_PRESENTATION varchar2(254) NULL," + "REMARK varchar2(254) NULL," + "VERSION varchar2(2) NULL," + "VDSNAME varchar2(40) NULL," + "SENDBACKSTEP varchar2(2) NULL," + "LEVEL_NO varchar2(6) NULL," + "UPDATE_DATE varchar2(10) NULL," + "UPDATE_TIME varchar2(8) NULL," + "FORM_PRESENT_CT varchar2(254) NULL," + "ATTACHMENTS varchar2(255) NULL," + "CREATE_TIME varchar2(50) NULL" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_TODOHIS table.\n\r"; } command.CommandText = "CREATE INDEX LISTID ON SYS_TODOHIS(LISTID)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX LISTID on table SYS_TODOHIS.\n\r"; } command.CommandText = "CREATE INDEX USERID ON SYS_TODOHIS(USER_ID)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX USERID on table SYS_TODOHIS.\n\r"; } // SYS_TODOLIST command.CommandText = "CREATE TABLE SYS_TODOLIST(" + "LISTID varchar2(40) NOT NULL," + "FLOW_ID varchar2(40) NOT NULL," + "FLOW_DESC varchar2(40) NULL," + "APPLICANT varchar2(20) NOT NULL," + "S_USER_ID varchar2(20) NULL," + "S_STEP_ID varchar2(20) NULL," + "S_STEP_DESC varchar2(64) NULL," + "D_STEP_ID varchar2(20) NULL," + "D_STEP_DESC varchar2(64) NULL," + "EXP_TIME number(8, 2) NOT NULL," + "URGENT_TIME number(8, 2) NOT NULL," + "TIME_UNIT varchar2(4) NOT NULL," + "USERNAME varchar2(30) NULL," + "FORM_NAME varchar2(30) NULL," + "NAVIGATOR_MODE varchar2(2) NOT NULL," + "FLNAVIGATOR_MODE varchar2(2) NOT NULL," + "PARAMETERS varchar2(254) NULL," + "SENDTO_KIND varchar2(4) NOT NULL," + "SENDTO_ID varchar2(20) NOT NULL," + "FLOWIMPORTANT varchar2(1) NOT NULL," + "FLOWURGENT varchar2(1) NOT NULL," + "STATUS varchar2(4) NULL," + "FORM_TABLE varchar2(30) NULL," + "FORM_KEYS varchar2(254) NULL," + "FORM_PRESENTATION varchar2(254) NULL," + "FORM_PRESENT_CT varchar2(254) NOT NULL," + "REMARK varchar2(254) NULL," + "PROVIDER_NAME varchar2(254) NULL," + "VERSION varchar2(2) NULL," + "EMAIL_ADD varchar2(40) NULL," + "EMAIL_STATUS varchar2(1) NULL," + "VDSNAME varchar2(40) NULL," + "SENDBACKSTEP varchar2(2) NULL," + "LEVEL_NO varchar2(6) NULL," + "WEBFORM_NAME varchar2(50) NULL," + "UPDATE_DATE varchar2(10) NULL," + "UPDATE_TIME varchar2(8) NULL," + "FLOWPATH varchar2(100) NOT NULL," + "PLUSAPPROVE varchar2(1) NOT NULL," + "PLUSROLES varchar2(254) NULL," + "MULTISTEPRETURN varchar2(1) NULL," + "SENDTO_NAME varchar2(30) NULL," + "ATTACHMENTS varchar2(255) NULL," + "CREATE_TIME varchar2(50) NULL" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_TODOLIST table.\n\r"; } command.CommandText = "CREATE INDEX LISTID ON SYS_TODOLIST(LISTID)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX LISTID on table SYS_TODOLIST.\n\r"; } command.CommandText = "CREATE INDEX SENDTOID ON SYS_TODOLIST(SENDTO_ID, SENDTO_KIND)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX SENDTOID on table SYS_TODOLIST.\n\r"; } command.CommandText = "CREATE INDEX FLOWDESC ON SYS_TODOLIST(FLOW_DESC)"; try { command.ExecuteNonQuery(); } catch { //result += "Can not create INDEX FLOWDESC on table SYS_TODOLIST.\n\r"; } // SYS_FLDefinition command.CommandText = "CREATE TABLE SYS_FLDEFINITION" + "(" + "FLTYPEID varchar2(50) NOT NULL, " + "FLTYPENAME varchar2(200) NOT NULL, " + "FLDEFINITION blob NOT NULL, " + "VERSION int NULL," + "PRIMARY KEY(FLTYPEID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_FLDEFINITION table.\n\r"; } // SYS_FLInstanceState command.CommandText = "CREATE TABLE SYS_FLINSTANCESTATE" + "(" + "FLINSTANCEID varchar2(50) NOT NULL, " + "STATE blob NOT NULL, " + "STATUS int NULL, " + "INFO varchar2(200) NULL," + "PRIMARY KEY(FLINSTANCEID)" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_FLINSTANCESTATE table.\n\r"; } // Sys_ExtApprove command.CommandText = "CREATE TABLE SYS_EXTAPPROVE" + "(" + "APPROVEID varchar2(50) NULL, " + "GROUPID varchar2(50) NULL, " + "MINIMUM varchar2(50) NULL, " + "MAXIMUM varchar2(50) NULL," + "ROLEID varchar2(50) NULL" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_EXTAPPROVE table.\n\r"; } #endregion } else if (cdb.x == radioType.EEPCloud) { #region EEPCloud //[SYS_SDALIAS] command.CommandText = "CREATE TABLE SYS_SDALIAS(" + " USERID varchar2(20) NOT NULL, " + " ALIASNAME varchar2(30) NOT NULL, " + " SYSTEMALIAS varchar2(30) NULL, " + " DBNAME varchar2(25) NOT NULL, " + " SPLIT number NULL, " + " CONSTRAINT PK_SYS_SDALIAS PRIMARY KEY " + "( " + " USERID , " + " ALIASNAME , " + " DBNAME " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_SDALIAS table.\n\r"; } //[SYS_SDGROUPS] command.CommandText = "CREATE TABLE SYS_SDGROUPS(" + " GROUPID varchar2(20) NOT NULL, " + " GROUPNAME varchar2(30) NULL, " + " CONSTRAINT PK_SYS_SDGROUPS PRIMARY KEY " + "( " + " GROUPID " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_SDGROUPS table.\n\r"; } //[SYS_SDQUEUE] command.CommandText = "CREATE TABLE SYS_SDQUEUE(" + " ID int NOT NULL, " + " USERID varchar2(30) NOT NULL, " + " PAGETYPE char(1) NOT NULL, " + " CREATETIME date NULL, " + " FINISHTIME date NULL, " + " FINISHFLAG number NOT NULL, " + " DOCUMENT blob NULL, " + " FILENAME varchar2(40) NULL, " + " PRINTSETTING varchar2(40) NULL, " + " CONSTRAINT PK_SYS_SDQUEUE PRIMARY KEY " + "( " + " ID " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_SDQUEUE table.\n\r"; } //[SYS_SDQUEUEPAGE] command.CommandText = "CREATE TABLE SYS_SDQUEUEPAGE(" + " ID int NOT NULL, " + " DOCUMENT blob NOT NULL, " + " PHOTO blob NULL, " + " PAGENAME varchar2(30) NOT NULL, " + " CONSTRAINT PK_SYS_SDQUEUEPAGE PRIMARY KEY " + "( " + " ID , " + " PAGENAME " + ")" + ")"; try { command.ExecuteNonQuery(); command.CommandText = "ALTER TABLE SYS_SDQUEUEPAGE WITH CHECK ADD CONSTRAINT FK_SYS_SDQUEUEPAGE_SYS_SDQUEUE FOREIGN KEY(ID) " + "REFERENCES SYS_SDQUEUE (ID)"; command.ExecuteNonQuery(); command.CommandText = "ALTER TABLE SYS_SDQUEUEPAGE CHECK CONSTRAINT FK_SYS_SDQUEUEPAGE_SYS_SDQUEUE"; command.ExecuteNonQuery(); } catch { result += "Can not create SYS_SDQUEUEPAGE table.\n\r"; } //[SYS_SDSOLUTIONS] command.CommandText = "CREATE TABLE SYS_SDSOLUTIONS(" + " USERID varchar2(20) NOT NULL, " + " SOLUTIONID varchar2(30) NOT NULL, " + " SOLUTIONNAME nvarchar2(30) NULL, " + " MOUDLEXMLTEXT nvarchar2(max) NOT NULL, " + " SETTING blob NULL, " + " ALIASOPTIONS varchar2(250) NULL, " + " LOGONIMAGE blob NULL, " + " BGSTARTCOLOR varchar2(9) NULL, " + " BGENDCOLOR varchar2(9) NULL, " + " THEME varchar2(20) NULL, " + " COMPANY nvarchar2(30) NULL, " + " PAGESAVEOPTION int NULL, " + " CONSTRAINT PK_SYS_SDSOLUTIONS PRIMARY KEY " + "( " + " USERID , " + " SOLUTIONID " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_SDSOLUTIONS table.\n\r"; } //[SYS_SDUSERS] command.CommandText = "CREATE TABLE SYS_SDUSERS(" + " USERID varchar2(20) NOT NULL, " + " USERNAME nvarchar2(30) NULL, " + " PASSWORD varchar2(20) NULL, " + " GROUPID varchar2(20) NULL, " + " LASTDATE date NULL, " + " EMAIL nvarchar2(50) NULL, " + " SYSTYPE nvarchar2(1) NULL, " + " CONSTRAINT PK_SYS_SDUSERS PRIMARY KEY " + "( " + " USERID " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_SDUSERS table.\n\r"; } //[SYS_SDUSERS_LOG] iii command.CommandText = "CREATE TABLE SYS_SDUSERS_LOG(" + " ID int NOT NULL, " + " USERID varchar2(20) NOT NULL, " + " IPADDRESS varchar2(20) NOT NULL, " + " LOGINTIME date NOT NULL, " + " LOGOUTTIME date NOT NULL, " + " CONSTRAINT PK_SYS_SDUSERS_LOG PRIMARY KEY " + "( " + " ID " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_SDUSERS_LOG table.\n\r"; } //[SYS_WEBPAGES] command.CommandText = "CREATE TABLE SYS_WEBPAGES(" + " PAGENAME varchar2(30) NOT NULL, " + " PAGETYPE char(1) NOT NULL, " + " DESCRIPTION varchar2(60) NULL, " + " CONTENT blob NULL, " + " USERID varchar2(20) NOT NULL, " + " SOLUTIONID varchar2(30) NOT NULL, " + " SERVERDLL blob NULL, " + " CHECKOUT number NULL, " + " CHECKOUTDATE date NULL, " + " CHECKOUTUSER varchar2(20) NULL, " + " CONSTRAINT PK_SYS_WEBPAGES PRIMARY KEY " + "( " + " PAGENAME , " + " PAGETYPE , " + " USERID , " + " SOLUTIONID " + ")" + ") "; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_WEBPAGES table.\n\r"; } //[SYS_WEBPAGES_LOG] iii command.CommandText = "CREATE TABLE SYS_WEBPAGES_LOG(" + " PAGENAME varchar2(30) NOT NULL, " + " PAGETYPE char(1) NOT NULL, " + " DESCRIPTION varchar2(60) NULL, " + " CONTENT blob NULL, " + " USERID varchar2(20) NOT NULL, " + " SOLUTIONID varchar2(30) NOT NULL, " + " SERVERDLL blob NULL, " + " CHECKINDATE date NOT NULL, " + " ID int NOT NULL, " + " CHECKINUSER varchar2(20) NULL, " + " CHECKINDESCRIPTION varchar2(255) NULL, " + " CONSTRAINT PK_SYS_WEBPAGES_LOG PRIMARY KEY " + "( " + " ID " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_WEBPAGES_LOG table.\n\r"; } //[SYS_WEBRUNTIME] command.CommandText = "CREATE TABLE SYS_WEBRUNTIME(" + " PAGENAME varchar2(30) NOT NULL, " + " PAGETYPE char(1) NOT NULL, " + " CONTENT blob NULL, " + " USERID varchar2(20) NOT NULL, " + " SOLUTIONID varchar2(30) NOT NULL, " + " CONSTRAINT PK_SYS_WEBRUNTIME PRIMARY KEY " + "( " + " PAGENAME , " + " PAGETYPE , " + " USERID , " + " SOLUTIONID " + ")" + ")"; try { command.ExecuteNonQuery(); } catch { result += "Can not create SYS_WEBRUNTIME table.\n\r"; } #endregion } if (result != "") MessageBox.Show(result); else if (cdb.x == radioType.typical) MessageBox.Show("Create all System Tables successfully."); else if (cdb.x == radioType.simplified) MessageBox.Show("Create table COLDEF table and table SYSAUTONUM successfully."); else if (cdb.x == radioType.EEP7m) MessageBox.Show("Alter successfully."); else if (cdb.x == radioType.EEP2006m) MessageBox.Show("EEP 2006 2.1.0.1(SP2) Migration success"); else if (cdb.x == radioType.WorkFlow) MessageBox.Show("Create WorkFlow Tables successfully."); else if (cdb.x == radioType.EEPCloud) MessageBox.Show("Create EEPCloud system tables successfully."); } }