public override int GetHashCode() { unchecked // Overflow is fine, just wrap { int hash = ProcessInstanceId.GetHashCode(); // Suitable nullity checks etc, of course :) if (ProcessKey != null) { hash = hash * 17 + ProcessKey.GetHashCode(); } if (ProcessInstanceName != null) { hash = hash * 17 + ProcessInstanceName.GetHashCode(); } if (BusinessKey != null) { hash = hash * 17 + BusinessKey.GetHashCode(); } hash = hash * 17 + SuspensionState.GetHashCode(); if (UserCandidates != null) { hash = hash * 17 + UserCandidates.GetHashCode(); } if (Owner != null) { hash = hash * 17 + Owner.GetHashCode(); } return(hash); } }
public void Should_trim_client_id_and_signing_key() { var key = new BusinessKey(" client-id ", " signing-key "); Assert.Equal("client-id", key.ClientId); Assert.Equal("signing-key", key.SigningKey); }
public override string ToString() { var sb = new StringBuilder("QueueMessage("); int tmp3 = 0; if ((UniqueId != null) && __isset.uniqueId) { if (0 < tmp3++) { sb.Append(", "); } sb.Append("UniqueId: "); UniqueId.ToString(sb); } if ((BusinessKey != null) && __isset.businessKey) { if (0 < tmp3++) { sb.Append(", "); } sb.Append("BusinessKey: "); BusinessKey.ToString(sb); } if ((Base64Data != null) && __isset.base64Data) { if (0 < tmp3++) { sb.Append(", "); } sb.Append("Base64Data: "); Base64Data.ToString(sb); } sb.Append(')'); return(sb.ToString()); }
public async Task <IEnumerable <PhysiciansDTO> > GetPhysicians(BusinessKey businessKey) { var phys = await _context.RawDataFacts .Where(r => (r.CycleId == businessKey.CycleId) && (r.SubGroupId == businessKey.SubGroupId) && (r.IndicatorId == businessKey.IndicatorId)) .Select(r => new { PayrollId = r.PayrollId, OppeKey = r.CycleId }) .ToListAsync(); var p = phys.GroupBy(x => x.PayrollId).Select(x => new { PayrollId = x.Key, C = x.Count() }).ToArray(); var physArr = new List <PhysiciansDTO>(); for (int x = 0; x < p.Length; x++) { if (p[x].C >= 5) { var physDto = new PhysiciansDTO { PayrollId = p[x].PayrollId }; physArr.Add(physDto); } } return(physArr); }
public override string ToString() { var sb = new StringBuilder("NotificationQueueRequest("); int tmp1 = 0; if ((UniqueId != null) && __isset.uniqueId) { if (0 < tmp1++) { sb.Append(", "); } sb.Append("UniqueId: "); UniqueId.ToString(sb); } if ((BusinessKey != null) && __isset.businessKey) { if (0 < tmp1++) { sb.Append(", "); } sb.Append("BusinessKey: "); BusinessKey.ToString(sb); } if ((Data != null) && __isset.data) { if (0 < tmp1++) { sb.Append(", "); } sb.Append("Data: "); Data.ToString(sb); } sb.Append(')'); return(sb.ToString()); }
protected int Find(BusinessKey item) { int result = -1; if (item == null) { return(result); } loc.EnterReadLock(); try { Parallel.For(0, Items.Count, (x, state) => { if (item.ID == item.ID) { result = x; } state.Break(); }); } finally { if (loc.IsReadLockHeld) { loc.ExitReadLock(); } } return(result); }
public void ServiceUrl_should_contains_channel_name() { var channel = "channel1"; var key = new BusinessKey("client-id", "signature", channel); var geocoder = new GoogleGeocoder(key); Assert.Contains("channel=" + channel, geocoder.ServiceUrl); }
public void Should_be_equal_by_value() { var key1 = new BusinessKey("client-id", "signing-key"); var key2 = new BusinessKey("client-id", "signing-key"); Assert.Equal(key1, key2); Assert.Equal(key1.GetHashCode(), key2.GetHashCode()); }
public void Should_not_be_equal_with_different_signing_keys() { var key1 = new BusinessKey("client-id", "signing-key1"); var key2 = new BusinessKey("client-id", "signing-key2"); Assert.NotEqual(key1, key2); Assert.NotEqual(key1.GetHashCode(), key2.GetHashCode()); }
public void Should_generate_signature_from_url() { var key = new BusinessKey("clientID", "vNIXE0xscrmjlyV-12Nj_BvUPaw="); string signedUrl = key.GenerateSignature("http://maps.googleapis.com/maps/api/geocode/json?address=New+York&sensor=false&client=clientID"); Assert.NotNull(signedUrl); Assert.Equal("http://maps.googleapis.com/maps/api/geocode/json?address=New+York&sensor=false&client=clientID&signature=KrU1TzVQM7Ur0i8i7K3huiw3MsA=", signedUrl); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected String processBusinessKey(org.aopalliance.intercept.MethodInvocation invocation) throws Throwable protected internal virtual string processBusinessKey(MethodInvocation invocation) { IDictionary <BusinessKey, string> businessKeyAnnotations = this.mapOfAnnotationValues(typeof(BusinessKey), invocation); if (businessKeyAnnotations.Count == 1) { BusinessKey processId = businessKeyAnnotations.Keys.GetEnumerator().next(); return(businessKeyAnnotations[processId]); } return(null); }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> /// <remarks> /// User BusinessKey to Compare /// This method is set as virtual for ORM framework to dynamically create proxy /// </remarks> public virtual int CompareTo(object obj) { if (obj == null) { throw new ArgumentNullException(); } if (!(obj is EntityWithIdNBizKeyBase)) { throw new ArgumentException("Object must be of type EntityWithIdNBizKeyBase"); } return(BusinessKey.CompareTo(((EntityWithIdNBizKeyBase)obj).BusinessKey)); }
public override int GetHashCode() { int hashcode = 157; unchecked { if ((UniqueId != null) && __isset.uniqueId) { hashcode = (hashcode * 397) + UniqueId.GetHashCode(); } if ((BusinessKey != null) && __isset.businessKey) { hashcode = (hashcode * 397) + BusinessKey.GetHashCode(); } if ((Data != null) && __isset.data) { hashcode = (hashcode * 397) + Data.GetHashCode(); } } return(hashcode); }
public async Task <int> DeletePValueFacts(BusinessKey businessKey) { var recordsToBeDeleted = await _context.PValueFacts.Where(p => (p.CycleId == businessKey.CycleId) && (p.SubGroupId == businessKey.SubGroupId) && (p.IndicatorId == businessKey.IndicatorId) && (p.PayrollId == businessKey.PayrollId)) .ToListAsync(); var deleted = 0; foreach (var rawDataFact in recordsToBeDeleted) { _context.PValueFacts.Remove(rawDataFact); } deleted = await _context.SaveChangesAsync(); return(deleted); }
private async Task <TTestGroupsDTO> CreateGroupsForTTest(BusinessKey businessKey) { var rawData = await _oppeDBService.GetRawDataFactList(businessKey); if (!rawData.Any()) { return(null); } var grp1 = Array.ConvertAll(rawData.Where(r => r.Name == "Peers").Select(r => r.Value).ToArray(), x => (double)x); var grp2 = Array.ConvertAll(rawData.Where(r => r.Name != "Peers").Select(r => r.Value).ToArray(), x => (double)x); var tTestGroupsDto = new TTestGroupsDTO { Group1 = _engine.CreateNumericVector(grp1), Group2 = _engine.CreateNumericVector(grp2) }; return(tTestGroupsDto); }
private async Task <LeveneTestDTO> CreateGroupsForLevene(BusinessKey businessKey) { var rawData = await _oppeDBService.GetRawDataFactList(businessKey); if (!rawData.Any()) { return(null); } var namesV = rawData.Select(l => l.Name).ToArray(); var values = Array.ConvertAll(rawData.Select(l => l.Value).ToArray(), x => (double)x); LeveneTestDTO leveneTestDTO = new LeveneTestDTO { Names = _engine.CreateCharacterVector(namesV), Values = _engine.CreateNumericVector(values) }; return(leveneTestDTO); }
public async Task <IEnumerable <PValueDTO> > CalculatePValue(BusinessKey businessKey) { var phys = await _oppeDBService.GetPhysicians(businessKey); var pValueFacts = new List <PValueDTO>(); foreach (var phy in phys) { businessKey.PayrollId = phy.PayrollId; await _oppeDBService.DeletePValueFacts(businessKey); var pValueFact = await _utilService.GeneratePValueFactRecord(businessKey); if (pValueFact != null) { pValueFacts.Add(pValueFact); } } return(pValueFacts); }
public async Task <IEnumerable <TestDTO> > GetRawDataFactList(BusinessKey businessKey) { var physData = await _context.RawDataFacts .Where(p => (p.CycleId == businessKey.CycleId) && (p.SubGroupId == businessKey.SubGroupId) && (p.IndicatorId == businessKey.IndicatorId) && (p.PayrollId == businessKey.PayrollId) ).ToListAsync(); var peersData = await _context.RawDataFacts .Where(p => (p.CycleId == businessKey.CycleId) && (p.SubGroupId == businessKey.SubGroupId) && (p.IndicatorId == businessKey.IndicatorId) && (p.PayrollId != businessKey.PayrollId) ).ToListAsync(); peersData.ForEach(p => p.PayrollId = "Peers"); physData.AddRange(peersData); var c = peersData.Count; var tTestDTOList = new List <TestDTO>(); if (c >= 5) { physData.ForEach(p => { var tTestDTO = new TestDTO { Name = p.PayrollId, Value = p.Numerator }; tTestDTOList.Add(tTestDTO); }); } return(tTestDTOList); }
public bool Equals(ProcessInstance other) { // Check for null if (ReferenceEquals(other, null)) { return(false); } // Check for same reference if (ReferenceEquals(this, other)) { return(true); } // Not Check ProcessInstanceId, because generated Guid // Check for same value return(((ProcessKey == null && other.ProcessKey == null) || (ProcessKey != null && other.ProcessKey != null && ProcessKey.Equals(other.ProcessKey))) && ((ProcessInstanceName == null && other.ProcessInstanceName == null) || (ProcessInstanceName != null && other.ProcessInstanceName != null && ProcessInstanceName.Equals(other.ProcessInstanceName))) && ((BusinessKey == null && other.BusinessKey == null) || (BusinessKey != null && other.BusinessKey != null && BusinessKey.Equals(other.BusinessKey))) && SuspensionState.Equals(other.SuspensionState) && ((UserCandidates == null && other.UserCandidates == null) || (UserCandidates != null && other.UserCandidates != null && UserCandidates.Equals(other.UserCandidates))) && ((Owner == null && other.Owner == null) || (Owner != null && other.Owner != null && Owner.Equals(other.Owner)))); }
public async Task <PValueDTO> GeneratePValueFactRecord(BusinessKey businessKey) { float leveneValue = 0; float pValueUnequalVariance = 0; float pValueEqualVariance = 0; float chiRatio = 0; float pValue = 0; var phys = await _oppeDBService.GetRawDataFactList(businessKey); var physCount = phys.Count(p => p.Name != "Peers"); float physSum = (float)phys.Where(p => p.Name != "Peers").Sum(p => p.Value); float physMean = (float)(physCount == 0 ? 0 : physSum / physCount); var peersCount = phys.Count(p => p.Name == "Peers"); float peersSum = (float)phys.Where(p => p.Name == "Peers").Sum(p => p.Value); float peersMean = (float)(peersCount == 0 ? 0 : peersSum / peersCount); if (businessKey.isTTest) { LeveneTestDTO leveneTestDTO = await CreateGroupsForLevene(businessKey); if (leveneTestDTO == null) { return(null); } leveneValue = CalculateLeveneValue(leveneTestDTO); TTestGroupsDTO tTestGroupsDto = await CreateGroupsForTTest(businessKey); if (tTestGroupsDto == null) { return(null); } pValueUnequalVariance = CalculateUnequalVariance(tTestGroupsDto); pValueEqualVariance = CalculateEqualVariance(tTestGroupsDto); pValue = leveneValue > 0.05 ? pValueEqualVariance : pValueUnequalVariance; if (float.IsNaN(leveneValue) || float.IsNaN(pValueUnequalVariance) || float.IsNaN(pValueEqualVariance)) { return(null); } } else { if (phys.Any()) { CalculateChiForPhys(phys, out chiRatio, out pValue); } } PValueDTO pValueDTO = new PValueDTO { CycleId = businessKey.CycleId, SubGroupId = (int)businessKey.SubGroupId, IndicatorId = (int)businessKey.IndicatorId, PayrollId = businessKey.PayrollId, PhysicianCount = physCount, PhysicianSum = physSum, PhysicianMean = physMean, PeersCount = peersCount, PeersSum = peersSum, PeersMean = peersMean, LeveneValue = leveneValue, PValueUnequalVariance = pValueUnequalVariance, PValueEqualVariance = pValueEqualVariance, ChiRatio = chiRatio, PValue = pValue }; return(pValueDTO); }
public override int GetHashCode() { return(BusinessKey.GetHashCode()); }
public BusinessDoesNotExists(BusinessKey key) : base("Business does not exists") { Data.Add("BusinessCode", key.Code); }
public void Should_trim_and_lower_channel_name(string channel) { var key = new BusinessKey("client-id", "signature", channel); Assert.Equal(channel.Trim().ToLower(), key.Channel); }
public async Task <IActionResult> GetData(CycleParam param) { var cycle = param.CycleId; var toFile = param.ToFile == 1; var pValueDTOs = new List <PValueDTO>(); int recordsAdded = 0; int i = 0; foreach (var subGroup in param.SubGroups) { int[] indicators = new int[subGroup.Indicators.Length]; int j = 0; foreach (var ind in subGroup.Indicators) { indicators[j] = ind; // var indicatorDim = await _rService.GetIndicatorDim(ind); BusinessKey businessKey = new BusinessKey { }; switch (indicatorDim.StatisticalTestId) { case 1: //T-Test businessKey.CycleId = cycle; businessKey.SubGroupId = subGroup.SubGroupId; businessKey.IndicatorId = ind; businessKey.isTTest = true; var pValuesT = await _rService.CalculatePValue(businessKey); pValueDTOs.AddRange(pValuesT); break; case 2: //Chi-square businessKey.CycleId = cycle; businessKey.SubGroupId = subGroup.SubGroupId; businessKey.IndicatorId = ind; businessKey.isTTest = false; var pValuesC = await _rService.CalculatePValue(businessKey); pValueDTOs.AddRange(pValuesC); break; default: break; } j++; } i++; } if (toFile) { // save to file recordsAdded = await _rService.SaveToExcelFile(pValueDTOs); } else { // save to DB recordsAdded = await _rService.SavePValues(pValueDTOs); } return(Ok(recordsAdded)); }
public Product FindByCodeOrName(BusinessKey businessKey, string productCode, string productName) { return(Store.FirstOrDefault(x => x.BusinessKey.Equals(businessKey) && (x.Code == productCode || x.Name == productName))); }
public IEnumerable <Product> FindByBusiness(BusinessKey businessKey) { return(Store.FindAll(x => x.BusinessKey.Equals(businessKey))); }
/// <summary> /// /// </summary> /// <returns></returns> public override string ToString() { return (GetType().ToString() + " #" + Id.ToString() + "( BusinessKey:" + BusinessKey.ToString().Replace(BIZKEYSEP, " ") + ")"); }
protected TaskBase(BusinessKey businessKey) { BusinessKey = businessKey; }