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
            {
            }
        }
Exemple #2
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
            {
                // 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
            {
            }
        }
        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
            {
            }
        }
        /// <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)
        {
            // Aktivierung mit <null> verhindern
            if (m_MainActivator.DbObject == null)
            {
                return;
            }

            string domaintrustsclause = ActiveDirectory.GetUserOrGroupDomainTrustWhereClause(m_MainActivator.DbObject);

            m_MemberRelation1.WhereClause = SqlFormatter.AndRelation(
                domaintrustsclause,
                string.Format("UID_Person in (select UID_Person from Person where {0} AND {1})",
                              SqlFormatter.Comparison("IsDummyPerson", true, ValType.Bool),
                              SqlFormatter.Comparison("IsTASUser", true, ValType.Bool))
                );

            m_MemberRelation1.RootFilterMemberWhereClause =
                SqlFormatter.UidComparison("UID_ADSDomain", "%UID_ADSDomain%");


            m_MemberRelation1.RootFilterWhereClause = ActiveDirectory.GetDomainTrustWhereClause(m_MainActivator.DbObject);
        }
Exemple #7
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
            {
            }
        }
        /// <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);
            }
        }