Пример #1
0
        public bool Update()
        {
            bool           isSaved    = false;
            SqlConnection  conn       = null;
            SqlTransaction tran       = null;
            ScalingBLL     objScaling = new ScalingBLL();

            objScaling = objScaling.GetById(this.Id);
            if (objScaling == null)
            {
                throw new Exception("Null Old Value Exception");
            }
            try
            {
                conn    = Connection.getConnection();
                tran    = conn.BeginTransaction();
                isSaved = ScalingDAL.Update(this, tran);
                if (isSaved == true)
                {
                    int           at    = -1;
                    AuditTrailBLL objat = new AuditTrailBLL();
                    at = objat.saveAuditTrail(objScaling, this, WFStepsName.EditScaling.ToString(), UserBLL.GetCurrentUser(), "Update Scaling Information");
                    if (at == 1)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        isSaved = false;
                        tran.Rollback();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new Exception("An Error has ccured please try again. If the error persists Contact the Administrator", ex);
            }
            finally
            {
                if (tran != null)
                {
                    tran.Dispose();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(isSaved);
        }
Пример #2
0
        public Guid GetScalingIdByGradingId(Guid Id)
        {
            ScalingBLL      obj       = new ScalingBLL();
            Nullable <Guid> ScalingId = null;

            try
            {
                ScalingId = ScalingDAL.GetApprovedScalingIdByGradingId(Id);
                if (ScalingId != null)
                {
                    return((Guid)ScalingId);
                }
                else
                {
                    throw new Exception("Invalid Scaling Id.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public static float GetApprovedWeightByGradingId(Guid id)
        {
            ScalingBLL       obj    = new ScalingBLL();
            Nullable <float> weight = null;

            try
            {
                weight = ScalingDAL.GetApprovedWeightInformationByGradingId(id);
                if (weight != null)
                {
                    return((float)weight);
                }
                else
                {
                    throw new Exception("Total Approved weight exception.");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }