ExceptionLibrary.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. using Quadarax.Foundation.Core.Exceptions;
  2. namespace Quadarax.Application.QLiberace.Common
  3. {
  4. public class ExceptionLibrary : ExceptionCodes
  5. {
  6. protected override void OnSetupCodes()
  7. {
  8. AddCode(ExceptionsCodes.ValidationErrorsCode, ExceptionsCodes.ValidationErrorsMsg);
  9. AddCode(ExceptionsCodes.SettingsNotFoundCode, ExceptionsCodes.SettingsNotFoundMsg);
  10. AddCode(ExceptionsCodes.SettingsNotFoundForModuleCode, ExceptionsCodes.SettingsNotFoundForModuleMsg);
  11. AddCode(ExceptionsCodes.SettingsHasNoPropertyCode, ExceptionsCodes.SettingsHasNoPropertyMsg);
  12. AddCode(ExceptionsCodes.SettingsAlreadyExistsCode, ExceptionsCodes.SettingsAlreadyExistsMsg);
  13. AddCode(ExceptionsCodes.TenantNotFoundCode, ExceptionsCodes.TenantNotFoundMsg);
  14. AddCode(ExceptionsCodes.TenantAlreadyExistsCode, ExceptionsCodes.TenantAlreadyExistsMsg);
  15. AddCode(ExceptionsCodes.TenantLockedCode, ExceptionsCodes.TenantLockedMsg);
  16. AddCode(ExceptionsCodes.TenantDifferentContextCode, ExceptionsCodes.TenantDifferentContextMsg);
  17. AddCode(ExceptionsCodes.UserNotFoundCode, ExceptionsCodes.UserNotFoundMsg);
  18. AddCode(ExceptionsCodes.UserAlreadyExistsCode, ExceptionsCodes.UserAlreadyExistsMsg);
  19. AddCode(ExceptionsCodes.CustomerNotFoundCode, ExceptionsCodes.CustomerNotFoundMsg);
  20. AddCode(ExceptionsCodes.CustomerUserAlreadyAssignedCode, ExceptionsCodes.CustomerUserAlreadyAssignedMsg);
  21. AddCode(ExceptionsCodes.CustomerUserNotFoundAssignedCode, ExceptionsCodes.CustomerUserNotFoundAssignedMsg);
  22. }
  23. public static class ExceptionsCodes
  24. {
  25. public const string ValidationErrorsMsg = "Validation errors follows:";
  26. public const int ValidationErrorsCode = 1000;
  27. public const string SettingsNotFoundMsg = "Setting '{0}' not found fo module '{1}'";
  28. public const int SettingsNotFoundCode = 10000;
  29. public const string SettingsNotFoundForModuleMsg = "Any setting not found for module '{0}'";
  30. public const int SettingsNotFoundForModuleCode = 10001;
  31. public const string SettingsHasNoPropertyMsg = "Setting '{0}' has no defined property in class '{1}'";
  32. public const int SettingsHasNoPropertyCode = 10002;
  33. public const string SettingsAlreadyExistsMsg = "Setting '{0}' for module '{1}' already exists.";
  34. public const int SettingsAlreadyExistsCode = 10003;
  35. public const string TenantNotFoundMsg = "Tenant with identifier {0}='{1}' not found";
  36. public const int TenantNotFoundCode = 10010;
  37. public const string TenantAlreadyExistsMsg = "Tenant with code '{0}' already exists";
  38. public const int TenantAlreadyExistsCode = 10011;
  39. public const string TenantLockedMsg = "Tenant with code '{0}' is LOCKED! Cannot access.";
  40. public const int TenantLockedCode = 10012;
  41. public const string TenantDifferentContextMsg = "Cannot update different Tenant with code '{0}' in tenant context '{1}'";
  42. public const int TenantDifferentContextCode = 10013;
  43. public const string UserNotFoundMsg = "User with identifier {0}='{1}' not found";
  44. public const int UserNotFoundCode = 10020;
  45. public const string UserAlreadyExistsMsg = "User with login name '{0}' already exists";
  46. public const int UserAlreadyExistsCode = 10021;
  47. public const string CustomerNotFoundMsg = "Customer with identifier {0}='{1}' not found";
  48. public const int CustomerNotFoundCode = 10030;
  49. public const string CustomerUserAlreadyAssignedMsg = "Customer with identifier {0}='{1}' has already user '{2}' assigned.";
  50. public const int CustomerUserAlreadyAssignedCode = 10031;
  51. public const string CustomerUserNotFoundAssignedMsg = "Customer with identifier {0}='{1}' has no user '{2}' assigned.";
  52. public const int CustomerUserNotFoundAssignedCode = 10032;
  53. }
  54. }
  55. }