private static List <ORM_TMS_PRO_DeveloperTask_Priority> Search(Query query, string connectionString, DbConnection connection, DbTransaction transaction) { CSV2Core.Core.Interfaces.IManagedConnection managedConnection = new CSV2Core_MySQL.MySQLManagedConnection(); List <ORM_TMS_PRO_DeveloperTask_Priority> 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_PRO_DeveloperTask_Priority>(); var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader()); reader.SetOrdinals(new string[] { "TMS_PRO_DeveloperTask_PriorityID", "GlobalPropertyMatchingID", "Label_DictID", "Description_DictID", "IconLocationURL", "Priority_Colour", "Groups", "PriorityLevel", "IsPersistent", "Creation_Timestamp", "IsDeleted", "Tenant_RefID" }); while (reader.Read()) { ORM_TMS_PRO_DeveloperTask_Priority item = new ORM_TMS_PRO_DeveloperTask_Priority(); //0:Parameter TMS_PRO_DeveloperTask_PriorityID of type Guid item.TMS_PRO_DeveloperTask_PriorityID = reader.GetGuid(0); //1:Parameter GlobalPropertyMatchingID of type String item.GlobalPropertyMatchingID = reader.GetString(1); //2:Parameter Label of type Dict item.Label = reader.GetDictionary(2); loader.Append(item.Label, TableName); //3:Parameter Description of type Dict item.Description = reader.GetDictionary(3); loader.Append(item.Description, TableName); //4:Parameter IconLocationURL of type String item.IconLocationURL = reader.GetString(4); //5:Parameter Priority_Colour of type String item.Priority_Colour = reader.GetString(5); //6:Parameter Groups of type String item.Groups = reader.GetString(6); //7:Parameter PriorityLevel of type int item.PriorityLevel = reader.GetInteger(7); //8:Parameter IsPersistent of type Boolean item.IsPersistent = reader.GetBoolean(8); //9:Parameter Creation_Timestamp of type DateTime item.Creation_Timestamp = reader.GetDate(9); //10:Parameter IsDeleted of type Boolean item.IsDeleted = reader.GetBoolean(10); //11:Parameter Tenant_RefID of type Guid item.Tenant_RefID = reader.GetGuid(11); item.Status_IsAlreadySaved = true; item.Status_IsDirty = false; items.Add(item); } reader.Close(); loader.Load(); managedConnection.commit(); } catch (Exception ex) { managedConnection.rollback(); throw ex; } return(items); }
protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L2DTP_SDTP_1431 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { #region UserCode var returnValue = new FR_Guid(); //Put your code here var item = new CL1_TMS_PRO.ORM_TMS_PRO_DeveloperTask_Priority(); if (Parameter.TMS_PRO_DeveloperTask_PriorityID != Guid.Empty) { //ORM_TMS_PRO_DeveloperTask_Priority.Query.Search(Connection, Transaction, new ORM_TMS_PRO_DeveloperTask_Priority.Query() //{ // Tenant_RefID = securityTicket.TenantID, // IsDeleted = false, // TMS_PRO_DeveloperTask_PriorityID = Parameter.TMS_PRO_DeveloperTask_PriorityID //}); var result = item.Load(Connection, Transaction, Parameter.TMS_PRO_DeveloperTask_PriorityID); if (result.Status != FR_Status.Success || item.TMS_PRO_DeveloperTask_PriorityID == 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_PRO.ORM_TMS_PRO_DeveloperTask.Query searchQuery = new CL1_TMS_PRO.ORM_TMS_PRO_DeveloperTask.Query(); searchQuery.DeveloperTask_Type_RefID = Parameter.TMS_PRO_DeveloperTask_PriorityID; CL1_TMS_PRO.ORM_TMS_PRO_DeveloperTask.Query updateQuery = new CL1_TMS_PRO.ORM_TMS_PRO_DeveloperTask.Query(); updateQuery.DeveloperTask_Type_RefID = Parameter.IfDeleteReplaceWith; CL1_TMS_PRO.ORM_TMS_PRO_DeveloperTask.Query.Update(Connection, Transaction, searchQuery, updateQuery); item.IsDeleted = true; item.Save(Connection, Transaction); //cls_Update_TMS_PRO_DTPriorityLevels_for_TenantID.Invoke(Connection, Transaction, securityTicket); return(new FR_Guid(item.TMS_PRO_DeveloperTask_PriorityID)); } if (Parameter.TMS_PRO_DeveloperTask_PriorityID == Guid.Empty) { item.Tenant_RefID = securityTicket.TenantID; item.IsPersistent = true; } if (Parameter.Label != null) { item.Label = Parameter.Label; } if (Parameter.Description != null) { item.Description = Parameter.Description; } if (Parameter.IconLocationURL != null) { item.IconLocationURL = Parameter.IconLocationURL; } if (Parameter.Groups != null) { item.Groups = Parameter.Groups; } item.PriorityLevel = (int)Parameter.PriorityLevel; if (Parameter.Priority_Colour != null) { item.Priority_Colour = Parameter.Priority_Colour; } return(new FR_Guid(item.Save(Connection, Transaction), item.TMS_PRO_DeveloperTask_PriorityID)); #endregion UserCode }