Exemple #1
0
        /// <summary>
        /// Wird aufgerufen, bevor der MainActivator aktiviert wird.
        /// Hier sollten alle von einem DB-Objekt abhängige Initialisierungen
        /// durchgeführt werden.
        /// </summary>
        private void MainActivator_OnActivating(object sender, System.EventArgs e)
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                // Inaktive dürfen nicht mehr zugeordnet werden
                string isinactiveclause = string.Format("{0} or {1} in (select {1} from MachineTypeHasDriver where {2})",
                                                        SqlFormatter.Comparison("IsInActive", false, ValType.Bool),
                                                        SqlFormatter.FormatColumnname("UID_MachineType", true, ValType.String, FormatterOptions.None),
                                                        SqlFormatter.UidComparison("UID_Driver", FormTool.GetValueSafe(dbobject, "UID_Driver", "")));

                m_MemberRelation1.WhereClause = SqlFormatter.AndRelation(
                    isinactiveclause, string.Format("{0} and ((not {1}) or {2})",
                                                    SqlFormatter.Comparison("ChgNumber", 0, ValType.Int, CompareOperator.GreaterThan),
                                                    SqlFormatter.Comparison("netcard", "dummy%", ValType.String, CompareOperator.Like),
                                                    SqlFormatter.EmptyClause("netcard", ValType.String)));
            }
            finally
            {
            }
        }
        /// <summary>
        /// Wird aufgerufen, bevor der MainActivator aktiviert wird.
        /// Hier sollten alle von einem DB-Objekt abhängige Initialisierungen
        /// durchgeführt werden.
        /// </summary>
        private void MainActivator_OnActivating(object sender, System.EventArgs e)
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                string mnbasecolumn = m_MemberRelation1.MNBaseColumnName;

                // Inaktive dürfen nicht mehr zugeordnet werden
                string isinactiveclause = SqlFormatter.Comparison("IsInActive", false, ValType.Bool);

                string osclause = dbobject.Columns.Contains("UID_OS") ?
                                  (FormTool.CanSee(dbobject, "UID_OS") ? SqlFormatter.UidComparison("UID_OS", FormTool.GetValueSafe(dbobject, "UID_OS", "")) : "1=2")
                    : "";


                if (Connection.GetConfigParm(@"Software\Driver\ShowWithoutProfile") == "1")
                {
                    m_MemberRelation1.WhereClause = SqlFormatter.AndRelation(isinactiveclause, osclause);
                }
                else
                {
                    m_MemberRelation1.WhereClause = SqlFormatter.AndRelation(
                        isinactiveclause,
                        string.Format("{0} in (select {0} from Driverprofile where {1})",
                                      SqlFormatter.FormatColumnname("UID_Driver", true, ValType.String),
                                      SqlFormatter.Comparison("ChgNumber", 0, ValType.Int, CompareOperator.GreaterThan)),
                        osclause
                        );
                }

                // and all already assigned ones.
                m_MemberRelation1.WhereClause = SqlFormatter.OrRelation(m_MemberRelation1.WhereClause,
                                                                        string.Format("UID_Driver in (select UID_Driver from {0} where {1})",
                                                                                      m_MemberRelation1.MNTableName,
                                                                                      SqlFormatter.Comparison(mnbasecolumn, dbobject[mnbasecolumn].New.String, ValType.String, CompareOperator.Equal, FormatterOptions.None)
                                                                                      ));
            }
            finally
            {
            }
        }
