Exemplo n.º 1
0
        /// <summary>
        /// validation method
        /// RULE: BirthDate should not be later than the HireDate
        /// </summary>
        void ValidateBirthDateAndHireDate()
        {
            //if BirthDate or HireDate is assigned and BirthDate is greater than HireDate, throw exception
            if ((BirthDate != null) && (!HireDate.IsEmpty()) && (DateTime.Compare((DateTime)BirthDate, HireDate) >= 0))
            {
                throw new BusinessRuleViolationOnInMemoryException("Exception!!! BirthDate should be earlier than HireDate!");
            }

            Console.WriteLine("CONSOLE: HireDate Value " + HireDate.ToString());

            Debug.WriteLine("DEBUG: HireDate Value " + HireDate.ToString());
            //Debug.Assert(BirthDate == null, "DEBUG: BirthDate is null");

            Trace.WriteLine("TRACE: HireDate Value " + HireDate.ToString());
            //Trace.Assert(BirthDate == null, "TRACE: BirthDate is null");
            Trace.TraceWarning("TRACE WARNING: HireDate Value " + HireDate.ToString());
        }
Exemplo n.º 2
0
        public async Task <ClaimsIdentity> GenerateUserIdentityAsync(UserManager <ApplicationUser> manager)
        {
            // Note the authenticationType must match the one defined in CookieAuthenticationOptions.AuthenticationType
            var userIdentity = await manager.CreateIdentityAsync(this, DefaultAuthenticationTypes.ApplicationCookie);

            // Add custom user claims here
            userIdentity.AddClaim(new Claim("UserType", this.UserType));
            userIdentity.AddClaim(new Claim("MobileNo", this.MobileNo));
            userIdentity.AddClaim(new Claim("Landline", this.Landline));
            userIdentity.AddClaim(new Claim("CompanyName", this.CompanyName));
            userIdentity.AddClaim(new Claim("SalesTaxNo", this.SalesTaxNo));
            userIdentity.AddClaim(new Claim("NTNNo", this.NTNNo));
            userIdentity.AddClaim(new Claim("Designation", this.Designation));
            userIdentity.AddClaim(new Claim("BasicSalary", this.BasicSalary.ToString()));
            userIdentity.AddClaim(new Claim("HireDate", HireDate.ToString()));
            userIdentity.AddClaim(new Claim("CurrentEmployee", this.CurrentEmployee.ToString()));

            return(userIdentity);
        }
Exemplo n.º 3
0
 public override string?ToString()
 {
     return($"{BusinessEntityID.ToString()}, {LoginID}, {HireDate.ToString()}, {JobTitle}");
 }
Exemplo n.º 4
0
        public List <Claim> GetClaims(ClaimsPrincipal principal)
        {
            //getting the claims for the token created by the sts
            List <Claim> claims = new List <Claim>()
            {
                new Claim("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", Email),
                new Claim("http://schemas.microsoft.com/accesscontrolservice/2010/07/claims/identityprovider", Email),
                new Claim("'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress", Email),
                new Claim(System.IdentityModel.Claims.ClaimTypes.Name, Email),
                //new Claim(System.IdentityModel.Claims.ClaimTypes.NameIdentifier, Email),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + "Email", Email),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + "PhoneNumber", PhoneNumber),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_ROLE_ID, ManagerID.ToString()),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_FIRST_NAME, FirstName),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_LAST_NAME, LastName),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_ACCESS, Administrator),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_FIRST_NAME, FirstName),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_LAST_NAME, LastName),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_ACCOUNT, Account),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_DEPARTMENT_ID, DepartmentID.ToString()),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_ROLE_ID, RoleID.ToString()),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_ID, EmployeeID.ToString()),
                new Claim(Const.CLAIM.CLAIM_NAMESPACE + "/" + Const.Fields.EMPLOYEE_HIRE_DATE, HireDate.ToString())
            };

            return(claims);
        }
Exemplo n.º 5
0
        public Boolean CheckForCompletion()
        {
            string[] requiredFields = null;
            AppComplete = true;

            if (CurrentPage == 1)
            {
                requiredFields = new string[] { FirstName, LastName, SocSecNo, DriverLicenseNo, PhoneNo, Email };
            }
            else if (CurrentPage == 2)
            {
                requiredFields = new string[] { DesiredAddress, CurrentAddress, CurrentCSZ, CurrMoveReason };
            }
            else if (CurrentPage == 3)
            {
                requiredFields = new string[] { CurrentEmployer, EmpPhoneNo, GrossWages.ToString(), ManagerName, HireDate.ToString() };
            }
            else if (CurrentPage == 4)
            {
                requiredFields = new string[] { StayDuration, Pets, EmergencyName, EmergencyPhone, LimitRent, MoneyValue, HearSource, WhyRent };
            }
            else if (CurrentPage == 5)
            {
                return(true);
            }

            foreach (string item in requiredFields)
            {
                if (string.IsNullOrWhiteSpace(item))
                {
                    AppComplete = false;
                    return(false);
                }
            }

            return(AppComplete);
        }