/// <summary>
        /// Initializes a new instance of the <see cref="ReferralRejectionReason" /> class.
        /// </summary>
        /// <param name="campaignId">campaignId (required).</param>
        /// <param name="referralId">referralId (required).</param>
        /// <param name="reason">reason (required).</param>
        public ReferralRejectionReason(int campaignId = default(int), int referralId = default(int), ReasonEnum reason = default(ReasonEnum))
        {
            // to ensure "campaignId" is required (not null)
            if (campaignId == null)
            {
                throw new InvalidDataException("campaignId is a required property for ReferralRejectionReason and cannot be null");
            }
            else
            {
                this.CampaignId = campaignId;
            }

            // to ensure "referralId" is required (not null)
            if (referralId == null)
            {
                throw new InvalidDataException("referralId is a required property for ReferralRejectionReason and cannot be null");
            }
            else
            {
                this.ReferralId = referralId;
            }

            // to ensure "reason" is required (not null)
            if (reason == null)
            {
                throw new InvalidDataException("reason is a required property for ReferralRejectionReason and cannot be null");
            }
            else
            {
                this.Reason = reason;
            }
        }
Esempio n. 2
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            // Check if LoggedUserExists
            if (AuthenticationManager.LoggedUser == null)
            {
                Reason = ReasonEnum.Login;
                return false;
            }

            if (CheckType && AuthenticationManager.UserType.Value != UserType)
            {
                Reason = ReasonEnum.Role;
                return false;
            }

            // Users authorization
            if (!string.IsNullOrEmpty(Users))
            {
                if (Users.Split(',').Any(u => string.Compare(u, AuthenticationManager.LoggedUser.Username, StringComparison.OrdinalIgnoreCase) == 0))
                {
                    return true;
                }
            }

            // If authorization is ok, return true
            return true;
        }
Esempio n. 3
0
 public IsLegalResponse(ReasonEnum reason = ReasonEnum.Fine)
 {
     this.Reason = reason;
     this.Killed = new List<Chain>();
     this.MergeResultant = new Chain();
     this.AbsorbedInMerge = new List<Chain>();
 }
 public MyEventSectorOwnerChanged(MyFaction oldOwner, MyFaction newOwner, MySector sector, ReasonEnum reason) : base(false)
 {
     OldOwner = oldOwner;
     NewOwner = newOwner ?? throw new ArgumentNullException(nameof(newOwner));
     Sector   = sector ?? throw new ArgumentNullException(nameof(sector));
     _reason  = reason;
 }
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            // Check if LoggedUserExists
            if (AuthenticationManager.LoggedUser == null)
            {
                Reason = ReasonEnum.Login;
                return(false);
            }

            // Roles authorization
            if (!string.IsNullOrEmpty(Roles))
            {
                if (!(Roles.Split(',').Any(role => string.Compare(role.Trim(), AuthenticationManager.LoggedUser.Role.ToString(), StringComparison.OrdinalIgnoreCase) == 0)))
                {
                    Reason = ReasonEnum.Role;
                    return(false);
                }
            }

            // Users authorization
            if (!string.IsNullOrEmpty(Users))
            {
                if (Users.Split(',').Any(u => string.Compare(u, AuthenticationManager.LoggedUser.Username, StringComparison.OrdinalIgnoreCase) == 0))
                {
                    return(true);
                }
            }

            // If authorization is ok, return true
            return(true);
        }
