/// <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; } ISqlFormatter f = dbobject.Connection.SqlFormatter; string statement = string.Format("select UpdateWhereClause from DialogTableGroupRight where {0} and UID_DialogGroup in (select UID_DialogGroup from DialogUserInGroup where UID_DialogUser in (select UID_DialogUser from DialogUser where {1}))", f.AndRelation( f.Comparison("UID_DialogTable", "SDL-T-SDLDomain", ValType.String), f.Comparison("CanEdit", true, ValType.Bool) ), f.Comparison("username", dbobject.Connection.User.Identifier, ValType.String)); SqlExecutor exec = dbobject.Connection.CreateSqlExecutor((byte[])m_MainActivator.Variables[GenericPropertyDictionary.ConnectionPublicKey, null]); IDataReader datareader = null; using (datareader = exec.SqlExecute(statement)) { statement = "select count(*) from SDLDOmain where " + SqlFormatter.UidComparison("UID_SDLDomain", dbobject["UID_SDLDomainRDOwner"].New.String); string wherest = ""; while (datareader.Read()) { string where = datareader.GetString(0).Trim(); if (where == "") { wherest = ""; break; } wherest = wherest.Length == 0 ? string.Format("({0})", where) : string.Format("{0} or ({1})", wherest, where); } if (wherest != "") { statement = statement + string.Format(" and ({0})", wherest); } } object result = exec.SqlExecuteScalar(Connection.Variables.Replace(statement)); if (result != null && Convert.ToInt32(result) > 0) { m_MemberRelation1.WhereClause = string.Format("(UID_SDLDomain in (select UID_SDLDomain from ApplicationServer) or {0}) and not (UID_SDLDomain in (select UID_SDLDomain from ApplicationServer Where {1}))", SqlFormatter.UidComparison("UID_ServerTAS", "", CompareOperator.NotEqual), SqlFormatter.Comparison("IsCentralLibrary", true, ValType.Bool)); m_LblHinweis.Visible = false; } else { m_MemberRelation1.WhereClause = string.Format("{0} = {1}", SqlFormatter.FormatValue(1, ValType.Int), SqlFormatter.FormatValue(2, ValType.Int)); m_LblHinweis.Visible = true; } } finally { } }