public CommodityGradeFactorValueBLL GetActiveValueByCommodoityGradeId(Guid CommodityGradeId) { CommodityGradeFactorValueBLL obj = null; obj = CommodityGradeFactorValueDAL.GetActiveValueByGradeId(CommodityGradeId); if (obj != null) { return(obj); } else { return(null); } }
public bool HasValidGradingResult(Guid GradingResultId, Guid CommodityGradeId) { int count = 0; GradingFactorBLL objHasFactorsInTotalValue = new GradingFactorBLL(); count = objHasFactorsInTotalValue.GetCountOfTotalValueGradingFactors(CommodityGradeId); if (count == 0) { return(true); } else { //get Total Value. Nullable <float> totalValue = null; totalValue = this.GetGradingResultDetialByGradingResdultIdTotalValue(GradingResultId); if (totalValue == null) { return(false); } else { CommodityGradeFactorValueBLL objValue = new CommodityGradeFactorValueBLL(); objValue = objValue.GetActiveValueByCommodoityGradeId(CommodityGradeId); if (objValue != null) { return(false); } else { if (objValue.MaxValue == null || objValue.MinValue == null) { return(false); } else { if ((float)objValue.MaxValue >= totalValue && (float)objValue.MinValue <= totalValue) { return(true); } else { return(false); } } } } } }
//public bool PreInsertHasValidGradingResult(float TotalValue, Guid CommodityGradeId) //{ // int count = 0; // GradingFactorBLL objHasFactorsInTotalValue = new GradingFactorBLL(); // count = objHasFactorsInTotalValue.GetCountOfTotalValueGradingFactors(CommodityGradeId); // if (count == 0) // { // return true; // } // else // { // CommodityGradeFactorValueBLL objValue = new CommodityGradeFactorValueBLL(); // objValue = objValue.GetActiveValueByCommodoityGradeId(CommodityGradeId); // if (objValue == null) // { // return false; // } // else // { // if (objValue.MaxValue == null || objValue.MinValue == null) // { // return false; // } // else // { // if ((float)objValue.MaxValue >= TotalValue && (float)objValue.MinValue <= TotalValue) // { // return true; // } // else // { // return false; // } // } // } // } //} public bool PreInsertHasValidGradingResult(float TotalValue, Guid CommodityGradeId, out string err) { err = "The sum of Grading Values does not match with the Value for the Commodity Grade"; int count = 0; GradingFactorBLL objHasFactorsInTotalValue = new GradingFactorBLL(); count = objHasFactorsInTotalValue.GetCountOfTotalValueGradingFactors(CommodityGradeId); if (count == 0) { return(true); } else { CommodityGradeFactorValueBLL objValue = new CommodityGradeFactorValueBLL(); objValue = objValue.GetActiveValueByCommodoityGradeId(CommodityGradeId); if (objValue == null) { return(false); } else { if (objValue.MaxValue == null || objValue.MinValue == null) { return(false); } else { if ((float)objValue.MaxValue >= TotalValue && (float)objValue.MinValue <= TotalValue) { return(true); } else { err = err + ": ( " + objValue.MaxValue.ToString() + "-" + objValue.MinValue + ")"; return(false); } } } } }