Exemplo n.º 1
0
        public void LoadSamplingRealtedData(Guid SamplingResultId, DateTime RecivedDateTime)
        {
            ReSamplingBLL obj = new ReSamplingBLL();

            obj                    = ReSamplingDAL.GetSamplingRelatedDataBySamplingResultId(SamplingResultId);
            this.SamplingId        = obj.SamplingId;
            this.SamplingResultId  = obj.SamplingResultId;
            this.ReceivigRequestId = obj.ReceivigRequestId;
            this.DateTimeRequested = RecivedDateTime;
        }
Exemplo n.º 2
0
 public ReSamplingBLL GetByTrackingNo(string TrackingNo)
 {
     try
     {
         return(ReSamplingDAL.GetByTrackingNo(TrackingNo));
     }
     catch
     {
         throw new Exception("An  error has occured please try again.if the error persists contact the adminstrator");
     }
 }
Exemplo n.º 3
0
 public ReSamplingBLL GetById(Guid Id)
 {
     try
     {
         return(ReSamplingDAL.GetById(Id));
     }
     catch
     {
         throw new Exception("An  error has occured please try again.if the error persists contact the adminstrator");
     }
 }
Exemplo n.º 4
0
        public List <ReSamplingBLL> GetPendingResampling(Guid WarehouseId)
        {
            List <ReSamplingBLL> list = new List <ReSamplingBLL>();

            try
            {
                list = ReSamplingDAL.GetMoistureFailedSamples(WarehouseId);
                return(list);
            }
            catch (Exception ex)
            {
                throw new Exception("An Error Has Occured Please Try Again.If the error Persists contact The Administrator", ex);
            }
        }
Exemplo n.º 5
0
 public List <ReSamplingBLL> Search(string TrackingNo, Nullable <int> previousSampleCode, Nullable <DateTime> from, Nullable <DateTime> to, Nullable <ReSamplingStatus> status)
 {
     try
     {
         return(ReSamplingDAL.Search(TrackingNo, previousSampleCode, from, to, status));
     }
     catch (NULLSearchParameterException ex)
     {
         throw new Exception("Please Provide Search Parameter", ex);
     }
     catch (Exception ex)
     {
         throw new Exception("An Error has occured please try again.if the error persists Contact the administrator", ex);
     }
 }
Exemplo n.º 6
0
        public bool isUnique(Guid SamplingResultId)
        {
            int count = -1;

            try
            {
                count = ReSamplingDAL.GetCountBySamplingResult(SamplingResultId);
            }
            catch
            {
                throw new Exception("Unable to get Count");
            }
            if (count == 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 7
0
        public bool Save()
        {
            SqlTransaction trans;
            Guid           TransactionTypeId = Guid.Empty;
            string         TransactionNo     = "";
            SqlConnection  conn;

            conn  = Connection.getConnection();
            trans = conn.BeginTransaction();
            bool isSaved = false;;

            try
            {
                try
                {
                    TransactionTypeId = TransactionTypeProvider.GetTransactionTypeId("CoffeeResample");
                }
                catch
                {
                    throw new Exception("Unable to get Transaction Type.Please contact the Administrator");
                }
                try
                {
                    TransactionNo   = WFTransaction.GetTransaction(TransactionTypeId, trans);
                    this.TrackingNo = TransactionNo;
                }
                catch
                {
                    throw new Exception("Unable to get Tracking Nunber.Please contact the Administrator");
                }
                //entered as New.
                this.Status = ReSamplingStatus.New;
                this.Id     = Guid.NewGuid();
                isSaved     = ReSamplingDAL.Insert(this, trans);
                if (isSaved == true)
                {
                    int           at    = -1;
                    AuditTrailBLL objAt = new AuditTrailBLL();
                    at = objAt.saveAuditTrail(this, WFStepsName.AddReSamplingRequest.ToString(), UserBLL.GetCurrentUser(), "Add Re-sampling Request");
                    if (at == 1)
                    {
                        trans.Commit();
                        return(true);
                    }
                    else
                    {
                        trans.Rollback();
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                if (trans != null)
                {
                    trans.Rollback();
                }
                throw new Exception("An Error Has occured please try Again.If the error persists Contact Administrator", ex);
            }
            finally
            {
                trans.Dispose();
                if (conn != null)
                {
                    if (conn.State == System.Data.ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
        }
Exemplo n.º 8
0
        public bool Update()
        {
            bool           isSaved = false;
            SqlTransaction trans;
            SqlConnection  conn = new SqlConnection();

            conn  = Connection.getConnection();
            trans = conn.BeginTransaction();
            ReSamplingBLL objold = new ReSamplingBLL();

            objold = objold.GetById(this.Id);
            if (objold == null)
            {
                throw new Exception("Invalid Old Value exception");
            }
            try
            {
                isSaved = ReSamplingDAL.Update(this, trans);


                if (isSaved == true)
                {
                    int           at    = -1;
                    AuditTrailBLL objAt = new AuditTrailBLL();
                    at = objAt.saveAuditTrail(objold, this, WFStepsName.EditResampling.ToString(), UserBLL.GetCurrentUser(), "Update Resampling");
                    if (at == 1)
                    {
                        if (this.Status == ReSamplingStatus.Approved)
                        {
                            WFTransaction.WorkFlowManager(this.TrackingNo);
                        }
                        else if (this.Status == ReSamplingStatus.Cancelled)
                        {
                            WFTransaction.Close(this.TrackingNo);
                        }
                        trans.Commit();
                        return(true);
                    }
                    else
                    {
                        trans.Commit();
                        return(false);
                    }
                }
                else
                {
                    trans.Rollback();
                    return(false);
                }
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw new Exception("Unable to Update Data", ex);
            }
            finally
            {
                trans.Dispose();
                if (conn.State == System.Data.ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 9
0
 public String[] GetReGradingRequestbyTrackingNo(string TrackingNo)
 {
     return(ReSamplingDAL.GetReGradingRequestbyTrackingNo(TrackingNo));
 }