Esempio n. 6
0
        public SessionEndedRequest(JObject json) : base(json)
        {
            ReasonEnum reason = ReasonEnum.UNKNOWN;

            Enum.TryParse(json.Value <string>("reason"), out reason);
            Reason = reason;
            Error  = Error.FromJson(json.Value <JObject>("error"));
        }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InvalidToShareUserDisplayDetails" /> class.
 /// </summary>
 /// <param name="Reason">The reason why the user was not valid for updating the share (required).</param>
 /// <param name="Username">The user&#39;s username (required).</param>
 /// <param name="Firstname">The user&#39;s first name (required).</param>
 /// <param name="Surname">The user&#39;s surname (required).</param>
 /// <param name="EmailAddress">The user&#39;s email address (required).</param>
 public InvalidToShareUserDisplayDetails(ReasonEnum Reason = default(ReasonEnum), string Username = default(string), string Firstname = default(string), string Surname = default(string), string EmailAddress = default(string))
 {
     // to ensure "Reason" is required (not null)
     if (Reason == null)
     {
         throw new InvalidDataException("Reason is a required property for InvalidToShareUserDisplayDetails and cannot be null");
     }
     else
     {
         this.Reason = Reason;
     }
     // to ensure "Username" is required (not null)
     if (Username == null)
     {
         throw new InvalidDataException("Username is a required property for InvalidToShareUserDisplayDetails and cannot be null");
     }
     else
     {
         this.Username = Username;
     }
     // to ensure "Firstname" is required (not null)
     if (Firstname == null)
     {
         throw new InvalidDataException("Firstname is a required property for InvalidToShareUserDisplayDetails and cannot be null");
     }
     else
     {
         this.Firstname = Firstname;
     }
     // to ensure "Surname" is required (not null)
     if (Surname == null)
     {
         throw new InvalidDataException("Surname is a required property for InvalidToShareUserDisplayDetails and cannot be null");
     }
     else
     {
         this.Surname = Surname;
     }
     // to ensure "EmailAddress" is required (not null)
     if (EmailAddress == null)
     {
         throw new InvalidDataException("EmailAddress is a required property for InvalidToShareUserDisplayDetails and cannot be null");
     }
     else
     {
         this.EmailAddress = EmailAddress;
     }
 }
Esempio n. 8
0
        private string GetStatusTranscription(ReasonEnum status)
        {
            string statusString;

            switch (status)
            {
            case ReasonEnum.None:
                statusString = "Aucun";
                break;

            case ReasonEnum.Absent:
                statusString = "Autre";
                break;

            case ReasonEnum.Formation:
                statusString = "Formation";
                break;

            case ReasonEnum.Holiday:
                statusString = "Congé";
                break;

            case ReasonEnum.Recover:
                statusString = "Récupération";
                break;

            case ReasonEnum.Sickness:
                statusString = "Maladie";
                break;

            default:
                statusString = "Aucun";
                break;
            }

            return(statusString);
        }
Esempio n. 9
0
 public SessionEndedRequest(string requestId, string timestamp, string locale, ReasonEnum reason, Error error)
 {
     this.requestId = requestId;
     this.timestamp = timestamp;
     this.locale    = locale;
     this.error     = error;
     this.reason    = reason;
 }
Esempio n. 10
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="service">A Service to which the rule is added when created</param>
 /// <param name="result">Result of the rule</param>
 /// <param name="reason">Description of eventual failure reason</param>
 public ApplicationRule(IApplicationServiceWithRules <ApplicationRule> service, bool result, ReasonEnum reason)
 {
     Result = result;
     Reason = reason;
     service.AddRule(this);
 }
 public SessionEndedRequest(string requestId, DateTime timestamp, string locale, ReasonEnum reason, Error error)
     : base(requestId, timestamp, locale)
 {
     Reason = reason;
     Error  = error;
 }
Esempio n. 12
0
 public void ApplyLeave(string userName, DateTime startDate, DateTime endDate, int workingDays, ReasonEnum reason, string comment, DateTime? asAt = null)
 {
     asAt = asAt ?? DateTime.Now;
     Update(new LeaveApplied
     {
         WorkingDays = workingDays,
         UserName = userName,
         Comment = comment,
         StartDate = startDate,
         EndDate = endDate,
         Reason = reason,
         SourceId = Id,
         HappenedOn = asAt.Value,
     });
 }
Esempio n. 13
0
 public void Set(ReasonEnum value)
 {
     Set(value.ToString());
 }
Esempio n. 14
0
 public RequestResponse(ReasonEnum reason)
 {
     this.Reason = reason;
 }
Esempio n. 15
0
 public void ApplyLeave(string userName, DateTime startDate, DateTime endDate, int workingDays, ReasonEnum reason, string comment, DateTime?asAt = null)
 {
     asAt = asAt ?? DateTime.Now;
     Update(new LeaveApplied
     {
         WorkingDays = workingDays,
         UserName    = userName,
         Comment     = comment,
         StartDate   = startDate,
         EndDate     = endDate,
         Reason      = reason,
         SourceId    = Id,
         HappenedOn  = asAt.Value,
     });
 }