/// <summary> /// Returns true if self and the provided entity have the same Id values /// and the Ids are not of the default Id value /// </summary> protected bool HasSameNonDefaultIdAs(AlgorithmCheck compareTo) { return(!this.IsTransient() && !compareTo.IsTransient() && this.Id.Equals(compareTo.Id)); }
public static DSS5_SupplyChainFinancialsOptimisation.BO.AlgorithmCheck AlgorithmCheckImplementation(decimal?annual_turnover, string b2b, string b2c, decimal?payment_term_of_receivable, decimal?average_of_payment_terms, decimal?average_invoice_value, decimal?equity_ratio) { DSS5_SupplyChainFinancialsOptimisation.BO.AlgorithmCheck algorithmCheck = new DSS5_SupplyChainFinancialsOptimisation.BO.AlgorithmCheck(); algorithmCheck.AnnualTurnover = annual_turnover; algorithmCheck.B2B = b2b; algorithmCheck.B2C = b2c; algorithmCheck.PaymentTerm = payment_term_of_receivable; algorithmCheck.AveragePaymentTerm = average_of_payment_terms; algorithmCheck.AverageInvoiceValue = average_invoice_value; algorithmCheck.EquityRatio = equity_ratio; int?count = 0; if ((algorithmCheck?.AnnualTurnover ?? 0) >= 500000) { count = count.GetValueOrDefault(0) + 1; } if (algorithmCheck?.B2B?.ToLower() == "yes") { count = count.GetValueOrDefault(0) + 1; } if ((algorithmCheck?.PaymentTerm ?? 0) <= 160) { count = count.GetValueOrDefault(0) + 1; } if ((algorithmCheck?.AveragePaymentTerm ?? 0) >= 30 && (algorithmCheck?.AveragePaymentTerm ?? 0) <= 120) { count = count.GetValueOrDefault(0) + 1; } if ((algorithmCheck?.AverageInvoiceValue ?? 0) >= 300) { count = count.GetValueOrDefault(0) + 1; } if ((algorithmCheck?.EquityRatio ?? 0) >= 10) { count = count.GetValueOrDefault(0) + 1; } algorithmCheck.AlgorithmCount = count; if (count == 6) { algorithmCheck.Result = "Very High Performance"; } else if (count == 5) { algorithmCheck.Result = "High Performance"; } else if (count == 4) { algorithmCheck.Result = "Medium Performance"; } else if (count == 3) { algorithmCheck.Result = "Borderline Performance"; } else if (count == 2) { algorithmCheck.Result = "Low Performance"; } else if (count == 1) { algorithmCheck.Result = "Very Low Performance"; } else { algorithmCheck.Result = "--"; } return(algorithmCheck); }
/// <summary> /// Copies the current object to a new instance /// </summary> /// <param name="deep">Copy members that refer to objects external to this class (not dependent)</param> /// <param name="copiedObjects">Objects that should be reused</param> /// <param name="asNew">Copy the current object as a new one, ready to be persisted, along all its members.</param> /// <param name="reuseNestedObjects">If asNew is true, this flag if set, forces the reuse of all external objects.</param> /// <param name="copy">Optional - An existing [AlgorithmCheck] instance to use as the destination.</param> /// <returns>A copy of the object</returns> public virtual AlgorithmCheck Copy(bool deep = false, Hashtable copiedObjects = null, bool asNew = false, bool reuseNestedObjects = false, AlgorithmCheck copy = null) { if (copiedObjects == null) { copiedObjects = new Hashtable(); } if (copy == null && copiedObjects.Contains(this)) { return((AlgorithmCheck)copiedObjects[this]); } copy = copy ?? new AlgorithmCheck(); if (!asNew) { copy.TransientId = this.TransientId; copy.Id = this.Id; } copy.AnnualTurnover = this.AnnualTurnover; copy.B2B = this.B2B; copy.B2C = this.B2C; copy.PaymentTerm = this.PaymentTerm; copy.AveragePaymentTerm = this.AveragePaymentTerm; copy.AverageInvoiceValue = this.AverageInvoiceValue; copy.EquityRatio = this.EquityRatio; copy.AlgorithmCount = this.AlgorithmCount; copy.Result = this.Result; if (!copiedObjects.Contains(this)) { copiedObjects.Add(this, copy); } return(copy); }