public string Save(string fieldName, int fieldType, int length, bool isnull, bool isPrimarykey, string tableID) { string a = Shared.generateID(); DBConst dbfieldid = DBConst.String(a); DBConst dbtableID = DBConst.String(tableID); DBConst dbfieldName = DBConst.String(fieldName); DBConst dbfieldtype = DBConst.Int32(fieldType); DBConst dbisnull = DBConst.Const(DbType.Boolean, isnull); DBConst dbisprimary = DBConst.Const(DbType.Boolean, isPrimarykey); DBConst dblength = DBConst.Int32(length); DBQuery insert = DBQuery.InsertInto(TzAccount.Field.Table).Fields( TzAccount.Field.TableID.Name, TzAccount.Field.FieldID.Name, TzAccount.Field.FieldName.Name, TzAccount.Field.FieldType.Name, TzAccount.Field.Length.Name, TzAccount.Field.IsNullable.Name, TzAccount.Field.ISPrimaryKey.Name ).Values( dbtableID, dbfieldid, dbfieldName, dbfieldtype, dblength, dbisnull, dbisprimary ); int val = 0; using (DbTransaction trans = db.BeginTransaction()) { val = db.ExecuteNonQuery(trans, insert); trans.Commit(); } if (val > 0) { return(a); } else { return(""); } }
/// <summary> /// /// </summary> /// <param name="host"></param> /// <param name="dbname"></param> /// <param name="userName"></param> /// <param name="password"></param> /// <param name="port"></param> /// <returns></returns> public string Save(string host, string dbname, string userName, string password, int port , string serverName ) { DBDatabase db; db = base.Database; string a = Shared.generateID(); DBConst dbServerID = DBConst.String(a); DBConst dbHostName = DBConst.String(host); DBConst dbServerName = DBConst.String(serverName); DBConst dbDBname = DBConst.String(dbname); DBConst dbPassword = DBConst.String(password); DBConst dbUserName = DBConst.String(userName); DBConst dbPort = DBConst.Int32(port); DBQuery insert = DBQuery.InsertInto(TzAccount.Server.Table).Fields( TzAccount.Server.ServerID.Name, TzAccount.Server.Host.Name, TzAccount.Server.UserID.Name, TzAccount.Server.Password.Name, TzAccount.Server.Port.Name, TzAccount.Server.DB.Name, TzAccount.Server.ServerName.Name).Values( dbServerID, dbHostName, dbUserName, dbPassword, dbPort, dbDBname, dbServerName ); int val = 0; using (DbTransaction trans = db.BeginTransaction()) { val = db.ExecuteNonQuery(trans, insert); trans.Commit(); } if (val > 0) { return(a); } else { return(""); } }
/// <summary> /// /// </summary> /// <param name="clientid"></param> /// <param name="groupid"></param> /// <param name="userid"></param> /// <param name="componentid"></param> /// <param name="componentype"></param> /// <param name="add"></param> /// <param name="edit"></param> /// <param name="view"></param> /// <param name="remove"></param> /// <returns></returns> public string Save(string clientid, string groupid, string componentid, int componentype, bool add, bool edit, bool view, bool remove ) { string a = Shared.generateID(); var insert = DBQuery.InsertInto(TzAccount.SecurityPrivilege.Table) .Fields(TzAccount.SecurityPrivilege.PrivilegeID.Name, TzAccount.SecurityPrivilege.ClientID.Name, TzAccount.SecurityPrivilege.SecurityGroupID.Name, //TzAccount.SecurityPrivilege.UserID.Name, TzAccount.SecurityPrivilege.SecurityComponentID.Name, TzAccount.SecurityPrivilege.ComponentType.Name, TzAccount.SecurityPrivilege.Add.Name, TzAccount.SecurityPrivilege.Edit.Name, TzAccount.SecurityPrivilege.Remove.Name, TzAccount.SecurityPrivilege.View.Name ). Values(DBConst.String(a), DBConst.String(clientid), DBConst.String(groupid), // DBConst.String(userid), DBConst.String(componentid), DBConst.Int32(componentype), DBConst.Const(DbType.Boolean, add), DBConst.Const(DbType.Boolean, edit), DBConst.Const(DbType.Boolean, view), DBConst.Const(DbType.Boolean, remove)); int val = 0; using (DbTransaction trans = db.BeginTransaction()) { val = db.ExecuteNonQuery(trans, insert); trans.Commit(); } if (val > 0) { return(a); } else { return(""); } }
public string Save(string clientid, string groupName, string description, int context, bool isBase, int baseType ) { string a = Shared.generateID(); var insert = DBQuery.InsertInto(TzAccount.SecurityGroup.Table) .Fields(TzAccount.SecurityGroup.SecurityGroupID.Name, TzAccount.SecurityGroup.ClientID.Name, TzAccount.SecurityGroup.GroupName.Name, TzAccount.SecurityGroup.Context.Name, TzAccount.SecurityGroup.IsBaseType.Name, TzAccount.SecurityGroup.BaseType.Name, TzAccount.SecurityGroup.Description.Name). Values(DBConst.String(a), DBConst.String(clientid), DBConst.String(groupName), DBConst.Int32(context), DBConst.Const(DbType.Boolean, isBase), DBConst.Int32(baseType), DBConst.String(description)); int val = 0; using (DbTransaction trans = db.BeginTransaction()) { val = db.ExecuteNonQuery(trans, insert); trans.Commit(); } if (val > 0) { return(a); } else { return(""); } }
/// <summary> /// /// </summary> /// <param name="tableName"></param> /// <param name="tableCategory"></param> /// <returns></returns> public string Save(string serverID, string tableName, string tableCategory, string clientID) { string a = Shared.generateID(); DBConst dbTableid = DBConst.String(a); DBConst dbServerID = DBConst.String(serverID); DBConst dbClientID = DBConst.String(clientID); DBConst dbtableName = DBConst.String(tableName); DBConst dbtableCategory = DBConst.String(tableCategory); DBQuery insert = DBQuery.InsertInto(TzAccount.Tables.Table).Fields( TzAccount.Tables.TableID.Name, TzAccount.Tables.TableName.Name, TzAccount.Tables.Category.Name, TzAccount.Tables.ServerID.Name, TzAccount.Tables.ClientID.Name ).Values( dbTableid, dbtableName, dbtableCategory, dbServerID, dbClientID ); int val = 0; using (DbTransaction trans = db.BeginTransaction()) { val = db.ExecuteNonQuery(trans, insert); trans.Commit(); } if (val > 0) { return(a); } else { return(""); } }