Exemple #3
0
        /// <summary>
        /// Wird aufgerufen, bevor der MainActivator mit der Aktivierung beginnt.
        /// Hier sollten alle von einem DB-Objekt abhängige Initialisierungen
        /// durchgeführt werden. Das Formular besitzt zu diesem Zeitpunkt die Connection
        /// und alle davon abhängigen Komponenten (SqlFormatter, Preprocessor-Auswertung, ...)
        /// </summary>
        private void MainActivator_OnActivating(object sender, System.EventArgs e)
        {
            try
            {
                // Aktivierung mit <null> verhindern
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                // Inaktive dürfen nicht mehr zugeordnet werden
                m_MemberRelation1.WhereClause = string.Format("{0} or {1} in (select {2} from {4} where {3})",
                                                              SqlFormatter.Comparison("IsInActive", false, ValType.Bool),
                                                              SqlFormatter.FormatColumnname("UID_Application", true, ValType.String, FormatterOptions.None),
                                                              SqlFormatter.FormatColumnname("UID_ApplicationParent", true, ValType.String, FormatterOptions.None),
                                                              SqlFormatter.UidComparison("UID_ApplicationChild", FormTool.GetValueSafe(dbobject, "UID_Application", "")),
                                                              "ApplicationDependsOnApp");

                m_MemberRelation2.WhereClause = string.Format("{0} or {1} in (select {2} from {4} where {3})",
                                                              SqlFormatter.Comparison("IsInActive", false, ValType.Bool),
                                                              SqlFormatter.FormatColumnname("UID_Application", true, ValType.String, FormatterOptions.None),
                                                              SqlFormatter.FormatColumnname("UID_ApplicationChild", true, ValType.String, FormatterOptions.None),
                                                              SqlFormatter.UidComparison("UID_ApplicationParent", FormTool.GetValueSafe(dbobject, "UID_Application", "")),
                                                              "ApplicationDependsOnApp");

                m_MemberRelation3.WhereClause = string.Format("{0} or {1} in (select {2} from {4} where {3})",
                                                              SqlFormatter.Comparison("IsInActive", false, ValType.Bool),
                                                              SqlFormatter.FormatColumnname("UID_Driver", true, ValType.String, FormatterOptions.None),
                                                              SqlFormatter.FormatColumnname("UID_DriverParent", true, ValType.String, FormatterOptions.None),
                                                              SqlFormatter.UidComparison("UID_ApplicationChild", FormTool.GetValueSafe(dbobject, "UID_Application", "")),
                                                              "ApplicationDependsOnDriver");

                m_MemberRelationApplicationExcludeAppUIDApplication.WhereClause        =
                    m_MemberRelationApplicationExcludeDriverUIDApplication.WhereClause = SqlFormatter.Comparison("IsInActive", false, ValType.Bool);
            }
            finally
            {
            }
        }
Exemple #4
0
        /// <summary>
        /// Wird aufgerufen, bevor der MainActivator aktiviert wird.
        /// Hier sollten alle von einem DB-Objekt abhängige Initialisierungen
        /// durchgeführt werden.
        /// </summary>
        private void MainActivator_OnActivating(object sender, System.EventArgs e)
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                // Inaktive dürfen nicht mehr zugeordnet werden
                string isinactiveclause = string.Format("{0} or {1} in (select {1} from MachineHasDriver where {2})",
                                                        SqlFormatter.Comparison("IsInActive", false, ValType.Bool),
                                                        SqlFormatter.FormatColumnname("UID_Driver", true, ValType.String),
                                                        SqlFormatter.UidComparison("UID_Hardware", FormTool.GetValueSafe(dbobject, "UID_Hardware", "")));


                if (Connection.GetConfigParm(@"Software\Driver\ShowWithoutProfile") == "1")
                {
                    m_MemberRelation1.WhereClause = isinactiveclause;
                }
                else
                {
                    m_MemberRelation1.WhereClause = SqlFormatter.AndRelation(
                        isinactiveclause, string.Format("{0} and {1} in (select {1} from driverprofile where {2} AND {3})",
                                                        SqlFormatter.UidComparison("UID_OS", FormTool.GetValueSafe(dbobject, "UID_OS", "")),
                                                        SqlFormatter.FormatColumnname("uid_driver", false, ValType.String),
                                                        SqlFormatter.UidComparison("UID_SDLDomainRD", FormTool.GetValueSafe(dbobject, "UID_SDLDomainRD", "")),
                                                        SqlFormatter.Comparison("ChgTest", 0, ValType.Int, CompareOperator.GreaterThan)));
                }
            }
            finally
            {
            }
        }
Exemple #5
0
        /// <summary>
        /// Wird aufgerufen, bevor der MainActivator aktiviert wird.
        /// Hier sollten alle von einem DB-Objekt abhängige Initialisierungen
        /// durchgeführt werden.
        /// </summary>
        private void MainActivator_OnActivating(object sender, System.EventArgs e)
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                // Inaktive dürfen nicht mehr zugeordnet werden
                string isinactiveclause = string.Format("{0} or {1} in (select {1} from DriverHasLicence where {2})",
                                                        SqlFormatter.Comparison("IsInActive", false, ValType.Bool),
                                                        SqlFormatter.FormatColumnname("UID_Driver", true, ValType.String, FormatterOptions.None),
                                                        SqlFormatter.UidComparison("UID_Licence", FormTool.GetValueSafe(dbobject, "UID_Licence", "")));

                m_MemberRelation1.WhereClause = isinactiveclause;
            }
            finally
            {
            }
        }