ExceptionLibrary.cs 5.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. AddCode(ExceptionsCodes.CustomerMissingContactCode, ExceptionsCodes.CustomerMissingContactMsg);
  23. AddCode(ExceptionsCodes.CustomerMissingAddressCode, ExceptionsCodes.CustomerMissingAddressMsg);
  24. AddCode(ExceptionsCodes.CustomerMissingEmailCode, ExceptionsCodes.CustomerMissingEmailMsg);
  25. AddCode(ExceptionsCodes.CustomerMissingPhoneCode, ExceptionsCodes.CustomerMissingPhoneMsg);
  26. AddCode(ExceptionsCodes.ContactNotFoundCode, ExceptionsCodes.ContactNotFoundMsg);
  27. }
  28. public static class ExceptionsCodes
  29. {
  30. public const string ValidationErrorsMsg = "Validation errors follows:";
  31. public const int ValidationErrorsCode = 1000;
  32. public const string SettingsNotFoundMsg = "Setting '{0}' not found fo module '{1}'";
  33. public const int SettingsNotFoundCode = 10000;
  34. public const string SettingsNotFoundForModuleMsg = "Any setting not found for module '{0}'";
  35. public const int SettingsNotFoundForModuleCode = 10001;
  36. public const string SettingsHasNoPropertyMsg = "Setting '{0}' has no defined property in class '{1}'";
  37. public const int SettingsHasNoPropertyCode = 10002;
  38. public const string SettingsAlreadyExistsMsg = "Setting '{0}' for module '{1}' already exists.";
  39. public const int SettingsAlreadyExistsCode = 10003;
  40. public const string TenantNotFoundMsg = "Tenant with identifier {0}='{1}' not found";
  41. public const int TenantNotFoundCode = 10010;
  42. public const string TenantAlreadyExistsMsg = "Tenant with code '{0}' already exists";
  43. public const int TenantAlreadyExistsCode = 10011;
  44. public const string TenantLockedMsg = "Tenant with code '{0}' is LOCKED! Cannot access.";
  45. public const int TenantLockedCode = 10012;
  46. public const string TenantDifferentContextMsg = "Cannot update different Tenant with code '{0}' in tenant context '{1}'";
  47. public const int TenantDifferentContextCode = 10013;
  48. public const string UserNotFoundMsg = "User with identifier {0}='{1}' not found";
  49. public const int UserNotFoundCode = 10020;
  50. public const string UserAlreadyExistsMsg = "User with login name '{0}' already exists";
  51. public const int UserAlreadyExistsCode = 10021;
  52. public const string CustomerNotFoundMsg = "Customer with identifier {0}='{1}' not found";
  53. public const int CustomerNotFoundCode = 10030;
  54. public const string CustomerUserAlreadyAssignedMsg = "Customer with identifier {0}='{1}' has already user '{2}' assigned.";
  55. public const int CustomerUserAlreadyAssignedCode = 10031;
  56. public const string CustomerUserNotFoundAssignedMsg = "Customer with identifier {0}='{1}' has no user '{2}' assigned.";
  57. public const int CustomerUserNotFoundAssignedCode = 10032;
  58. public const string CustomerMissingContactMsg = "Customer with identifier {0}='{1}' has no any contact.";
  59. public const int CustomerMissingContactCode = 10033;
  60. public const string CustomerMissingAddressMsg = "Customer with identifier {0}='{1}' has no one preffered Address.";
  61. public const int CustomerMissingAddressCode = 10034;
  62. public const string CustomerMissingPhoneMsg = "Customer with identifier {0}='{1}' has no one preffered Phone.";
  63. public const int CustomerMissingPhoneCode = 10035;
  64. public const string CustomerMissingEmailMsg = "Customer with identifier {0}='{1}' has no one preffered Email.";
  65. public const int CustomerMissingEmailCode = 10036;
  66. public const string ContactNotFoundMsg = "Contact with identifier {0}='{1}' not found";
  67. public const int ContactNotFoundCode = 10040;
  68. }
  69. }
  70. }