Esempio n. 1
0
 public static void FindEmployeeByDepartmentId(DepartmentCode code)
 {
     using (var session = NHibernateHelper.OpenSession())
     {
         using (var transaction = session.BeginTransaction())
         {
             var departmentEmployees = session.Query <Department>().Join(session.Query <Employee>(),
                                                                         department => department.Id,
                                                                         employee => employee.Department.Id,
                                                                         (department, employee) => new
             {
                 departmentId        = department.Id,
                 employeeName        = employee.Name,
                 employeeDesignation = employee.Designation,
                 employeeDepartment  = department.DeptName,
                 employeeSalary      = employee.Salary
             }).Where(x => x.departmentId == (int)code);
             Console.WriteLine($"Displaying Employee from {code.ToString()}");
             foreach (var employeeData in departmentEmployees)
             {
                 Console.WriteLine($"\nEmployee Name : {employeeData.employeeName} | Employee Designation : {employeeData.employeeDesignation}" +
                                   $" | Employee Department : {employeeData.employeeDepartment}" +
                                   $" | Employee Salary : {employeeData.employeeSalary}");
             }
         }
     }
 }
        public static string GetStringValue(this DepartmentCode dep)
		{
			switch (dep)
			{
                case DepartmentCode.D_21510:
                    return S_21510;

				case DepartmentCode.D_21520:
					return S_21520;

				case DepartmentCode.D_21540:
                    return S_21540;

                case DepartmentCode.D_21570:
                    return S_21570;

                case DepartmentCode.D_SLFIN:
                    return S_SLFIN;

                case DepartmentCode.D_SLKPO:
                    return S_SLKPO;

				default:
                    return S_UNKNOWN;
			}
		}
Esempio n. 3
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 26, Configuration.FieldSeparator),
                       Id,
                       SetIdFt1.HasValue ? SetIdFt1.Value.ToString(culture) : null,
                       TransactionId,
                       TransactionBatchId,
                       TransactionDate.HasValue ? TransactionDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       TransactionPostingDate.HasValue ? TransactionPostingDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       TransactionType,
                       TransactionCode?.ToDelimitedString(),
                       TransactionDescription,
                       TransactionDescriptionAlt,
                       TransactionQuantity.HasValue ? TransactionQuantity.Value.ToString(Consts.NumericFormat, culture) : null,
                       TransactionAmountExtended?.ToDelimitedString(),
                       TransactionAmountUnit?.ToDelimitedString(),
                       DepartmentCode?.ToDelimitedString(),
                       HealthPlanId?.ToDelimitedString(),
                       InsuranceAmount?.ToDelimitedString(),
                       AssignedPatientLocation?.ToDelimitedString(),
                       FeeSchedule,
                       PatientType,
                       DiagnosisCodeFt1 != null ? string.Join(Configuration.FieldRepeatSeparator, DiagnosisCodeFt1.Select(x => x.ToDelimitedString())) : null,
                       PerformedByCode?.ToDelimitedString(),
                       OrderedByCode?.ToDelimitedString(),
                       UnitCost?.ToDelimitedString(),
                       FillerOrderNumber?.ToDelimitedString(),
                       EnteredByCode?.ToDelimitedString(),
                       ProcedureCode?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
Esempio n. 4
0
 // オブジェクトに重複しないハッシュコードを振り分ける
 public override int GetHashCode()
 {
     return
         (Code.GetHashCode() ^
          Name.GetHashCode() ^
          DepartmentCode.GetHashCode() ^
          Password.GetHashCode() ^
          AdminFlug.GetHashCode());
 }
