public GradingFactorBLL(GradingFactorBLL source) { this.Id = source.Id; this.CommodityGradeId = source.CommodityGradeId; this.GradingTypeId = source.GradingTypeId; this.GradingFactorName = source.GradingFactorName; this.Status = source.Status; this.PossibleValues = source.PossibleValues; this.CreatedBy = source.CreatedBy; this.CreatedTimestamp = source.CreatedTimestamp; this.LastModifiedBy = source.LastModifiedBy; this.LastModifiedTimestamp = source.LastModifiedTimestamp; }
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 Update(GradingFactorBLL oldGF) { bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); isSaved = GradingFactorDAL.Update(this, tran); int At = -1; if (isSaved == true) { AuditTrailBLL objAT = new AuditTrailBLL(); At = objAT.saveAuditTrail(this, oldGF, WFStepsName.GradingFactorUpdate.ToString(), UserBLL.GetCurrentUser(), "Update Grading Factor"); } if (At == 1) { tran.Commit(); return(true); } else { tran.Rollback(); return(false); } } catch (Exception ex) { tran.Rollback(); throw new Exception("Unable to saved reocrd", ex); } finally { tran.Dispose(); if (conn.State == ConnectionState.Open) { conn.Close(); } } }
//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); } } } } }
public GradingResultStatus GetGradingResultStatus(string value, FailPointComparsion Comparision, string FailPoint, string Type) { bool isOkay = false;; Nullable <float> fFailPoint = null; Nullable <float> fvalue = null; if (FailPoint == "") { return(GradingResultStatus.New); } switch (Type) { case "Float": try { fFailPoint = float.Parse(FailPoint); } catch { throw new Exception("Unable to Compare Grading Result"); } try { fvalue = float.Parse(value); } catch { throw new Exception("Unable to Compare Grading Result"); } isOkay = GradingFactorBLL.FloatComparer(Comparision, (float)fvalue, (float)fFailPoint); break; case "int": try { fFailPoint = float.Parse(FailPoint); } catch { return(GradingResultStatus.New); } try { fvalue = float.Parse(value); } catch { throw new Exception("Unable to Compare Grading Result"); } isOkay = GradingFactorBLL.FloatComparer(Comparision, (float)fvalue, (float)fFailPoint); break; case "bit": isOkay = GradingFactorBLL.StringEqualityComparer(value, FailPoint); return(GradingResultStatus.New); default: isOkay = true; break; } if (isOkay == false) { return(GradingResultStatus.GeneralRequiementfail); } else { return(GradingResultStatus.Approved); } }