/// <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); } }
/// <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); } }
/// <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> /// 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> /// /// </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> /// FormMethode SyncProfile /// </summary> public void FormMethod_SyncProfile() { try { ISingleDbObject app = null; // Daten holen und prüfen ISingleDbObject profile = m_MainActivator.DbObject; if (profile == null) { return; } bool SyncProfilesPossible; if (profile["UID_SDLDomainRD"].New.String.Length > 0) { var dom = profile.GetFK("UID_SDLDomainRD").Create(); if (dom != null) { app = profile.GetFK("UID_Driver").Create(); } } string strReturn; if (ProfileTool.GetProfilePathOnTas(profile, out strReturn)) { m_MProfilePathOnTAS = strReturn; if (ProfileTool.ReadFileFromProfile(Path.Combine(m_MProfilePathOnTAS, "profile.vii"), out strReturn)) { SyncProfilesPossible = true; } else { FormTool.ShowError("VIP7_SyncAppProfile_ErrNoProfileVII"); return; } } else { FormTool.ShowError(strReturn); return; } if (profile.IsChanged) { profile.Save(); profile.Load(); } if (SyncProfilesPossible) { ProfileTool.SyncWithProfileVii(profile, Path.Combine(m_MProfilePathOnTAS, "profile.vii")); } if (profile.IsChanged) { profile.Save(); profile.Load(); } if (FormTool.MainForm != null) { FormTool.MainForm.BringToFront(); } } catch (Exception ex) { // Fehler melden VI.FormBase.ExceptionMgr.Instance.HandleException( new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationProfileMasterData_Task_SynchronizeApplicationProfile").Replace("&", "")), this); } }
/// <summary> /// FormMethode ProfileEdit /// </summary> public void FormMethod_ProfileEdit() { try { ISingleDbObject dom = null; ISingleDbObject app = null; // Daten holen und prüfen ISingleDbObject profile = m_MainActivator.DbObject; if (profile == null) { return; } if (profile["UID_SDLDomainRD"].New.String.Length > 0) { dom = profile.GetFK("UID_SDLDomainRD").Create(); if (dom != null) { app = profile.GetFK("UID_Driver").Create(); } } string strReturn; if (ProfileTool.GetProfilePathOnTas(profile, out strReturn)) { m_MProfilePathOnTAS = strReturn; ProfileTool.ReadFileFromProfile(Path.Combine(m_MProfilePathOnTAS, "profile.vii"), out strReturn); } else { FormTool.ShowError(strReturn); return; } if (profile.IsChanged) { profile.Save(); profile.Load(); } if (ProfileTool.StarteProfileEditor(profile, dom, app)) { // liefert true, wenn sich die profile.vii geändert hat // profile edit schreibt profile.vii - damit ist sync möglich if (ProfileTool.SyncWithProfileVii(profile, Path.Combine(m_MProfilePathOnTAS, "profile.vii"))) { // unbedingt speichern, da sonst die JobKette auf einem alten Profilstand generiert wird. if (profile.IsChanged) { profile.Save(); profile.Load(); } profile.Custom.CallMethod("WriteVIIFiles"); //// Profile neu laden, da von WriteVIIFiles (Jobkette) geändert //DbObjectKey key = new DbObjectKey(profile); //profile.Clear(); //key.FillObject(profile); //profile.Load(); // das muss sein, da FillObject beim Setzen des PKs ein COlumnChanged auslöst, bei allen anderen // Spalten nicht, deshalb stimmt die Sheet Bestimmung nicht mehr und das Form heist AppProfile-Objekt ohne Anzeigename. Document.Reload(); } } } catch (Exception ex) { // Fehler melden VI.FormBase.ExceptionMgr.Instance.HandleException( new FormCustomizerException(929001, ex, GetString("SDL_FormApplicationProfileMasterData_Task_EditApplicationProfile").Replace("&", "")), this); } }
private void LoadData() { using (new VI.FormBase.UpdateHelper(m_TreeList)) { m_TreeList.Nodes.Clear(); // Daten holen und prüfen ISingleDbObject dbobject = m_MainActivator.DbObject; if (dbobject == null || !dbobject.TableDef.CanSee) { return; } IColDbObject col = Connection.CreateCol(m_DataStore.String1); col.Prototype.WhereClause = SqlFormatter.Comparison(m_DataStore.String2, FormTool.GetValueSafe(dbobject, m_DataStore.String2, ""), ValType.String); col.Prototype.Columns["CountLicMacDirectTarget"].IsDisplayItem = true; col.Prototype.Columns["CountLicMacIndirectTarget"].IsDisplayItem = true; col.Prototype.Columns["CountLicUserTarget"].IsDisplayItem = true; col.Prototype.Columns["CountLicMacPossTarget"].IsDisplayItem = true; col.Prototype.Columns["CountLicMacDirectActual"].IsDisplayItem = true; col.Prototype.Columns["CountLicMacDirectActual"].IsDisplayItem = true; col.Prototype.Columns["CountLicMacIndirectActual"].IsDisplayItem = true; col.Prototype.Columns["CountLicUserActual"].IsDisplayItem = true; col.Prototype.Columns["CountLicMacPossActual"].IsDisplayItem = true; col.Prototype.Columns["CountLicMacReal"].IsDisplayItem = true; col.Prototype.Columns["CountLimit"].IsDisplayItem = true; col.Load(); bool canedit = col.Prototype.Columns["CountLimit"].CanEdit; bool[] cansees = new bool[] { col.Prototype.Columns["UID_Licence"].CanSee, col.Prototype.Columns["CountLimit"].CanSee, col.Prototype.Columns["CountLicMacDirectActual"].CanSee, col.Prototype.Columns["CountLicMacDirectTarget"].CanSee, col.Prototype.Columns["CountLicMacIndirectActual"].CanSee, col.Prototype.Columns["CountLicMacIndirectTarget"].CanSee, col.Prototype.Columns["CountLicMacPossActual"].CanSee, col.Prototype.Columns["CountLicMacPossTarget"].CanSee, col.Prototype.Columns["CountLicMacReal"].CanSee, col.Prototype.Columns["CountLicUserActual"].CanSee, col.Prototype.Columns["CountLicUserTarget"].CanSee, }; // und Grid füllen foreach (IColElem elem in col) { ISingleDbObject obj = elem.Create(); ISingleDbObject identfk = obj.GetFK("UID_Licence").Create(); string ident = identfk != null ? identfk["Ident_Licence"].New.String : ""; TreeListNode node = m_TreeList.Nodes.Add(cansees[0] ? ident : "", 0); node.ForeColor = SystemColors.ControlDark; ITreeListItem subitem = canedit ? new TreeListItemTextBox(cansees[1] ? elem["CountLimit"].ToString() : "", 8) : new TreeListItem(cansees[1] ? elem["CountLimit"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = canedit ? SystemColors.ControlText : SystemColors.ControlDark; subitem = new TreeListItem(cansees[2] ? elem["CountLicMacReal"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[3] ? elem["CountLicUserActual"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[4] ? elem["CountLicUserTarget"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[5] ? elem["CountLicMacDirectActual"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[6] ? elem["CountLicMacDirectTarget"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[7] ? elem["CountLicMacIndirectActual"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[8] ? elem["CountLicMacIndirectTarget"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[9] ? elem["CountLicMacPossActual"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; subitem = new TreeListItem(cansees[10] ? elem["CountLicMacPossTarget"].ToString() : ""); node.SubItems.Add(subitem); subitem.ForeColor = SystemColors.ControlDark; node.Tag = obj; } } }
/// <summary> /// Synchronisation zwischen rofile.vii und Profil-Objekt. /// </summary> /// <param name="profile">Profil Objekt.</param> /// <param name="profviiPath">Vollständiger Pfad zur Profile.vii.</param> /// <returns></returns> public static bool SyncWithProfileVii(ISingleDbObject profile, string profviiPath) { /* * profile_object profile.vii master * ---------------------------------------------------------------------- * App.Ident_Sectionname Sektion db * ChgTest ChgNr max * Displayname Bezeichnung db * ClientStepCounter AnzahlEintraege vii * OSMode OSMode vii * MemoryUsage Speicherbedarf vii * OrderNumber OrdnungsNr db * ProfileType ProfileType vii * HashValueTAS ProfileHash vii * CachingBehavior LokaleZwischenspeicherbarkeit vii * RemoveHKeyCurrentUser VerarbeitungHkcuBeimDeinstallieren vii */ try { string profvii = ""; if (!ReadFileFromProfile(profviiPath, out profvii)) { throw new ViException(profviiPath); } if (string.IsNullOrEmpty(getViiValue(profvii, "ProfileHash"))) { throw new ViException(LanguageManager.Instance["VIP7_SyncAppProfile_ErrProfileNotAutark"]); } bool profviiChanged = false; string section = SectionName(profvii); string chgnr = getViiValue(profvii, "ChgNr"); string bezeichnung = getViiValue(profvii, "Bezeichnung"); string anzahleintraege = getViiValue(profvii, "AnzahlEintraege"); string osmode = getViiValue(profvii, "OSMode"); string speicherbedarf = getViiValue(profvii, "Speicherbedarf"); string ordnungsnr = getViiValue(profvii, "OrdnungsNr"); if (string.IsNullOrEmpty(ordnungsnr)) { ordnungsnr = FormatOrderNumber("0"); } string profiletype = getViiValue(profvii, "ProfileType"); string profilehash = getViiValue(profvii, "ProfileHash"); string cachingbehavior = getViiValue(profvii, "LokaleZwischenspeicherbarkeit").Trim(); bool removehkeycurrentuser = false; if (string.IsNullOrEmpty(chgnr)) { chgnr = "0"; profviiChanged = true; } //ChgNr or Changetest ? - take allways the max of both chgNumbers int intchgnr = int.Parse(chgnr); int objchgnr = profile.GetValue("ChgTest").Int; if (intchgnr > objchgnr) { profile.PutValue("ChgTest", intchgnr); } else if (intchgnr < objchgnr) { chgnr = profile.GetValue("ChgTest").String; profviiChanged = true; } if (string.IsNullOrEmpty(anzahleintraege)) { anzahleintraege = profile.GetValue("ClientStepCounter").String; profviiChanged = true; } if (string.IsNullOrEmpty(osmode)) { osmode = profile.GetValue("OSMode").String; profviiChanged = true; } if (string.IsNullOrEmpty(speicherbedarf)) { speicherbedarf = profile.GetValue("MemoryUsage").String; profviiChanged = true; } if (string.IsNullOrEmpty(profiletype)) { profiletype = profile.GetValue("ProfileType").String; profviiChanged = true; } if (string.IsNullOrEmpty(cachingbehavior)) { cachingbehavior = profile.GetValue("CachingBehavior").String; profviiChanged = true; } string dummy = getViiValue(profvii, "VerarbeitungHkcuBeimDeinstallieren").Trim().ToLowerInvariant(); if (string.IsNullOrEmpty(dummy)) { removehkeycurrentuser = profile.GetValue("RemoveHKeyCurrentUser").Bool; profviiChanged = true; } else { if (dummy == "wahr") { removehkeycurrentuser = true; } else if (dummy == "falsch") { removehkeycurrentuser = false; } else { removehkeycurrentuser = bool.Parse(dummy); } } // profile.vii is master if (profile.GetValue("ClientStepCounter").String != anzahleintraege) { profile.PutValue("ClientStepCounter", int.Parse(anzahleintraege)); } if (profile.GetValue("OSMode").String != osmode) { profile.PutValue("OSMode", osmode); } if (profile.GetValue("MemoryUsage").String != speicherbedarf) { profile.PutValue("MemoryUsage", speicherbedarf); } if (profile.GetValue("ProfileType").String != profiletype) { profile.PutValue("ProfileType", profiletype); } if (profile.GetValue("HashValueTAS").String != profilehash) { profile.PutValue("HashValueTAS", int.Parse(profilehash)); } if (profile.GetValue("CachingBehavior").String != cachingbehavior) { profile["CachingBehavior"].NewValue = cachingbehavior; } if (profile.GetValue("RemoveHKeyCurrentUser").Bool != removehkeycurrentuser) { profile["RemoveHKeyCurrentUser"].NewValue = removehkeycurrentuser; } // db is master ISingleDbObject appobject = (isApplicationProfile(profile) ? profile.GetFK("UID_Application").Create() : profile.GetFK("UID_Driver").Create()); if (appobject.GetValue("Ident_Sectionname").String != section) { section = appobject.GetValue("Ident_Sectionname").String; profviiChanged = true; } if (profile.GetValue("Displayname").String != bezeichnung) { bezeichnung = profile.GetValue("Displayname").String; profviiChanged = true; } string objordnungsnr = FormatOrderNumber(profile.GetValue("OrderNumber").String); if (ordnungsnr != objordnungsnr) { ordnungsnr = objordnungsnr; profviiChanged = true; } if (profviiChanged && IsProfileViiWriteable(profviiPath)) { profvii = "[" + section + "]" + Environment.NewLine + "ChgNr=" + chgnr + Environment.NewLine + "Bezeichnung=" + bezeichnung + Environment.NewLine + "AnzahlEintraege=" + anzahleintraege + Environment.NewLine + "OSMode=" + osmode + Environment.NewLine + "Speicherbedarf=" + speicherbedarf + Environment.NewLine + "OrdnungsNr=" + ordnungsnr + Environment.NewLine + "ProfileType=" + profiletype + Environment.NewLine + "ProfileHash=" + profilehash + Environment.NewLine + "LokaleZwischenspeicherbarkeit=" + cachingbehavior + Environment.NewLine + "VerarbeitungHkcuBeimDeinstallieren=" + removehkeycurrentuser.ToString(); // + "Autark=TRUE"; WriteToFile(profviiPath, profvii); } return(true); } catch (Exception exception) { VI.FormBase.ExceptionMgr.Instance.HandleException(exception, null); } return(false); }
/// <summary> /// Abspeichern der Übergabeparementer für Profile Eidtor. /// </summary> /// <param name="profile">Applikations- bzw. Treiberprofil.</param> /// <param name="domain">Domäne.</param> /// <param name="application">Application bzw. Treiber</param> /// <param name="path">Pfad des Profils, wenn bekannt.</param> /// <returns></returns> private static bool storeParameters(ISingleDbObject profile, ISingleDbObject domain, ISingleDbObject application, params string[] path) { try { string profpath = ""; if (path.Length > 0) { profpath = path[0]; } else if (!GetProfilePathOnTas(profile, out profpath)) { profpath = ""; } if (string.IsNullOrEmpty(profpath)) { return(false); } bool isapp = isApplicationProfile(profile); ISingleDbObject ptas = domain.GetFK("UID_ServerTAS").Create(); string server = ""; if (isapp && profile.GetValue("ServerDrive").String.Length != 0) { server = profile.GetValue("PackagePath").String.Length >= 0 ? @"\\" + ptas.GetValue("Ident_Server").String + @"\" + domain.GetValue("ServerPartShareOnTAS").String + @"\" + profile.GetValue("PackagePath").String : @"\\" + ptas.GetValue("Ident_Server").String + @"\" + domain.GetValue("ServerPartShareOnTAS").String + @"\" + profile.GetValue("SubPath").String; } saveProfileEditParm("Language", LanguageManager.Instance.Language); saveProfileEditParm("SectionName", application.GetValue("Ident_SectionName").String); saveProfileEditParm("ProfileName", profile.GetValue("DisplayName").String); saveProfileEditParm("OrderNumber", FormatOrderNumber(profile.GetValue("OrderNumber").String)); saveProfileEditParm("ChgNr", profile.GetValue("ChgTest").String); saveProfileEditParm("ProfilePath", profpath); saveProfileEditParm("ProfileKind", (isapp ? "ApplicationProfile" : "DriverProfile")); saveProfileEditParm("ProfilePathServer", server); saveProfileEditParm("MasterDomain", domain.GetValue("Ident_Domain").String); // saveProfileEditParm("DomainClientDrive", domain.GetValue("ClientDrive").String); saveProfileEditParm("DomainAppsDrive", (isapp ? profile.GetValue("ServerDrive").String : "")); saveProfileEditParm("DefDriveTarget", profile.GetValue("DefDriveTarget").String); saveProfileEditParm("ClientPartPathOnServers", domain.GetValue("ClientPartPathOnServers").String); saveProfileEditParm("DomainClientPart", (isapp ? domain.GetValue("ClientPartApps").String : domain.GetValue("ClientPartDriver").String)); saveProfileEditParm("ProfileSubPath", profile.GetValue("subpath").String); saveProfileEditParm("VariableStart", profile.Connection.GetConfigParm(@"Software\SoftwareDistribution\Variable\Start")); saveProfileEditParm("VariableEnd", profile.Connection.GetConfigParm(@"Software\SoftwareDistribution\Variable\End")); saveProfileEditParm("CachingBehavior", profile.GetValue("CachingBehavior").String); saveProfileEditParm("RemoveHKeyCurrentUser", profile.GetValue("RemoveHKeyCurrentUser").Bool ? "1" : "0"); saveProfileEditParm("ProfileType", profile.GetValue("ProfileType").String); saveProfileEditParm("OSMode", profile.GetValue("OSMode").String); saveProfileEditParm("ScanType", "NT4"); // in AE3 imemr NT4 damit der ProfilEditor CMDs schreibt return(true); } catch (Exception exception) { VI.FormBase.ExceptionMgr.Instance.HandleException(exception, null); } return(false); }