private void _LoadActivatorCombo() { using (new UpdateHelper(m_ActivatorCombo)) { m_ActivatorCombo.ComboItems.Clear(); ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } // das hat nur Sinn, wenn ich die UID_ADSAccount lesen darf if (FormTool.CanSee(dbobject, "UID_ADSAccount")) { IColDbObject col = Connection.CreateCol("ClientLog"); col.Prototype.WhereClause = SqlFormatter.UidComparison("UID_ADSAccount", dbobject["UID_ADSAccount"].New.String); col.Prototype.OrderBy = "InstallDate DESC"; col.Load(); foreach (IColElem elem in col) { m_ActivatorCombo.ComboItems.Add(elem); } } } }
/// <summary> /// /// </summary> private void TreeComboBox3_OnSelectionChangeCommitted(object sender, System.EventArgs e) { try { // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null || !m_BInitialised || FormTool.GetValueSafe(dbobject, "UID_SDLDomain", "") == "") { return; } // das reicht völlig aus dbobject.GetFK("UID_ParentApplicationServer").SetParent(null); m_TreeComboBoxUIDParentApplicationServer.WhereClause = !FormTool.CanSee(dbobject, "UID_ApplicationServer", "UID_SDLDomain") ? "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"))); } catch (Exception ex) { // Fehler melden HandleException(ex); } }
/// <summary> /// /// </summary> private void CmdOrderNumber_OnClick(object sender, System.EventArgs e) { try { // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null || !FormTool.CanSee(dbobject, "UID_SDLDomainRD", "UID_Profile", "OrderNumber", "UID_OS")) { return; } using (SortOrderPackDialog dlg = new SortOrderPackDialog(Connection, ProfileType.Application)) { dlg.UidSDLDomainRD = dbobject["UID_SDLDomainRD"].New.String; dlg.UidProfile = dbobject["UID_Profile"].New.String; dlg.OrderNumber = dbobject["OrderNumber"].New.Double; dlg.UidOs = dbobject["UID_OS"].New.String; if (dlg.ShowDialog() != DialogResult.OK) { return; } FormTool.SetValueSafe(dbobject, "OrderNumber", dlg.OrderNumber); } } 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 prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } if (Connection.GetConfigParm(@"Software\Driver\ShowWithoutProfile") == "1") { m_MemberRelation1.WhereClause = SqlFormatter.OrRelation( SqlFormatter.Comparison("IsPc", true, ValType.Bool), SqlFormatter.Comparison("IsServer", true, ValType.Bool)); } else { m_MemberRelation1.WhereClause = FormTool.CanSee(dbobject, "UID_OS", "UID_Driver") ? string.Format("UID_Hardware IN ( SELECT UID_Hardware from Hardware WHERE {0} and {1} and UID_SDLDomainRD in (select UID_SDLDomainRD from driverprofile WHERE {2} and {3}))", SqlFormatter.OrRelation( SqlFormatter.Comparison("IsPc", true, ValType.Bool), SqlFormatter.Comparison("IsServer", true, ValType.Bool)), SqlFormatter.UidComparison("UID_OS", dbobject["UID_OS"].New), SqlFormatter.UidComparison("UID_Driver", dbobject["UID_Driver"].New), SqlFormatter.Comparison("ChgNumber", 0, ValType.Bool, CompareOperator.GreaterThan)) : "1=2"; } } 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 { // Aktivierung mit <null> verhindern if (m_MainActivator.DbObject == null) { return; } // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } m_ListViewProfiles.ListItems.Clear(); if (!FormTool.CanSee(dbobject, "UID_SDLDomainRD", "DisplayName", "OrderNumber", "UID_OS")) { return; } IColDbObject profiles = Connection.CreateCol("ApplicationProfile"); profiles.Prototype.WhereClause = SqlFormatter.AndRelation( SqlFormatter.UidComparison("UID_SDLDomainRD", FormTool.GetValueSafe(dbobject, "UID_SDLDomainRD", "")), SqlFormatter.OrRelation( SqlFormatter.UidComparison("UID_OS", FormTool.GetValueSafe(dbobject, "UID_OS", "")), string.Format("UID_Profile in (select UID_Profile from ProfileCanUsedAlso where {0})", SqlFormatter.UidComparison("UID_OS", FormTool.GetValueSafe(dbobject, "UID_OS", ""))) ) ); profiles.Prototype.Columns["OrderNumber"].IsDisplayItem = true; profiles.Prototype.Columns["DisplayName"].IsDisplayItem = true; profiles.Prototype.OrderBy = "OrderNumber"; profiles.Load(); string uidprofile = FormTool.GetValueSafe(dbobject, "UID_Profile", ""); foreach (IColElem profile in profiles) { ListViewItem item = new ListViewItem(new string[] { profile["DisplayName"].ToString(), profile["OrderNumber"].ToString() }); item.ForeColor = string.Equals(uidprofile, profile["UID_Profile"].ToString(), StringComparison.OrdinalIgnoreCase) ? Color.Red : Color.Black; item.UseItemStyleForSubItems = true; m_ListViewProfiles.ListItems.Add(item); } // TODO Whereklauseln setzen } finally { } }
/// <summary> /// /// </summary> private void FillDestDomains() { try { // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } m_cboDestDomain.ComboItems.Clear(); if (!FormTool.CanSee(dbobject, "UID_Profile")) { return; } string where = ""; #warning ##RIGHTS## UpdateWhereClause muß anders gelöst werden //string updateWhere = Connection.Tables["Domain"].UpdateWhereClause; //if ( !string.IsNullOrEmpty(updateWhere) ) //{ // where = string.Format("ident_domain in (select ident_DomainAllowed from " + // " DriverCanUsedByRD where {0} " + // " and ident_domainallowed in ( select ident_domain from domain where {0} ))", // SqlFormatter.UidComparison("uid_profile", dbobject["UID_Profile"].New.String, ValType.String, // CompareOperator.Equal, FormatterOptions.None), // updateWhere); //} //else { where = string.Format("UID_SDLDomain in (select UID_SDLDomainAllowed from " + " DriverCanUsedByRD where {0} )", SqlFormatter.UidComparison("UID_Profile", dbobject["UID_Profile"].New.String)); } IColDbObject dom = Connection.CreateCol("SDLDomain"); dom.Prototype.Columns["Ident_Domain"].IsDisplayItem = true; dom.Prototype.WhereClause = where; dom.Load(); foreach (IColElem elem in dom) { m_cboDestDomain.ComboItems.Add(elem["Ident_Domain"].ToString()); } } catch (Exception ex) { // Fehler melden HandleException(ex); } }
private void _Load(VI.Controls.Interfaces.ITreeListControl treeList, bool loadApps) { ITreeListProxy proxy = treeList.Proxy; using (new UpdateHelper(treeList)) { proxy.Clear(); // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } IColDbObject col = Connection.CreateCol("MachineAppsInfo"); col.Prototype["displayname"].IsDisplayItem = true; col.Prototype["CurrentlyActive"].IsDisplayItem = true; col.Prototype["Installdate"].IsDisplayItem = true; col.Prototype["deinstalldate"].IsDisplayItem = true; col.Prototype["revision"].IsDisplayItem = true; col.Prototype["UID_OS"].IsDisplayItem = true; col.Prototype["UID_InstallationType"].IsDisplayItem = true; col.Prototype.WhereClause = SqlFormatter.AndRelation(!FormTool.CanSee(dbobject, "UID_HardWare") ? "1=2" : SqlFormatter.UidComparison("UID_Hardware", dbobject["UID_HardWare"].New.String), SqlFormatter.Comparison("AppsNotDriver", loadApps, ValType.Bool)); col.Prototype.OrderBy = "Displayname, Installdate, DeInstallDate"; col.Load(CollectionLoadType.ForeignDisplays); foreach (IColElem elem in col) { ITreeListNode node = proxy.AddNode(elem.GetDisplayValue("displayname"), (int)VI.ImageLibrary.StockImage.ApplicationProfile); ITreeListItemSmall item = proxy.CreateCheckBoxItem(elem.GetValue("CurrentlyActive").Bool); item.Enabled = false; proxy.AddItem(node, item); DateTime date = elem.GetValue("Installdate").Date; item = proxy.AddItem(node, DbVal.IsEmpty(date, ValType.Date) ? "" : date.ToString()); item.Data = date; date = elem.GetValue("deinstalldate").Date; item = proxy.AddItem(node, DbVal.IsEmpty(date, ValType.Date) ? "" : date.ToString()); item.Data = date; item = proxy.AddItem(node, elem["Revision"]); item.Data = elem.GetValue("Revision").Int; proxy.AddItem(node, elem.GetDisplayValue("UID_OS")); proxy.AddItem(node, elem.GetDisplayValue("UID_InstallationType")); } } }
/// <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> /// 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 { } }
private void _LoadProtocols() { ITreeListProxy proxy = m_TreeListProtocols.Proxy; using (new UpdateHelper(m_TreeListProtocols)) { proxy.Clear(); // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } IColDbObject col = Connection.CreateCol("ADSAccountAppsInfo"); col.Prototype["displayname"].IsDisplayItem = true; col.Prototype["CurrentlyActive"].IsDisplayItem = true; col.Prototype["Installdate"].IsDisplayItem = true; col.Prototype["deinstalldate"].IsDisplayItem = true; col.Prototype["revision"].IsDisplayItem = true; col.Prototype["UID_OS"].IsDisplayItem = true; col.Prototype["UID_InstallationType"].IsDisplayItem = true; col.Prototype.WhereClause = !FormTool.CanSee(dbobject, "UID_ADSAccount") ? "1=2" : SqlFormatter.UidComparison("UID_ADSAccount", FormTool.GetValueSafe(dbobject, "UID_ADSAccount", "")); col.Prototype.OrderBy = "displayname"; col.Load(CollectionLoadType.ForeignDisplays); foreach (IColElem elem in col) { ITreeListNode node = proxy.AddNode(elem.GetDisplayValue("displayname"), (int)VI.ImageLibrary.StockImage.ApplicationProfile); ITreeListItemSmall item = proxy.CreateCheckBoxItem(elem.GetValue("CurrentlyActive").Bool); item.Enabled = false; proxy.AddItem(node, item); proxy.AddItem(node, elem["Installdate"]); proxy.AddItem(node, elem["deinstalldate"]); proxy.AddItem(node, elem["Revision"]); proxy.AddItem(node, elem.GetDisplayValue("UID_OS")); proxy.AddItem(node, elem.GetDisplayValue("UID_InstallationType")); } } }
/// <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> /// /// </summary> private void MainActivator_OnActivated(object sender, System.EventArgs e) { try { if (m_MainActivator.DbObject == null) { return; } string path = ""; ISingleDbObject domain = m_MainActivator.DbObject; if (domain != null) { ISingleDbObject tas = domain.GetFK("UID_ServerTAS").Create(); if (tas != null && FormTool.CanSee(tas, "Ident_Server") && FormTool.CanSee(domain, "NetLogonOnTAS")) { path = @"\\" + tas.GetValue("Ident_Server") + @"\" + domain.GetValue("NetLogonOnTAS") + @"\"; if (!Directory.Exists(path)) { FormTool.ShowMessage("Der Pfad: " + path + " konnte nicht gefunden werden" + Environment.NewLine + "oder keine Verbindung zum Netzlaufwerk vorhanden."); } } } m_EditPath.Text = m_SaveFileDialog.InitialDirectory = m_OpenFileDialog.InitialDirectory = (path == "" || !Directory.Exists(path)) ? @"C:\" : path; } catch (Exception ex) { 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 MainActivator_OnActivated(object sender, System.EventArgs e) { try { // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null) { return; } if (FormTool.CanSee(dbobject, "ChgNumber", "ChgTest") && dbobject["ChgNumber"].New.Int == 0 && dbobject["ChgTest"].New.Int == 0) { m_EditChgTest.EnabledByUser = true; m_EditSubPath.EnabledByUser = true; Tasks["EnableSubPath"].Visible = false; } else { m_EditChgTest.EnabledByUser = false; m_EditSubPath.EnabledByUser = false; Tasks["EnableSubPath"].Visible = true; } m_CheckboxRemoveHKeyCurrentUser.EnabledByUser = !dbobject.IsLoaded; m_TextComboBoxCachingBehavior.EnabledByUser = !dbobject.IsLoaded; } catch (Exception ex) { // Fehler melden HandleException(ex); } }
/// <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); } }