moved

moved

git-svn-id: 1b52f0a7ed2a8098cb721f3b9b4408691a7bfc16@391 c93b7781-d36b-0e4d-be4f-9d94f2a838be

--- Libraries/DAE.DevicePGSQL/Device.PGSQL/PostgreSQLDevice.cs
+++ Libraries/DAE.DevicePGSQL/Device.PGSQL/PostgreSQLDevice.cs
@@ -1,1392 +0,0 @@
-using System;
-using System.Globalization;
-using System.IO;
-using Alphora.Dataphor.DAE;
-using Alphora.Dataphor.DAE.Connection;
-using Alphora.Dataphor.DAE.Device.SQL;
-using Alphora.Dataphor.DAE.Language;
-using Alphora.Dataphor.DAE.Language.D4;
-using Alphora.Dataphor.DAE.Language.SQL;
-using Alphora.Dataphor.DAE.Language.PGSQL;
-using Alphora.Dataphor.DAE.Runtime;
-using Alphora.Dataphor.DAE.Runtime.Data;
-using Alphora.Dataphor.DAE.Runtime.Instructions;
-using Alphora.Dataphor.DAE.Schema;
-using Alphora.Dataphor.DAE.Server;
-using ColumnExpression = Alphora.Dataphor.DAE.Language.SQL.ColumnExpression;
-using DropIndexStatement = Alphora.Dataphor.DAE.Language.PGSQL.DropIndexStatement;
-using SelectStatement = Alphora.Dataphor.DAE.Language.SQL.SelectStatement;
-
-namespace Alphora.Dataphor.Device.PGSQL
-{
-
-
-    #region Device
-
-    public class PostgreSQLDevice : SQLDevice
-    {
-        public const string CPostgreSQLBinaryScalarType = "PostgreSQLDevice.PostgreSQLBinary";
-
-        public static string CEnsureDatabase =
-            @"
-if not exists (select * from sysdatabases where name = '{0}')
-	create database {0}
-			";
-
-        protected string FApplicationName = "Dataphor Server";
-        protected string FDatabaseName = String.Empty;
-
-        private int FMajorVersion = 8; // default to SQL Server 2000 (pending detection)
-        protected string FServerName = String.Empty;
-        protected bool FShouldDetermineVersion = true;
-        protected bool FShouldEnsureDatabase = true;
-        protected bool FShouldEnsureOperators = true;
-        protected bool FShouldReconcileRowGUIDCol;
-        protected bool FUseIntegratedSecurity;
-
-        public PostgreSQLDevice(int AID, string AName, int AResourceManagerID)
-            : base(AID, AName, AResourceManagerID)
-        {
-            IsOrderByInContext = false;
-            // T-SQL allows items in the order by list to reference the column aliases used in the query
-            UseParametersForCursors = true;
-            ShouldNormalizeWhitespace = false;
-        }
-
-        public int MajorVersion
-        {
-            get { return FMajorVersion; }
-            set { FMajorVersion = value; }
-        }
-
-
-
-        public bool IsAccess { set; get; }
-
-        /// <value>Indicates whether the device should auto-determine the version of the target system.</value>
-        public bool ShouldDetermineVersion
-        {
-            get { return FShouldDetermineVersion; }
-            set { FShouldDetermineVersion = value; }
-        }
-
-        /// <value>Indicates whether the device should create the database if it does not already exist.</value>
-        public bool ShouldEnsureDatabase
-        {
-            // maybe check and throw to see if it is access because can't create (at least I don't think so) an access database;
-            get { return FShouldEnsureDatabase; }
-            set { FShouldEnsureDatabase = value; }
-        }
-
-        /// <value>Indicates whether the device should reconcile columns that are marked as ROWGUIDCOL in SQLServer.</value>
-        public bool ShouldReconcileRowGUIDCol
-        {
-            get { return FShouldReconcileRowGUIDCol; }
-            set { FShouldReconcileRowGUIDCol = value; }
-        }
-
-        /// <value>Indicates whether the device should create the DAE support operators if they do not already exist.</value>
-        /// <remarks>The value of this property is only valid if IsPostgreSQL70 is false.</remarks>
-        public bool ShouldEnsureOperators
-        {
-            get { return FShouldEnsureOperators; }
-            set { FShouldEnsureOperators = value; }
-        }
-
-        public string ServerName
-        {
-            get { return FServerName; }
-            set { FServerName = value == null ? String.Empty : value; }
-        }
-
-        public string DatabaseName
-        {
-            get { return FDatabaseName; }
-            set { FDatabaseName = value == null ? String.Empty : value; }
-        }
-
-        public string ApplicationName
-        {
-            get { return FApplicationName; }
-            set { FApplicationName = value == null ? "Dataphor Server" : value; }
-        }
-
-        public bool UseIntegratedSecurity
-        {
-            get { return FUseIntegratedSecurity; }
-            set { FUseIntegratedSecurity = value; }
-        }
-
-        protected override void SetMaxIdentifierLength()
-        {
-            FMaxIdentifierLength = 128;
-        }
-
-        protected override void InternalStarted(ServerProcess AProcess)
-        {
-            string LOnExecuteConnectStatement = OnExecuteConnectStatement;
-            OnExecuteConnectStatement = null;
-            try
-            {
-                if (ShouldDetermineVersion)
-                    DetermineVersion(AProcess);
-
-                base.InternalStarted(AProcess);
-
-                InitializeDatabase(AProcess);
-            }
-            finally
-            {
-                OnExecuteConnectStatement = LOnExecuteConnectStatement;
-            }
-        }
-
-        protected override void RegisterSystemObjectMaps(ServerProcess AProcess)
-        {
-            base.RegisterSystemObjectMaps(AProcess);
-
-            // Perform system type and operator mapping registration
-            using (Stream LStream = GetType().Assembly.GetManifestResourceStream("SystemCatalog.d4"))
-            {
-#if USEISTRING
-				RunScript(AProcess, String.Format(new StreamReader(LStream).ReadToEnd(), Name, IsCaseSensitive.ToString().ToLower(), IsPostgreSQL70.ToString().ToLower(), IsAccess.ToString().ToLower()));
-#else
-                RunScript(AProcess,
-                          String.Format(new StreamReader(LStream).ReadToEnd(), Name, "false",
-                                        "false", IsAccess.ToString().ToLower()));
-#endif
-            }
-        }
-
-        protected void EnsureDatabase(ServerProcess AProcess)
-        {
-            string LDatabaseName = DatabaseName;
-            DatabaseName = "master";
-            try
-            {
-                var LDeviceSession = (SQLDeviceSession)Connect(AProcess, AProcess.ServerSession.SessionInfo);
-                try
-                {
-                    LDeviceSession.Connection.Execute(String.Format(CEnsureDatabase, LDatabaseName));
-                }
-                finally
-                {
-                    Disconnect(LDeviceSession);
-                }
-            }
-            finally
-            {
-                DatabaseName = LDatabaseName;
-            }
-        }
-
-        protected void DetermineVersion(ServerProcess AProcess)
-        {
-            string LDatabaseName = DatabaseName;
-            DatabaseName = "master";
-            try
-            {
-                var LDeviceSession = (SQLDeviceSession)Connect(AProcess, AProcess.ServerSession.SessionInfo);
-                try
-                {
-                    SQLCursor LCursor = LDeviceSession.Connection.Open("exec xp_msver");
-                    try
-                    {
-                        string LVersion = String.Empty;
-                        while (LCursor.Next())
-                            if (Convert.ToString(LCursor[1]) == "ProductVersion")
-                            {
-                                LVersion = Convert.ToString(LCursor[3]);
-                                break;
-                            }
-
-                        if (LVersion.Length > 0)
-                            FMajorVersion = Convert.ToInt32(LVersion.Substring(0, LVersion.IndexOf('.')));
-                    }
-                    finally
-                    {
-                        LCursor.Command.Connection.Close(LCursor);
-                    }
-                }
-                finally
-                {
-                    Disconnect(LDeviceSession);
-                }
-            }
-            finally
-            {
-                DatabaseName = LDatabaseName;
-            }
-        }
-
-        protected void InitializeDatabase(ServerProcess AProcess)
-        {
-            // access checks should go here maybe?
-
-            // Create the database, if necessary
-            if (ShouldEnsureDatabase)
-                EnsureDatabase(AProcess);
-
-            // Run the initialization script, if specified
-            if (ShouldEnsureOperators)
-                EnsureOperators(AProcess);
-        }
-
-        protected void EnsureOperators(ServerProcess AProcess)
-        {
-            // no access
-            var LDeviceSession = (SQLDeviceSession)Connect(AProcess, AProcess.ServerSession.SessionInfo);
-            try
-            {
-                SQLConnection LConnection = LDeviceSession.Connection;
-                if (!LConnection.InTransaction)
-                    LConnection.BeginTransaction(SQLIsolationLevel.Serializable);
-                try
-                {
-                    using (SQLCommand LCommand = LConnection.CreateCommand(false))
-                    {
-                        using (Stream LStream = GetType().Assembly.GetManifestResourceStream("SystemCatalog.sql"))
-                        {
-                            foreach (
-                                string LBatch in SQLUtility.ProcessBatches(new StreamReader(LStream).ReadToEnd(), "go"))
-                            {
-                                LCommand.Statement = LBatch;
-                                LCommand.Execute();
-                            }
-                        }
-                    }
-                    LConnection.CommitTransaction();
-                }
-                catch
-                {
-                    LConnection.RollbackTransaction();
-                    throw;
-                }
-            }
-            finally
-            {
-                Disconnect(LDeviceSession);
-            }
-        }
-
-        protected override DeviceSession InternalConnect(ServerProcess AServerProcess,
-                                                         DeviceSessionInfo ADeviceSessionInfo)
-        {
-            return new PostgreSQLDeviceSession(this, AServerProcess, ADeviceSessionInfo);
-        }
-
-        protected override Statement TranslateDropIndex(TableVar ATableVar, Key AKey)
-        {
-            var LStatement = new DropIndexStatement();
-            LStatement.TableSchema = MetaData.GetTag(ATableVar.MetaData, "Storage.Schema", Schema);
-            LStatement.TableName = ToSQLIdentifier(ATableVar);
-            LStatement.IndexSchema = MetaData.GetTag(AKey.MetaData, "Storage.Schema", String.Empty);
-            LStatement.IndexName = GetIndexName(LStatement.TableName, AKey);
-            return LStatement;
-        }
-
-        protected override Statement TranslateDropIndex(TableVar ATableVar, Order AOrder)
-        {
-            var LStatement = new DropIndexStatement();
-            LStatement.TableSchema = MetaData.GetTag(ATableVar.MetaData, "Storage.Schema", Schema);
-            LStatement.TableName = ToSQLIdentifier(ATableVar);
-            LStatement.IndexSchema = MetaData.GetTag(AOrder.MetaData, "Storage.Schema", String.Empty);
-            LStatement.IndexName = GetIndexName(LStatement.TableName, AOrder);
-            return LStatement;
-        }
-
-        public override TableSpecifier GetDummyTableSpecifier()
-        {
-            var LSelectExpression = new SelectExpression();
-            LSelectExpression.SelectClause = new SelectClause();
-            LSelectExpression.SelectClause.Columns.Add(new ColumnExpression(new ValueExpression(0), "dummy1"));
-            return new TableSpecifier(LSelectExpression, "dummy1");
-        }
-
-        // ShouldIncludeColumn
-        public override bool ShouldIncludeColumn(ServerProcess AProcess, string ATableName, string AColumnName,
-                                                 string ADomainName)
-        {
-            switch (ADomainName.ToLower())
-            {
-                case "bit":
-                case "tinyint":
-                case "smallint":
-                case "int":
-                case "integer":
-                case "bigint":
-                case "decimal":
-                case "numeric":
-                case "float":
-                case "real":
-                case "datetime":
-                case "smalldatetime":
-                case "money":
-                case "smallmoney":
-                case "uniqueidentifier":
-                case "char":
-                case "varchar":
-                case "nchar":
-                case "nvarchar":
-                case "text":
-                case "ntext":
-                case "image":
-                case "binary":
-                case "varbinary":
-                case "timestamp":
-                    return true;
-                default:
-                    return false;
-            }
-        }
-
-        // FindScalarType
-        public override ScalarType FindScalarType(ServerProcess AProcess, string ADomainName, int ALength,
-                                                  MetaData AMetaData)
-        {
-            switch (ADomainName.ToLower())
-            {
-                case "bit":
-                    return AProcess.DataTypes.SystemBoolean;
-                case "tinyint":
-                    return AProcess.DataTypes.SystemByte;
-                case "smallint":
-                    return AProcess.DataTypes.SystemShort;
-                case "int":
-                case "integer":
-                    return AProcess.DataTypes.SystemInteger;
-                case "bigint":
-                    return AProcess.DataTypes.SystemLong;
-                case "decimal":
-                case "numeric":
-                case "float":
-                case "real":
-                    return AProcess.DataTypes.SystemDecimal;
-                case "datetime":
-                case "smalldatetime":
-                    return AProcess.DataTypes.SystemDateTime;
-                case "money":
-                case "smallmoney":
-                    return AProcess.DataTypes.SystemMoney;
-                case "uniqueidentifier":
-                    return AProcess.DataTypes.SystemGuid;
-                case "char":
-                case "varchar":
-                case "nchar":
-                case "nvarchar":
-                    AMetaData.Tags.Add(new Tag("Storage.Length", ALength.ToString()));
-#if USEISTRING
-					return IsCaseSensitive ? AProcess.DataTypes.SystemString : AProcess.DataTypes.SystemIString;
-#else
-                    return AProcess.DataTypes.SystemString;
-#endif
-#if USEISTRING
-				case "text":
-				case "ntext": return (ScalarType)(IsCaseSensitive ? AProcess.ServerSession.Server.Catalog[CSQLTextScalarType] : AProcess.ServerSession.Server.Catalog[CSQLITextScalarType]);
-#else
-                case "text":
-                case "ntext":
-                    return (ScalarType)Compiler.ResolveCatalogIdentifier(AProcess.Plan, CSQLTextScalarType, true);
-#endif
-                case "binary":
-                case "timestamp":
-                    AMetaData.Tags.Add(new Tag("Storage.Length", ALength.ToString()));
-                    return (ScalarType)Compiler.ResolveCatalogIdentifier(AProcess.Plan, CPostgreSQLBinaryScalarType, true);
-                case "varbinary":
-                    AMetaData.Tags.Add(new Tag("Storage.Length", ALength.ToString()));
-                    return AProcess.DataTypes.SystemBinary;
-                case "image":
-                    return AProcess.DataTypes.SystemBinary;
-                default:
-                    throw new SQLException(SQLException.Codes.UnsupportedImportType, ADomainName);
-            }
-        }
-
-        // Emitter
-        protected override SQLTextEmitter InternalCreateEmitter()
-        {
-            return new TSQLTextEmitter();
-        }
-
-        protected override string GetDeviceTablesExpression(TableVar ATableVar)
-        {
-            return
-                DeviceTablesExpression != String.Empty
-                    ?
-                        base.GetDeviceTablesExpression(ATableVar)
-                    :
-                        String.Format
-                            (
-                            (
-                                !IsAccess
-                                    ?
-                                        @"
-									select
-											su.name as TableSchema,
-											so.name as TableName,
-											sc.name as ColumnName,
-											sc.colorder as OrdinalPosition,
-											so.name as TableTitle,
-											sc.name as ColumnTitle,
-											snt.name as NativeDomainName,
-											st.name as DomainName,
-											convert(integer, sc.length) as Length,
-											sc.isnullable as IsNullable,
-											case when snt.name in ('text', 'ntext', 'image') then 1 else 0 end as IsDeferred
-										from sysobjects as so
-											join sysusers as su on so.uid = su.uid
-											join syscolumns as sc on sc.id = so.id
-											join systypes as st on st.xusertype = sc.xusertype
-											join systypes as snt on st.xtype = snt.xusertype
-										where (so.xtype = 'U' or so.xtype = 'V')
-											and OBJECTPROPERTY(so.id, 'IsMSShipped') = 0
-											{0}
-											{1}
-										order by so.name, sc.colid
-								"
-                                    :
-                                        @"
-									select
-											Name as TableSchema,
-											Name as TableName,
-											uhh column name
-
-
-								"
-                            ),
-                            ATableVar == null
-                                ? String.Empty
-                                : String.Format("and so.name = '{0}'", ToSQLIdentifier(ATableVar)),
-                            FShouldReconcileRowGUIDCol
-                                ? String.Empty
-                                : "and COLUMNPROPERTY(so.id, sc.name, 'IsRowGUIDCol') = 0"
-                            );
-        }
-
-        protected override string GetDeviceIndexesExpression(TableVar ATableVar)
-        {
-            return
-                DeviceIndexesExpression != String.Empty
-                    ?
-                        base.GetDeviceIndexesExpression(ATableVar)
-                    :
-                        String.Format
-                            (
-                            @"
-							select
-									su.name as TableSchema,
-									so.name as TableName,
-									si.name as IndexName,
-									sc.name as ColumnName,
-									sik.keyno as OrdinalPosition,
-									INDEXPROPERTY(so.id, si.name, 'IsUnique') as IsUnique,
-									{0} /* if ServerVersion >= 8.0, otherwise 0 as IsDescending */
-								from sysobjects as so
-									join sysusers as su on so.uid = su.uid
-									join sysindexes as si on si.id = so.id
-									left join sysobjects as sno on sno.name = si.name
-									left join sysconstraints as sn on sn.constid = sno.id
-									join sysindexkeys as sik on sik.id = so.id and sik.indid = si.indid
-									join syscolumns as sc on sc.id = so.id and sc.colid = sik.colid
-								where (so.xtype = 'U' or so.xtype = 'V')
-									and OBJECTPROPERTY(so.id, 'isMSShipped') = 0
-									and INDEXPROPERTY(so.id, si.name, 'IsStatistics') = 0
-									{1} /* if ServerVersion >= 8.0, otherwise empty string */
-									{2}
-								order by so.name, si.indid, sik.keyno
-						",
-                             "INDEXKEY_PROPERTY(so.id, si.indid, sik.keyno, 'IsDescending') as IsDescending",
-                             "and INDEXKEY_PROPERTY(so.id, si.indid, sik.keyno, 'IsDescending') is not null",
-                            ATableVar == null
-                                ? String.Empty
-                                : String.Format("and so.name = '{0}'", ToSQLIdentifier(ATableVar))
-                            );
-        }
-
-        protected override string GetDeviceForeignKeysExpression(TableVar ATableVar)
-        {
-            return
-                DeviceForeignKeysExpression != String.Empty
-                    ?
-                        base.GetDeviceForeignKeysExpression(ATableVar)
-                    :
-                        String.Format
-                            (
-                            @"
-							select
-									su.name as ConstraintSchema,
-									so.name as ConstraintName,
-									ssu.name as SourceTableSchema,
-									sso.name as SourceTableName,
-									ssc.name as SourceColumnName,
-									tsu.name as TargetTableSchema,
-									tso.name as TargetTableName,
-									tsc.name as TargetColumnName,
-									keyno OrdinalPosition
-								from sysforeignkeys as sfk
-									join sysobjects as so on sfk.constid = so.id
-									join sysusers as su on su.uid = so.uid
-									join sysobjects as sso on sfk.fkeyid = sso.id
-									join sysusers as ssu on ssu.uid = sso.uid
-									join syscolumns as ssc on ssc.colid = sfk.fkey and ssc.id = sfk.fkeyid
-									join sysobjects as tso on sfk.rkeyid = tso.id
-									join sysusers as tsu on tsu.uid = tso.uid
-									join syscolumns as tsc on tsc.colid = sfk.rkey and tsc.id = sfk.rkeyid
-								where 1 = 1
-									{0}
-								order by ConstraintSchema, ConstraintName, OrdinalPosition
-						",
-                            ATableVar == null ? String.Empty : "and so.name = '" + ToSQLIdentifier(ATableVar) + "'"
-                            );
-        }
-
-        public override void DetermineCursorBehavior(Plan APlan, TableNode ATableNode)
-        {
-            base.DetermineCursorBehavior(APlan, ATableNode);
-            // TODO: This will actually only be static if the ADOConnection is used because the DotNet providers do not support a method for obtaining a static cursor.
-        }
-
-        // ServerName
-
-        public override SelectStatement TranslateOrder(DevicePlan ADevicePlan, TableNode ANode,
-                                                       SelectStatement AStatement)
-        {
-            if (AStatement.Modifiers == null)
-                AStatement.Modifiers = new LanguageModifiers();
-            AStatement.Modifiers.Add(new LanguageModifier("OptimizerHints", "option (fast 1)"));
-            return base.TranslateOrder(ADevicePlan, ANode, AStatement);
-        }
-    }
-
-    public class PostgreSQLDeviceSession : SQLDeviceSession
-    {
-        public PostgreSQLDeviceSession(PostgreSQLDevice ADevice, ServerProcess AServerProcess,
-                                  DeviceSessionInfo ADeviceSessionInfo)
-            : base(ADevice, AServerProcess, ADeviceSessionInfo)
-        {
-        }
-
-        public new PostgreSQLDevice Device
-        {
-            get { return (PostgreSQLDevice)base.Device; }
-        }
-
-        protected override SQLConnection InternalCreateConnection()
-        {
-            // ConnectionClass:
-            //  ODBCConnection
-            //  OLEDBConnection (default)
-            //  ADOConnection
-            //  PostgreSQLConnection
-            // ConnectionStringBuilderClass
-            // PostgreSQLOLEDBConnectionStringBuilder (default) (use with ADOConnection and OLEDBConnection)
-            // PostgreSQLADODotNetConnectionStringBuilder (use with PostgreSQLConnection)
-            // PostgreSQLODBCConnectionStringBuilder (use with ODBCConnection)
-
-            /*
-				Connectivity Implementations with PostgreSQL:
-					ADOConnection ->
-						When we use ADO, it is fully functional, but thread locks when we attempt to use it concurrently.
-						If we switch providers to MSDASQL, it doesn't work either because the Command and Recordset objects
-						are not being released.  The connection complains that too many recordsets are open, even though no
-						recordsets are open.  Marshal.ReleaseComObject doesn't help either.  I suspect that the thread locking
-						problem we are seeing when we use ADO is related to this same issue.
-
-					PostgreSQLConnection ->
-						When we use the native managed provider (SqlClient), performance drops by a factor of 2.
-						There are also issues with binary, varbinary, and image data types.
-
-					OLEDBConnection ->
-						The OLEDB managed provider seems to resolve the thread locking issues, but it has yet to be probed for
-						full functionality.  As of right now, this if the only supported connectivity implementation for the
-						PostgreSQLDevice.  This may change.
-
-					There are also several mono providers which we can try if we run out of options in the Microsoft space.
-
-				BTR 12/20/2004 ->
-					Changed the default to use the native managed provider on the assumption that this is faster because less
-					layers are involved. This assumption did not hold up under transaction processing tests prior to service pack 1,
-					but we are hoping that service pack 1 has improved performance of this provider. We still need to run tp tests
-					with the provider.
-
-				BTR 12/20/2004 ->
-					Later that same day...
-					When using the SqlClient on Jeff's machine (not sure whether it was sp1 or not, need to check) we were getting
-					non-deterministic behavior (The connection would close unexpectedly after an open and cause Dataphor to consider
-					the connection a transaction failure). This behavior does not occur with the OleDbConnection so we switched back
-					to it. More later...
-
-				BTR 12/21/2004 ->
-					SqlClient using .NET 1.1 with sp1 is confirmed, the behavior is unpredictable, same codebase with the OleDbConnection
-					works fine, so we are switching to that provider until further notice.
-			*/
-
-            var LClassDefinition =
-                new ClassDefinition
-                    (
-                    Device.ConnectionClass == String.Empty
-                        ?
-#if USEADOCONNECTION
-						"ADOConnection.ADOConnection" :
-#else
-#if USEOLEDBCONNECTION
-						"Connection.OLEDBConnection" :
-#else
- "Connection.PostgreSQLConnection"
-                        :
-#endif
-#endif
- Device.ConnectionClass
-                    );
-            var LBuilderClass =
-                new ClassDefinition
-                    (
-                    Device.ConnectionStringBuilderClass == String.Empty
-                        ?
-#if USEADOCONNECTION
-						"PostgreSQLDevice.PostgreSQLOLEDBConnectionStringBuilder" :
-#else
-#if USEOLEDBCONNECTION
-						"PostgreSQLDevice.PostgreSQLOLEDBConnectionStringBuilder" :
-#else
- "PostgreSQLDevice.PostgreSQLADODotNetConnectionStringBuilder"
-                        :
-#endif
-#endif
- Device.ConnectionStringBuilderClass
-                    );
-            var LConnectionStringBuilder =
-                (ConnectionStringBuilder)
-                ServerProcess.Plan.Catalog.ClassLoader.CreateObject(LBuilderClass, new object[] { });
-
-            var LTags = new Tags();
-            LTags.AddOrUpdate("ServerName", Device.ServerName);
-            LTags.AddOrUpdate("DatabaseName", Device.DatabaseName);
-            LTags.AddOrUpdate("ApplicationName", Device.ApplicationName);
-            if (Device.UseIntegratedSecurity)
-                LTags.AddOrUpdate("IntegratedSecurity", "true");
-            else
-            {
-                LTags.AddOrUpdate("UserName", DeviceSessionInfo.UserName);
-                LTags.AddOrUpdate("Password", DeviceSessionInfo.Password);
-            }
-
-            LTags = LConnectionStringBuilder.Map(LTags);
-            Device.GetConnectionParameters(LTags, DeviceSessionInfo);
-            string LConnectionString = SQLDevice.TagsToString(LTags);
-            return
-                (SQLConnection)
-                ServerProcess.Plan.Catalog.ClassLoader.CreateObject(LClassDefinition, new object[] { LConnectionString });
-        }
-    }
-
-    #endregion
-
-    #region Connection String Builder
-
-    /// <summary>
-    /// This class is the tag translator for ADO
-    /// </summary>
-    public class PostgreSQLOLEDBConnectionStringBuilder : ConnectionStringBuilder
-    {
-        public PostgreSQLOLEDBConnectionStringBuilder()
-        {
-#if USESQLOLEDB
-            FParameters.AddOrUpdate("Provider", "SQLOLEDB");
-#else
-            FParameters.AddOrUpdate("Provider", "MSDASQL");
-#endif
-
-#if !USECONNECTIONPOOLING
-            FParameters.AddOrUpdate("OLE DB Services", "-2"); // Turn off OLEDB resource pooling
-#endif
-            FLegend.AddOrUpdate("ServerName", "Data source");
-            FLegend.AddOrUpdate("DatabaseName", "initial catalog");
-            FLegend.AddOrUpdate("UserName", "user id");
-            FLegend.AddOrUpdate("Password", "password");
-            FLegend.AddOrUpdate("ApplicationName", "app name");
-        }
-
-        public override Tags Map(Tags ATags)
-        {
-            Tags LTags = base.Map(ATags);
-            Tag LTag = LTags.GetTag("IntegratedSecurity");
-            if (LTag != null)
-            {
-                LTags.Remove(LTag);
-                LTags.AddOrUpdate("Integrated Security", "SSPI");
-            }
-            return LTags;
-        }
-    }
-
-    public class PostgreSQLADODotNetConnectionStringBuilder : ConnectionStringBuilder
-    {
-        public PostgreSQLADODotNetConnectionStringBuilder()
-        {
-            FLegend.AddOrUpdate("ServerName", "server");
-            FLegend.AddOrUpdate("DatabaseName", "database");
-            FLegend.AddOrUpdate("UserName", "user id");
-            FLegend.AddOrUpdate("Password", "password");
-            FLegend.AddOrUpdate("IntegratedSecurity", "integrated security");
-            FLegend.AddOrUpdate("ApplicationName", "application name");
-        }
-    }
-
-    public class PostgreSQLODBCConnectionStringBuilder : ConnectionStringBuilder
-    {
-        public PostgreSQLODBCConnectionStringBuilder()
-        {
-            FLegend.AddOrUpdate("ServerName", "DSN");
-            FLegend.AddOrUpdate("DatabaseName", "Database");
-            FLegend.AddOrUpdate("UserName", "UID");
-            FLegend.AddOrUpdate("Password", "PWD");
-            FLegend.AddOrUpdate("ApplicationName", "APPNAME");
-        }
-
-        public override Tags Map(Tags ATags)
-        {
-            Tags LTags = base.Map(ATags);
-            Tag LTag = LTags.GetTag("IntegratedSecurity");
-            if (LTag != null)
-            {
-                LTags.Remove(LTag.Name);
-                LTags.AddOrUpdate("Trusted_Connection", "Yes");
-            }
-            return LTags;
-        }
-    }
-
-    public class AccessConnectionStringBuilder : ConnectionStringBuilder
-    {
-        public override Tags Map(Tags ATags)
-        {
-            Tags LTags = base.Map(ATags);
-            return LTags;
-        }
-    }
-
-    #endregion
-
-    #region Types
-
-    /// <summary>
-    /// PostgreSQL type : bit
-    ///	D4 Type : Boolean
-    /// 0 = false
-    /// 1 = true
-    /// </summary>
-    public class PostgreSQLBoolean : SQLScalarType
-    {
-        public PostgreSQLBoolean(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        //public PostgreSQLBoolean(ScalarType AScalarType, D4.ClassDefinition AClassDefinition) : base(AScalarType, AClassDefinition){}
-        //public PostgreSQLBoolean(ScalarType AScalarType, D4.ClassDefinition AClassDefinition, bool AIsSystem) : base(AScalarType, AClassDefinition, AIsSystem){}
-
-        public override string ToLiteral(Scalar AValue)
-        {
-            if ((AValue == null) || AValue.IsNil)
-                return String.Format("cast(null as {0})", DomainName());
-
-            return AValue.AsBoolean ? "1" : "0";
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            if (AValue is bool)
-                return new Scalar(AProcess, ScalarType, (bool)AValue);
-            else
-                return new Scalar(AProcess, ScalarType, (int)AValue == 0 ? false : true);
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            return AValue.AsBoolean;
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLBooleanType();
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "bit";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : tinyint
-    /// D4 Type : Byte
-    /// </summary>
-    public class PostgreSQLByte : SQLScalarType
-    {
-        public PostgreSQLByte(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            // According to the docs for the SQLOLEDB provider this is supposed to come back as a byte, but
-            // it is coming back as a short, I don't know why, maybe interop?
-            return new Scalar(AProcess, ScalarType, Convert.ToByte(AValue));
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            return AValue.AsByte;
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLIntegerType(1);
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "tinyint";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : money
-    /// D4 Type : Money
-    /// </summary>
-    public class PostgreSQLMoney : SQLScalarType
-    {
-        public PostgreSQLMoney(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            return new Scalar(AProcess, ScalarType, Convert.ToDecimal(AValue));
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            return AValue.AsDecimal;
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLMoneyType();
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "money";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : datetime
-    /// D4 Type : DateTime
-    /// TSQL datetime values are specified for the range DateTime(1753, 1, 1) to DateTime(9999, 12, 31, 12, 59, 59, 997), accurate to 3.33 milliseconds
-    /// The ADO connectivity layer seems to be rounding datetime values to the nearest second, even though the server is capable of storing greater precision
-    /// </summary>
-    public class PostgreSQLDateTime : SQLScalarType
-    {
-        public const string CDateTimeFormat = "yyyy/MM/dd HH:mm:ss";
-
-        public static readonly DateTime Accuracy = new DateTime((long)(TimeSpan.TicksPerMillisecond * 3.33));
-        public static readonly DateTime MinValue = new DateTime(1753, 1, 1);
-
-        private string FDateTimeFormat = CDateTimeFormat;
-
-        public PostgreSQLDateTime(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        public string DateTimeFormat
-        {
-            get { return FDateTimeFormat; }
-            set { FDateTimeFormat = value; }
-        }
-
-        public override string ToLiteral(Scalar AValue)
-        {
-            if ((AValue == null) || AValue.IsNil)
-                return String.Format("cast(null as {0})", DomainName());
-
-            DateTime LValue = AValue.AsDateTime;
-            if (LValue == DateTime.MinValue)
-                LValue = MinValue;
-            if (LValue < MinValue)
-                throw new SQLException(SQLException.Codes.ValueOutOfRange, ScalarType.Name, LValue.ToString());
-
-            return String.Format("'{0}'", LValue.ToString(DateTimeFormat, DateTimeFormatInfo.InvariantInfo));
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            var LDateTime = (DateTime)AValue;
-            // If the value is equal to the device's zero date, set it to Dataphor's zero date
-            if (LDateTime == MinValue)
-                LDateTime = DateTime.MinValue;
-            long LTicks = LDateTime.Ticks;
-            return new Scalar(AProcess, ScalarType, new DateTime(LTicks - (LTicks % TimeSpan.TicksPerSecond)));
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            DateTime LValue = AValue.AsDateTime;
-            // If the value is equal to Dataphor's zero date, set it to the Device's zero date
-            if (LValue == DateTime.MinValue)
-                LValue = MinValue;
-            if (LValue < MinValue)
-                throw new SQLException(SQLException.Codes.ValueOutOfRange, ScalarType.Name, LValue.ToString());
-            return LValue;
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLDateTimeType();
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "datetime";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : datetime
-    /// D4 Type : Date
-    /// TSQL datetime values are specified for the range DateTime(1753, 1, 1) to DateTime(9999, 12, 31, 12, 59, 59, 997), accurate to 3.33 milliseconds
-    /// </summary>
-    public class PostgreSQLDate : SQLScalarType
-    {
-        public const string CDateFormat = "yyyy/MM/dd";
-
-        private string FDateFormat = CDateFormat;
-
-        public PostgreSQLDate(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        public string DateFormat
-        {
-            get { return FDateFormat; }
-            set { FDateFormat = value; }
-        }
-
-        public override string ToLiteral(Scalar AValue)
-        {
-            if ((AValue == null) || AValue.IsNil)
-                return String.Format("cast(null as {0})", DomainName());
-
-            DateTime LValue = AValue.AsDateTime;
-            // If the value is equal to Dataphor's zero date (Jan, 1, 0001), set it to the device's zero date
-            if (LValue == DateTime.MinValue)
-                LValue = PostgreSQLDateTime.MinValue;
-            if (LValue < PostgreSQLDateTime.MinValue)
-                throw new SQLException(SQLException.Codes.ValueOutOfRange, ScalarType.Name, LValue.ToString());
-
-            return String.Format("'{0}'", LValue.ToString(DateFormat, DateTimeFormatInfo.InvariantInfo));
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            var LDateTime = (DateTime)AValue;
-            // If the value is equal to the Device's zero date, set it to Dataphor's zero date
-            if (LDateTime == PostgreSQLDateTime.MinValue)
-                LDateTime = DateTime.MinValue;
-            long LTicks = LDateTime.Ticks;
-            return new Scalar(AProcess, ScalarType, new DateTime(LTicks - (LTicks % TimeSpan.TicksPerDay)));
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            DateTime LValue = AValue.AsDateTime;
-            // If the value is equal to Dataphor's zero date (Jan, 1, 0001), set it to the device's zero date
-            if (LValue == DateTime.MinValue)
-                LValue = PostgreSQLDateTime.MinValue;
-            if (LValue < PostgreSQLDateTime.MinValue)
-                throw new SQLException(SQLException.Codes.ValueOutOfRange, ScalarType.Name, LValue.ToString());
-            return LValue;
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLDateType();
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "datetime";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : datetime
-    /// D4 Type : SQLTime
-    /// TSQL datetime values are specified for the range DateTime(1753, 1, 1) to DateTime(9999, 12, 31, 12, 59, 59, 997), accurate to 3.33 milliseconds
-    /// </summary>
-    public class PostgreSQLTime : SQLScalarType
-    {
-        public const string CTimeFormat = "HH:mm:ss";
-
-        private string FTimeFormat = CTimeFormat;
-
-        public PostgreSQLTime(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        public string TimeFormat
-        {
-            get { return FTimeFormat; }
-            set { FTimeFormat = value; }
-        }
-
-        public override string ToLiteral(Scalar AValue)
-        {
-            if ((AValue == null) || AValue.IsNil)
-                return String.Format("cast(null as {0})", DomainName());
-
-            // Added 1899 years, so that a time can actually be stored.
-            // Adding 1899 years puts it at the year 1900
-            // which is stored as zero in PostgreSQL.
-            // this year value of 1900 may make some translation easier.
-            DateTime LValue = AValue.AsDateTime.AddYears(1899);
-            if (LValue < PostgreSQLDateTime.MinValue)
-                throw new SQLException(SQLException.Codes.ValueOutOfRange, ScalarType.Name, LValue.ToString());
-
-            return String.Format("'{0}'", LValue.ToString(TimeFormat, DateTimeFormatInfo.InvariantInfo));
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            return new Scalar(AProcess, ScalarType, new DateTime(((DateTime)AValue).Ticks % TimeSpan.TicksPerDay));
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            // Added 1899 years, so that a time can actually be stored.
-            // Adding 1899 years puts it at the year 1900
-            // which is stored as zero in PostgreSQL.
-            // this year value of 1900 may make some translation easier.
-            DateTime LValue = AValue.AsDateTime.AddYears(1899);
-            if (LValue < PostgreSQLDateTime.MinValue)
-                throw new SQLException(SQLException.Codes.ValueOutOfRange, ScalarType.Name, LValue.ToString());
-            return LValue;
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLTimeType();
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "datetime";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : uniqueidentifier
-    /// D4 type : Guid
-    /// TSQL comparison operators for the TSQL uniqueidentifier data type use string semantics, not hexadecimal
-    /// </summary>
-    public class PostgreSQLGuid : SQLScalarType
-    {
-        public PostgreSQLGuid(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        public override string ToLiteral(Scalar AValue)
-        {
-            if ((AValue == null) || AValue.IsNil)
-                return String.Format("cast(null as {0})", DomainName());
-
-            return String.Format("'{0}'", AValue.AsGuid);
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            if (AValue is string)
-                return new Scalar(AProcess, ScalarType, new Guid((string)AValue));
-            else
-                return new Scalar(AProcess, ScalarType, (Guid)AValue);
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            return AValue.AsGuid;
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLGuidType();
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "uniqueidentifier";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : text
-    /// D4 Type : SQLText, SQLIText
-    /// </summary>
-    public class PostgreSQLText : SQLText
-    {
-        public PostgreSQLText(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        //public PostgreSQLText(ScalarType AScalarType, D4.ClassDefinition AClassDefinition) : base(AScalarType, AClassDefinition){}
-        //public PostgreSQLText(ScalarType AScalarType, D4.ClassDefinition AClassDefinition, bool AIsSystem) : base(AScalarType, AClassDefinition, AIsSystem){}
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "text";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : image
-    /// D4 type : Binary
-    /// </summary>
-    public class PostgreSQLBinary : SQLBinary
-    {
-        public PostgreSQLBinary(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        //public PostgreSQLBinary(ScalarType AScalarType, D4.ClassDefinition AClassDefinition) : base(AScalarType, AClassDefinition){}
-        //public PostgreSQLBinary(ScalarType AScalarType, D4.ClassDefinition AClassDefinition, bool AIsSystem) : base(AScalarType, AClassDefinition, AIsSystem){}
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "image";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : image
-    /// D4 type : Graphic
-    /// </summary>
-    public class PostgreSQLGraphic : SQLGraphic
-    {
-        public PostgreSQLGraphic(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        //public PostgreSQLGraphic(ScalarType AScalarType, D4.ClassDefinition AClassDefinition) : base(AScalarType, AClassDefinition){}
-        //public PostgreSQLGraphic(ScalarType AScalarType, D4.ClassDefinition AClassDefinition, bool AIsSystem) : base(AScalarType, AClassDefinition, AIsSystem){}
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return "image";
-        }
-    }
-
-    /// <summary>
-    /// PostgreSQL type : binary(Storage.Length)
-    /// D4 Type : PostgreSQLBinary
-    /// </summary>
-    public class PostgreSQLPostgreSQLBinary : SQLScalarType
-    {
-        public PostgreSQLPostgreSQLBinary(int AID, string AName)
-            : base(AID, AName)
-        {
-        }
-
-        public override string ToLiteral(Scalar AValue)
-        {
-            if ((AValue == null) || AValue.IsNil)
-                return String.Format("cast(null as {0})", DomainName());
-
-            return String.Format("'{0}'", AValue.AsString);
-        }
-
-        public override Scalar ToScalar(IServerProcess AProcess, object AValue)
-        {
-            return new Scalar(AProcess, ScalarType, AValue);
-        }
-
-        public override object FromScalar(Scalar AValue)
-        {
-            return AValue.AsByteArray;
-        }
-
-        protected int GetLength(MetaData AMetaData)
-        {
-            return Int32.Parse(GetTag("Storage.Length", "30", AMetaData));
-        }
-
-        public override SQLType GetSQLType(MetaData AMetaData)
-        {
-            return new SQLByteArrayType(GetLength(AMetaData));
-        }
-
-        protected override string InternalNativeDomainName(MetaData AMetaData)
-        {
-            return String.Format("binary({0})", GetLength(AMetaData)); // todo: what about varbiniary?
-        }
-    }
-
-
-    #endregion
-
-    #region Instruction Nodes
-
-    public class PostgreSQLPostgreSQLBinaryCompareNode : InstructionNode
-    {
-        public static int Compare(Scalar ALeftValue, Scalar ARightValue)
-        {
-            Stream LLeftStream = ALeftValue.IsNative
-                                     ? new MemoryStream(ALeftValue.AsByteArray, 0, ALeftValue.AsByteArray.Length, false,
-                                                        true)
-                                     : ALeftValue.OpenStream();
-            try
-            {
-                Stream LRightStream = ARightValue.IsNative
-                                          ? new MemoryStream(ARightValue.AsByteArray, 0, ARightValue.AsByteArray.Length,
-                                                             false, true)
-                                          : ARightValue.OpenStream();
-                try
-                {
-                    int LLeftByte;
-                    int LRightByte;
-
-                    while (true)
-                    {
-                        LLeftByte = LLeftStream.ReadByte();
-                        LRightByte = LRightStream.ReadByte();
-
-                        if (LLeftByte != LRightByte)
-                            break;
-
-                        if (LLeftByte == -1)
-                            break;
-
-                        if (LRightByte == -1)
-                            break;
-                    }
-
-                    return LLeftByte == LRightByte ? 0 : LLeftByte > LRightByte ? 1 : -1;
-                }
-                finally
-                {
-                    LRightStream.Close();
-                }
-            }
-            finally
-            {
-                LLeftStream.Close();
-            }
-        }
-
-        public override DataVar InternalExecute(ServerProcess AProcess, DataVar[] AArguments)
-        {
-            if ((AArguments[0].Value == null) || (AArguments[1].Value == null))
-                return new DataVar(FDataType, null);
-            else
-                return new DataVar(FDataType,
-                                   new Scalar(AProcess, (ScalarType)FDataType,
-                                              Compare((Scalar)AArguments[0].Value, (Scalar)AArguments[1].Value)));
-        }
-    }
-
-    public class PostgreSQLPostgreSQLBinaryEqualNode : InstructionNode
-    {
-        public override DataVar InternalExecute(ServerProcess AProcess, DataVar[] AArguments)
-        {
-            if ((AArguments[0].Value == null) || (AArguments[1].Value == null))
-                return new DataVar(FDataType, null);
-            else
-                return new DataVar(FDataType,
-                                   new Scalar(AProcess, (ScalarType)FDataType,
-                                              PostgreSQLPostgreSQLBinaryCompareNode.Compare((Scalar)AArguments[0].Value,
-                                                                                (Scalar)AArguments[1].Value) == 0));
-        }
-    }
-
-    public class PostgreSQLPostgreSQLBinaryNotEqualNode : InstructionNode
-    {
-        public override DataVar InternalExecute(ServerProcess AProcess, DataVar[] AArguments)
-        {
-            if ((AArguments[0].Value == null) || (AArguments[1].Value == null))
-                return new DataVar(FDataType, null);
-            else
-                return new DataVar(FDataType,
-                                   new Scalar(AProcess, (ScalarType)FDataType,
-                                              PostgreSQLPostgreSQLBinaryCompareNode.Compare((Scalar)AArguments[0].Value,
-                                                                                (Scalar)AArguments[1].Value) != 0));
-        }
-    }
-
-    public class PostgreSQLPostgreSQLBinaryLessNode : InstructionNode
-    {
-        public override DataVar InternalExecute(ServerProcess AProcess, DataVar[] AArguments)
-        {
-            if ((AArguments[0].Value == null) || (AArguments[1].Value == null))
-                return new DataVar(FDataType, null);
-            else
-                return new DataVar(FDataType,
-                                   new Scalar(AProcess, (ScalarType)FDataType,
-                                              PostgreSQLPostgreSQLBinaryCompareNode.Compare((Scalar)AArguments[0].Value,
-                                                                                (Scalar)AArguments[1].Value) < 0));
-        }
-    }
-
-    public class PostgreSQLPostgreSQLBinaryInclusiveLessNode : InstructionNode
-    {
-        public override DataVar InternalExecute(ServerProcess AProcess, DataVar[] AArguments)
-        {
-            if ((AArguments[0].Value == null) || (AArguments[1].Value == null))
-                return new DataVar(FDataType, null);
-            else
-                return new DataVar(FDataType,
-                                   new Scalar(AProcess, (ScalarType)FDataType,
-                                              PostgreSQLPostgreSQLBinaryCompareNode.Compare((Scalar)AArguments[0].Value,
-                                                                                (Scalar)AArguments[1].Value) <= 0));
-        }
-    }
-
-    public class PostgreSQLPostgreSQLBinaryGreaterNode : InstructionNode
-    {
-        public override DataVar InternalExecute(ServerProcess AProcess, DataVar[] AArguments)
-        {
-            if ((AArguments[0].Value == null) || (AArguments[1].Value == null))
-                return new DataVar(FDataType, null);
-            else
-                return new DataVar(FDataType,
-                                   new Scalar(AProcess, (ScalarType)FDataType,
-                                              PostgreSQLPostgreSQLBinaryCompareNode.Compare((Scalar)AArguments[0].Value,
-                                                                                (Scalar)AArguments[1].Value) > 0));
-        }
-    }
-
-    public class PostgreSQLPostgreSQLBinaryInclusiveGreaterNode : InstructionNode
-    {
-        public override DataVar InternalExecute(ServerProcess AProcess, DataVar[] AArguments)
-        {
-            if ((AArguments[0].Value == null) || (AArguments[1].Value == null))
-                return new DataVar(FDataType, null);
-            else
-                return new DataVar(FDataType,
-                                   new Scalar(AProcess, (ScalarType)FDataType,
-                                              PostgreSQLPostgreSQLBinaryCompareNode.Compare((Scalar)AArguments[0].Value,
-                                                                                (Scalar)AArguments[1].Value) >= 0));
-        }
-    }
-
-    #endregion
-
-}


Ensure timescale is sent to new clients

Ensure timescale is sent to new clients

--- ShadowOperations/ServerGame/ServerMainSystem/ServerTick.cs
+++ ShadowOperations/ServerGame/ServerMainSystem/ServerTick.cs
@@ -273,6 +273,7 @@
             {
                 Players.Add((PlayerEntity)e);
                 ((PlayerEntity)e).Network.SendPacket(new YourEIDPacketOut(e.EID));
+                ((PlayerEntity)e).Network.SendPacket(new CVarSetPacketOut(CVars.g_timescale, this));
                 for (int i = 0; i < Networking.Strings.Strings.Count; i++)
                 {
                     ((PlayerEntity)e).Network.SendPacket(new NetStringPacketOut(Networking.Strings.Strings[i]));


removed obsolete from IsOpen and instead made it read only , add Cancelled event , also made IsCancelled read only Note : this isn't a breaking change , only the read only properties might be breaking

--- MahApps.Metro/Controls/Dialogs/ProgressDialogController.cs
+++ MahApps.Metro/Controls/Dialogs/ProgressDialogController.cs
@@ -12,23 +12,36 @@
         private ProgressDialog WrappedDialog { get; set; }
         private Func<Task> CloseCallback { get; set; }

+
+
+        /// <summary>
+        /// This event is raised when the associated <see cref="ProgressDialog"/> was closed programmatically.
+        /// </summary>
+        public event EventHandler Closed;
+
+        /// <summary>
+        /// This event is raised when the associated <see cref="ProgressDialog"/> was cancelled by the user.
+        /// </summary>
+        public event EventHandler Cancelled;
+
+        /// <summary>
+        /// Gets if the Cancel button has been pressed.
+        /// </summary>
+        public bool IsCancelled {get{ return m_iscanceled;}}
+        private bool m_iscanceled;
+
         /// <summary>
         /// Gets if the wrapped ProgressDialog is open.
-        /// </summary>
-        [Obsolete("Use the Closed event instead")]
-        public bool IsOpen { get; private set; }
-
-        /// <summary>
-        /// This event is raised when the associated <see cref="ProgressDialog"/> was closed.
-        /// </summary>
-        public event EventHandler Closed;
+        /// </summary>
+        public bool IsOpen { get { return m_isopen; } }
+        private bool m_isopen;

         internal ProgressDialogController(ProgressDialog dialog, Func<Task> closeCallBack)
         {
             WrappedDialog = dialog;
             CloseCallback = closeCallBack;

-            IsOpen = dialog.IsVisible;
+            m_isopen = dialog.IsVisible;

             InvokeAction(() => {
                 WrappedDialog.PART_NegativeButton.Click += PART_NegativeButton_Click;
@@ -43,7 +56,12 @@
         private void PART_NegativeButton_Click(object sender, RoutedEventArgs e)
         {
             Action action = () => {
-                IsCanceled = true;
+                m_iscanceled = true;
+                var handler = Cancelled;
+                if (handler != null)
+                {
+                    handler(this, EventArgs.Empty);
+                }
                 WrappedDialog.PART_NegativeButton.IsEnabled = false;
             };

@@ -121,10 +139,7 @@
             InvokeAction(() => WrappedDialog.Title = title);
         }

-        /// <summary>
-        /// Gets if the Cancel button has been pressed.
-        /// </summary>
-        public bool IsCanceled { get; private set; }
+

         /// <summary>
         /// Begins an operation to close the ProgressDialog.
@@ -135,7 +150,7 @@
             Action action = () => {
                 if (!WrappedDialog.IsVisible)
                 {
-                    throw new InvalidOperationException();
+                    throw new InvalidOperationException("Dialog isn't visible to close");
                 }
                 WrappedDialog.Dispatcher.VerifyAccess();
                 WrappedDialog.PART_NegativeButton.Click -= PART_NegativeButton_Click;
@@ -144,7 +159,7 @@
             InvokeAction(action);

             return CloseCallback().ContinueWith(_ => InvokeAction(new Action(() => {
-                IsOpen = false;
+                m_isopen = false;

                 var handler = Closed;
                 if (handler != null) {


ViewOrCreateRoute -> NavigateRoute

ViewOrCreateRoute -> NavigateRoute

--- Signum.Web.Extensions.Selenium/OldApi/SeleniumTestClass.cs
+++ Signum.Web.Extensions.Selenium/OldApi/SeleniumTestClass.cs
@@ -99,7 +99,7 @@
             return new SearchPageProxy(selenium);
         }

-        protected virtual string ViewOrCreateRoute(Type type, int? id)
+        protected virtual string NavigateRoute(Type type, int? id)
         {
             var typeName = TypeLogic.TypeToName.TryGetC(type) ?? Reflector.CleanTypeName(type);

@@ -109,9 +109,9 @@
                 return "Create/{0}".Formato(typeName);
         }

-        protected virtual string ViewRoute(Lite<IIdentifiable> lite)
+        protected virtual string NavigateRoute(Lite<IIdentifiable> lite)
         {
-            return ViewOrCreateRoute(lite.EntityType, lite.IdOrNull);
+            return NavigateRoute(lite.EntityType, lite.IdOrNull);
         }

         public NormalPage<T> NormalPage<T>(int id, Action<string> checkLogin = null) where T : IdentifiableEntity
@@ -121,7 +121,7 @@

         public NormalPage<T> NormalPage<T>(Action<string> checkLogin = null) where T : IdentifiableEntity
         {
-            var url = Url(ViewOrCreateRoute(typeof(T), null));
+            var url = Url(NavigateRoute(typeof(T), null));

             return NormalPageUrl<T>(url, checkLogin);
         }
@@ -131,7 +131,7 @@
             if(lite != null && lite.EntityType != typeof(T))
                 throw new InvalidOperationException("Use NormalPage<{0}> instead".Formato(lite.EntityType.Name));

-            var url = Url(ViewRoute(lite));
+            var url = Url(NavigateRoute(lite));

             return NormalPageUrl<T>(url, checkLogin);
         }


(TFS CS 5830)

(TFS CS 5830)

--- Signum.Web.Extensions/Operations/OperationButtonFactory.cs
+++ Signum.Web.Extensions/Operations/OperationButtonFactory.cs
@@ -21,7 +21,11 @@
             return new ToolBarButton
             {
                 Id = EnumDN.UniqueKey(ctx.OperationInfo.Key),
-                DivCssClass = ctx.OperationSettings.TryCC(o => EntityOperationSettings.CssClass(ctx.OperationInfo.Key)) ?? ToolBarButton.DefaultEntityDivCssClass,
+
+                DivCssClass = " ".CombineIfNotEmpty(
+                    ToolBarButton.DefaultEntityDivCssClass,
+                    EntityOperationSettings.CssClass(ctx.OperationInfo.Key)),
+
                 AltText = ctx.OperationSettings.TryCC(o => o.AltText) ?? ctx.OperationInfo.CanExecute,
                 Enabled = ctx.OperationInfo.CanExecute == null,

@@ -35,7 +39,11 @@
             return new ToolBarButton
             {
                 Id = EnumDN.UniqueKey(ctx.OperationInfo.Key),
-                DivCssClass = ctx.OperationSettings.TryCC(o => EntityOperationSettings.CssClass(ctx.OperationInfo.Key)) ?? ToolBarButton.DefaultQueryCssClass,
+
+                DivCssClass = " ".CombineIfNotEmpty(
+                    ToolBarButton.DefaultQueryCssClass,
+                    EntityOperationSettings.CssClass(ctx.OperationInfo.Key)),
+
                 AltText = ctx.OperationSettings.TryCC(o => o.AltText),

                 Text = ctx.OperationSettings.TryCC(o => o.Text) ?? ctx.OperationInfo.Key.NiceToString(),


have a better delete and create logic for extra or missing recourceGroups

--- SimpleWAWS/Code/CsmExtensions/CsmSubscriptionExtensions.cs
+++ SimpleWAWS/Code/CsmExtensions/CsmSubscriptionExtensions.cs
@@ -63,14 +63,14 @@
                        !subscription.ResourceGroups
                            .Any(rg => rg.ResourceGroupName.StartsWith(string.Format(CultureInfo.InvariantCulture, "{0}_{1}", Constants.TryResourceGroupPrefix, g.Replace(" ", Constants.TryResourceGroupSeparator)), StringComparison.OrdinalIgnoreCase)));

-            result.Ready = subscription.ResourceGroups;
+            result.ToDelete = subscription.ResourceGroups
+                .GroupBy(s => s.GeoRegion)
+                .Select(g => new { Region = g.Key, ResourceGroups = g.Select(r => r), Count = g.Count() })
+                .Where(g => g.Count > 1)
+                .Select(g => g.ResourceGroups.Where(rg => string.IsNullOrEmpty(rg.UserId)).Skip(1))
+                .SelectMany(i => i);

-            if (subscription.ResourceGroups.Count() > geoRegions.Count())
-            {
-                //we have extra resourceGroups. We should delete it.
-            }
-
-            result.ToDelete = Enumerable.Empty<ResourceGroup>();
+            result.Ready = subscription.ResourceGroups.Where(rg => !result.ToDelete.Any(drg => drg.ResourceGroupName == rg.ResourceGroupName));

             return result;
         }


comment out the extension attribute

comment out the extension attribute

--- OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
+++ OpenSim/Region/OptionalModules/Example/BareBonesShared/BareBonesSharedModule.cs
@@ -49,7 +49,7 @@
     /// When the module is enabled it will print messages when it receives certain events to the screen and the log
     /// file.
     /// </remarks>
-    [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BareBonesSharedModule")]
+    //[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "BareBonesSharedModule")]
     public class BareBonesSharedModule : ISharedRegionModule
     {
         private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);


fixed a problem where the image could not be displayed

--- Source/Examples/WPF.SharpDX/ImageViewDemo/MainViewModel.cs
+++ Source/Examples/WPF.SharpDX/ImageViewDemo/MainViewModel.cs
@@ -33,7 +33,7 @@
         private Color gridColor;
         private Media3D.Transform3D planeTransform;
         private Media3D.Transform3D gridTransform;
-        private Vector3 directionalLightDirection;
+        private Vector3D directionalLightDirection;
         private Color4 directionalLightColor;
         private Color4 ambientLightColor;

@@ -91,7 +91,7 @@
             }
         }

-        public Vector3 DirectionalLightDirection
+        public Vector3D DirectionalLightDirection
         {
             get { return this.directionalLightDirection; }
             set
@@ -139,7 +139,7 @@
             // setup lighting
             this.AmbientLightColor = new Color4(0f, 0f, 0f, 0f);
             this.DirectionalLightColor = Color.White;
-            this.DirectionalLightDirection = new Vector3(-0, -0, -10);
+            this.DirectionalLightDirection = new Vector3D(-0, -0, -10);

             // floor plane grid
             this.Grid = LineBuilder.GenerateGrid(Vector3.UnitZ, -5, 5, -5, 5);
@@ -266,4 +266,4 @@
             }
         }
     }
-}+}


Capability classes: override Equals(object)

--- Models/SelfOrganizingPillProduction/Modeling/Capability.cs
+++ Models/SelfOrganizingPillProduction/Modeling/Capability.cs
@@ -35,15 +35,33 @@
     /// <summary>
     /// Represents the loading of empty pill containers on the conveyor belt.
     /// </summary>
-    public class ProduceCapability : Capability
+    public sealed class ProduceCapability : Capability
     {
+        public override bool Equals(object obj)
+        {
+            return obj is ProduceCapability;
+        }
+
+        public override int GetHashCode()
+        {
+            return 17;
+        }
     }

     /// <summary>
     /// Represents the removal of pill containers from the conveyor belt, labeling and palletization.
     /// </summary>
-    public class ConsumeCapability : Capability
+    public sealed class ConsumeCapability : Capability
     {
+        public override bool Equals(object obj)
+        {
+            return obj is ConsumeCapability;
+        }
+
+        public override int GetHashCode()
+        {
+            return 31;
+        }
     }

     /// <summary>
@@ -60,5 +78,18 @@
         public IngredientType Type { get; }

         public uint Amount { get; }
+
+        public override bool Equals(object obj)
+        {
+            var other = obj as Ingredient;
+            if (other != null)
+                return other.Type == Type && other.Amount == Amount;
+            return false;
+        }
+
+        public override int GetHashCode()
+        {
+            return (int)Type + 57 * (int)Amount;
+        }
     }
 }


[Debugger] Use the passed-in options when evaluating ValueReference.Value

Fixes a bug reported in Assistly where clicking the Refresh button didn't
actually refresh the value.

--- Mono.Debugging/Mono.Debugging.Evaluation/ValueReference.cs
+++ Mono.Debugging/Mono.Debugging.Evaluation/ValueReference.cs
@@ -88,7 +88,6 @@
 			if (!CanEvaluate (options))
 				return DC.ObjectValue.CreateImplicitNotSupported (this, new ObjectPath (Name), ctx.Adapter.GetTypeName (GetContext (options), Type), Flags);
 			if (withTimeout) {
-				options = options.Clone ();
 				return ctx.Adapter.CreateObjectValueAsync (Name, Flags, delegate {
 					return CreateObjectValue (options);
 				});
@@ -128,7 +127,18 @@
 				name = "?";

 			EvaluationContext newCtx = GetContext (options);
-			object val = Value;
+			EvaluationContext oldCtx = Context;
+			object val = null;
+
+			try {
+				// Note: The Value property implementation may make use of the EvaluationOptions,
+				// so we need to override our context temporarily to do the evaluation.
+				ctx = newCtx;
+				val = Value;
+			} finally {
+				ctx = oldCtx;
+			}
+
 			if (val != null)
 				return newCtx.Adapter.CreateObjectValue (newCtx, this, new ObjectPath (name), val, Flags);
 			else


fixed broken unit test

fixed broken unit test

--- Source/MonoGame.Extended.Content.Pipeline.Tests/AstridAnimatorProcessorTests.cs
+++ Source/MonoGame.Extended.Content.Pipeline.Tests/AstridAnimatorProcessorTests.cs
@@ -17,9 +17,13 @@
             var processor = new AstridAnimatorProcessor();
             var result = processor.Process(importerResult, null);

-            Assert.AreEqual("", result.TextureAtlasAssetName);
-            Assert.AreEqual("", result.Directory);
-            Assert.IsNotNull(result);
+
+            Assert.AreEqual("astrid-animator-atlas", result.TextureAtlasAssetName);
+            Assert.AreEqual("TestData", result.Directory);
+            Assert.AreEqual(3, result.Frames.Count);
+            Assert.AreEqual("appear_01", result.Frames[0]);
+            Assert.AreEqual("appear_02", result.Frames[1]);
+            Assert.AreEqual("die_01", result.Frames[2]);
         }
     }
 }


minimize json before saving

minimize json before saving

--- NeuralNetwork.GeneticAlgorithm/Utils/NeuralNetworkSaver.cs
+++ NeuralNetwork.GeneticAlgorithm/Utils/NeuralNetworkSaver.cs
@@ -1,11 +1,10 @@
 using ArtificialNeuralNetwork;
 using Newtonsoft.Json;
 using System;
-using System.Collections.Generic;
 using System.IO;
-using System.Linq;
+using System.IO.Compression;
 using System.Text;
-using System.Threading.Tasks;
+using System.Text.RegularExpressions;

 namespace NeuralNetwork.GeneticAlgorithm.Utils
 {
@@ -22,9 +21,15 @@
         {
             var genes = network.GetGenes();
             var json = JsonConvert.SerializeObject(genes);
+            var minimized = MinifyJson(json);
             var filename = string.Format("\\network_eval_{0}_epoch_{1}_date_{2}.json", networkEvaluation, epoch, DateTime.Now.Ticks);
-            File.WriteAllText(_directory + filename, json);
+            File.WriteAllText(_directory + filename, minimized);
             return filename;
+        }
+
+        internal string MinifyJson(string json)
+        {
+            return Regex.Replace(json, "(\"(?:[^\"\\\\]|\\\\.)*\")|\\s+", "$1");
         }
     }
 }


[VsIntegration] Fix another case where the data for the first member in the XML file is not shown

--- VisualStudio/ProjectPackage/Editors/XMLDoc/XSharpXMLDoc.cs
+++ VisualStudio/ProjectPackage/Editors/XMLDoc/XSharpXMLDoc.cs
@@ -184,10 +184,7 @@
                 uint id = 0;
                 string xml = "";
                 var result = file.ParseMemberSignature(sig, out id);
-                if (result >= 0 && id != 0)
-                {
-                    result = file.GetMemberXML(id, out xml);
-                }
+                result = file.GetMemberXML(id, out xml);
                 summary = getSummary(file, xml, out returns, out remarks);
             }
             return summary;
@@ -311,10 +308,7 @@
                     uint id = 0;
                     string xml = "";
                     var result = file.ParseMemberSignature(sig, out id);
-                    if (result >= 0 && id != 0)
-                    {
-                        result = file.GetMemberXML(id, out xml);
-                    }
+                    result = file.GetMemberXML(id, out xml);
                     getParameterInfo(file, xml, names, descriptions);
                 }
             }


* fixed issue where images were being decoded into poor quality

--- TwinTechsForms/TwinTechsForms.Droid/MonoDroidToolkit/ImageLoader/ImageLoader.cs
+++ TwinTechsForms/TwinTechsForms.Droid/MonoDroidToolkit/ImageLoader/ImageLoader.cs
@@ -172,12 +172,13 @@
 			try {
 				//decode image size
 				BitmapFactory.Options options = new BitmapFactory.Options {
-					InJustDecodeBounds = true,
-					InPurgeable = true
+					//InJustDecodeBounds = true,
+					InPreferQualityOverSpeed = true
 				};

-				BitmapFactory.DecodeStream (new FileStream (file.Path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite), null, options);//FileStream?
-
+				return BitmapFactory.DecodeStream (new FileStream (file.Path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite), null, options);//FileStream?
+
+				/*
 				//Find the correct scale value. It should be the power of 2.
 				int tempWidth = options.OutWidth;
 				int tempHeight = options.OutHeight;
@@ -197,6 +198,7 @@
 				BitmapFactory.Options options2 = new BitmapFactory.Options { InSampleSize = scale };

 				return BitmapFactory.DecodeStream (new FileStream (file.Path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite), null, options2);//FileStream?
+				*/
 			} catch (Exception e) {

 			}


hopefully fix murder premature solve

hopefully fix murder premature solve

--- TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Asimir/MurderComponentSolver.cs
+++ TwitchPlaysAssembly/Src/ComponentSolvers/Modded/Asimir/MurderComponentSolver.cs
@@ -56,7 +56,7 @@
 				foreach (object item in CycleThroughCategory(i))
 				{
 					double j = i == 2 ? 0.8 : 1.5;
-					DoInteractionClick((MonoBehaviour) item);
+					yield return DoInteractionClick((MonoBehaviour) item);
 					yield return "trywaitcancel " + j + " The murder cycle command was cancelled";
 				}
 			}
@@ -98,6 +98,7 @@
 			}
 		}

+		yield return null;
 		if (!anyMisspelling)
 			yield return DoInteractionClick(_buttons[6]);
 	}


fix(on main program exit): add onexit handle when program exit on windows

--- src/WeGouSharp/Program.cs
+++ src/WeGouSharp/Program.cs
@@ -51,8 +51,8 @@
                 {
                     //run powershell to kill
                     var gracefulShutdown = @"$
-                    geckodrives=(ps -Name geckodrive)
-                    Stop-Process -InputObject $geckodrives
+                    $geckodrivers=(ps -Name geckodriver)
+                    Stop-Process -InputObject $geckodrivers

                     #list all firefox instance
                     $all_ff=(ps -Name firefox | select id,ProcessName,mainWindowTItle)
@@ -93,6 +93,28 @@
                 {
                      Console.WriteLine("Ctrl-C catched ");
                 }
+
+                //On windows 10, program catch calcle signal, but not handle , so clean up and exit program manully
+                 if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+                {
+                    //run powershell to kill
+                    var gracefulShutdown = @"$
+                    $geckodrivers=(ps -Name geckodriver)
+                    Stop-Process -InputObject $geckodrivers
+
+                    #list all firefox instance
+                    $all_ff=(ps -Name firefox | select id,ProcessName,mainWindowTItle)
+                    echo $all_ff
+
+                    #headless firefox mainWindowTItle=''
+                    $headless_firefox=(ps -Name firefox| Where { $_.mainWindowTItle -eq '' } )
+                    Stop-Process -InputObject $headless_firefox";
+                    gracefulShutdown.RunAsShell(isPowerShell:true);
+                   // return;
+                    Environment.Exit(0);
+
+                }
+

             };


# UI Improvement for PROCUREMENT: - Bid Administration View

--- Web/Areas/Procurement/Views/BidAdministration/Index.cshtml
+++ Web/Areas/Procurement/Views/BidAdministration/Index.cshtml
@@ -6,154 +6,193 @@
 @model Cats.Areas.Procurement.Models.SelectedBidWinnerViewModel
 @{
     ViewBag.Title = "Index";
-    Layout = "~/Views/Shared/_MainLayoutWide.cshtml";
+    Layout = "~/Views/Shared/NewTheme _MainLayout.cshtml";
+    //Layout = "~/Views/Shared/_MainLayout.cshtml";
+    ViewBag.PageTitle = "Bid Administration";
+    ViewBag.PageTitleDescription = "";
 }
 @*@section LeftBar
-{
-    @Html.Partial("LeftBar")
-
-}*@
+    {
+        @Html.Partial("LeftBar")
+
+    }*@

-@section Toolbar    {
-
-   @*

-        <button class="btn">Action</button>
-        @{
-
-            <button class="btn dropdown-toggle " data-toggle="dropdown">
-
-            </button>
-
-        }
-

-
-
View Bid Plan

-

+@*@section Toolbar    {

-
*@
-
-}
+

+            <button class="btn">Action</button>
+            @{

-

-

-                    @Html.Label("Active BID")
+                <button class="btn dropdown-toggle " data-toggle="dropdown">
+
+                </button>
+
+            }
+

+
+
View Bid Plan

+

+
+

+
+    }
+*@
+

+

+

+

+                @Html.Label("Active BID")
+

+

+                @Html.DropDownList("BIDID", null, "--- Select Active Bid ---", new {@class = "form-control"})
+

+
Winner Is not Generated for this Bid

+                    Go To Winner Generation Page

-

-        @Html.DropDownList("BIDID",String.Empty)
-

-
Winner Is not Generated for this Bid

-         Go To Winner Generation Page
-

+

+

-

-@*
*@
+

+

+

+

+

+
+                     @Html.Translate("List of  Bid Winners")
+
+

-

-
List of Bid Winners

-        @(Html.Kendo().Grid<BidWinnerViewModel>()
-              .Name("grid1")
-              .Columns(columns =>
-                  {
+

+
+

+

+

+                @*
*@
+                @*
List of Bid Winners
*@
+

+                    @(Html.Kendo().Grid<BidWinnerViewModel>()
+                          .Name("grid1")
+                          .Columns(columns =>
+                          {

-                      columns.Bound(t => t.TransporterName);
-                      columns.Bound(t => t.SourceWarehouse);
-                      columns.Bound(t => t.Woreda);
-                      columns.Bound(t => t.WinnerTariff).Title(Html.Translate("Tariff/Qtl"));
-
-                  })
-              .Scrollable()
-               .HtmlAttributes(new {style = "height:340px;"})
-              .DataSource(datasource =>
+                              columns.Bound(t => t.TransporterName);
+                              columns.Bound(t => t.SourceWarehouse);
+                              columns.Bound(t => t.Woreda);
+                              columns.Bound(t => t.WinnerTariff).Title(Html.Translate("Tariff/Qtl"));
+
+                          })
+                          .Scrollable()
+                          .HtmlAttributes(new {style = "height:340px;"})
+                          .DataSource(datasource =>
+                              datasource
+                                  .Ajax()
+                                  .Model(model => model.Id(p => p.BidWinnnerID))
+                                  .Group(group => group.Add(m => m.Region))
+                                  //.Group(group => group.Add(m => m.SourceWarehouse))
+                                  .Group(group => group.Add(m => m.TransporterName))
+
+                                  .Read(read => read.Action("BidAdminDraft_Read", "BidAdministration").Data("filterInfo"))))
+
+
+
+

+

+

+

+    @*

+
Bid Plan Detail

+
+            @Html.Partial("_BidPlanDetail", Model)
+
 *@
+

+

+

+

+
+                     @Html.Translate("Woredas With out bid Offer")
+
+

+
+

+
+

+

+

+                @*
*@
+                @*
Woredas With out bid Offer
*@
+

+                    @(Html.Kendo().Grid<BidWinnerViewModel>()
+                      .Name("withOutOffer")
+                      .Columns(columns =>
+                      {
+
+                          columns.Bound(t => t.SourceWarehouse);
+                          columns.Bound(t => t.Woreda);
+                      })
+                      .Scrollable()
+                      .HtmlAttributes(new {style = "height:340px;"})
+                      .DataSource(datasource =>
                           datasource
                               .Ajax()
-                              .Model(model => model.Id(p => p.BidWinnnerID))
-                              .Group(group=> group.Add(m=>m.Region))
-                              //.Group(group => group.Add(m => m.SourceWarehouse))
-                              .Group(group=> group.Add(m=>m.TransporterName))
-
-              .Read(read=>read.Action("BidAdminDraft_Read","BidAdministration").Data("filterInfo"))))
-
+                              .Model(model => model.Id(p => p.BidID))
+                              .Group(group => group.Add(m => m.Region))
+                              // .Read(read=>read.Action("WoredasWithoutOffer_Read","BidAdministration").Data("filterInfo"))
+                              .Read(read => read.Action("WoredasWithoutOffer_Read", "BidAdministration").Data("filterInfo"))
+                      ))

-
+
+

+

+

-    @*

-
Bid Plan Detail

-
-        @Html.Partial("_BidPlanDetail", Model)
-
 *@
-

-
Woredas With out bid Offer

-
-         @(Html.Kendo().Grid<BidWinnerViewModel>()
-        .Name("withOutOffer")
-        .Columns(columns=>
-        {
-
-       columns.Bound(t => t.SourceWarehouse);
-        columns.Bound(t => t.Woreda);
-        })
-     .Scrollable()
-      .HtmlAttributes(new {style = "height:340px;"})
-        .DataSource(datasource=>
-            datasource
-            .Ajax()
-    .Model(model=>model.Id(p=>p.BidID))
-    .Group(group=>group.Add(m=>m.Region))
-   // .Read(read=>read.Action("WoredasWithoutOffer_Read","BidAdministration").Data("filterInfo"))
-    .Read(read=>read.Action("WoredasWithoutOffer_Read","BidAdministration").Data("filterInfo"))
-    ))
-
-
-

-
-@*
*@
-
+
+
+    </script>


Test3 'Red'

Test3 'Red'

--- TDD-Katas-project/TDD-Katas-project/OddEvenKata/OddEven.cs
+++ TDD-Katas-project/TDD-Katas-project/OddEvenKata/OddEven.cs
@@ -34,5 +34,9 @@
         {
             return (number % 2 != 0);
         }
+        private static bool IsPrimeNumber(int number)
+        {
+            return number%number == 0;
+        }
     }
 }


Add a method in the MathHelperExtension class to get the centroid of a polygon.

--- Xmas-Hell/Xmas-Hell-Core/Extensions/MathHelperExtension.cs
+++ Xmas-Hell/Xmas-Hell-Core/Extensions/MathHelperExtension.cs
@@ -72,5 +72,28 @@
         {
             return vector1.Y * vector2.X - vector1.X * vector2.Y;
         }
+
+        public static Vector2 GetCentroid(List<Vector2> worldPositionVertices)
+        {
+            float area = 0f, crossProduct = 0f;
+            Vector2 centroid = Vector2.Zero, currentVector = Vector2.Zero;
+            Vector2 previousVector = Vertices[Vertices.Count - 1];
+
+            for (int i = 0; i < worldPositionVertices.Count; i++)
+            {
+                currentVector = worldPositionVertices[i];
+                crossProduct = MathHelperExtension.CrossProduct(currentVector, previousVector);
+                var temp = (currentVector + previousVector) * crossProduct;
+                centroid += temp;
+                area += crossProduct;
+
+                previousVector = currentVector;
+            }
+
+            area *= 3;
+            centroid /= area;
+
+            return (area == 0) ? Vector2.Zero : centroid;
+        }
     }
 }


Fixes for #196 * ignore missing descriptor * improve notification logic in cases with indications only * remove some unnecessary context flipping

--- Plugin.BluetoothLE/Platforms/Android/GattCharacteristic.cs
+++ Plugin.BluetoothLE/Platforms/Android/GattCharacteristic.cs
@@ -2,7 +2,6 @@
 using System.Linq;
 using System.Reactive.Linq;
 using System.Reactive.Disposables;
-using System.Reactive.Threading.Tasks;
 using Acr.Logging;
 using Acr.Reactive;
 using Android.Bluetooth;
@@ -35,8 +34,7 @@
         public override byte[] Value => this.native.GetValue();

-        public override IObservable<CharacteristicGattResult> WriteWithoutResponse(byte[] value)
-            => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
+        public override IObservable<CharacteristicGattResult> WriteWithoutResponse(byte[] value) => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
         {
             this.AssertWrite(false);

@@ -64,8 +62,7 @@
         }));

-        public override IObservable<CharacteristicGattResult> Write(byte[] value)
-            => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
+        public override IObservable<CharacteristicGattResult> Write(byte[] value) => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
         {
             this.AssertWrite(false);

@@ -99,8 +96,7 @@
         }));

-        public override IObservable<CharacteristicGattResult> Read()
-            => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
+        public override IObservable<CharacteristicGattResult> Read() => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
         {
             this.AssertRead();

@@ -126,49 +122,67 @@
         }));

-        public override IObservable<CharacteristicGattResult> EnableNotifications(bool useIndicationsIfAvailable)
-            => this.context.Invoke(Observable.FromAsync(async ct =>
-        {
+        public override IObservable<CharacteristicGattResult> EnableNotifications(bool useIndicationsIfAvailable) => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
+        {
+            void success()
+            {
+                this.IsNotifying = true;
+                ob.Respond(new CharacteristicGattResult(this, null));
+            };
+
+            if (!this.context.Gatt.SetCharacteristicNotification(this.native, true))
+                throw new BleException("Failed to set characteristic notification value");
+
+            IDisposable sub = null;
             var descriptor = this.native.GetDescriptor(NotifyDescriptorId);
             if (descriptor == null)
-                throw new BleException("Characteristic Client Configuration Descriptor not found");
-
-            var wrap = new GattDescriptor(this, this.context, descriptor);
-            if (!this.context.Gatt.SetCharacteristicNotification(this.native, true))
-                throw new BleException("Failed to set characteristic notification value");
-
-            await this.context.OpPause(ct).ConfigureAwait(false);
-            var bytes = this.GetNotifyDescriptorBytes(useIndicationsIfAvailable);
-
-            await wrap
-                .WriteInternal(bytes)
-                .ToTask(ct)
-                .ConfigureAwait(false);
-
-            this.IsNotifying = true;
-            return new CharacteristicGattResult(this, null);
-        }));
-
-
-        public override IObservable<CharacteristicGattResult> DisableNotifications()
-            => this.context.Invoke(Observable.FromAsync(async ct =>
-        {
+            {
+                success();
+            }
+            else
+            {
+                var wrap = new GattDescriptor(this, this.context, descriptor);
+                var bytes = this.GetNotifyDescriptorBytes(useIndicationsIfAvailable);
+                sub = wrap.WriteInternal(bytes)
+                    .Delay(CrossBleAdapter.PauseBetweenInvocations.Value)
+                    .Subscribe(
+                        _ => success(),
+                        ex => success()
+                    );
+            }
+            return () => sub?.Dispose();
+        }));
+
+
+        public override IObservable<CharacteristicGattResult> DisableNotifications() => this.context.Invoke(Observable.Create<CharacteristicGattResult>(ob =>
+        {
+            void success()
+            {
+                this.IsNotifying = false;
+                ob.Respond(new CharacteristicGattResult(this, null));
+            };
+            if (!this.context.Gatt.SetCharacteristicNotification(this.native, false))
+                throw new BleException("Could not set characteristic notification value");
+
+            IDisposable sub = null;
             var descriptor = this.native.GetDescriptor(NotifyDescriptorId);
             if (descriptor == null)
-                throw new BleException("Characteristic Client Configuration Descriptor not found");
-
-            var wrap = new GattDescriptor(this, this.context, descriptor);
-            if (!this.context.Gatt.SetCharacteristicNotification(this.native, false))
-                throw new BleException("Could not set characteristic notification value");
-
-            await this.context.OpPause(ct).ConfigureAwait(false);
-            await wrap
-                .WriteInternal(BluetoothGattDescriptor.DisableNotificationValue.ToArray())
-                .ToTask(ct)
-                .ConfigureAwait(false);
-
-            this.IsNotifying = false;
-            return new CharacteristicGattResult(this, null);
+            {
+                success();
+            }
+            else
+            {
+                var wrap = new GattDescriptor(this, this.context, descriptor);
+                sub = wrap
+                    .WriteInternal(BluetoothGattDescriptor.DisableNotificationValue.ToArray())
+                    .Delay(CrossBleAdapter.PauseBetweenInvocations.Value)
+                    .Subscribe(
+                        _ => success(),
+                        ex => success()
+                    );
+            }
+
+            return () => sub?.Dispose();
         }));

@@ -256,8 +270,7 @@

         byte[] GetNotifyDescriptorBytes(bool useIndicationsIfAvailable)
         {
-            // if only indicate
-            if (useIndicationsIfAvailable && this.CanIndicate())
+            if ((useIndicationsIfAvailable || !this.CanNotify()) && this.CanIndicate())
                 return BluetoothGattDescriptor.EnableIndicationValue.ToArray();

              return BluetoothGattDescriptor.EnableNotificationValue.ToArray();


Add Console.Read() - Simple implementation of window.prompt()

--- Html5/Console.cs
+++ Html5/Console.cs
@@ -12,8 +12,73 @@
     [Name("console")]
     public static class Console
     {
-        /// <summary>
-        /// The Window.prompt() displays a dialog with an optional message prompting the user to input some text.
+        [Name("log")]
+        public static void WriteLine(string message)
+        {
+        }
+
+        [Template("console.log(Bridge.String.format({message}, {args}))")]
+        public static void WriteLine(string message, params object[] args)
+        {
+        }
+
+        [Template("console.log()")]
+        public static void WriteLine()
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(bool value)
+        {
+        }
+
+        [Template("console.log(String.fromCharCode({value}))")]
+        public static void WriteLine(char value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(decimal value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(double value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(float value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(int value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(long value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(object value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(uint value)
+        {
+        }
+
+        [Template("console.log({value})")]
+        public static void WriteLine(ulong value)
+        {
+        }
+
+        /// <summary>
+        /// ReadLine uses the native JavaScript prompt() to dialog with an optional message prompting the user to input some text.
         /// </summary>
         /// <param name="text">text is a string of text to display to the user. This parameter is optional and can be omitted if there is nothing to show in the prompt window.</param>
         /// <param name="value">value is a string containing the default value displayed in the text input field. It is an optional parameter. Note that in Internet Explorer 7 and 8, if you do not provide this parameter, the string "undefined" is the default value.</param>
@@ -25,7 +90,7 @@
         }

         /// <summary>
-        /// The Window.prompt() displays a dialog with an optional message prompting the user to input some text.
+        /// ReadLine uses the native JavaScript prompt() to display a dialog with an optional message prompting the user to input some text.
         /// </summary>
         /// <param name="text">text is a string of text to display to the user. This parameter is optional and can be omitted if there is nothing to show in the prompt window.</param>
         /// <returns>result is a string containing the text entered by the user, or the value null.</returns>
@@ -36,7 +101,7 @@
         }

         /// <summary>
-        /// The Window.prompt() displays a dialog with an optional message prompting the user to input some text.
+        /// ReadLine uses the native JavaScript prompt() to display a dialog with an optional message prompting the user to input some text.
         /// </summary>
         /// <returns>result is a string containing the text entered by the user, or the value null.</returns>
         [Template("prompt()")]
@@ -45,69 +110,14 @@
             return null;
         }

-        [Name("log")]
-        public static void WriteLine(string message)
-        {
-        }
-
-        [Template("console.log(Bridge.String.format({message}, {args}))")]
-        public static void WriteLine(string message, params object[] args)
-        {
-        }
-
-        [Template("console.log()")]
-        public static void WriteLine()
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(bool value)
-        {
-        }
-
-        [Template("console.log(String.fromCharCode({value}))")]
-        public static void WriteLine(char value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(decimal value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(double value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(float value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(int value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(long value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(object value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(uint value)
-        {
-        }
-
-        [Template("console.log({value})")]
-        public static void WriteLine(ulong value)
-        {
+        /// <summary>
+        /// Read uses the native JavaScript prompt() to display a dialog with an optional message prompting the user to input some text.
+        /// </summary>
+        /// <returns>result is a string containing the text entered by the user, or the value null.</returns>
+        [Template("prompt()")]
+        public static string Read()
+        {
+            return null;
         }

         /// <summary>


Remove Diagnostic Alert from Image Modal

--- Portal.CMS.Web/Areas/Builder/Views/Component/_Image.cshtml
+++ Portal.CMS.Web/Areas/Builder/Views/Component/_Image.cshtml
@@ -19,8 +19,6 @@
             success: function (result) {
                 if (result.State === true)
                 {
-                    alert(elementType);
-
                     if (elementType === "img")
                     {
                         $('#@Model.ElementId').attr("src", result.Source);


git-svn-id: https://axiomengine.svn.sourceforge.net/svnroot/axiomengine/branches/crickhollow@1334 bb9bf1cf-960d-0410-9a3a-baeba60cf407

--- Projects/Axiom/Source/RenderSystems/DirectX9/D3DTexture.cs
+++ Projects/Axiom/Source/RenderSystems/DirectX9/D3DTexture.cs
@@ -261,6 +261,7 @@
 					// Call internal LoadImages, not LoadImage since that's external and
 					// will determine load status etc again
 					LoadImages( new Image[] { Image.FromStream( strm, ext ) } );
+                    strm.Close();

 				}
 			}


Add comment

Add comment

Add comment

--- QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs
+++ QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs
@@ -20,7 +20,7 @@
 		/// GraphicData is the queue for storing the graphic data.
 		/// GraphicData佇列用於儲存繪圖資料
 		/// </summary>
-		private Queue<object> GraphicData;
+		private Queue<object> GraphicData;                                      //	GraphicData object, GraphicData佇列物件

 		/// <summary>
 		/// GraphicDataQueueMax is the max number of count of GraphData elements.


Add comment

Add comment

Add comment

--- QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs
+++ QueueDataGraphic/QueueDataGraphic/CSharpFiles/DataQueue.cs
@@ -57,4 +57,4 @@

 	}                                                                           //	DataQueue class end, 結束DataQueue類別
-}                                                                               //	namespace end
+}                                                                               //	namespace end, 結束命名空間


修改版本。

修改版本。

--- Rabbit.WeiXin/SDK/Rabbit.WeiXin/Properties/AssemblyInfo.cs
+++ Rabbit.WeiXin/SDK/Rabbit.WeiXin/Properties/AssemblyInfo.cs
@@ -31,5 +31,5 @@
 // 可以指定所有这些值，也可以使用“生成号”和“修订号”的默认值，
 // 方法是按如下所示使用“*”:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.1.1")]
+[assembly: AssemblyVersion("0.1.0")]
 [assembly: AssemblyFileVersion("0.1.1")]