public boMandant getMandantByUser(string userName) { boMandant retVal = null; PermissionPolicyUser curUser = this.Session.FindObject <PermissionPolicyUser>(new BinaryOperator("UserName", userName, BinaryOperatorType.Equal)); corePortalAccount curPortalAccount = this.Session.FindObject <corePortalAccount>(new BinaryOperator("SystemBenutzer.Oid", curUser.Oid, BinaryOperatorType.Equal)); if (curPortalAccount != null) { //den hausverwalter rausfinden boHausverwalter curHausverwalter = this.Session.FindObject <boHausverwalter>(new BinaryOperator("Oid", curPortalAccount.HausVerwalter.Oid, BinaryOperatorType.Equal)); retVal = curHausverwalter.Mandant; } boMitarbeiter curMitarbeiter = this.Session.FindObject <boMitarbeiter>(new BinaryOperator("Systembenutzer.Oid", curUser.Oid, BinaryOperatorType.Equal)); if (curMitarbeiter != null) { retVal = curMitarbeiter.Mandant; } if (retVal == null) { boMandant curMandant = this.Session.FindObject <boMandant>(new BinaryOperator("IsDefault", "true", BinaryOperatorType.Equal)); retVal = curMandant; } return(retVal); }
public boWartungszone getWartungszone(boMandant curMandant) { boWartungszone retVal; if (this.ort != null) { retVal = Session.FindObject <boWartungszone>(new GroupOperator(new BinaryOperator("Mandant.Oid", curMandant.Oid, BinaryOperatorType.Equal), new ContainsOperator("lstOrte", new BinaryOperator("Name", this.ort.Name, BinaryOperatorType.Equal)))); } else { retVal = null; } return(retVal); }
public override void AfterConstruction() { base.AfterConstruction(); artikelArtikelKatalog chosenKatalog = null; boMandant chosenMandant = getCurrentMandant(); if (chosenMandant != null) { chosenKatalog = this.Session.FindObject <artikelArtikelKatalog>(new GroupOperator(new BinaryOperator("Mandant.Oid", chosenMandant.Oid, BinaryOperatorType.Equal), new BinaryOperator("Bezeichnung", "Anlagenartikel", BinaryOperatorType.Equal))); if (chosenKatalog != null) { this.ArtikelKatalog = chosenKatalog; } } }
private void createNumber(boMandant selectedMandant) { Type curType = this.GetType(); //var nummer = this.Session.FindObject<boNummernkreis>(new GroupOperator(new BinaryOperator("Objekt", typeof(boMitarbeiter), BinaryOperatorType.Equal), new BinaryOperator("Mandant.Oid",selectedMandant.Oid,BinaryOperatorType.Equal), // new BinaryOperator("ValidFrom", DateTime.Now, BinaryOperatorType.LessOrEqual), // new BinaryOperator("ValidTo", DateTime.Now, BinaryOperatorType.GreaterOrEqual))); var nummer = this.Session.FindObject <boNummernkreis>(new GroupOperator(new BinaryOperator("Objekt", curType, BinaryOperatorType.Equal), new BinaryOperator("Mandant.Oid", selectedMandant.Oid, BinaryOperatorType.Equal), new BinaryOperator("GueltigAb", DateTime.Now, BinaryOperatorType.LessOrEqual), new BinaryOperator("GueltigBis", DateTime.Now, BinaryOperatorType.GreaterOrEqual))); if (nummer != null) { this.Personalnummer = nummer.NextNumber; nummer.FortlaufendeNummer = nummer.FortlaufendeNummer + 1; nummer.Save(); } }
private boMandant getCurrentMandant() { boMitarbeiter curMitarbeiter = null; boMandant curMandant = null; PermissionPolicyUser curUser = (PermissionPolicyUser)SecuritySystem.CurrentUser; //gibt es einen Mitarbeiter dazu? curMitarbeiter = this.Session.FindObject <boMitarbeiter>(new BinaryOperator("Systembenutzer.Oid", curUser.Oid, BinaryOperatorType.Equal)); if (curMitarbeiter != null) { if (curMitarbeiter.Mandant != null) { curMandant = this.Session.GetObjectByKey <boMandant>(curMitarbeiter.Mandant.Oid); } } return(curMandant); }
protected override void OnChanged(string propertyName, object oldValue, object newValue) { base.OnChanged(propertyName, oldValue, newValue); switch (propertyName) { case "Mandant": //immer auf die Standardbibliothek setzen if (newValue != null) { boMandant selectedMandant = (boMandant)newValue; boAttachmentBibliothek curBib = this.Session.FindObject <boAttachmentBibliothek>(new GroupOperator(new BinaryOperator("Mandant.Oid", selectedMandant.Oid, BinaryOperatorType.Equal), new BinaryOperator("Bezeichnung", "Standardbibliothek", BinaryOperatorType.Equal))); if (curBib != null) { this.Bibliothek = this.Session.GetObjectByKey <boAttachmentBibliothek>(curBib.Oid); } } break; case "File": this.Filesize = this.File.Size; //this.Extension = this.File.FileName.Substring(this.File.FileName.LastIndexOf('.'), this.File.FileName.Length-1); break; } }
private static void initAppSettings() { //Settings für die Log-Datei Console.WriteLine("Initalisierung"); var workingDirectory = AppDomain.CurrentDomain.BaseDirectory; //gibt es schon ein Log-Directory? DirectoryInfo diLog = new DirectoryInfo(String.Format("{0}\\{1}", workingDirectory, "Log")); if (!diLog.Exists) { diLog.Create(); } logDirectory = diLog.FullName; var logFileName = string.Empty; var fullLogFileName = string.Empty; var appName = string.Empty; appName = ConfigurationManager.AppSettings.Get("AppName").ToString(); logFileName = String.Format("LOG_{0}_{1}", appName, DateTime.Now.ToString("ddMMyyyyHHmm"));// ToShortDateString(), DateTime.Now.ToLongTimeString()); fullLogFileName = String.Format("{0}\\{1}.txt", logDirectory, logFileName); currentLogFile = fullLogFileName; //curMandant = uow.FindObject<boMandant>(new BinaryOperator("Mandantenkennung", Mandant, BinaryOperatorType.Equal)); //Session workingSession = XpoHelper.GetNewSession(curMandantName);/// = HauptsystemHelper.GetNewSession(); Session curSession = HauptsystemHelper.GetNewSession(); if (curSession != null) { using (curSession) { //UnitOfWork uow = new UnitOfWork(curSession.DataLayer); curMandant = curSession.FindObject <boMandant>(new BinaryOperator("Mandantenkennung", curMandantKennung, BinaryOperatorType.Equal)); if (curMandant != null) { //curSession = workingSession; writeToLogSimpel(String.Format("Mandant {0} gültig", curMandant.Mandantenkennung)); //dann prüfen ob es für deisenMandanten den angegebnen Dokumenttyasp gibt curDocumentTyp = curSession.FindObject <importDokumentTyp>(new GroupOperator(new BinaryOperator("Mandant.Oid", curMandant.Oid, BinaryOperatorType.Equal), new BinaryOperator("Kuerzel", curDocumentTypeKuerzel, BinaryOperatorType.Equal))); if (curDocumentTyp != null) { writeToLogSimpel(String.Format("Dokumenttyp {0} gefunden.", curDocumentTyp.Bezeichnung)); } else { writeToLogSimpel(String.Format("Dokumenttyp {0} für den Mandanten {1} nicht gefunden.", curDocumentTypeKuerzel, curMandant.Mandantenname)); } } else { writeToLogSimpel(String.Format("Mandant {0} nicht gefunden", curMandantKennung)); } } } else { writeToLogStart(String.Format("Sesion für Mandant {0} kann nicht erstellt werden", curMandantKennung)); } curSession.Dispose(); }