예제 #1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            string strTrackingNo = "";

            strTrackingNo        = this.txtTrackingNo.Text;
            this.lblstatus.Text  = "";
            this.lblMessage.Text = "";
            if (!(string.IsNullOrEmpty(strTrackingNo)))
            {
                try
                {
                    this.lblstatus.Text = WFTransaction.GetMessage(strTrackingNo);
                }
                catch
                {
                    this.lblMessage.Text = "Can't Find this tracking No.";
                }
            }
            else
            {
                this.lblMessage.Text = "please enter Tracking No.";
            }
        }
예제 #2
0
        public static Nullable <Guid> GetRandomSamplingId(Guid WarehouseId)
        {
            Nullable <Guid> Id     = null;
            string          strSql = "spGetDepositeRequestWaitingSampling";
            SqlConnection   conn   = Connection.getConnection();

            SqlParameter[]     arPar = new SqlParameter[1];
            List <SamplingBLL> list  = null;
            SqlDataReader      reader;

            try
            {
                arPar[0]       = new SqlParameter("@WarehouseId", SqlDbType.UniqueIdentifier);
                arPar[0].Value = WarehouseId;
                String strId = "";

                reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar);
                if (reader.HasRows)
                {
                    list = new List <SamplingBLL>();
                    while (reader.Read())
                    {
                        SamplingBLL objSampling = new SamplingBLL();
                        if (reader["ReceivigRequestId"] != DBNull.Value)
                        {
                            objSampling.Id = new Guid(reader["ReceivigRequestId"].ToString());
                        }
                        if (reader["TrackingNo"] != DBNull.Value)
                        {
                            objSampling.TrackingNo = reader["TrackingNo"].ToString();
                        }
                        list.Add(objSampling);
                    }
                    if (list.Count < 1)
                    {
                        return(null);
                    }
                    else
                    {
                        foreach (SamplingBLL o in list)
                        {
                            try
                            {
                                string strm = WFTransaction.GetMessage(o.TrackingNo);
                                if (strm.ToUpper() == "GetSampleTicket".ToUpper())
                                {
                                    WFTransaction.UnlockTask(o.TrackingNo);
                                    return(o.Id);
                                }
                                else
                                {
                                    WFTransaction.UnlockTask(o.TrackingNo);
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                else
                {
                    return(null);
                }
            }
            catch (NullReferenceException ex)
            {
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (conn != null || conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            return(Id);
        }
예제 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="WarehouseId"></param>
        /// <returns>Commodity Deposite Request</returns>
        ///
        public static List <TrucksForSamplingBLL> GetRandomTrucksForSamplingId(Guid WarehouseId, int NumberOfTrucks)
        {
            List <TrucksForSamplingBLL> list = null;
            string        strSql             = "spGetTrucksWaitingSampling";
            SqlConnection conn = null;

            SqlParameter[] arPar  = new SqlParameter[2];
            SqlDataReader  reader = null;

            arPar[0]       = new SqlParameter("@WarehouseId", SqlDbType.UniqueIdentifier);
            arPar[0].Value = WarehouseId;
            arPar[1]       = new SqlParameter("@top", SqlDbType.Int);
            arPar[1].Value = NumberOfTrucks;

            try
            {
                conn   = Connection.getConnection();
                reader = SqlHelper.ExecuteReader(conn, CommandType.StoredProcedure, strSql, arPar);
                if (reader.HasRows)
                {
                    list = new List <TrucksForSamplingBLL>();
                    int counter = 1;
                    while (reader.Read())
                    {
                        TrucksForSamplingBLL obj = new TrucksForSamplingBLL();
                        obj.WarehouseId       = WarehouseId;
                        obj.ReceivigRequestId = new Guid(reader["Id"].ToString());
                        if (reader["DriverInformationId"] != DBNull.Value)
                        {
                            obj.DriverInformationId = new Guid(reader["DriverInformationId"].ToString());
                        }
                        else
                        {
                            obj.DriverInformationId = Guid.Empty;
                        }

                        obj.DateGenerated      = DateTime.Now;
                        obj.SamplerInspectorId = UserBLL.GetCurrentUser();
                        obj.Status             = TrucksForSamplingStatus.New;
                        obj.TrackingNo         = reader["TrackingNo"].ToString();
                        obj.CreatedBy          = UserBLL.GetCurrentUser();
                        obj.PlateNo            = reader["PlateNumber"].ToString();
                        obj.TrailerPlateNo     = reader["TrailerPlateNumber"].ToString();
                        if (obj.TrackingNo != "")
                        {
                            try
                            {
                                string strM = "";
                                strM = WFTransaction.GetMessage(obj.TrackingNo);
                                if (strM.ToUpper() == "GetTrucksReadyForSam".ToUpper())
                                {
                                    if (counter <= NumberOfTrucks)
                                    {
                                        list.Add(obj);
                                        counter++;
                                    }
                                }
                                WFTransaction.UnlockTask(obj.TrackingNo);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                reader.Close();
                if (conn != null)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
            }
            return(list);
        }