Ejemplo n.º 1
0
 public Employee(int id, string name, string contractTypeName, decimal hourlySalary, decimal monthlySalary, Role role, IEmployeeRepository employeeRepository)
 {
     Id                      = id;
     Name                    = name;
     ContractType            = (ContractType)Enum.Parse(typeof(ContractType), contractTypeName);
     Salary                  = ContractType.Equals(ContractType.HourlySalaryEmployee) ? hourlySalary : monthlySalary;
     RoleId                  = role.Id;
     Role                    = role;
     this.employeeRepository = employeeRepository;
     salaryContract          = SalaryContractFactory.Build(ContractType, Salary);
 }
Ejemplo n.º 2
0
 public override bool Equals(object obj)
 {
     return(obj == null || !(obj is Contract) ? false : ContractType.Equals(((Contract)obj).ContractType));
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Returns true if Contract instances are equal
        /// </summary>
        /// <param name="other">Instance of Contract to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Contract other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     StaffGroup == other.StaffGroup ||
                     StaffGroup != null &&
                     StaffGroup.Equals(other.StaffGroup)
                     ) &&
                 (
                     Grade == other.Grade ||
                     Grade != null &&
                     Grade.Equals(other.Grade)
                 ) &&
                 (
                     _Contract == other._Contract ||
                     _Contract != null &&
                     _Contract.Equals(other._Contract)
                 ) &&
                 (
                     Payscale == other.Payscale ||
                     Payscale != null &&
                     Payscale.Equals(other.Payscale)
                 ) &&
                 (
                     ContractType == other.ContractType ||
                     ContractType != null &&
                     ContractType.Equals(other.ContractType)
                 ) &&
                 (
                     ContractedTime == other.ContractedTime ||
                     ContractedTime != null &&
                     ContractedTime.Equals(other.ContractedTime)
                 ) &&
                 (
                     DefaultUnavailabilityHours == other.DefaultUnavailabilityHours ||
                     DefaultUnavailabilityHours != null &&
                     DefaultUnavailabilityHours.Equals(other.DefaultUnavailabilityHours)
                 ) &&
                 (
                     WtdOptOut == other.WtdOptOut ||

                     WtdOptOut.Equals(other.WtdOptOut)
                 ) &&
                 (
                     SalaryFrequency == other.SalaryFrequency ||
                     SalaryFrequency != null &&
                     SalaryFrequency.Equals(other.SalaryFrequency)
                 ) &&
                 (
                     SalaryAmount == other.SalaryAmount ||

                     SalaryAmount.Equals(other.SalaryAmount)
                 ));
        }