public SocialInsuranceReport_Dto GetSIReport(PayrunDetail_Dto detail) { double upperLimit = SocialInsuranceAppService.GetCurrentSetup().SI_UpperLimit; List <PayrunAllowanceSummary_Dto> payrunAllowances = detail.PayrunAllowancesSummaries.Where(x => x.AllowanceType.Dimension_1_Value.ToUpper() == "TRUE").ToList(); GeneralInfo generalInfo = JsonSerializer.Deserialize <GeneralInfo>(detail.Employee.ExtraProperties["generalInfo"].ToString()); PhysicalId <Guid> currentPhysicalId = generalInfo.PhysicalIds.Last(x => x.GetIDTypeValue == "Iqama" && x.EndDate <= DateTime.Now); string empPhysicalIdNumber = currentPhysicalId.IDNumber; SocialInsuranceReport_Dto siDSRow = new SocialInsuranceReport_Dto(); siDSRow.Payrun = detail.Payrun; siDSRow.PayrunId = detail.PayrunId; siDSRow.Employee = detail.Employee; siDSRow.EmployeeId = detail.EmployeeId; siDSRow.EmpID = empPhysicalIdNumber; siDSRow.EmpSIId = detail.Employee.SocialInsuranceId; double curBasicSalary = (double)detail.BasicSalary; siDSRow.BasicSalary = curBasicSalary; siDSRow.PayrunDate = new DateTime(detail.Year, detail.Month, detail.CreationTime.Day); siDSRow.PayrunSIAllowancesSummaries = payrunAllowances;//payrunAllowances.Select(x => x.a); siDSRow.TotalSISalary = (double)siDSRow.PayrunSIAllowancesSummaries.Sum(x => x.Value); siDSRow.TotalSISalary += curBasicSalary; siDSRow.TotalSISalary = Math.Min(upperLimit, siDSRow.TotalSISalary); return(siDSRow); }
public BobDisk(PhysicalId physicalId, MountPath mountPath, BobPath bobPath, string diskNameInBob) { PhysicalId = physicalId ?? throw new ArgumentNullException(nameof(physicalId)); MountPath = mountPath; BobPath = bobPath ?? throw new ArgumentNullException(nameof(bobPath)); DiskNameInBob = diskNameInBob; }
private static Volume ParseVolume(LshwNode volumeNode, PhysicalId diskPhysicalId) { var physicalIdStr = volumeNode.FindSingleValue(TokenType.PhysicalId); var devPath = GetDevPath(volumeNode); if (devPath == null) { return(null); } var uuid = volumeNode.FindSingleValue(TokenType.Serial); var state = volumeNode.FindSingleValue(TokenType.State); var mountPath = volumeNode.FindSingleValue(t => t.Type == TokenType.LogicalName && !t.Value.StartsWith("/dev")) ?? volumeNode.FindSingleValue(TokenType.LastMountPoint); var filesystem = volumeNode.FindSingleValue(TokenType.Filesystem); var physicalId = new PhysicalId(physicalIdStr, diskPhysicalId); var logicalVolumeNodes = volumeNode.Children; var logicalVolumes = logicalVolumeNodes.Select(lv => ParseLogicalVolume(lv, physicalId)).ToList(); var mountOptions = volumeNode.FindSingleValue(TokenType.MountOptions); return(new Volume(physicalId, new DevPath(devPath), new UUID(uuid), state is null ? State.NotMounted : Enum.Parse <State>(state, true), mountPath is null ? null : new MountPath(mountPath), filesystem is null ? null : new Filesystem(filesystem), logicalVolumes, mountOptions is null ? null : new MountOptions(mountOptions))); }
private static LogicalVolume ParseLogicalVolume(LshwNode logicalVolumeNode, PhysicalId volumePhysicalId) { var physicalId = logicalVolumeNode.FindSingleValue(TokenType.PhysicalId); var devPath = GetDevPath(logicalVolumeNode); var uuid = logicalVolumeNode.FindSingleValue(TokenType.Serial); return(new LogicalVolume( new PhysicalId(physicalId, volumePhysicalId), new DevPath(devPath), new UUID(uuid))); }
private static PhysicalId CollectPhysicalId(LshwNode node) { var physIds = new Stack <string>(); string physId; while (node != null && (physId = node.FindSingleValue(TokenType.PhysicalId)) != null) { physIds.Push(physId); node = node.Parent; } PhysicalId res = null; while (physIds.TryPop(out var s)) { res = new PhysicalId(s, res); } return(res); }