/// <summary> /// validation method /// RULE: BirthDate should not be later than the HireDate /// </summary> void ValidateBirthDateAndHireDate() { if ((BirthDate != null) && (!HireDate.IsEmpty()) && (DateTime.Compare((DateTime)BirthDate, HireDate) >= 0)) { throw new BusinessRuleViolationOnInMemoryException("Exception!!! BirthDate should be earlier than HireDate!"); } }
public override int GetHashCode() { unchecked { var hashCode = Id; hashCode = (hashCode * 397) ^ (LastName != null ? LastName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FirstName != null ? FirstName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (TitleOfCourtesy != null ? TitleOfCourtesy.GetHashCode() : 0); hashCode = (hashCode * 397) ^ BirthDate.GetHashCode(); hashCode = (hashCode * 397) ^ HireDate.GetHashCode(); hashCode = (hashCode * 397) ^ (Address != null ? Address.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Region != null ? Region.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (PostalCode != null ? PostalCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (HomePhone != null ? HomePhone.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Extension != null ? Extension.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Photo != null ? Photo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Notes != null ? Notes.GetHashCode() : 0); hashCode = (hashCode * 397) ^ ReportsTo.GetHashCode(); hashCode = (hashCode * 397) ^ (PhotoPath != null ? PhotoPath.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { int code = 27; code = unchecked ( code ^ EmployeeID.GetHashCode() ^ FirstName.GetHashCode() ^ Title.GetHashCode() ^ TitleOfCourtesy.GetHashCode() ^ BirthDate.GetHashCode() ^ HireDate.GetHashCode() ^ Address.GetHashCode() ^ City.GetHashCode() ^ Region.GetHashCode() ^ PostalCode.GetHashCode() ^ Country.GetHashCode() ^ HomePhone.GetHashCode() ^ Extension.GetHashCode() ^ Photo.GetHashCode() ^ Notes.GetHashCode() ^ ReportsTo.GetHashCode() ^ PhotoPath.GetHashCode() ); return(code); }
public virtual void Validate(ValidationResult result) { Bonus.ValidateRequired(result, nameof(Bonus)); HireDate.ValidateRequired(result, nameof(HireDate)); Name.ValidateRequired(result, nameof(Name)); Name.ValidateMaxLength(result, nameof(Name), 50); }
public override int GetHashCode() { unchecked { int hashCode = (FullName != null ? FullName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Department != null ? Department.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Position != null ? Position.GetHashCode() : 0); hashCode = (hashCode * 397) ^ HireDate.GetHashCode(); hashCode = (hashCode * 397) ^ (EmployeeNumber != null ? EmployeeNumber.GetHashCode() : 0); return(hashCode); } }
public virtual void Validate(ValidationResult result) { HireDate.ValidateRequired(result, nameof(HireDate)); Name.ValidateRequired(result, nameof(Name)); Name.ValidateMaxLength(result, nameof(Name), 50); CellPhone?.Validate(result); Spouse?.Validate(result); }
public override void Validate(ValidationResult result) { base.Validate(result); HireDate.ValidateRequired(result, nameof(HireDate)); CellPhone.Validate(result); foreach (var person in Dependants) { person.Validate(result); } }
/// <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()); }
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); }
public override int GetHashCode() { unchecked { int hash = 17; hash = hash * 23 + (BirthDate == default(DateTime) ? 0 : BirthDate.GetHashCode()); hash = hash * 23 + (BusinessEntityId == default(int) ? 0 : BusinessEntityId.GetHashCode()); hash = hash * 23 + (CurrentFlag == default(bool) ? 0 : CurrentFlag.GetHashCode()); hash = hash * 23 + (Gender == null ? 0 : Gender.GetHashCode()); hash = hash * 23 + (HireDate == default(DateTime) ? 0 : HireDate.GetHashCode()); hash = hash * 23 + (JobTitle == null ? 0 : JobTitle.GetHashCode()); hash = hash * 23 + (LoginId == null ? 0 : LoginId.GetHashCode()); hash = hash * 23 + (MaritalStatus == null ? 0 : MaritalStatus.GetHashCode()); hash = hash * 23 + (ModifiedDate == default(DateTime) ? 0 : ModifiedDate.GetHashCode()); hash = hash * 23 + (NationalIdNumber == null ? 0 : NationalIdNumber.GetHashCode()); hash = hash * 23 + (OrganizationLevel == null ? 0 : OrganizationLevel.GetHashCode()); hash = hash * 23 + (Rowguid == default(Guid) ? 0 : Rowguid.GetHashCode()); hash = hash * 23 + (SalariedFlag == default(bool) ? 0 : SalariedFlag.GetHashCode()); hash = hash * 23 + (SickLeaveHours == default(short) ? 0 : SickLeaveHours.GetHashCode()); hash = hash * 23 + (VacationHours == default(short) ? 0 : VacationHours.GetHashCode()); return(hash); } }
private void myradwizard_Next(object sender, NavigationButtonsEventArgs e) { if (this.myradwizard.SelectedPage == Page0) // Check if this is the desired page { if (LastName.Text == "") { errormessage.Text = "Last Name cannot be empty"; LastName.Focus(); myradwizard.SelectedPage = Page1; } else if (FirstName.Text == "") { errormessage.Text = "First Name cannot be empty"; FirstName.Focus(); myradwizard.SelectedPage = Page1; } else if (CityName.SelectedValue == null || PermanentCityName.SelectedValue == null) { errormessage.Text = "Please complete address"; myradwizard.SelectedPage = Page1; } else if (ContactPerson.Text == "") { errormessage.Text = "Contact Person cannot be empty"; ContactPerson.Focus(); myradwizard.SelectedPage = Page1; } else if (ContactPhone.Text == "") { errormessage.Text = "Contact Phone cannot be empty"; ContactPhone.Focus(); myradwizard.SelectedPage = Page1; } else if (ContactAddress.Text == "") { errormessage.Text = "Contact Address cannot be empty"; ContactAddress.Focus(); myradwizard.SelectedPage = Page1; } else if (BirthDate.DateTimeText == "") { errormessage.Text = "BirthDay cannot be empty"; BirthDate.Focus(); myradwizard.SelectedPage = Page1; } else if (CivilStatus.SelectedValue == null) { errormessage.Text = "Please select Civil Status"; CivilStatus.Focus(); myradwizard.SelectedPage = Page1; } else if (Nationality.SelectedValue == null) { errormessage.Text = "Please select Nationality"; Nationality.Focus(); myradwizard.SelectedPage = Page1; } else if (Religion.SelectedValue == null) { errormessage.Text = "Please select Religion"; Religion.Focus(); myradwizard.SelectedPage = Page1; } else if (Sex.SelectedValue == null) { errormessage.Text = "Please select Gender"; Sex.Focus(); myradwizard.SelectedPage = Page1; } else if (HireDate.DateTimeText == "") { errormessage.Text = "Please select Hire Date"; HireDate.Focus(); myradwizard.SelectedPage = Page1; } else if (Department.SelectedValue == null) { errormessage.Text = "Please select Department"; Department.Focus(); myradwizard.SelectedPage = Page1; } else if (Section.SelectedValue == null) { errormessage.Text = "Please select Section"; Section.Focus(); myradwizard.SelectedPage = Page1; } else if (Position.SelectedValue == null) { errormessage.Text = "Please select Position"; Position.Focus(); myradwizard.SelectedPage = Page1; } else if (EmploymentStatus.SelectedValue == null) { errormessage.Text = "Please select Employee Status"; EmploymentStatus.Focus(); myradwizard.SelectedPage = Page1; } if (EmailAddress.Text.Length == 0) { } else { if (!Regex.IsMatch(EmailAddress.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$")) { errormessage.Text = "Please enter a valid email."; EmailAddress.Select(0, EmailAddress.Text.Length); EmailAddress.Focus(); myradwizard.SelectedPage = Page1; } else { } } } }
public override string?ToString() { return($"{BusinessEntityID.ToString()}, {LoginID}, {HireDate.ToString()}, {JobTitle}"); }
public bool Equals(EmployeeDto other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Id == other.Id && string.Equals(LastName, other.LastName) && string.Equals(FirstName, other.FirstName) && string.Equals(Title, other.Title) && string.Equals(TitleOfCourtesy, other.TitleOfCourtesy) && BirthDate.Equals(other.BirthDate) && HireDate.Equals(other.HireDate) && string.Equals(Address, other.Address) && string.Equals(City, other.City) && string.Equals(Region, other.Region) && string.Equals(PostalCode, other.PostalCode) && string.Equals(Country, other.Country) && string.Equals(HomePhone, other.HomePhone) && string.Equals(Extension, other.Extension) && Equals(Photo, other.Photo) && string.Equals(Notes, other.Notes) && ReportsTo == other.ReportsTo && string.Equals(PhotoPath, other.PhotoPath)); }
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); }
public override string ToString() { return("Name: " + Name + "| HireDate: " + HireDate.ToShortDateString() + " | Role: " + Role.ToString()); }
protected bool Equals(Employee other) { return(string.Equals(FullName, other.FullName) && string.Equals(Department, other.Department) && string.Equals(Position, other.Position) && HireDate.Equals(other.HireDate) && string.Equals(EmployeeNumber, other.EmployeeNumber)); }
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); }