コード例 #1
0
        public bool Save()
        {
            bool           isSaved = false;
            SqlTransaction tran    = null;
            SqlConnection  conn    = null;

            try
            {
                conn    = Connection.getConnection();
                tran    = conn.BeginTransaction();
                isSaved = CommodityGradingFactorDAL.Save(this, tran);
                if (isSaved == true)
                {
                    isSaved = false;
                    AuditTrailBLL objAt = new AuditTrailBLL();
                    int           at    = -1;
                    at = objAt.saveAuditTrail(this, WFStepsName.CommmodityGradingFactor.ToString(), UserBLL.GetCurrentUser(), " Add Comm. Grading Factors ");
                    if (at == 1)
                    {
                        isSaved = true;
                    }
                }
                if (isSaved == true)
                {
                    tran.Commit();
                }
                else
                {
                    tran.Rollback();
                }
                return(isSaved);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            {
                if (tran != null)
                {
                    tran.Dispose();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
コード例 #2
0
        public bool Inactive(Guid Id)
        {
            bool           isSaved = false;
            SqlTransaction tran    = null;
            SqlConnection  conn    = null;

            conn = Connection.getConnection();
            tran = conn.BeginTransaction();
            try
            {
                isSaved = CommodityGradingFactorDAL.Inactive(Id, tran);
                if (isSaved == true)
                {
                    int           At    = -1;
                    AuditTrailBLL objAt = new AuditTrailBLL();
                    At = objAt.saveAuditTrailStringFormat("", Id.ToString() + " - Staus set to Canceled", WFStepsName.CommmodityGradingFactor.ToString(), UserBLL.GetCurrentUser(), "Cancel Comm. Grading factor");
                    if (At == 1)
                    {
                        isSaved = true;
                    }
                    else
                    {
                        isSaved = false;
                    }
                }
                else
                {
                    tran.Rollback();
                }
                if (isSaved == true)
                {
                    tran.Commit();
                }
                else
                {
                    tran.Rollback();
                }
                return(isSaved);
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            {
            }
        }
コード例 #3
0
 public List <CommodityGradingFactorBLL> GetByCommodityId(Guid CommodityId)
 {
     return(CommodityGradingFactorDAL.GetByCommodityId(CommodityId));
 }