/// <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> /// /// </summary> private void Combo1_OnSelectionChangeCommitted(object sender, System.EventArgs e) { try { // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } m_Combo2.ComboItems.Clear(); // if (m_Combo1.SelectedIndex == 0) m_Combo2.Enabled = false; // else if (m_Combo1.SelectedIndex == 1 || m_Combo1.SelectedIndex == 2) { m_ColAppServer = Connection.CreateCol("ApplicationServer"); m_ColAppServer.Prototype.WhereClause = !FormTool.CanSee(dbobject, "UID_SDLDomain") ? "1=2" : SqlFormatter.AndRelation( SqlFormatter.UidComparison("UID_SDLDomain", dbobject["UID_SDLDomain"].New.String), " not " + SqlFormatter.EmptyClause("UID_ParentApplicationServer", ValType.String)); m_ColAppServer.Prototype.Columns["UID_Server"].IsDisplayItem = true; m_ColAppServer.Load(); if (m_ColAppServer.Count > 0) { foreach (IColElem elem in m_ColAppServer) { m_Combo2.ComboItems.Add(elem); } // m_Combo2.Enabled = true; } else { FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_NoChildServerActionNotPossible"); // m_Combo2.Enabled = false; } } } catch (Exception ex) { // Fehler melden VI.FormBase.ExceptionMgr.Instance.HandleException(ex, this, 100); } }
/// <summary> /// /// </summary> private void MainActivator_OnActivated(object sender, System.EventArgs e) { try { m_BInitialised = true; // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject != null) { var SDLDomaiDef = FormTool.GetValueSafe(dbobject, "UID_SDLDomain", "") != ""; m_TreeComboBoxUIDSDLDomain.EnabledByUser = !SDLDomaiDef; if (SDLDomaiDef) { m_TreeComboBoxUIDParentApplicationServer.WhereClause = !FormTool.CanSee(dbobject, "UID_ApplicationServer") ? "1=2" : // ReSharper disable once UseStringInterpolation string.Format("{0} and not {1}", SqlFormatter.UidComparison("UID_SDLDomain", dbobject["UID_SDLDomain"].New.String), SqlFormatter.InClause("UID_ApplicationServer", ValType.String, FormTool.GetChildUuids(Connection, "Applicationserver", "UID_Applicationserver", dbobject["UID_ApplicationServer"].New.String, "UID_ParentApplicationserver"))); } else { m_TreeComboBoxUIDParentApplicationServer.WhereClause = SqlFormatter.EmptyClause("UID_SDLDomain", ValType.String); } } if (m_EditIdentApplicationServer.Enabled && m_EditIdentApplicationServer.Visible) { m_EditIdentApplicationServer.Select(); } } catch (Exception ex) { // Fehler melden HandleException(ex); } }
/// <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; } m_MemberRelation1.WhereClause = !FormTool.CanSee(dbobject, "UID_OS") ? "1=2" : string.Format("UID_WorkDesk in (select UID_Workdesk from Workdesk where {0})", SqlFormatter.OrRelation( SqlFormatter.UidComparison("UID_OS", dbobject["UID_OS"].New.String), SqlFormatter.EmptyClause("UID_OS", ValType.String))); } finally { } }
/// <summary> /// /// </summary> private void Combo1_OnSelectionChangeCommitted(object sender, System.EventArgs e) { try { m_Combo2.ComboItems.Clear(); if (m_Combo1.SelectedIndex == 2 || m_Combo1.SelectedIndex == 3) { m_Label1.Caption = "SDL_FormMachineTypeCopyToOtherSite_Label1"; m_ColAppServer = Connection.CreateCol("ApplicationServer"); m_ColAppServer.Prototype.WhereClause = !FormTool.CanSee(Connection, "ApplicationServer", "UID_Server", "UID_SDLDomain") ? "1=2" : SqlFormatter.Comparison("IsCentralLibrary", true, ValType.Bool); m_ColAppServer.Prototype.Columns["UID_Server"].IsDisplayItem = true; m_ColAppServer.Prototype.Columns["UID_SDLDomain"].IsDisplayItem = true; m_ColAppServer.Load(); switch (m_ColAppServer.Count) { // korrekt case 1: m_ColDestinationDomain = Connection.CreateCol("SDLDomain"); m_ColDestinationDomain.Prototype.WhereClause = SqlFormatter.UidComparison("UID_SDLDomain", m_ColAppServer[0]["UID_SDLDomain"].ToString(), CompareOperator.NotEqual); m_ColDestinationDomain.Load(); if (m_ColDestinationDomain.Count > 0) { foreach (IColElem elem in m_ColDestinationDomain) { m_Combo2.ComboItems.Add(elem); } // m_Combo2.Enabled = true; } else { FormTool.ShowMessage("SDL_FormMachineTypeCopyToOtherSite_Message_NoDomain"); // m_Combo2.Enabled = false; } break; case 0: FormTool.ShowMessage("SDL_FormMachineTypeCopyToOtherSite_Message_NoAppServer"); // m_Combo2.Enabled = false; break; default: FormTool.ShowMessage("SDL_FormMachineTypeCopyToOtherSite_Message_MoreAppServer"); // m_Combo2.Enabled = false; break; } } else { // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } m_Label1.Caption = "SDL_FormApplicationProfileCopyAll_ChildServer"; m_ColAppServer = Connection.CreateCol("ApplicationServer"); m_ColAppServer.Prototype.WhereClause = !FormTool.CanSee(dbobject, "UID_SDLDomain") ? "1=2" : SqlFormatter.AndRelation( SqlFormatter.Comparison("UID_SDLDomain", dbobject["UID_SDLDomain"].New.String, ValType.String), " not " + SqlFormatter.EmptyClause("UID_ParentApplicationServer", ValType.String)); m_ColAppServer.Load(); if (m_ColAppServer.Count > 0) { foreach (IColElem elem in m_ColAppServer) { m_Combo2.ComboItems.Add(elem); } } else { FormTool.ShowMessage("SDL_FormApplicationProfileCopyAll_Message_NoChildServerActionNotPossible"); } } // damit die neue Caption angezeigt wird m_Label1.Invalidate(); } catch (Exception ex) { // Fehler melden VI.FormBase.ExceptionMgr.Instance.HandleException(ex, this, 100); } }