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

            conn = Connection.getConnection();

            UnloadingBLL objOld = new UnloadingBLL();

            objOld = objOld.GetById(this.Id);
            if (objOld == null)
            {
                throw new Exception("Null Old Value Exception");
            }
            try
            {
                conn = Connection.getConnection();
                tran = conn.BeginTransaction();
                if (UnloadingDAL.UpdateUnloading(this, tran) == true)
                {
                    int           at    = -1;
                    AuditTrailBLL objAt = new AuditTrailBLL();
                    at = objAt.saveAuditTrail(objOld, this, WFStepsName.EditUnloading.ToString(), UserBLL.GetCurrentUser(), "Edit Unloading");
                    if (at == 1)
                    {
                        tran.Commit();
                        issaved = true;
                    }
                    else
                    {
                        tran.Rollback();
                        issaved = false;
                    }
                }
                else
                {
                    tran.Rollback();
                    issaved = false;
                }
            }
            catch
            {
                tran.Rollback();
                throw new Exception("Unable to Update the record.");
            }
            finally
            {
                if (tran != null)
                {
                    tran.Dispose();
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Dispose();
                }
            }
            return(issaved);
        }
コード例 #2
0
 public UnloadingBLL GetApprovedUnloadingByGradingResultId(Guid GradingResultId)
 {
     try
     {
         return(UnloadingDAL.GetApprovedUnloadingInformationByGradingResultId(GradingResultId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #3
0
 public UnloadingBLL GetApprovedUnloadingByCommodityDepositeId(Guid CommodityDepositeId)
 {
     try
     {
         return(UnloadingDAL.GetApprovedUnloadingInformationByCommodityDepositeId(CommodityDepositeId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
コード例 #4
0
 public UnloadingBLL GetById()
 {
     try
     {
         return(UnloadingDAL.GetUnloadingInformationById(this.Id));
     }
     catch (Exception ex)
     {
         ErrorLogger.Log(ex);
         // Redirect to error page.
         return(null);
     }
 }
コード例 #5
0
 public List <UnloadingBLL> Search(string code, string trackingno)
 {
     return(UnloadingDAL.SearchUnloadingInformation(code, trackingno));
 }
コード例 #6
0
        public bool Add(List <StackUnloadedBLL> list)
        {
            Nullable <Guid> Id    = null;
            int             Count = 1;

            Count = UnloadingDAL.GetNumberofUnloadingByGradeingResultId(this.GradingResultId);
            if (Count == 0)
            {
                SqlTransaction tran;
                SqlConnection  conn = new SqlConnection();
                conn = Connection.getConnection();
                tran = conn.BeginTransaction();
                try
                {
                    Id = UnloadingDAL.InsertUnloadingInformation(this, tran);

                    if (Id == null)
                    {
                        tran.Rollback();
                        conn.Close();
                        return(false);
                    }
                    else
                    {
                        // add the Stack information
                        this.Id = (Guid)Id;
                        StackUnloadedBLL stackObj    = new StackUnloadedBLL();
                        bool             isSavedList = false;
                        isSavedList = stackObj.Add(tran, list, (Guid)Id);
                        if (isSavedList == true)
                        {
                            int           at    = -1;
                            AuditTrailBLL objAt = new AuditTrailBLL();
                            at = objAt.saveAuditTrail(this, WFStepsName.AddUnloadingInfo.ToString(), UserBLL.GetCurrentUser(), "Add Unloading Information");
                            if (at == 1)
                            {
                                isSavedList = true;
                            }
                            else
                            {
                                isSavedList = false;
                            }
                        }

                        if (isSavedList == true)
                        {
                            WFTransaction.WorkFlowManager(this.TrackingNo);
                        }
                        if (isSavedList == true)
                        {
                            tran.Commit();
                            return(true);
                        }
                        else
                        {
                            tran.Rollback();
                            return(false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    tran.Dispose();
                    conn.Close();
                }
            }
            else
            {
                return(false);
            }
        }