Example #1
0
        /// <summary>
        /// Searchs sampling by either of the
        /// </summary>
        /// <param name="TrackingNo"></param>
        /// <param name="SamplingCode"></param>
        /// <returns></returns>
        public static List <SamplingBLL> SearchSampling(string TrackingNo, string SamplingCode, Nullable <DateTime> from, Nullable <DateTime> to)
        {
            List <SamplingBLL> list = null;

            list = SamplingDAL.Search(TrackingNo, SamplingCode, from, to);
            return(list);
        }
Example #2
0
        //SampleDate
        public bool UpdateDateCoded()
        {
            bool isSaved = false;

            isSaved = SamplingDAL.UpdateDateSampled(this.Id, this.GeneratedTimeStamp);
            return(isSaved);
        }
Example #3
0
 public SamplingBLL GetApprovedSamplesByGradingId(Guid GradingId)
 {
     try
     {
         return(SamplingDAL.GetApprovedSampleByGradingId(GradingId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #4
0
 public List <SamplingBLL> GetSamplesPenndingResultByTrackingNo(Guid WarehouseId, string TrackingNo)
 {
     try
     {
         return(SamplingDAL.GetSamplesPendingResultByTrackingNo(WarehouseId, TrackingNo));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Example #5
0
 public static int GetSerial(Guid WarehouseId)
 {
     try
     {
         return(Convert.ToInt32(SamplingDAL.GetSerial(WarehouseId)));
     }
     catch (Exception ex)
     {
         throw new Exception("Inavlid Serial Number exception", ex);
     }
 }
Example #6
0
 public SamplingBLL GetApprovedSamplesByReceivigRequestId(Guid ReceivigRequestId)
 {
     try
     {
         return(SamplingDAL.GetApprovedSampleByReceivigRequestId(ReceivigRequestId));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #7
0
 //18-01-2012
 public List <SamplingBLL> GetSamplesPenndingResult(Guid WarehouseId, string TranNo)
 {
     try
     {
         return(SamplingDAL.GetSamplesPendingResult(WarehouseId, TranNo));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #8
0
 /// <summary>
 /// Gets the Serial number by incrementing one on the numeber of Samplings generated per a given date.
 /// </summary>
 /// <returns>Integer Serial number.</returns>
 public Nullable <int> GetSerialNo(Guid WarehouseId)
 {
     try
     {
         return(SamplingDAL.GetSerial(WarehouseId));
     }
     catch (Exception ex)
     {
         throw new Exception("Unable to Generate Serial no.", ex);
     }
 }
Example #9
0
 public List <SamplingBLL> GetSamplesPendingCoding(Guid WarehouseId)
 {
     try
     {
         List <SamplingBLL> list = new List <SamplingBLL>();
         list = SamplingDAL.GetSamplesPendingCoding(WarehouseId);
         return(list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #10
0
        public static Nullable <Guid> GetRandomReSampling(Guid WarehouseId, out Guid MoistureId, out string TransactionId)
        {
            Nullable <Guid> id = null;

            try
            {
                id = SamplingDAL.GetRandomReSamplingId(WarehouseId, out MoistureId, out TransactionId);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(id);
        }
Example #11
0
        /// <summary>
        /// This method picks a single Sample from the Commodity Deposite Requests based upon DateTime reciced.
        ///
        /// </summary>
        /// <param name="WarehouseId"></param>
        /// <returns>Sampling Id</returns>
        public static Nullable <Guid> GetRandomSample(Guid WarehouseId)
        {
            Nullable <Guid> id = null;

            // id = SamplingDAL.GetRandomSamplingIdWithin2Hours(WarehouseId);
            //if (id == null)
            //{
            id = SamplingDAL.GetRandomSamplingId(WarehouseId);
            if (id == null)
            {
                throw new Exception("There are no enteries pending Sampling.");
            }
            //}
            return(id);
        }
Example #12
0
 public String[] GetMixedSamplingCodeBylistTrackingNo(string TrackingNo)
 {
     return(SamplingDAL.GetSamplingCodeForMixedBylistTrackingNo(TrackingNo));
 }
Example #13
0
 public static string GetTransactionNumber(Guid Id)
 {
     return(SamplingDAL.GetTransactionNumber(Id));
 }
Example #14
0
 public SamplingBLL GetSampleDetail(Guid SampleTicketId)
 {
     return(SamplingDAL.GetSampleById(SampleTicketId));
 }
Example #15
0
        public Nullable <Guid> InsertSample(SamplingBLL objSampling, SamplerBLL objSampler, bool isMoisture)
        {
            bool issaved = false;

            SqlConnection   conn              = null;
            SqlTransaction  trans             = null;
            int             at                = -1;
            Nullable <Guid> DepositeRequestId = null;

            try
            {
                conn  = Connection.getConnection();
                trans = conn.BeginTransaction();
                //using (TransactionScope scope = new TransactionScope())
                //{
                DepositeRequestId = new Guid(SamplingDAL.InsertSample(objSampling, trans).ToString());
                if (DepositeRequestId == null)
                {
                    trans.Rollback();
                    return(null);
                    //throw new Exception("Invalid Sample Id.");
                }
                objSampling.Id = (Guid)DepositeRequestId;
                AuditTrailBLL objAt = new AuditTrailBLL();
                at = objAt.saveAuditTrail(objSampling, WFStepsName.AddSampleCoding.ToString(), UserBLL.GetCurrentUser(), "Get Sample Ticket");
                if (at == 1)
                {
                    at = -1;
                    objSampler.SampleingTicketId = (Guid)DepositeRequestId;
                    objSampler.Id = Guid.NewGuid();
                    issaved       = SamplerDAL.InsertSampler(objSampler, trans);
                    if (issaved == true)
                    {
                        HttpContext.Current.Session["msg"] = null;
                        WFTransaction.UnlockTask(objSampling.TrackingNo);
                        ECXWF.CMessage mess = WFTransaction.Request(objSampling.TrackingNo);
                        HttpContext.Current.Session["msg"] = mess;
                        if (mess.Name.Trim() == "GetSampleTicket".Trim())
                        {
                            WFTransaction.WorkFlowManager(objSampling.TrackingNo);
                            trans.Commit();
                        }
                        else
                        {
                            objAt.RoleBack();
                            trans.Rollback();
                            DepositeRequestId = null;
                        }
                    }
                    else
                    {
                        objAt.RoleBack();
                        trans.Rollback();
                        DepositeRequestId = null;
                    }
                }
                else
                {
                    trans.Rollback();
                    DepositeRequestId = null;
                    throw new Exception("Unable to log Audit Trail");
                }
                //    scope.Complete();
                // }
            }
            catch (Exception ex)
            {
                trans.Rollback();
                DepositeRequestId = null;
                throw ex;
            }
            finally
            {
                trans.Dispose();
                conn.Close();
            }
            return(DepositeRequestId);
        }