protected static FR_Guid Execute(DbConnection Connection, DbTransaction Transaction, P_L2SH_SSSH_1313 Parameter, CSV2Core.SessionSecurity.SessionSecurityTicket securityTicket = null) { //Leave UserCode region to enable user code saving #region UserCode var returnValue = new FR_Guid(); //Put your code here var account = new ORM_USR_Account(); account.Load(Connection, Transaction, securityTicket.AccountID); var statusPickingFinished = ORM_LOG_SHP_Shipment_Status.Query.Search(Connection, Transaction, new ORM_LOG_SHP_Shipment_Status.Query() { GlobalPropertyMatchingID = EnumUtils.GetEnumDescription(Parameter.ShipmentHeaderStatus), Tenant_RefID = securityTicket.TenantID, IsDeleted = false }).Single(); var shipmentStatusHistory = new CL1_LOG_SHP.ORM_LOG_SHP_Shipment_StatusHistory(); shipmentStatusHistory.LOG_SHP_Shipment_Header_RefID = Parameter.ShipmentHeaderID; shipmentStatusHistory.LOG_SHP_Shipment_Status_RefID = statusPickingFinished.LOG_SHP_Shipment_StatusID; shipmentStatusHistory.PerformedBy_BusinessParticipant_RefID = account.BusinessParticipant_RefID; shipmentStatusHistory.Tenant_RefID = securityTicket.TenantID; shipmentStatusHistory.Save(Connection, Transaction); return(returnValue); #endregion UserCode }
private static List <ORM_LOG_SHP_Shipment_StatusHistory> Search(Query query, string connectionString, DbConnection connection, DbTransaction transaction) { CSV2Core.Core.Interfaces.IManagedConnection managedConnection = new CSV2Core_MySQL.MySQLManagedConnection(); List <ORM_LOG_SHP_Shipment_StatusHistory> 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_LOG_SHP_Shipment_StatusHistory>(); var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader()); reader.SetOrdinals(new string[] { "LOG_SHP_Shipment_StatusHistoryID", "LOG_SHP_Shipment_Header_RefID", "LOG_SHP_Shipment_Status_RefID", "PerformedBy_BusinessParticipant_RefID", "Creation_Timestamp", "Tenant_RefID", "IsDeleted" }); while (reader.Read()) { ORM_LOG_SHP_Shipment_StatusHistory item = new ORM_LOG_SHP_Shipment_StatusHistory(); //0:Parameter LOG_SHP_Shipment_StatusHistoryID of type Guid item.LOG_SHP_Shipment_StatusHistoryID = reader.GetGuid(0); //1:Parameter LOG_SHP_Shipment_Header_RefID of type Guid item.LOG_SHP_Shipment_Header_RefID = reader.GetGuid(1); //2:Parameter LOG_SHP_Shipment_Status_RefID of type Guid item.LOG_SHP_Shipment_Status_RefID = reader.GetGuid(2); //3:Parameter PerformedBy_BusinessParticipant_RefID of type Guid item.PerformedBy_BusinessParticipant_RefID = reader.GetGuid(3); //4:Parameter Creation_Timestamp of type DateTime item.Creation_Timestamp = reader.GetDate(4); //5:Parameter Tenant_RefID of type Guid item.Tenant_RefID = reader.GetGuid(5); //6:Parameter IsDeleted of type Boolean item.IsDeleted = reader.GetBoolean(6); 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); }