/// <summary>
        ///
        /// </summary>
        private void MainActivator_OnSaved(object sender, System.EventArgs e)
        {
            try
            {
                foreach (TreeListNode node in m_TreeList.Nodes)
                {
                    if (!node.SubItemsContentChanged)
                    {
                        continue;
                    }

                    ISingleDbObject dbobject = node.Tag as ISingleDbObject;

                    if (FormTool.SetValueSafe(dbobject, "CountLimit", int.Parse(node.SubItems[0].Data as string)))
                    {
                        node.SubItems[0].ForeColor = SystemColors.ControlText;
                    }

                    dbobject.Save();
                    dbobject.Load();
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
            finally
            {
                m_TreeList.Invalidate();
            }
        }
        /// <summary>
        ///
        /// </summary>
        private void MainActivator_OnActivated(object sender, System.EventArgs e)
        {
            try
            {
                // den Clone vernichten, wegen FormCache
                m_Clone = null;

                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                m_StrDestinationDomain = m_MainActivator.Variables["CustomString", ""].ToString();

                // kopieren ohne Customizer ist nicht möglich
                m_Command1.Enabled = dbobject != null && dbobject.Custom != null;
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
        }
        /// <summary>
        /// FormMethode NewProfile
        /// </summar>
        public void FormTask_NewProfile()
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                // neues Profil anlegen
                ISingleDbObject newprofile = Connection.CreateSingle("ApplicationProfile");

                // FK setzen
                newprofile.GetFK("UID_Application").SetParent(m_MainActivator.DbObject);

                // das Form dazu aufrufen
                NavigateTo(newprofile);
            }
            catch (Exception ex)
            {
                // Fehler melden
                VI.FormBase.ExceptionMgr.Instance.HandleException(
                    new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationHasApplicationProfile_Task_LinkNewProfile").Replace("&", "")), this);
            }
        }
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 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
            {
            }
        }
        public string GetProfilePathServer(bool DoForTAS)
        {
            string strProfPath = "";

            using (NoRightsCheck())
            {
                if (String.IsNullOrEmpty(DbObject["Ident_DomainRD"].New.String))
                {
                    throw new ViException(881146, ExceptionRelevance.EndUser, "Ident_DomainRD");
                }

                ISingleDbObject dbDomain = DbObject.GetFK("Ident_DomainRD").Create();

                if (DoForTAS)
                {
                    string strTAS = (string)dbDomain.Custom.CallMethod("GetTASName");

                    if (String.IsNullOrEmpty(strTAS))
                    {
                        return(String.Empty);
                    }

                    strProfPath = String.Concat(@"\\", strTAS, @"\", dbDomain["ServerPartShareOnTAS"].New.String, @"\", DbObject["SubPath"].New.String);
                }
                else
                {
                    strProfPath = String.Concat(dbDomain["ServerPartShareOnServers"].New.String, @"\", DbObject["SubPath"].New.String);
                }
            }

            return(strProfPath);
        }
        private void FormMethod_Release()
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                if (m_IsChanged)
                {
                    DialogResult result = FormTool.ShowQuestion("SDL_FormSDLDomainNetlogon_Question_SaveChanges", MessageBoxButtons.YesNoCancel);

                    if (result == DialogResult.Cancel)
                    {
                        return;
                    }

                    if (result == DialogResult.Yes)
                    {
                        Save();
                    }
                }

                JobGen.Generate(dbobject, "CopyNETLOGONFromTASToFDS");
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
        }
        /// <summary>
        /// Initialize the customizer instance and assign the functionality to the given object.
        /// </summary>
        /// <param name="theObj">ISingleDbObject to be initialized with this customizer.</param>
        protected override void Initialize(ISingleDbObject theObj)
        {
            // call baseobject
            base.Initialize(theObj);

            // proterty - events
            theObj["ChgNumber"].ValueSet            += UpdateProfileVII_ValueSet;
            theObj["ChgTest"].ValueSet              += UpdateProfileVII_ValueSet;
            theObj["ClientStepCounter"].ValueSet    += UpdateProfileVII_ValueSet;
            theObj["Ident_DomainRD"].ValueSet       += Ident_DomainRD_ValueSet;
            theObj["Ident_InstType"].ValueSet       += UpdatePathVII_ValueSet;
            theObj["Ident_OS"].ValueSet             += UpdatePathVII_ValueSet;
            theObj["MemoryUsage"].ValueSet          += UpdateProfileVII_ValueSet;
            theObj["OrderNumber"].ValueSet          += UpdateProfileVII_ValueSet;
            theObj["OrderNumber"].ValueChecking     += OrderNumber_ValueChecking;
            theObj["OSMode"].ValueSet               += UpdateProfileVII_ValueSet;
            theObj["OSMode"].ValueChecking          += OSMode_ValueChecking;
            theObj["ServerDrive"].ValueSet          += UpdateProfileVII_ValueSet;
            theObj["SubPath"].ValueChecking         += SubPath_ValueChecking;
            theObj["SubPath"].ValueSet              += UpdatePathVII_ValueSet;
            theObj["UID_Application"].ValueChecking += UID_Application_ValueChecking;
            theObj["UID_Application"].ValueSet      += UID_Application_ValueSet;

            // Objekt initialisieren
            m_InitDate = DbObject.Connection.GetServerTime();
            _Handle_InitColumns();
        }
Exemple #8
0
        /// <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 MainActivator_OnDiscarded(object sender, System.EventArgs e)
        {
            try
            {
                foreach (TreeListNode node in m_TreeList.Nodes)
                {
                    if (!node.SubItemsContentChanged)
                    {
                        continue;
                    }

                    ISingleDbObject dbobject = node.Tag as ISingleDbObject;

                    node.SubItems[0].Data      = FormTool.GetValueSafe(dbobject, "CountLimit", 0).ToString();
                    node.SubItems[0].ForeColor = SystemColors.ControlText;
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
            finally
            {
                m_TreeList.Invalidate();
            }
        }
        private void _LoadList()
        {
            const int ConstDisplayName            = 0;
            const int ConstProfileStateProduction = 1;
            const int ConstProfileStateShadow     = 2;
            const int ConstChgNumber = 3;

            using (new UpdateHelper(m_TreeList))
            {
                m_Proxy.Clear();

                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                var runner = Session.Resolve <IStatementRunner>();
                using (IDataReader reader = new CachedDataReader(runner.SqlExecute("SDL-FormAppServerDriverProfile", new List <QueryParameter>()
                {
                    new QueryParameter("UID_ApplicationServer", ValType.String, FormTool.GetValueSafe(dbobject, "UID_ApplicationServer", ""))
                })))
                {
                    while (reader.Read())
                    {
                        ITreeListNode node = m_Proxy.AddNode(reader.GetString(ConstDisplayName), (int)StockImage.DriverProfile);
                        m_Proxy.AddItem(node, reader.GetString(ConstProfileStateProduction));
                        m_Proxy.AddItem(node, reader.GetString(ConstProfileStateShadow));
                        m_Proxy.AddItem(node, reader.GetString(ConstChgNumber));
                    }
                }
            }
        }
        private void _LoadActivatorCombo()
        {
            using (new UpdateHelper(m_ActivatorCombo))
            {
                m_ActivatorCombo.ComboItems.Clear();

                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                IColDbObject col = Connection.CreateCol("ClientLog");
                col.Prototype.WhereClause = SqlFormatter.UidComparison("UID_Hardware", dbobject["UID_HardWare"].New.String);
                col.Prototype.OrderBy     = "InstallDate DESC";

                col.Load();

                foreach (IColElem elem in col)
                {
                    m_ActivatorCombo.ComboItems.Add(elem);
                }
            }
        }
        /// <summary>
        /// FormMethode NewProfile
        /// </summar>
        public void FormTask_NewProfile()
        {
            try
            {
                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                ISingleDbObject profile = Connection.CreateSingle("DriverProfile");

                profile.GetFK("UID_Driver").Parent = m_MainActivator.DbObject;

                NavigateTo(profile);
            }
            catch (Exception ex)
            {
                // Fehler melden
                ExceptionMgr.Instance.HandleException(
                    new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationHasApplicationProfile_Task_LinkNewProfile").Replace("&", "")), this);
            }
        }
        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 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);
            }
        }
Exemple #15
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 #16
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
            {
            }
        }
        /// <exclude/>
        /// <summary>
        /// Es wird geprüft, ob zu der zu diesem Profil zugehörigen Applikation Profile vorhanden sind.
        /// Falls ja, wird das Flag IsProfileApplication in Application auf 1 gesetzt
        /// Falls nicht, wird das Flag IsProfileApplication in Application auf 0 gesetzt.
        /// </summary>
        private void _CheckIsProfileApplication()
        {
            IColDbObject  colApplicationProfile = DbObject.Connection.CreateCol("ApplicationProfile");;
            ISqlFormatter fSQL = DbObject.Connection.SqlFormatter;

            // Objekt wurde gelöscht
            if (DbObject.IsDeleted)
            {
                // geloescht

                // gibt es noch andere Profile ???
                colApplicationProfile.Prototype.WhereClause =
                    fSQL.AndRelation(fSQL.Comparison("UID_Application", DbObject["UID_Application"].New.String,
                                                     ValType.String, CompareOperator.Equal, FormatterOptions.None),
                                     fSQL.Comparison("UID_Profile", DbObject["UID_Profile"].New.String,
                                                     ValType.String, CompareOperator.NotEqual, FormatterOptions.None)
                                     );

                // nein
                if (colApplicationProfile.DBCount == 0)
                {
                    // exists the Application ( we are not in DeleteCascade )
                    // This Check is required because the UID_Application is filled, but the Object is already deleted
                    if (DbObject.Connection.Exists("Application", fSQL.Comparison("UID_Application", DbObject["UID_Application"].New.String,
                                                                                  ValType.String, CompareOperator.Equal, FormatterOptions.None)))
                    {
                        // auf false setzen
                        ISingleDbObject dbApplication = DbObject.GetFK("UID_Application").Create();

                        if (dbApplication != null)
                        {
                            if (dbApplication["IsProfileApplication"].New.Bool == true)
                            {
                                dbApplication["IsProfileApplication"].NewValue = false;
                                dbApplication.Save();
                            }
                        }
                    }
                }
            }

            // Objekt wurde neu angelegt
            if (!DbObject.IsLoaded)
            {
                // Insert
                ISingleDbObject dbApplication = DbObject.GetFK("UID_Application").Create();

                if (dbApplication != null)
                {
                    if (dbApplication["IsProfileApplication"].New.Bool == false)
                    {
                        dbApplication["IsProfileApplication"].NewValue = true;
                        dbApplication.Save();
                    }
                }
            }
        }
Exemple #18
0
        /// <summary>
        ///
        /// </summary>
        private void MainActivator_OnActivated(object sender, System.EventArgs e)
        {
            try
            {
                m_EditAsLabel2.Text = "";
                m_EditAsLabel3.Text = "";
                m_EditAsLabel4.Text = "";

                // Daten holen und prüfen
                ISingleDbObject dbobject = m_MainActivator.DbObject;

                if (dbobject == null)
                {
                    return;
                }

                string path = "";

                if (!ProfileTool.GetProfilePathOnTas(dbobject, out path))
                {
                    return;
                }

                m_EditAsLabel4.Text = path;

                string file  = "";
                string error = "";

                if (ProfileTool.ReadFileFromProfile(System.IO.Path.Combine(path, "profiledescription.vii"), out file))
                {
                    m_EditAsLabel2.Text = file;
                }
                else
                {
                    error = GetString("SDL_FormApplicationProfileSyncViiFiles_Message_ErrorNoProfileDescriptionVII") + Environment.NewLine;
                }

                if (ProfileTool.ReadFileFromProfile(System.IO.Path.Combine(path, "profile.vii"), out file))
                {
                    m_EditAsLabel3.Text = file;
                }
                else
                {
                    error += GetString("SDL_FormApplicationProfileSyncViiFiles_Message_ErrorNoProfileVII") + Environment.NewLine;
                }

                if (error.Length > 0)
                {
                    FormTool.ShowError(error);
                }
            }
            catch (Exception ex)
            {
                // Fehler melden
                HandleException(ex);
            }
        }
Exemple #19
0
        /// <summary>
        /// Gibt es in der Datenbank bereits neuere Einträge für Installationen?
        /// </summary>
        /// <param name="lastModified">Letzte Modifikation des Feedback-Files.</param>
        /// <param name="account"></param>
        /// <param name="machine"></param>
        public bool NewerInstallDataDoesExist(DateTime lastModified, ISingleDbObject account, ISingleDbObject machine)
        {
            var exec = Conn.CreateSqlExecutor(ConnectData.PublicKey);
            var sql  = GetCountOfNewerStatement(lastModified, account, machine);

            int cnt = (int)DbVal.ConvertTo(exec.SqlExecuteScalar(sql), ValType.Int);

            return(cnt > 0);
        }
        /// <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);
            }
        }
 protected override string GetCountOfNewerStatement(DateTime date, ISingleDbObject account, ISingleDbObject machine)
 {
     return(string.Format(
                Conn.SqlStrings["COUNT_ADS_ACCOUNT"],
                account == null ? "1=0" :
                Formatter.Comparison("UID_ADSAccount", account["UID_ADSAccount"].NewValue, ValType.String, CompareOperator.Equal, FormatterOptions.None),
                machine == null ? "1=0" :
                Formatter.Comparison("UID_Hardware", machine["UID_Hardware"].NewValue, ValType.String, CompareOperator.Equal, FormatterOptions.None),
                Formatter.Comparison("InstallDate", date, ValType.Date, CompareOperator.GreaterOrEqual)));
 }
        /// <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)
        {
            // Aktivierung mit <null> verhindern
            ISingleDbObject dbobject = m_MainActivator.DbObject;

            if (dbobject == null)
            {
                return;
            }

            try
            {
                string pkcol = "UID_" + dbobject.Tablename;

                // TODO Whereklauseln setzen
                m_MemberRelation1.WhereClause =
                    SqlFormatter.Comparison(pkcol, dbobject[pkcol].New.String, ValType.String, CompareOperator.NotEqual);

                m_MemberRelation1.RootFilterMemberWhereClause = "";
                m_MemberRelation1.RootFilterWhereClause       = "";
                m_MemberRelation1.RootFilterTableName         = "";

                switch (dbobject.Tablename.ToLowerInvariant())
                {
                case "aerole":
                    m_MemberRelation1.MNTableName = "AERoleRelatedToAERole";
                    break;

                case "department":
                    m_MemberRelation1.MNTableName = "DepartmentRelatedToDepartment";
                    break;

                case "locality":
                    m_MemberRelation1.MNTableName = "LocalityRelatedToLocality";
                    break;

                case "org":
                    m_MemberRelation1.MNTableName                 = "OrgRelatedToOrg";
                    m_MemberRelation1.RootFilterTableName         = "OrgRoot";
                    m_MemberRelation1.RootFilterMemberWhereClause =
                        SqlFormatter.UidComparison("UID_OrgRoot", "%UID_OrgRoot%");
                    m_MemberRelation1.RootFilterWhereClause = "UID_OrgRoot in (select UID_OrgRoot from Org)";
                    break;

                case "profitcenter":
                    m_MemberRelation1.MNTableName = "ProfitCenterRelatedToProf";
                    break;
                }

                m_MemberRelation1.MNBaseColumnName = pkcol;
            }
            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"));
                }
            }
        }
        private static Task WriteViiFilesAsync(ISession session, IEntity entity, CancellationToken ct)
        {
            ISingleDbObject dbObject = entity.CreateSingleDbObject(session);

            ModProfile.WriteVIIFiles(dbObject);

            dbObject.Connection.ShowMessage(
                LanguageManager.Instance["str881_WriteVIIFiles"],
                LanguageManager.Instance["str881_Information"]);

            return(NullTask.Instance);
        }
        /// <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)
        {
            // Daten holen und prüfen
            ISingleDbObject dbobject = m_MainActivator.DbObject;

            if (dbobject == null)
            {
                return;
            }

            m_TreeComboBoxUIDSectionName.WhereClause = SqlFormatter.Comparison("AppsNotDriver", true, ValType.Bool);
        }
        /// <summary>
        /// Startet den Profil Editor.
        /// </summary>
        /// <param name="profile">Applikations- oder Treiberprofil als SingleDbObject.</param>
        /// <param name="domain">Domäne als SingleDbObject.</param>
        /// <param name="application">Applikation oder Treiber als SingleDbObject.</param>
        /// <returns>Wahr, wenn Änderungen an der Profile.vii vorgenommen wurden.</returns>
        public static bool StarteProfileEditor(ISingleDbObject profile, ISingleDbObject domain, ISingleDbObject application)
        {
            try
            {
                // 1. Schritt: ProfileEdit suchen.
                string pepath = FindProfileEditExe();

                if (string.IsNullOrEmpty(pepath))
                {
                    throw new ViException(LanguageManager.Instance["VIP7_frmEditNoProfileEdit"]);
                }

                // 2. Schritt: Path on TAS ermitteln.
                string pathontas = "";

                if (!GetProfilePathOnTas(profile, out pathontas))
                {
                    throw new ViException(pathontas);
                }

                // 3. Schritt: alte Profile.vii lesen.
                string profvii1 = "";
                string profvii2 = "";

                if (!ReadFileFromProfile(Path.Combine(pathontas, "profile.vii"), out profvii1))
                {
                    profvii1 = "";                       // Neue profile.vii wird von profile edit angelegt.
                }
                // 4. Schritt: Übergabeparameter in Registry ablegen.
                if (storeParameters(profile, domain, application, pathontas))
                {
                    // 5. Schritt: ProfileEdit synchron starten und neue Profile.vii einlesen.
                    int ret = ExecCmd(pepath, "Packager");

                    if (!ReadFileFromProfile(Path.Combine(pathontas, "profile.vii"), out profvii2))
                    {
                        profvii2 = "";
                    }

                    // 6. Schritt: Feststellen, ob Profile.vii geändert wurde.
                    return(profileViiHasChanged(profvii1, profvii2));
                }
            }
            catch (Exception exception)
            {
                VI.FormBase.ExceptionMgr.Instance.HandleException(exception, null);
            }

            return(false);
        }
        /// <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>
        /// Ermittelt den Pfad auf dem TAS.
        /// </summary>
        /// <param name="profile_object"></param>
        /// <param name="strReturn">Pfad als String oder Fehlermeldung</param>
        /// <returns>Wahr, wenn der Pfad vollständig ermittelt werden konnte.</returns>
        public static bool GetPathOnTas(ISingleDbObject profile, string strReturn)
        {
            try
            {
                bool   isapp  = isApplicationProfile(profile);
                string prefix = "VIP7_Sync" + (isapp ? "App" : "Driver") + "Profile_";

                if (profile.GetValue("UID_SDLDomainRD").String.Length == 0)
                {
                    strReturn = LanguageManager.Instance[prefix + "ErrNoDomain"];
                    return(false);
                }

                ISingleDbObject domain = profile.GetFK("UID_SDLDomainRD").Create();

                if (domain.GetValue("UID_ServerTAS").String.Length == 0)
                {
                    strReturn = LanguageManager.Instance[prefix + "ErrNoTASinDomain"];
                    return(false);
                }

                string shareontas = domain.GetValue("ShareOnTAS").String;

                if (shareontas.Length == 0)
                {
                    strReturn = LanguageManager.Instance[prefix + "ErrNoShareOnTASinDomain"];
                    return(false);
                }

                string clientpart = domain.GetValue((isapp ? "ClientPartApps" : "ClientPartDriver")).String;

                if (clientpart.Length == 0)
                {
                    strReturn = LanguageManager.Instance[prefix + "ErrNoClientPartinDomain"];
                    return(false);
                }

                strReturn = @"\\" + domain.GetFK("UID_ServerTAS").Create().GetValue("Ident_Server") +
                            @"\" + shareontas + @"\" + clientpart + @"\";

                return(true);
            }
            catch (Exception exception)
            {
                strReturn = exception.Message;
            }

            return(false);
        }
        /// <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)
        {
            // Daten holen und prüfen
            ISingleDbObject dbobject = m_MainActivator.DbObject;

            if (dbobject == null)
            {
                return;
            }

            m_RichTextBox1.Text = "";

            _LoadProtocols();
            _LoadActivatorCombo();
        }
        public bool Assign(ISingleDbObject oOther)
        {
            if (null == oOther)
            {
                return(false);
            }

            using (NoRightsCheck())
            {
                //nicht auf sich selbst
                if (oOther.Equals(DbObject))
                {
                    return(false);
                }

                SetValue("Ident_DomainRD", oOther["Ident_DomainRD"].New.String);
                SetValue("Ident_OS", oOther["Ident_OS"].New.String);
                SetValue("Ident_InstType", oOther["Ident_InstType"].New.String);
                SetValue("Description", oOther["Description"].New.String);
                SetValue("ChgNumber", oOther["ChgNumber"].New.Int);
                SetValue("SubPath", oOther["SubPath"].New.String);
                SetValue("OrderNumber", oOther["OrderNumber"].New.Double);
                SetValue("ServerDrive", oOther["ServerDrive"].New.String);
                SetValue("DefDriveTarget", oOther["DefDriveTarget"].New.String);
                SetValue("OSMode", oOther["OSMode"].New.String);
                SetValue("MemoryUsage", oOther["MemoryUsage"].New.String);
                SetValue("ChgTest", oOther["ChgTest"].New.Int);
                SetValue("ClientStepCounter", oOther["ClientStepCounter"].New.Int);
                SetValue("Ident_DomainRDOwner", oOther["Ident_DomainRDOwner"].New.String);
                SetValue("ProfileType", oOther["ProfileType"].New.String);
                SetValue("UID_Application", oOther["UID_Application"].New.String);
                SetValue("ChgCL", oOther["ChgCL"].New.Int);
                SetValue("DisplayName", oOther["DisplayName"].New.String);
                SetValue("RemoveHKeyCurrentUser", oOther["RemoveHKeyCurrentUser"].New.String);

                SetValue("UID_OS", oOther["UID_OS"].New.String);
                SetValue("UID_InstallationType", oOther["UID_InstallationType"].New.String);
                SetValue("UID_SDLDomainRD", oOther["UID_SDLDomainRD"].New.String);
                SetValue("UID_SDLDomainRDOwner", oOther["UID_SDLDomainRDOwner"].New.String);

                // TODO: Check this! can we write this property ???
                if (DbObject["PackagePath"].CanEdit)
                {
                    SetValue("PackagePath", oOther["PackagePath"].New.String);
                }
            }
            return(true);
        }