private static List <ORM_TMS_QuickTask_Type> Search(Query query, string connectionString, DbConnection connection, DbTransaction transaction) { CSV2Core.Core.Interfaces.IManagedConnection managedConnection = new CSV2Core_MySQL.MySQLManagedConnection(); List <ORM_TMS_QuickTask_Type> items; try { managedConnection.set(connectionString, connection, transaction); var loader = new CSV2Core_MySQL.Dictionaries.MultiTable.Loader.DictionaryLoader(managedConnection.getConnection(), managedConnection.getTransaction()); DbCommand command = managedConnection.manage(query.CreateSelectQuery(TableName)); query.SetParameters(command); items = new List <ORM_TMS_QuickTask_Type>(); var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader()); reader.SetOrdinals(new string[] { "TMS_QuickTask_TypeID", "GlobalPropertyMatchingID", "QuickTaskType_ExternalID", "QuickTaskType_Name_DictID", "QuickTaskType_Description_DictID", "IsPersistent", "Tenant_RefID", "Creation_Timestamp", "IsDeleted" }); while (reader.Read()) { ORM_TMS_QuickTask_Type item = new ORM_TMS_QuickTask_Type(); //0:Parameter TMS_QuickTask_TypeID of type Guid item.TMS_QuickTask_TypeID = reader.GetGuid(0); //1:Parameter GlobalPropertyMatchingID of type String item.GlobalPropertyMatchingID = reader.GetString(1); //2:Parameter QuickTaskType_ExternalID of type String item.QuickTaskType_ExternalID = reader.GetString(2); //3:Parameter QuickTaskType_Name of type Dict item.QuickTaskType_Name = reader.GetDictionary(3); loader.Append(item.QuickTaskType_Name, TableName); //4:Parameter QuickTaskType_Description of type Dict item.QuickTaskType_Description = reader.GetDictionary(4); loader.Append(item.QuickTaskType_Description, TableName); //5:Parameter IsPersistent of type Boolean item.IsPersistent = reader.GetBoolean(5); //6:Parameter Tenant_RefID of type Guid item.Tenant_RefID = reader.GetGuid(6); //7:Parameter Creation_Timestamp of type DateTime item.Creation_Timestamp = reader.GetDate(7); //8:Parameter IsDeleted of type Boolean item.IsDeleted = reader.GetBoolean(8); item.Status_IsAlreadySaved = true; item.Status_IsDirty = false; items.Add(item); } reader.Close(); loader.Load(); managedConnection.commit(); } catch (Exception ex) { managedConnection.rollback(); throw; } return(items); }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L2WTT_SWTT_1313 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); var item = new CL1_TMS.ORM_TMS_QuickTask_Type(); if (Parameter.TMS_WorkingTaskTypeID != Guid.Empty) { var result = item.Load(Connection, Transaction, Parameter.TMS_WorkingTaskTypeID); if (result.Status != FR_Status.Success || item.TMS_QuickTask_TypeID == Guid.Empty) { var error = new FR_Guid(); error.ErrorMessage = "No Such ID"; error.Status = FR_Status.Error_Internal; return(error); } } if (Parameter.IsDeleted == true || Parameter.IfDeleteReplaceWith != Guid.Empty) { CL1_TMS.ORM_TMS_QuickTask.Query searchQuery = new CL1_TMS.ORM_TMS_QuickTask.Query(); searchQuery.QuickTask_Type_RefID = Parameter.TMS_WorkingTaskTypeID; CL1_TMS.ORM_TMS_QuickTask.Query updateQuery = new CL1_TMS.ORM_TMS_QuickTask.Query(); updateQuery.QuickTask_Type_RefID = Parameter.IfDeleteReplaceWith; CL1_TMS.ORM_TMS_QuickTask.Query.Update(Connection, Transaction, searchQuery, updateQuery); item.IsDeleted = true; item.Save(Connection, Transaction); return(new FR_Guid(item.TMS_QuickTask_TypeID)); } //Creation specific parameters (Tenant, Account ... ) if (Parameter.TMS_WorkingTaskTypeID == Guid.Empty) { item.Tenant_RefID = securityTicket.TenantID; item.IsPersistent = true; } item.QuickTaskType_Name = Parameter.QuickTaskType_Name; item.IsDeleted = Parameter.IsDeleted; return(new FR_Guid(item.Save(Connection, Transaction), item.TMS_QuickTask_TypeID)); #endregion UserCode }