Ejemplo n.º 1
0
            private static List <ORM_CMN_CAL_AVA_Date> Search(Query query, string connectionString, DbConnection connection, DbTransaction transaction)
            {
                CSV2Core.Core.Interfaces.IManagedConnection managedConnection = new CSV2Core_MySQL.MySQLManagedConnection();
                List <ORM_CMN_CAL_AVA_Date> 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_CMN_CAL_AVA_Date>();

                    var reader = new CSV2Core_MySQL.Support.DBSQLReader(command.ExecuteReader());
                    reader.SetOrdinals(new string[] { "CMN_CAL_AVA_DateID", "Availability_RefID", "CMN_CAL_Event_RefID", "DateName", "DateComment", "Creation_Timestamp", "Tenant_RefID", "IsDeleted" });
                    while (reader.Read())
                    {
                        ORM_CMN_CAL_AVA_Date item = new ORM_CMN_CAL_AVA_Date();
                        //0:Parameter CMN_CAL_AVA_DateID of type Guid
                        item.CMN_CAL_AVA_DateID = reader.GetGuid(0);
                        //1:Parameter Availability_RefID of type Guid
                        item.Availability_RefID = reader.GetGuid(1);
                        //2:Parameter CMN_CAL_Event_RefID of type Guid
                        item.CMN_CAL_Event_RefID = reader.GetGuid(2);
                        //3:Parameter DateName of type String
                        item.DateName = reader.GetString(3);
                        //4:Parameter DateComment of type String
                        item.DateComment = reader.GetString(4);
                        //5:Parameter Creation_Timestamp of type DateTime
                        item.Creation_Timestamp = reader.GetDate(5);
                        //6:Parameter Tenant_RefID of type Guid
                        item.Tenant_RefID = reader.GetGuid(6);
                        //7:Parameter IsDeleted of type Boolean
                        item.IsDeleted = reader.GetBoolean(7);


                        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);
            }