Esempio n. 1
0
        public bool Update()
        {
            bool           isSaved = false;
            SqlConnection  conn    = null;
            SqlTransaction tran    = null;
            RequestforApprovedGRNCancelationBLL objEdit = new RequestforApprovedGRNCancelationBLL();

            objEdit = objEdit.GetById(Id);
            try
            {
                conn    = Connection.getConnection();
                tran    = conn.BeginTransaction();
                isSaved = RequestforApprovedGRNCancelationDAL.Update(tran, this);
                if (isSaved == true)
                {
                    string        AppMode = Utility.GetApplicationName() + " - AppGRNCancel";
                    AuditTrailBLL objAT   = new AuditTrailBLL();
                    if (objAT.saveAuditTrail(objEdit, this, AppMode, UserBLL.GetCurrentUser(), "Update-ApprovedGRNCancelRequest") == 1)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                        return(false);
                    }
                }
                else
                {
                    tran.Rollback();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw new Exception("Unable to update Data.", ex);
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                if (tran != null)
                {
                    tran.Dispose();
                }
            }
            return(isSaved);
        }
Esempio n. 2
0
        public bool CancelGRNCancellationRequest(string TrackingNo)
        {
            Utility.LogException(new Exception(TrackingNo));
            bool           isSaved = false;
            SqlConnection  conn    = null;
            SqlTransaction tran    = null;
            RequestforApprovedGRNCancelationBLL objEdit = new RequestforApprovedGRNCancelationBLL();

            objEdit            = objEdit.GetByTrackingNo(TrackingNo);
            this.Id            = objEdit.Id;
            this.GRNId         = objEdit.GRNId;
            this.RequestedBy   = objEdit.RequestedBy;
            this.DateRequested = objEdit.DateRequested;;
            this.Remark        = objEdit.Remark;
            // set status to cancelled
            this.Status     = RequestforApprovedGRNCancelationStatus.Cancelled;
            this.GRN_Number = objEdit.GRN_Number;



            try
            {
                conn    = Connection.getConnection();
                tran    = conn.BeginTransaction();
                isSaved = RequestforApprovedGRNCancelationDAL.Update(tran, this);
                if (isSaved == true)
                {
                    WFTransaction.Close(TrackingNo);
                    string        AppMode = Utility.GetApplicationName() + " - AppGRNCancel";
                    AuditTrailBLL objAT   = new AuditTrailBLL();
                    if (objAT.saveAuditTrail(objEdit, this, AppMode, UserBLL.GetCurrentUser(), "Update-ApprovedGRNCancelRequest") == 1)
                    {
                        tran.Commit();
                    }
                    else
                    {
                        tran.Rollback();
                        return(false);
                    }
                }
                else
                {
                    tran.Rollback();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                tran.Rollback();
                throw ex;
            }
            finally
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                if (tran != null)
                {
                    tran.Dispose();
                }
            }
            return(isSaved);
        }