public static AddPasswordResetResult Failed(PasswordReset PasswordReset, EventTracking_Id EventTrackingId, Exception Exception) => new AddPasswordResetResult(PasswordReset, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message));
public static DeleteOrganizationResult Failed(Organization Organization, EventTracking_Id EventTrackingId, String Description) => new DeleteOrganizationResult(Organization, EventTrackingId, false, null, I18NString.Create(Languages.en, Description));
public static AddChargeBoxResult Failed(ChargeBox ChargeBox, EventTracking_Id EventTrackingId, Exception Exception) => new AddChargeBoxResult(ChargeBox, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message));
public static UpdateUserGroupResult Failed(UserGroup UserGroup, EventTracking_Id EventTrackingId, String Description) => new UpdateUserGroupResult(UserGroup, EventTrackingId, false, null, I18NString.Create(Languages.en, Description));
public static RemoveOrganizationGroupResult Failed(OrganizationGroup OrganizationGroup, EventTracking_Id EventTrackingId, Exception Exception) => new RemoveOrganizationGroupResult(OrganizationGroup, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message));
public static UpdateUserGroupResult Failed(UserGroup UserGroup, EventTracking_Id EventTrackingId, Exception Exception) => new UpdateUserGroupResult(UserGroup, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message));
public static UpdateOrganizationResult Failed(Organization Organization, EventTracking_Id EventTrackingId, Exception Exception) => new UpdateOrganizationResult(Organization, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message));
public static AddPasswordResetResult Failed(PasswordReset PasswordReset, EventTracking_Id EventTrackingId, String Description) => new AddPasswordResetResult(PasswordReset, EventTrackingId, false, null, I18NString.Create(Languages.en, Description));
public static AddChargeBoxResult Failed(ChargeBox ChargeBox, EventTracking_Id EventTrackingId, String Description) => new AddChargeBoxResult(ChargeBox, EventTrackingId, false, null, I18NString.Create(Languages.en, Description));
public static AddPasswordResetResult ArgumentError(PasswordReset PasswordReset, EventTracking_Id EventTrackingId, String Argument, String Description) => new AddPasswordResetResult(PasswordReset, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static RemoveOrganizationGroupResult ArgumentError(OrganizationGroup OrganizationGroup, EventTracking_Id EventTrackingId, String Argument, String Description) => new RemoveOrganizationGroupResult(OrganizationGroup, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static UpdateAPIKeyResult ArgumentError(APIKey APIKey, EventTracking_Id EventTrackingId, String Argument, String Description) => new UpdateAPIKeyResult(APIKey, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static DeleteOrganizationResult ArgumentError(Organization Organization, EventTracking_Id EventTrackingId, String Argument, String Description) => new DeleteOrganizationResult(Organization, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static DeleteUserResult ArgumentError(User User, EventTracking_Id EventTrackingId, String Argument, String Description) => new DeleteUserResult(User, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static UpdateChargeBoxResult ArgumentError(ChargeBox ChargeBox, EventTracking_Id EventTrackingId, String Argument, String Description) => new UpdateChargeBoxResult(ChargeBox, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static ChangePasswordResult ArgumentError(IEnumerable <User> Users, EventTracking_Id EventTrackingId, String Argument, String Description) => new ChangePasswordResult(Users, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static AddUserGroupResult ArgumentError(UserGroup UserGroup, EventTracking_Id EventTrackingId, String Argument, String Description) => new AddUserGroupResult(UserGroup, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public static AddOrganizationIfNotExistsResult ArgumentError(Organization Organization, EventTracking_Id EventTrackingId, String Argument, String Description) => new AddOrganizationIfNotExistsResult(Organization, EventTrackingId, false, Argument, I18NString.Create(Languages.en, Description));
public void SetupEachTest() { var folder = "UsersAPI_NotificationTests"; // C:\Users\...\AppData\Local\Temp\UsersAPI_NotificationTests try { Directory.Delete(folder, true); } catch { } usersAPI = new UsersAPI( ExternalDNSName: "example.cloud", HTTPServerPort: IPPort.Parse(81), APIRobotEMailAddress: new EMailAddress( "Users API Unit Tests", SimpleEMailAddress.Parse("*****@*****.**") ), AdminOrganizationId: Organization_Id.Parse("admins"), SMTPClient: new NullMailer(), SMSClient: new NullSMSAPI(), LoggingPath: folder, Autostart: true );; nullMailer = usersAPI.SMTPClient as NullMailer; nullSMSClient = usersAPI.SMSClient as NullSMSAPI; usersAPI.AddOrganization(new Organization( Organization_Id.Parse("admins"), I18NString.Create(Languages.en, "Admins") )).Wait(); #region / //_HTTPServer.AddMethodCallback(HTTPHostname.Any, // HTTPMethod.GET, // HTTPPath.Root, // HTTPDelegate: Request => Task.FromResult( // new HTTPResponse.Builder(Request) { // HTTPStatusCode = HTTPStatusCode.OK, // Server = "Test Server", // Date = DateTime.UtcNow, // AccessControlAllowOrigin = "*", // AccessControlAllowMethods = "GET", // AccessControlAllowHeaders = "Content-Type, Accept, Authorization", // ContentType = HTTPContentType.TEXT_UTF8, // Content = "Hello World!".ToUTF8Bytes(), // Connection = "close" // }.AsImmutable)); #endregion }
/// <summary> /// Try to parse the given XML representation of an OIOI Address. /// </summary> /// <param name="AddressXML">The XML to parse.</param> /// <param name="Address">The parsed address.</param> /// <param name="CustomAddressParser">A delegate to parse custom Address XML elements.</param> /// <param name="OnException">An optional delegate called whenever an exception occured.</param> public static Boolean TryParse(XElement AddressXML, out Address Address, CustomXMLParserDelegate <Address> CustomAddressParser = null, OnExceptionDelegate OnException = null) { try { var _CountryTXT = AddressXML.ElementValueOrFail(OICPNS.CommonTypes + "Country", "Missing 'Country'-XML tag!").Trim(); if (!Country.TryParse(_CountryTXT, out Country _Country)) { if (String.Equals(_CountryTXT, "UNKNOWN", StringComparison.CurrentCultureIgnoreCase)) { _Country = Country.unknown; } else { throw new Exception("'" + _CountryTXT + "' is an unknown country name!"); } } Address = new Address(_Country, I18NString.Create(Languages.unknown, AddressXML.ElementValueOrFail(OICPNS.CommonTypes + "City")?.Trim()), AddressXML.ElementValueOrFail(OICPNS.CommonTypes + "Street")?.Trim(), AddressXML.ElementValueOrDefault(OICPNS.CommonTypes + "PostalCode", "")?.Trim(), AddressXML.ElementValueOrDefault(OICPNS.CommonTypes + "HouseNum", "")?.Trim(), AddressXML.ElementValueOrDefault(OICPNS.CommonTypes + "Floor", "")?.Trim(), AddressXML.ElementValueOrDefault(OICPNS.CommonTypes + "Region", "")?.Trim(), AddressXML.ElementValueOrDefault(OICPNS.CommonTypes + "TimeZone", "")?.Trim()); if (CustomAddressParser != null) { Address = CustomAddressParser(AddressXML, Address); } return(true); } catch (Exception e) { OnException?.Invoke(DateTime.UtcNow, AddressXML, e); } Address = null; return(false); }
public static AddUserIfNotExistsResult Failed(User User, EventTracking_Id EventTrackingId, Exception Exception, Organization Organization = null) => new AddUserIfNotExistsResult(User, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message), Organization);
public static AddUserGroupResult Failed(UserGroup UserGroup, EventTracking_Id EventTrackingId, String Description, Organization Organization = null) => new AddUserGroupResult(UserGroup, EventTrackingId, false, null, I18NString.Create(Languages.en, Description), Organization);
public static AddOrUpdateOrganizationResult Failed(Organization Organization, EventTracking_Id EventTrackingId, Exception Exception, Organization ParentOrganization = null) => new AddOrUpdateOrganizationResult(Organization, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message), ParentOrganization);
public static AddOrUpdateUserGroupResult Failed(UserGroup UserGroup, EventTracking_Id EventTrackingId, Exception Exception, Organization Organization = null) => new AddOrUpdateUserGroupResult(UserGroup, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message), Organization);
public static AddChargeBoxIfNotExistsResult Failed(ChargeBox ChargeBox, EventTracking_Id EventTrackingId, Exception Exception, ChargeBox ParentChargeBox = null) => new AddChargeBoxIfNotExistsResult(ChargeBox, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message), ParentChargeBox);
public static AddAPIKeyResult Failed(APIKey APIKey, EventTracking_Id EventTrackingId, Exception Exception, Organization Organization = null) => new AddAPIKeyResult(APIKey, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message), Organization);
public static AddOrUpdateAPIKeyResult Failed(APIKey APIKey, EventTracking_Id EventTrackingId, String Description, Organization Organization = null) => new AddOrUpdateAPIKeyResult(APIKey, EventTrackingId, false, null, I18NString.Create(Languages.en, Description), Organization);
public static AddOrUpdateChargeBoxResult Failed(ChargeBox ChargeBox, EventTracking_Id EventTrackingId, String Description, ChargeBox ParentChargeBox = null) => new AddOrUpdateChargeBoxResult(ChargeBox, EventTrackingId, false, null, I18NString.Create(Languages.en, Description), ParentChargeBox);
public static AddOrganizationIfNotExistsResult Failed(Organization Organization, EventTracking_Id EventTrackingId, String Description, Organization ParentOrganization = null) => new AddOrganizationIfNotExistsResult(Organization, EventTrackingId, false, null, I18NString.Create(Languages.en, Description), ParentOrganization);
public static ResetPasswordResult Failed(IEnumerable <User> Users, EventTracking_Id EventTrackingId, Exception Exception, PasswordReset PasswordReset = null) => new ResetPasswordResult(Users, EventTrackingId, false, null, I18NString.Create(Languages.en, Exception.Message), PasswordReset);