Esempio n. 1
0
 public List <GradingBLL> GetGradingBySamplingResultId(Guid SamplingResultId)
 {
     try
     {
         return(GradingDAL.GetGradingBySamplingResultId(SamplingResultId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 2
0
 public List <GradingBLL> GetGradingPenndingDispute()
 {
     try
     {
         return(GradingDAL.GetGradingsPendingDispute(UserBLL.GetCurrentWarehouse()));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 3
0
 public List <GradingBLL> GetGradingsPendingCodeReceivingByTrackingNo(Guid WarehouseId, string TrackingNo)
 {
     try
     {
         return(GradingDAL.GetGradingsPendingCodeReceivingByTrackingNo(WarehouseId, TrackingNo));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 4
0
 public List <GradingBLL> GetGradingsPendingResultByGradingId(Guid WarehouseId, Guid GradingId)
 {
     try
     {
         return(GradingDAL.GetGradingsPendingResultByGradingId(WarehouseId, GradingId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 5
0
 public List <GradingBLL> Search(String TrackingNo, string GradingCode, string SamplingResultCode, Nullable <DateTime> from, Nullable <DateTime> to)
 {
     try
     {
         List <GradingBLL> list = new List <GradingBLL>();
         list = GradingDAL.Search(TrackingNo, GradingCode, SamplingResultCode, from, to);
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Esempio n. 6
0
        public GradingBLL GetById(Guid Id)
        {
            GradingBLL obj = new GradingBLL();

            try
            {
                obj = GradingDAL.GetGradingById(Id);
                return(obj);
            }
            catch
            {
                return(null);
            }
        }
Esempio n. 7
0
 public String[] GetGradingResultCodeBylistGRNEditTrackingNo(string TrackingNo)
 {
     return(GradingDAL.GetGradingCodeBylistTrackingNo(TrackingNo));
 }
Esempio n. 8
0
        public bool UpdateSampleCodeReceived()
        {
            //check necessary data is Suplied.
            if ((this.Id == null) && (this.Id == Guid.Empty))
            {
                throw new Exception("Invalid Parameter");
            }
            if (IsCodeReceivedAtLab == null)
            {
                throw new Exception("Invalid Parameter,IsCodeReceivedAtLab Can't be null");
            }
            if (CodeReceivedTimeStamp == null)
            {
                throw new Exception("Invalid Parameter, CodeReceivedTimeStamp Can't be null");
            }
            bool           isSaved = false;
            SqlTransaction tran    = null;
            SqlConnection  conn    = null;
            int            at      = -1;
            AuditTrailBLL  objAT   = new AuditTrailBLL();

            try
            {
                conn    = Connection.getConnection();
                tran    = conn.BeginTransaction();
                isSaved = GradingDAL.UpdateSampleCodeReceived(this.Id, (bool)this.IsCodeReceivedAtLab, (DateTime)this.CodeReceivedTimeStamp, this.LabTechRemark, tran);
                if (isSaved == true)
                {
                    isSaved = false;
                    at      = objAT.saveAuditTrail(this, WFStepsName.CodeSampRec.ToString(), UserBLL.GetCurrentUser(), "Receive Sample Code");
                    WFTransaction.WorkFlowManager(this.TrackingNo);
                    if (at == -1)
                    {
                        isSaved = false;
                    }
                }

                if (isSaved == true)
                {
                    tran.Commit();
                }
                else
                {
                    tran.Rollback();
                }

                // update the Database
            }
            catch (Exception ex)
            {
                if (at != -1)
                {
                    objAT.RoleBack();
                }
                tran.Rollback();
                throw ex;
            }
            finally
            {
                if (tran != null)
                {
                    tran.Dispose();
                }
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }



            return(isSaved);
        }
Esempio n. 9
0
        public bool Add(string WarehouseNo, string TrackingNo, List <GradingByBLL> list)
        {
            //Utility.LogException(new Exception(TrackingNo.ToString()));
            SqlTransaction trans;
            SqlConnection  conn    = Connection.getConnection();
            bool           isSaved = false;

            trans = conn.BeginTransaction();
            try
            {
                SamplingResultBLL obj = new SamplingResultBLL();
                obj = obj.GetSamplingResultById(this.SamplingResultId);


                //Tod Do if the code is from Regrading then the Tracking Number should change.
                string TranNoGradedispute = "";
                TranNoGradedispute = TrackingNo;
                //if not from regrading.


                if (TranNoGradedispute == "")
                {
                    throw new Exception("Unable to get Tracking Number.");
                }


                this.Id          = Guid.NewGuid();
                this.GradingCode = GetRandomCode(WarehouseNo);
                // TODO - Complete Work flow intgeration.
                //this.TrackingNo = TranNoGradedispute;


                this.TrackingNo = TrackingNo;
                isSaved         = GradingDAL.InsertGrading(this, trans);

                if (isSaved == true)
                {
                    // add Graders.
                    GradingByBLL objGradingBy = new GradingByBLL();
                    isSaved = objGradingBy.Add(this.Id, list, trans);
                    if (isSaved == false)
                    {
                        throw new CodeGenerationException("Can Not generarte Grading Code Exception");
                    }
                    else
                    {
                        int           at    = -1;
                        AuditTrailBLL objAt = new AuditTrailBLL();
                        at = objAt.saveAuditTrail(this, WFStepName.GenerateGradingCode.ToString(), UserBLL.GetCurrentUser(), "Get Grading Code");
                        if (at == 1)
                        {
                            isSaved = true;
                        }
                        else
                        {
                            isSaved = false;
                        }
                    }
                }
                else
                {
                    throw new CodeGenerationException("Can Not generarte Grading Code Exception");
                }



                if (isSaved == true)
                {
                    HttpContext.Current.Session["msg"] = WFTransaction.Request(TrackingNo);
                    WFTransaction.WorkFlowManager(TrackingNo);
                    trans.Commit();
                }
                return(isSaved);
            }
            catch (Exception ex)
            {
                trans.Rollback();
                throw ex;
            }
            finally
            {
                trans.Dispose();
                conn.Close();
            }
        }