Esempio n. 5
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 44, Configuration.FieldSeparator),
                       Id,
                       SetIdFt1.HasValue ? SetIdFt1.Value.ToString(culture) : null,
                       TransactionId,
                       TransactionBatchId,
                       TransactionDate?.ToDelimitedString(),
                       TransactionPostingDate.HasValue ? TransactionPostingDate.Value.ToString(Consts.DateTimeFormatPrecisionSecond, culture) : null,
                       TransactionType?.ToDelimitedString(),
                       TransactionCode?.ToDelimitedString(),
                       TransactionDescription,
                       TransactionDescriptionAlt,
                       TransactionQuantity.HasValue ? TransactionQuantity.Value.ToString(Consts.NumericFormat, culture) : null,
                       TransactionAmountExtended?.ToDelimitedString(),
                       TransactionAmountUnit?.ToDelimitedString(),
                       DepartmentCode?.ToDelimitedString(),
                       HealthPlanId?.ToDelimitedString(),
                       InsuranceAmount?.ToDelimitedString(),
                       AssignedPatientLocation?.ToDelimitedString(),
                       FeeSchedule?.ToDelimitedString(),
                       PatientType?.ToDelimitedString(),
                       DiagnosisCodeFt1 != null ? string.Join(Configuration.FieldRepeatSeparator, DiagnosisCodeFt1.Select(x => x.ToDelimitedString())) : null,
                       PerformedByCode != null ? string.Join(Configuration.FieldRepeatSeparator, PerformedByCode.Select(x => x.ToDelimitedString())) : null,
                       OrderedByCode != null ? string.Join(Configuration.FieldRepeatSeparator, OrderedByCode.Select(x => x.ToDelimitedString())) : null,
                       UnitCost?.ToDelimitedString(),
                       FillerOrderNumber?.ToDelimitedString(),
                       EnteredByCode != null ? string.Join(Configuration.FieldRepeatSeparator, EnteredByCode.Select(x => x.ToDelimitedString())) : null,
                       ProcedureCode?.ToDelimitedString(),
                       ProcedureCodeModifier != null ? string.Join(Configuration.FieldRepeatSeparator, ProcedureCodeModifier.Select(x => x.ToDelimitedString())) : null,
                       AdvancedBeneficiaryNoticeCode?.ToDelimitedString(),
                       MedicallyNecessaryDuplicateProcedureReason?.ToDelimitedString(),
                       NdcCode?.ToDelimitedString(),
                       PaymentReferenceId?.ToDelimitedString(),
                       TransactionReferenceKey != null ? string.Join(Configuration.FieldRepeatSeparator, TransactionReferenceKey.Select(x => x.ToString(Consts.NumericFormat, culture))) : null,
                       PerformingFacility != null ? string.Join(Configuration.FieldRepeatSeparator, PerformingFacility.Select(x => x.ToDelimitedString())) : null,
                       OrderingFacility?.ToDelimitedString(),
                       ItemNumber?.ToDelimitedString(),
                       ModelNumber,
                       SpecialProcessingCode != null ? string.Join(Configuration.FieldRepeatSeparator, SpecialProcessingCode.Select(x => x.ToDelimitedString())) : null,
                       ClinicCode?.ToDelimitedString(),
                       ReferralNumber?.ToDelimitedString(),
                       AuthorizationNumber?.ToDelimitedString(),
                       ServiceProviderTaxonomyCode?.ToDelimitedString(),
                       RevenueCode?.ToDelimitedString(),
                       PrescriptionNumber,
                       NdcQtyAndUom?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
        /**
         * Parses the EmployeeDto object from the SQL reader cache.
         *
         */
        EmployeeDto ParseFromReaderCache(MySqlDataReader dataReader)
        {
            // id
            int id = 0;

            try { id = dataReader.GetInt32(0); }
            catch (SqlNullValueException) { /* log the error */ }

            // first name
            string firstName = "N/A";

            try { firstName = dataReader.GetString(1); }
            catch (SqlNullValueException) { /* log the error */ }

            // last name
            string lastName = "N/A";

            try { lastName = dataReader.GetString(2); }
            catch (SqlNullValueException) { /* log the error */ }

            // birth place
            string birthPlace = "N/A";

            try { birthPlace = dataReader.GetString(3); }
            catch (SqlNullValueException) { /* log the error */ }

            // current place
            string currentPlace = "N/A";

            try { currentPlace = dataReader.GetString(4); }
            catch (SqlNullValueException) { /* log the error */ }

            // gender
            EmployeeGender gender = EmployeeGender.UNDEFINED;

            try { gender = EmployeeGenderExtensions.GetEnumValue(dataReader.GetInt32(5)); }
            catch (SqlNullValueException) { /* log the error */ }

            // department
            DepartmentCode departmentCode = DepartmentCode.UNKNOWN;

            try { departmentCode = DepartmentCodeExtensions.GetEnumValue(dataReader.GetString(6)); }
            catch (SqlNullValueException) { /* log the error */ }

            // oib
            string OIB = "N/A";

            try { OIB = dataReader.GetString(7); }
            catch (SqlNullValueException) { /* log the error */ }

            return((EmployeeDto)
                   new Employee(id, firstName, lastName, birthPlace, currentPlace, gender, departmentCode, OIB).ToDto());
        }
Esempio n. 7
0
 /*
  *  Public constructor.
  */
 public Employee(int id,
                 string firstName, string lastName,
                 string birthPlace, string currentPlace,
                 EmployeeGender gender,
                 DepartmentCode department,
                 string oib)
 {
     Id           = id;
     FirstName    = firstName;
     LastName     = lastName;
     BirthPlace   = birthPlace;
     CurrentPlace = currentPlace;
     Gender       = gender;
     Department   = department;
     OIB          = ValidateOib(oib);
 }
Esempio n. 8
0
        public override Expression <Func <User, bool> > ToPredicateExpression()
        {
            if (String.IsNullOrEmpty(SmgId) && String.IsNullOrEmpty(NameEng) && String.IsNullOrEmpty(FirstNameEng) &&
                String.IsNullOrEmpty(LastNameEng) && String.IsNullOrEmpty(DepartmentName) &&
                String.IsNullOrEmpty(DepartmentCode) && String.IsNullOrEmpty(Room) && String.IsNullOrEmpty(Position))
            {
                return(user => true);
            }

            return(user => (String.IsNullOrEmpty(SmgId) || user.SmgUserId.ToString().Contains(SmgId)) &&
                   (String.IsNullOrEmpty(NameEng) || (user.UserProfile.FirstNameEng.ToLower() + " " + user.UserProfile.LastNameEng.ToLower()).Contains(NameEng.ToLower())) &&
                   (String.IsNullOrEmpty(FirstNameEng) || user.UserProfile.FirstNameEng.ToLower().Contains(FirstNameEng.ToLower())) &&
                   (String.IsNullOrEmpty(LastNameEng) || user.UserProfile.LastNameEng.ToLower().Contains(LastNameEng.ToLower())) &&
                   (String.IsNullOrEmpty(DepartmentName) || user.Department.Name.ToLower().Contains(DepartmentName.ToLower())) &&
                   (String.IsNullOrEmpty(DepartmentCode) || user.Department.DepartmentCode.ToLower().Contains(DepartmentCode.ToLower())) &&
                   (String.IsNullOrEmpty(Room) || user.UserProfile.Room.Contains(Room)) &&
                   (String.IsNullOrEmpty(Position) || user.UserProfile.Position.ToLower().Contains(Position.ToLower())));
        }