public int UpdateContract(NpgsqlConnection connection, IDbTransaction trans, ContractInfo mContractInfo) { try { lock (lockObject) { if (mContractInfo == null) { return(DataTypeModel.RESULT_NG); } StringBuilder builder = new StringBuilder(); builder.Append(" UPDATE Contract "); builder.Append(" SET "); builder.Append(" Id = " + DatabaseUtility.Escape(mContractInfo.Id) + ", "); builder.Append(" Name = " + DatabaseUtility.Escape(mContractInfo.Name) + ", "); builder.Append(" Address = " + DatabaseUtility.Escape(mContractInfo.Address) + ", "); builder.Append(" Abi = " + DatabaseUtility.Escape(mContractInfo.Abi) + ", "); builder.Append(" ByteCode = " + DatabaseUtility.Escape(mContractInfo.ByteCode) + ", "); builder.Append(" Active = " + DatabaseUtility.Escape(mContractInfo.Active) + " "); builder.Append(" WHERE Id = " + DatabaseUtility.Escape(mContractInfo.Id)); return(base.baseDAO.DoUpdate(connection, trans, builder.ToString())); } } catch (Exception ex) { SanitaLog.Exception(ex); throw ex; } }
public ContractInfo GetContract(string ContractName) { StringBuilder builder = new StringBuilder(); builder.Append(" SELECT * "); builder.Append(" FROM Contract "); builder.Append(" WHERE Name = " + DatabaseUtility.Escape(ContractName)); builder.Append(" AND Active = " + DatabaseUtility.Escape(DataTypeModel.ACTIVE)); DataRow row = base.baseDAO.DoGetDataRow(builder.ToString()); return(this.MakeContract(row)); }
public int DeleteUser(User data) { lock (lockObject) { if (data == null) { return(DataTypeModel.RESULT_NG); } StringBuilder sql = new StringBuilder(); sql.Append(" DELETE FROM tb_user "); sql.Append(" WHERE UserID = " + DatabaseUtility.Escape(data.UserID)); return(baseDAO.DoUpdate(sql.ToString())); } }
public int DeleteDM_Intent_Type(DM_Intent_Type data) { lock (lockObject) { if (data == null) { return(DataTypeModel.RESULT_NG); } StringBuilder sql = new StringBuilder(); sql.Append(" DELETE FROM tb_dm_intent_type "); sql.Append(" WHERE DM_Intent_TypeDBID = " + DatabaseUtility.Escape(data.DM_Intent_TypeDBID)); return(baseDAO.DoUpdate(sql.ToString())); } }
public int DeleteIntent_Response(Intent_Response data) { lock (lockObject) { if (data == null) { return(DataTypeModel.RESULT_NG); } StringBuilder sql = new StringBuilder(); sql.Append(" DELETE FROM tb_intent_response "); sql.Append(" WHERE Intent_ResponseID = " + DatabaseUtility.Escape(data.Intent_ResponseID)); return(baseDAO.DoUpdate(sql.ToString())); } }
public int InsertContract(NpgsqlConnection connection, IDbTransaction trans, ContractInfo mContractInfo) { try { lock (lockObject) { if (mContractInfo == null) { return(DataTypeModel.RESULT_NG); } StringBuilder builder = new StringBuilder(); builder.Append(" INSERT INTO Contract ("); builder.Append(" Id,"); builder.Append(" Name,"); builder.Append(" Address,"); builder.Append(" Abi,"); builder.Append(" ByteCode,"); builder.Append(" Active)"); builder.Append(" VALUES( "); builder.Append(" " + DatabaseUtility.Escape(mContractInfo.Id) + ", "); builder.Append(" " + DatabaseUtility.Escape(mContractInfo.Name) + ", "); builder.Append(" " + DatabaseUtility.Escape(mContractInfo.Address) + ", "); builder.Append(" " + DatabaseUtility.Escape(mContractInfo.Abi) + ", "); builder.Append(" " + DatabaseUtility.Escape(mContractInfo.ByteCode) + ", "); builder.Append(" " + DatabaseUtility.Escape(mContractInfo.Active) + ") "); int num = base.baseDAO.DoInsert(connection, trans, builder.ToString()); if (num > 0) { return(DataTypeModel.RESULT_OK); } return(DataTypeModel.RESULT_NG); } } catch (Exception ex) { SanitaLog.Exception(ex); throw ex; } }
private static void bwAsync_Worker(object sender, DoWorkEventArgs e) { while (true) { System.Threading.Thread.Sleep(300); try { if (QueueLogRecord.Count > 0) { SanitaDataLogModel result = QueueLogRecord.Dequeue(); StringBuilder sql = new StringBuilder(); sql.Append(" INSERT INTO tblLogData ("); sql.Append(" LogApp,"); sql.Append(" LogUser,"); sql.Append(" SoftVersion,"); sql.Append(" LogTime,"); sql.Append(" IPAddress,"); sql.Append(" ComputerName,"); sql.Append(" LogValue) "); sql.Append(" VALUES( " + DatabaseUtility.Escape(result.App) + ", "); sql.Append(" " + DatabaseUtility.Escape(result.User) + ", "); sql.Append(" " + DatabaseUtility.Escape(result.SoftVersion) + ", "); sql.Append(" " + DatabaseUtility.Escape(result.LogTime) + ", "); sql.Append(" " + DatabaseUtility.Escape(result.IPAddress) + ", "); sql.Append(" " + DatabaseUtility.Escape(result.ComputerName) + ", "); sql.Append(" " + DatabaseUtility.Escape(result.LogValue) + ") "); // Assign new customer Id back to business object baseDAO.DoInsert(sql.ToString()); } } catch (Exception ex) { } } }