public Boolean Update() { // TODO : Check Sampling is Completed - check if Code is generated. int count = 0; bool isSaved = false; SqlTransaction tran = null; SqlConnection conn = null; SamplingResultBLL objSamplingResultold = new SamplingResultBLL(); objSamplingResultold = objSamplingResultold.GetSamplingResultById(this.Id); if (objSamplingResultold == null) { throw new Exception("Null Old Value Exception"); } try { conn = Connection.getConnection(); tran = conn.BeginTransaction(); count = SamplingResultDAL.GetNumberofSupervisorResults(this.Id); if (count > 0) { throw new Exception("A supervisor result with new or Approved already exists."); } else { isSaved = SamplingResultDAL.UpdateSamplingResult(this, tran); if (isSaved == true) { int at = -1; AuditTrailBLL objat = new AuditTrailBLL(); objat.saveAuditTrail(objSamplingResultold, this, WFStepsName.EditSamplingResult.ToString(), UserBLL.GetCurrentUser(), "Edit Sampling Result"); if (at == 1) { tran.Commit(); } else { isSaved = false; tran.Rollback(); } } return(isSaved); } } catch (Exception ex) { tran.Rollback(); throw ex; } finally { tran.Dispose(); conn.Close(); } }
public bool IsSingleSupervisorResult(Guid Id) { int count = 0; try { count = SamplingResultDAL.GetNumberofSupervisorResults(Id); if (count == 0) { return(true); } else { return(false); } } catch (Exception ex) { throw ex; } }